Simple AGC

From ProjectApollo
Jump to: navigation, search

Project Apollo has its own implementation of the Apollo Guidance Computer (AGC) software in C++. Some of the real programs are simulated along with a number of programs which did not exist in the real AGC, but are useful in Orbiter.


Diagram of DSKY interface for reference, showing LM and CM lights[1]

When you first start up your scenario the AGC will spend about thirty seconds running through its self-test program on the DSKY, just like a PC does. On a real Saturn V this would check all the computer hardware, but since we can pretty much guarantee that your PC is going to multiply and divide correctly if it's managing to run Windows, here it just does the final stage, and tests the display by outputting a selection of test patterns.

If you get bored, just hit 10x time acceleration briefly. Once the lights have turned off, the computer goes into standby mode with displays blanked and just the STDBY light lit. If you start the engines it will automatically start up as they ignite.

However, if you prefer to do things the 'proper' way, press the PRO key on the DSKY to start the computer. VERB 37 will flash on the display: this is the 'change program' verb: the computer is currently idling in program 00, but suggesting that you enter a new program to run. So press 'NOUN', then 0, then 1, then ENTER.

Note that whenever you enter data into the DSKY you will have to enter initial zeros in this way if the data would not otherwise require you to enter a digit in a specific column. If you attempt to enter too many digits, or attempt to ENTER a VERB/NOUN combination that isn't supported, the OPR ERR light will light up. Press RSET to reset the error indication and continue.

If you are entering data into the DSKY when the computer wishes to display information, the KBD REL light will light up. If you're finished with the keypad then press the KEY REL button and the computer will now be able to use the display; otherwise, typically, it will display the information it wants to show you after you finish entering the data you're typing in.

VERB 37 NOUN 01 will run the initial IMU alignment program: in Orbiter in merely lights the NO ATT light briefly and then changes automatically to program 02, in a real Saturn V this would align the IMU to the appropriate angles that have been entered into the computer and then switch to program 02.

Program 02 is the pre-launch setup program. You can use this to check the planned orbit from the scenario file, update the orbit and launch times, or simply ignore it and the computer will use the scenario values.

The program will start with a flashing VERB 06 NOUN 29. This shows the launch azimuth in hundredths of a degree on the top line of the display, and allows you to change it from the historically correct value if you choose.

To update the information on these lines you need to change the displayed values, then press PRO to enter them into the AGC. To update the first line, use VERB 21 ENTER, for the second VERB 22 ENTER , for the third VERB 23 ENTER. To update the first and second in sequence use VERB 24 ENTER, for all three use VERB 25 ENTER.

When you enter data the DSKY will blank the appropriate line. Press '+' or '-' to begin data entry (octal entry is not yet supported), then type in the digits, with preceding zeros when required. Once you type in all five digits, the value will be saved ready to be passed to the AGC. Note that if you make a mistake while entering the number, you can press CLR to clear the entry and try again. So, you can use VERB 21 ENTER to change the azimuth value, then press PRO to accept the value being displayed. Alternatively, if you're happy with the value, use VERB 33 ENTER to 'proceed without data': the computer will then use the displayed azimuth value for the launch.

Either way, the computer will respond with a flashing VERB 06 NOUN 44, displaying the desired apogee and perigee in tens of meters. Again, update them if desired, or use VERB 33 ENTER to continue.

The computer will respond with a flashing VERB 06 NOUN 33, displaying the time to liftoff: hours on the first line, minutes on the second line, and hundredths of a second on the third line.

If you wish to change your launch time, update the values on the display, then press PRO to load them into the computer. If you want to monitor the launch time, enter VERB 16 ENTER, which will switch to updating the countdown time roughly twice per second.


AGC running Program 11 during launch

So you're ready to launch. When the countdown reaches zero the AGC will start the engines, automatically switch to program 11 and activate the autopilot. If for some reason this should fail, then you can press VERB 75 ENTER or VERB 37 NOUN 11 ENTER to start the program manually: of course unless there's a horrid bug, this isn't going to happen :).

The program will switch to VERB 16 NOUN 62: Verb 06 and 16 are two which are very useful to know: Verb 06 means 'display the information for this noun', and can be used to check the current value of various internal variables. Verb 16 is the same, except rather than show just the value at the time you press ENTER, it will update automatically roughly twice per second.

Different Nouns will display different information. Noun 62 will display three lines on the DKSY, the first is the velocity relative to Earth in meters per second, the second is the vertical velocity in meters per second, and the third is the altitude in kilometers.

DSKY displaying orbit information during launch

To monitor the orbit information, either press VERB 82 ENTER or VERB 16 NOUN 44 ENTER (note that if either the Verb or Noun you wish to execute is already displayed, there's no need to type it in again: if, for example, the display was showing VERB 16 NOUN 62, you could just press NOUN 44 ENTER to switch). Noun 44 again displays three lines. The first is the apogee altitude in kilometers, the second the perigee altitude in kilometers, and the third is approximately the time in minutes and seconds to freefall to 300,000 feet if the engines were shut down: the latter is useful in planning aborts, as 300,000 feet is approximately the level where re-entry heating begins. If you haven't yet achieved a trajectory that will take you above 300,000 feet, or are moving too fast to return to that altitude, it will display 59:59.

Note that a real Apollo capsule wouldn't use SI units: instead, velocity would be measured in feet per second and altitudes in nautical miles. The code does have an option to switch to realistic units, but currently there's no way to enable that: it will be an option in the future for those who really want to do it the 'proper' way :).

If, at some point, you feel like flying manually, then enter VERB 46 ENTER. This will toggle the autopilot state each time you enter it.

Finally, when you reach orbit and the SIVB stage shuts down, the computer will disable the autopilot and prompt you to switch programs with a flashing VERB 37 again. You might as well enter NOUN 00 ENTER to switch to the idle program, to disable the computer for the time being.

TLI Burn

To perform the TLI burn, you need to run program 15. So, start with VERB 37 NOUN 15 ENTER to begin running that program.

Now use your favorite MFD to calculate the burn ejection time and delta-V. I've used the Transfer MFD, but this should work with TransX too.

The computer will respond with a flashing VERB 06 NOUN 33. This displays the time to ejection in hours (top line), minutes (middle line) and hundredths of seconds (bottom line). Skip time until the time to ejection in the MFD display is around 1300 seconds. Now enter VERB 22 ENTER to change the value of the minutes field. Press '+00020' to indicate twenty minutes, and wait. Watch the time to ejection count down and when it hits 1200 seconds, press PRO to update the time for the computer. You've now told the program when to make the TLI burn. The display will switch to VERB 06 NOUN 14. This is one line, the delta-V for the burn.

Press VERB 21 ENTER to update the delta V. Now press '+' and enter the value with appropriate leading zeros. For example, if your burn delta-V is going to be 3183 m/s, enter '+03183'. When you're done, press PRO.

The computer will perform some calculations and respond with a flashing VERB 06 NOUN 95. This shows the burn details. The top line is the time to engine ignition, the middle line the delta-V, and the bottom line the velocity for engine cutoff. The time to ignition will not be the value you just entered, as it allows for the burn duration and engine startup.

Now you can sit and wait, or skip time towards ignition. If you want a countdown, then press VERB 16 ENTER to monitor the burn values.

Along the way a few things will happen to keep you awake. About nine and a half minutes before ignition the UPLINK ACTY light will come on for a few seconds. About 1 minute and 45 seconds to ignition the display will blank briefly, then switch into countdown mode with VERB 16 NOUN 95.

About 1 minute and 30 seconds to ignition the computer will enable prograde mode, if it's not already enabled: it will then keep it active throughout the burn and turn it off at the end.

If you change your mind before ignition, then press VERB 34 ENTER to terminate the current program. If entered after ignition this will shut down the SIVB, but you will have used up your single restart. After the engines ignite, the display will change. Although it's still NOUN 95, it will now show an approximate countdown to engine shutoff in the top line, the remaining delta-V in the middle, and the cutoff velocity in the bottom line. If you want to monitor the state of your orbit, you can use VERB 16 NOUN 44 to display apogee, perigee and current altitude.

One thing you will notice is that the cutoff velocity in the NOUN 95 display will change during the burn. As the engine runs, you begin to climb away from Earth, and as a result you lose velocity. On a real Saturn V NASA would have calculated the cutoff velocity taking that loss into account, but the MFDs don't do so, therefore the computer performs the calculations in realtime as the engine runs.

When the engine cuts off, you should be within about 1 m/s of the correct velocity. If you're further out you can probably fine-tune with the SM RCS once you've seperated the LM from the SIVB.

The countdown on the DSKY will stop at zero, so press PRO. That will give you a flashing VERB 37 to remind you to change programs, at this point you might as well enter NOUN 00 ENTER to switch the AGC to idle, or NOUN 06 ENTER and then PRO to put it in standby mode.

Docked Vessel Control

The fictional Prog 59 is a generic 'docked vessel control' program which allows the Command Module AGC to perform various functions with docked vessels that support remote control; note that this is restricted to future fictional vessels and these programs do not work with the LEM.

Program 59 has a number of sub-programs, which perform the various functions. They are selected by entering a value into the R1 regsiter and pressing PRO.

Enter +00001 then press PRO to start and stop fuel venting... the AGC will display the amount of fuel left in the docked vessel as it's vented.

While docked, the CSM may be able to draw power from the docked vessel. Run Prog 59 again and enter +00002 in R1 to run the power display program. This displays the power flow from the docked vessel to the CSM, and the power left in the docked vessel's batteries, if appropriate.

Lunar Orbit Insertion

To enter lunar orbit, aim for a periapsis altitude of about 115 km and simply enter VERB 37 NOUN 16 ENTER on the DSKY about half an hour before periapsis. This will display NOUN 19, showing the status of the burn required to enter Lunar orbit.

R1 will show the time to ignition, then the time to cutoff after ignition. R2 shows altitude in tenths of a kilometer, and R3 shows offplane distance in tenths of a kilometer.

The resulting orbit will be about 115 x 315 km. Apollo 11 and 12 then did a LOI2 burn to achieve a roughly circular orbit. To do that execute P16 again at about half an hour before next periapsis, the resulting orbit will be about 110 x 120 km. Apollo 14 and later didn't do a LOI2 burn but the DOI burn directly with the complete CSM/LM stack, the Descent Orbit Insertion (DOI) program P17 is used for that.

Descent Orbit Insertion

To enter a suitable orbit for the LEM to land at the programmed landing site, run the Descent Orbit Insertion (DOI) Program 17 on either on the LM or CSM computer, for the LM, CSM, or docked pair. To start the program, use VERB 37 NOUN 17 ENTER.

The DSKY will display NOUN 23, which shows the number of passes before landing in R1, the time to the plane change or secondary burn in R2, and the delta-V in R3, in units of 0.1m/s. The program will pick a burn time on the next possible orbit, if you want to delay it then use VERB 21 ENTER to update the number of passes in R1, then press PRO. To get a countdown to the burn, use VERB 16 ENTER.

The program doesn't attempt to get the apoapsis to be 110 km. It simply does a burn 195 degrees away from where the landing site will be after the number of passes entered, so as to make the flight path angle zero and have the proper periapsis 15 degrees before the landing site. Since we're going to land, the apoapsis doesn't matter too much.

After the burn, you can run Program 18 to correct offplane errors.

Lunar Landing

Prior to initiating a descent to the moon, the orbit plane needs to come fairly close (<24 km) to the landing site (see P18), and have a periapsis altitude of between 10 and 20 km which is roughly above the landing site (see P17). This translates to radius from moon center of 1748 to 1758 km. When your orbit is correct and the LM is approaching the base about 1000 km away, you can start P63.

On the DSKY, enter VERB 37 NOUN 63 ENTER. If REALISM is set to zero, the rest of the landing will be automatic. Otherwise follow the instructions below.

The DSKY will display NOUN 89, showing the landing latitude in R1 and longitude / 2 in R2. Press PRO and the DSKY will show NOUN 61 with the time to go in R1, time from ignition in R2, and crossrange in tenths of kilometers in R3. If the cross-range is too high, you can thrust to improve it before the landing. Press PRO when you're happy.

This will display NOUN 33, showing the time to ignition; hours in R1, minutes in R2 and seconds and hundredths of seconds in R3. Press PRO to continue.

The DSKY will now display VERB 50 NOUN 18, showing the pitch, roll and yaw angles required for the burn. Press PRO to confirm the orientation.

At Ignition-35 seconds the DSKY blanks, then at Ignition-30 seconds switches to NOUN 62, which displays velocity in R1, time from ignition (in seconds) in R2, and required delta-V in R3.

At Ignition-5 seconds VERB 99 NOUN 62 flashes, requesting the astronaut to confirm the burn. Press PRO to confirm, and ensure you do it before the count reaches zero.

At ignition, NOUN 63 is displayed, with R1 showing the delta altitude from the landing site, R2 the altitude rate, and R3 the altitude.

Generic programs and data

Program 06 is the AGC standby program. Enter VERB 37 NOUN 06 ENTER to switch to program 06. It will then flash VERB 50 NOUN 25: this is a generic message from the computer telling you to perform a checklist action... the appropriate action will be displayed on the first line. In this case it is '00062', which means 'press the PRO key to put the AGC into standby'. Press that key and the displays will be blanked and the STDBY light come on. Press the PRO key again to bring the AGC out of standby.

Noun 38 shows the time since the AGC was booted. Noun 73 shows the altitude, velocity and angle of attack, the latter in hundredths of a degree.

Program Alarms

DSKY displaying a program alarm

If an error occurs in a program, it will light the PROG light on the DSKY and raise a program alarm. In some cases this will abort the program that's running, in others it will continue but you should consider corrective action. If you don't care, then just press RSET to clear the light and the record of the alarms.

To display the program alarms, use VERB 05 NOUN 09. This shows three lines: the first is the first alarm to occur since pressing RSET was pressed, the second is the second alarm to occur since RSET was pressed, and the third is the most recent alarm. If more than three alarms occur after pressing RSET, any others are lost.

Program Alarm Meaning

Not enough time for orientation prior to burn


Program 01 selected in orbit

Program Checksums

DSKY displaying bank six checksum

VERB 91 will display the program bank checksums. Press VERB 91 ENTER.

In Orbiter this is absolutely useless in this version of the AGC (they're actually the checksums of one version of the Colossus software), but in a real Apollo this was an important tool for verifying that the correct programs were loaded into the AGC core memory. In the Virtual AGC this could also be useful to determine which version of the AGC software is loaded by examining the checksums.

In the DSKY display, the first line is the checksum, the second line is the bank number and the third is more checksum: to be valid, the first checksum must be equal to the bank number or negative bank number (in octal), and the second checksum gives more information; technically, it's the contents of the extra word of data which is appended to the memory bank in order to make the checksum valid.

To display more banks, use VERB 33 ENTER to cycle through them. When you reach the end of the memory banks the program will cycle back to bank zero again.

Displaying Erasable Memory

DSKY displaying erasable memory

'Erasable Memory' was the AGC equivalent of modern RAM. The program was stored in fixed core memory, while data which might change (e.g. Current time, landing site location) was stored in erasable memory. Of course this meant that the astronauts needed a way to examine and change the memory.

To examine memory locations, use VERB 01 NOUN 02 ENTER. This will switch the R2 display to octal (base-8) and blank the R1 display, while flashing the verb and noun display to remind you that you need to do something. Enter a memory location in R1, and press PRO. The value of the erasable memory location will be displayed in R2, and the program will blank R1 again so you can enter a new memory location.

If, instead, you want to monitor a memory location as the data changes, use VERB 11 NOUN 02. As above, enter a memory address in R1 and press PRO. Rather than give you the option of entering another location, the verb and noun display will stop flashing and R2 will be continually updated with the contents of the memory location. Location (octal) 00025 is a good one to use, as it simulates the 10 millisecond timer on the real AGC.

Of course, since the memory is just simulated, this doesn't really help a huge amount. However, you can view various variables that control the AGC operation if you know how the program works, and will be able to change the program's operation by changing those variables.

To update an erasable memory location, use VERB 21 NOUN 02. Enter the address in R1 (in Octal) and the data in R2. Press PRO to update the erasable memory.

Verb, Noun and Program Summary

This section summarises the Verbs, Nouns and Programs used in this version of the AGC. Note that while many of these are identical or very similar to the real AGC, others are very different. Use the Virtual AGC documentation for flying with the Virtual AGC.

Verb Action
01 With noun 02, display contents of erasable memory location
03 Display R1 in octal
04 Display R1 & R2 in octal
05 Display R1, R2 and R3 in octal
06 Display data in decimal
11 With noun 02, monitor contents of erasable memory location
16 Monitor data in decimal
33 Proceed without data
34 Terminate current program
37 Run program
46 Select manual control during launch
69 Restart
75 Start launch control program
82 Display orbit information during launch
91 Display memory checksum
99 Confirm burn
Noun Data
09 Last three program alarms (always octal)
14 Desired delta-v
18 Desired or actual pitch, roll, yaw angles.
23 Number of passes, time to burn, burn delta-V.
25 Perform checklist action
29 Launch azimuth
33 Time to ignition
34 Time of next program event
35 Time to next program event
38 Time since boot
43 Latitude, Longitude, Altitude
44 Orbit information during launch or other maneuvers
50 Apoapsis, periapsis, fuel percentage
60 Forward velocity, altitude rate, altitude.
61 Time-to-go, time from ignition, crossrange (in 0.1km)
62 Velocity information during launch and landing
63 Delta-altitude, altitude rate and altitude.
64 LPD time and angle (seconds and degrees), altitude rate, altitude.
68 Downrange distance, time-to-go in braking phase (minutes and seconds), velocity.
73 Flight trajectory
74 Time from ignition, yaw after vertical rise, pitch after vertical rise.
76 Desired downrange velocity, desired radial velocity, cross-range.
89 Landing latitude, landing longitude / 2
94 Apoapsis, current altitude, target apoapsis
95 Burn details
Program Action
00 Idle
01 Pre-launch IMU alignment
02 Pre-launch setup
06 Computer standby mode
11 Launch control
12 LEM: ascent to orbit
15 TLI burn
16 LOI: Lunar Orbit Insertion
17 DOI: Descent Orbit Insertion
18 Orbit Plane/Surface Alignment
19 Orbit Adjustment- In Plane
32 CSI: Coelliptic Sequence Initiation
33 CDH: Constant Delta Height
34 TPI: Transfer Phase Initiation
35 TPM: Transfer Phase Midcourse
36 Rendezvous Braking and station keeping
40 LEM: DPS: Descent Propulsion System Burn
41 RCS: RCS Burn
42 LEM: APS: Ascent Propulsion System Burn
63 LEM: LM PDI Braking
64 LEM: LM Approach
65 LEM: LM Auto Landing
66 LEM: LM Manual landing
68 LEM: Landing confirmation
70 LEM: LM DPS Abort
71 LEM: LM APS Abort