university of the west of england bristol 1 webb g146/mapld 2004 simulation of apollo guidance...
TRANSCRIPT
1WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOL
Simulation of Apollo Guidance Computer
Main aim of project: To produce a fully functional Block II LGC
(Lunar Module version of the AGC) simulator/emulator running the original MIT-produced code and interacting with the user via reasonably accurate simulations of spacecraft controls
Though currently based on the LGC, the simulator would, with some alteration, also be able to represent the CMC
The AGC simulator is very much a “work in progress”!
2WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLMotivations
Why? To provide a working AGC based on original
materials rather than a functional simulation To provide an interesting and accessible history of
computing educational resource To honour the efforts of the programmers,
engineers and managers involved at MIT/Draper Labs
To preserve some AGC materials in a machine-readable form
To facilitate statistical analysis of AGC performance To allow better comparison with other 1960’s
computers (has the AGC had a bad press?)
3WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLThe AGC
AGC in context AGC used in both Apollo command (CMC) and
lunar (LGC) modules First true Digital Autopilot Core of PGNS:
alignment and control of IMU via AOT DAP including autostabilisation modes via RCS as
part of PGNCSautoflight capabilities including descent, landing,
ascent and rendezvousUpdates AGS to provide backup abort capability in
case of PGNS failure
4WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLHighlights of LGC
Hardware Memory word size: 15 bit + 1 parity bit 36 banks comprising 1K words per bank 2K erasable memory Main accumulator (A) and subsidiary registers (L and Q) 24 Channels provide communication to and from external
equipment (plus L and Q registers are also addressable as channels)
Modified ones-complement integer arithmetic (except for counters) so +0 and -0 exist and are used heavily in software
Fixed-point FP arithmetic (programmer must handle scaling) Double precision FP (28 data bits) also available
Accumulator uses two sign bits to detect overflow conditions Cycle time: 11.7s - most basic instructions use two cycles (max:
6 cycles for DIV instruction) Interpretative instructions provide advanced mathematical
manipulations (e.g. vector and matrix manipulations) – speed: around 1ms per instruction
5WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLHighlights of LGC
Software Time-shared, priority-driven OS – up to 7 (6 for
CMC) jobs can scheduled at once Interrupt-driven – 10 interrupt levels
associated with timers and external hardware Basic instructions implemented in hardware More complex instructions (e.g. vector and
matrix manipulations) provided by an interpreter to allow ease of application programming – can be combined with basic instructions for greater programming flexibility
6WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOL
A few interesting AGC instructions (1)
CCS Compare, Count and Skip 4-way branch - provides a convenient
loop control mechanismCCS k
Inst-a if (k)>0 A:=(k)-1 and branch to Inst-aInst-b if k=+0 A:=0 and branch to Inst-bInst-c if k<0 A:=ones-comp((k))-1 and branch to Inst-
cInst-d if k=-0 A:=+0 and branch to Inst-d
N.B. Not all branches need to be used (e.g. if (k) always >= +0)
7WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLAGC instructions (2)
TS Transfer to storageTS k
Inst-a
Inst-b
k := A if A is in positive or negative overflow, skip to Inst-b,
otherwise continue from Inst-a (implication of this instruction is that the programmer must always be aware whether A could be in a overflow condition)
INDEX index the next instruction Used to access array structures, e.g.:CA value Load accumulator with contents of value
INDEX offset Add contents of offset to next instructionAD base Add accumulator to base(offset)
Can also be used in sequence with other INDEXes
8WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLSample AGC program
EBANK= 5
SETLOC 4000
INHINT
CA FIVE
TS EB
START CA NINE
LOOPINI TS COUNT
CA VALS
INDEX COUNT
TS TABL1
CCS COUNT
TCF LOOPINI
CA NINE
LOOPAGIN TS COUNT
INDEX COUNT
CA TABL1
TS SR
CA SR
INDEX COUNT
TS TABL1
LOOPTEST CCS COUNT
TCF LOOPAGIN
RELINT
...
SR = 21
EB = 3
FIVE DEC 5
NINE DEC 9
VALS OCT 52525
SETLOC 2400
COUNT ERASE
SETLOC 300
TABL1 ERASE +9D
Equivalent to… (assuming 15 bit words)
#DEFINE vals 052525
// inhibit interrupts
for (count=9;count>=0;count--) {
tabl1(count)=vals;
}
for (count=9;count>=0;count--) {
tabl1(count)=(tabl1(count)>>1) |
((tabl1(count) & 1) << 14);
}
// enable interrupts
... Note that the Shift-Right register rotates any value
written to it
9WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLSimulator basics
The simulator provides a real-time emulation of the LGC, DSKY and other associated LM systems in a package for use under Windows XP
Written in C++ (the AGC itself) and Visual Basic (DSKY and other systems) these two major components communicate via DLLs also possible to interface other programs to AGC
The AGC simulator adjusts its speed automatically to give the correct 11.7s clock rate
10WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLSources used
Available sources Documentation
History of Recent Science and Technology project (mostly ex-MIT/Draper Labs documents)
Apollo Lunar Surface Journal (operational documentation, checklists etc.)
Source code listings (pdf files)Luminary 1C (for LGC - two versions prior to Apollo
13 flight release) Colossus 249 (for CMC - as flown on Apollo 9)
See References for more details
11WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLConstruction
Method Luminary source code entry (c1500 pages)
available as MS Excel and text files
‘YUL assembler’ written (in Perl) Assembled machine code checked against
original core listing (and later against another AGC enthusiast’s version)
AGC written and tested Interface DLL written DSKY and other components written Testing against original LM checklists
12WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLProgress so far
LGCFull instruction set operationalTimers and external interrupts operationalFully functional DSKY
Associated spacecraft systemsMajor associated LM switches and circuit-breakers
implementedMechanically functional AOT (no simulated starfield)Limited ACA/TTCA hand-controller simulation and RCS
graphicLimited IMU functionality
External systemsBasic telemetry downlink displayExecutive and Waitlist displayBasic statistical display
13WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLWork to do
The following features are planned for the future (not in any particular order):
Fully implement IMUSimulate vehicle dynamicsFinish implementation of AOT to permit star-based
alignmentsEmulation of microcode instructionsImprove statistical performance analysis
AcknowledgmentsThanks are due to Ron Burkey (who has been working
independently on an AGC simulator) for providing a series of stimulating questions during my work and for permitting the checking of the assembled Luminary code against his own machine code created in an alternative way
14WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLAcronyms
ACA – Attitude Controller Assembly AEA – Abort Electronics Assembly (the AGS digital computer system) AGC – Apollo Guidance Computer (cf CMC and LGC) AGS – Abort Guidance System – backup to PGNS to allow rendezvous AOT – Alignment Optical Telescope CMC – Command Module Computer DSKY – DiSplay and KeYboard for AGC IMU – Inertial Measurement Unit ISS – Inertial SubSection LGC – Lunar module Guidance Computer PGNCS – Primary Guidance, Navigation and Control Section PGNS – Primary Guidance and Navigation Section RCS – Reaction Control System (on LM 16 jets arranged in two
systems) TTCA – Throttle/Translation Controller Assembly YUL – AGC assembler (original written at Christmas)
15WEBB G146/MAPLD 2004
University of the West of
EnglandBRISTOLReferences
Some resources of interest to AGC historians... History of Recent Science and Technology - 77 documents
more-or-less relating to the development of the AGChttp://www.hrst.mit.edu/hrs/apollo (N.B. site is not always available)(A set of convenient indices to these documents is available at my
website:http://www.cems.uwe.ac.uk/~jtwebb/agc)
Apollo Lunar Surface Journal - contains several interesting LM operational documents plus complete surface transcripts
http://www.hq.nasa.gov/alsj Eldon C. Hall, Journey to the Moon, AIAA, Reston, VA, 1996
Should be read in conjunction with: Hugh Blair-Smith, Annotations to Journey to the Moon, http://www.hrst.mit.edu/hrs/apollo/ public/blairsmith.htm