The Analytical Engine

Web Emulator

----------------------------------------

The document explains the operation of an Analytical Engine emulator which runs within your Web browser using JavaScript. As long as your browser supports HTML5 and JavaScript, you can run Analytical Engine simulations with no additional software.

Main Window

Analyst's Program Panel

This panel allows the analyst to submit chains of cards to the attendant for processing by the Engine, and allows the cards to be easily modified. You can either type the cards into the text area or, more conveniently, load them by entering a local file name on your computer with the the “Choose File” button. (If your browser does not permit Web pages to read files on your machine [many do not, for well-justified security reasons], you won't be able to load cards from a file. But you still should be able to edit the cards with another application, then copy and paste them into the text area in the panel.) Files which contain special characters such as “×” and “÷” must be in the UTF-8 character encoding.

Once the cards are loaded, or after you've modified them by editing the text area, press the “Submit” button to deliver them to the attendant to mount on the machine. The attendant checks your cards for obvious errors, processes any Attendant Request cards present in your submission and, if all is well, places the cards in the Card Reader. If the attendant espies one or more errors, a description thereof will be written in in the Attendant's Log panel and the card chain not mounted.

Usually annotations, both by the analyst and added by the attendant in the process of preparing the cards for the machine, are preserved in the cards mounted on the machine. To discard all annotations, uncheck the “Keep comments” box before submitting the cards. The “Clear” button erases the text area; use this to discard existing cards before pasting new cards from your text editor.

Due to security restrictions in browsers, there is no way to save the cards from the text area into a file. You can work around this either by editing with a different application, then clearing and pasting the cards into the program text area for each run or by copying the cards in the text area to the clipboard, then pasting into another application from which you then save them to a file.

Important: Modifying the contents of the Analyst's Program text area does not automatically update the cards loaded on the Card Reader. After editing the program cards, you must press the “Submit” button to deliver them to the attendant for examination and mounting on the Engine. When you modify the program in the box, the legend in the “Submit” button turns red to remind you the changes haven't been submitted. Once submitted, the legend returns to black.

Printer Panel

The Printer panel shows all items written on the Printing Apparatus by “P” cards, as modified and expanded by various Attendant Request cards pertaining to the presentation of numbers and addition of annotations to the results. The Printer panel appends results from successive runs of the Engine to a continuous scroll; to clear the scroll, press “Erase”.

Attendant's Log Panel

The Attendant's Log shows messages from the Attendant to the analyst. If an error is found in a chain of cards submitted from the Analyst's Program panel, it will be reported here. If a trace of the computation is requested, the attendant writes the trace information here. To clear the Attendant's Log panel, press the “Erase” button. The “Timing” button prints current Engine statistics and an estimate of the running time since the program was started as described in the timing section below. You can request timing even while a program is running.

Controls

This panel controls the operation of the Engine. To clear the Mill and Store to their start-up conditions, press the “Reset” button. After a calculation is successfully submitted, you can cause the Engine to process it by pressing the “Start” button. The “Step” button amounts to one turn of the crank—the Engine processes the card currently in the reader, advances to the next card, and halts. Pressing the “Step” button while the Engine is running halts it; you can then examine its state in the Annunciator Panel and either continue to single step it or resume running by pressing “Start”. “Step” is useful in conjunction with the Annunciator Panel when you want to examine a calculation in detail. When “Panel” is checked, the Annunciator Panel (see below) is shown; this allows you to watch the Mill, Card Reader, and Store in operation. “Trace” causes the Attendant to write a trace of the calculation in the Attendant's Log panel, without the need to include a “T1” card in the card chain. When “Animate” is checked, pressing “Start” causes the Engine to process about one card per second, showing the results on the Annunciator Panel, if displayed.

The Annunciator Panel

The Annunciator panel represents the digits visible on the Mill and Store columns and the cards being turned by the Card Reader which form the basis of the trace written by the Attendant, if requested. With this panel, you can watch the Engine process the cards for your calculation. The Annunciator Panel is updated only when the “Animate” box is checked in the Controls, or you are cranking individual cards through with the “Step” button; when the Engine is running at normal speed, continually updating this window would make the simulation intolerably slow.

The topmost section of the window shows the current state of the Mill, with the first line indicating the current arithmetic operation, whether the run up lever is set, and whether the Engine is running (processing cards automatically) or halted, either for manual operation or due to an error or reaching the end of a card chain. The lines that follow show the values currently in the input and output axes of the Mill. Note that since loading the second argument of an arithmetic operator causes the Mill to perform the calculation, as soon as a value is loaded into Ingress axis 1, the results will appear in the Egress Axis and, if a multiplication or division, in the Primed Egress Axis.

The Card Reader display shows the current card on the reader, about to be acted on by the Engine, marked by an arrow at the left, amid adjacent cards. Each time you press the “Step” button the marked card is acted on and the next card is moved onto the reader.

The Store display shows all columns of the store into which values have been placed; the column which received the most recent value is indicated by a check at the left. If more columns have been used than fit in the window, you can resize the window to make more room to display the Store or scroll to show the items.

The Annunciator Panel can be hidden by unchecking the “Panel” item in the Controls section of the main window.

The Curve Drawing Apparatus

The Curve Drawing Apparatus is initially hidden and appears only when the first line is drawn on it with a “D+” card. The Apparatus plots a domain and range of ±1.0, with the fixed point decimal placed in the middle of the 50 digit capacity of the Engine. You can manually erase the contents of the Apparatus or hide it with the buttons at the bottom.

Web Emulator Specific Cards

The Web emulator supports the following cards in addition to those described in the programming cards document. If you use these cards and later wish to run your program with the command-line emulator, you will have to remove them first to avoid errors.

DC colour

The DC card informs the attendant to change the pen in the Curve Drawing Apparatus so that subsequent lines will be drawn in the specified colour, which may be any valid HTML/CSS colour specification such as “blue”, “#0000FF”, “rgb(0, 0, 255)”, etc.

DP

The DP card informs the attendant to change the paper in the Curve Drawing Apparatus. Any plot drawn within the window will be erased. You can do this manually with the “Erase” button at the bottom of the Apparatus.

A write timing

The attendant will write a summary of the operation of the Engine and the time elapsed running the program since it was loaded or the engine was last reset into the Attendant's Log. The format of the report is as follows.

Cards read: 411
    Advanced:  15
    Backed:    306
Mill operations: 61
    +  24
    −  7
    ×  7
    ÷  8
    <  15
Store operations: 133
    Put:  41
    Get:  92
    Slew: 190 columns
Total running time: 1,006 seconds (00:16:46).

The run time is estimated based upon Babbage's statements in his autobiography that the moving parts of the Engine move no faster than forty feet per minute (20.3 cm/sec) and that:

Further, in the discussion in Henry P. Babbage's 1888 paper, it is claimed that addition and subtraction times are independent of the arguments. One second is used as the time for these operations. In items 40–41 and 51 it is explicitly stated that multiplication detects the smaller of the two arguments. Multiplication has a set-up time of 10 seconds and is proportional to the size of the smaller argument. Division times are based upon my (poor) understanding of how Friden electromechanical calculators do it. The set-up time is 10 seconds, plus a time proportional to the difference in the number of digits in the dividend and divisor. All of this will doubtless be a matter of controversy and disputation, but the goal is just to provide some order of magnitude estimate of how long the Engine would have taken to perform a calculation. The Store is assumed to be circular, so that it takes no longer to slew from column 0 to column 999 than from column 0 to column 1.

You can obtain the execution and timing statistics for any program, even while it is running, by pressing the “Timing” button beneath the Attendant's Log panel.

Run the Web Emulator

----------------------------------------

by John Walker