# LM Simulator Documentation

## Index

1.0 About
2.0 Overview
3.0 Known Issues
4.0 LM Simulator Tutorial
5.0 Software License

## 1.0 About

Program: LM Simulator
Author: Stephan Hotto (Germany/Wuppertal)
Version: v1.0 / 21.04.2007
The program "LM_Simulator" simulates the Lunar Module of the NASA Apollo Moon landing project. It is an add-on to Ron Burkey's "yaAGC" which is a complete emulation of the original Apollo Guidance Computer running the real AGC Software developed by the MIT. In simple words, you have the computing capacity of the Apollo Program at your fingertips which enables you to simulate real world Lunar Module flight states by typing in the same AGC commands as the Apollo Astronauts did.
LM-Simulator has been developed by using TCL/TK which is an interpreter programming language developed by John K. Ousterhout.
Please refer to Ron Burkey's web page (http://www.ibiblio.org/apollo/) to get an extensive description of the Apollo Guidance Computer itself as well as to download the whole source code package ready for Linux, MS Windows and MAC or just the Windows binaries for the stand-alone version of the LM-Simulator.

### Simulation of a Lunar Module in flight

### Apollo Guidance Computer - DSKY (Display Keyboard)

### Apollo Guidance Computer - Logic Module

Back to the Index

## 2.0 Overview

The following Systems are part of the Simulation:

- yaAGC as Apollo Guidance Computer Emulator
- The whole Lunar Module Apollo Guidance Software
- IMU (Inertial Measurement Unit)
- FDAI (Flight Director Attitude Indicator) inluding:

- Yaw, Pitch and Roll Rate Indicators
- Error Needles to display data under the subsequent modes:

- DSKY: V61E -> DISPLAY DAP FOLLOWING ATTITUDE ERRORS
- DSKY: V62E -> DISPLAY TOTAL ATTITUDE ERRORS WITH RESPECT TO NOUN 22
- DSKY: V60E -> DISPLAY VEHICLE ATTITUDE RATES ON FDAI ERROR NEEDLES

- All Crew Switches connected to the AGC
- All binary AGC system inputs by providing check-buttons to change their status (e.g. Overtemperature)
- All binary AGC outputs by interpreting the different BIT combinations and presenting the status in a readable form
- A physical model to simulate the LM behavior in space

- The Calculation of the Moment of Inertia bases on the same hyperbola equation as used by the AGC state estimator

- The four quad RCS thruster system in conjunction with the above mentioned physical model
- Descent and Ascent Engine (Veryfied by Tsiolkovsky's Rocket Equation)
- Stage Separation
- A Bit-Monitor to trace the AGC inputs and outputs

Architecture Overview:
LM-Simulator connects via TCP/IP directly to "yaAGC". To use a joystick (RHC/ACA), which is strongly recommended, Ron Burkey's program "yaACA" has to be started (not available for the stand-alone version).
`----------------- --------------- -----------
| | TCP/IP | | TCP/IP | |
| LM Simulator | <----------> | yaAGC | <----------> | yaACA |
| | | | | |
----------------- --------------- -----------
`
How to run LM-Simulator in a Linux and Windows environment?
In a LINUX environment you need to have TCL/TK installed because LM-Simulator has been written by using that interpreter language.
Just do the following to start the application:
- Start the Apollo Guidance Computer Emulator: yaAGC
- As an option start the Rotational Hand Controller Interface for PC Joysticks: yaACA
- Finally start the LM-Simulator itself: wish lm_simulator.tcl
If you want to use the application within an MS Windows operating system then you can download (http://www.ibiblio.org/apollo/download.html) a stand-alone version which can be executed by a simple double click on lm_simulator.exe
Configuration:
If you start LM-Simulator without any parameter (wish lm_simulator.tcl) then it assumes a config file within the same directory called "lm_simulator.ini". If that config file is not available then LM-Simulator starts with internally defined standard values based on the LM-7 mission.
Command Line Configuration:

--port=PortNum | Changes the port number (by default, 19801) used to connect to yaAGC. This can also be changed in the configuration file.
--cfg=IniFilename | This option changes the name or directory of the configuration-file used. By default, the file is "lm_simulator.ini", located in the installation directory.

Menu Structure:
The program is divided into several sub-windows which can be called through the "Systems" menu:

Menu | Function
--- | ---
Edit -> Clear Message Window | Clears the Log Window
Edit -> Exit | Leaves the Program
Systems -> DSKY Lite | Display/Keyboard interface
Systems -> AGC Outputs | Monitoring and Correlating of the AGC Binary Outputs
Systems -> AGC LM System Input | Simulation of all binary AGC input values
Systems -> AGC Crew Inputs | Crew switches, buttons, RHC/ACA, THC connected to the AGC
Systems -> FDAI / IMU | Flight Director Attitude Indicator which shows the LM attitude in relation to the Inertial Measurement Unit
Systems -> Simulation Monitor & Control | Monitor simulation parameter like thrust and amount of propellant and control the Descent- and Ascent-Engine as well as the stage separation.
Info -> Help | An application overview
Info -> Tutorial | Explanation of some procedures like IMU initialization
Info -> Verbs & Nouns | A list of the available verbs & nouns to use the AGC
Info -> Alarm Codes | An overview of AGC alarm codes
Info -> About | Author, Version etc.
Info -> License | The license model of LM-Simulator

Back to the Index

## 3.0 Known Issues

- Fast rotations around the LM axes can cause overload on the LM_Simulator communication towards yaAGC
- In a windows environment TCL/TK (programming language of the LM_Simulator) behaves a bit strange. During moving of windows or opening of menus the application goes in a halt modus. If that status takes to long then the synchronization between yaAGC and LM_Simulator is in danger. So, please do not drag windows or open menues for a too long period of time.
- LM Simulator has problems with personal firewalls. Please switch them off to allow a real time local TCP/IP connection between LM_Simulator and yaAGC.

Back to the Index

## 4.0 LM Simulator Tutorial

Index:

0.0 | Fast Start
0.1 | AGC/LGC Initialization
1.0 | IMU Introduction
1.1 | IMU Start
1.2 | IMU Pre-flight Checkout
1.3 | IMU Coarse Align
1.4 | IMU Fine Align
1.5 | Zero IMU
1.6 | Monitor Gimbal Angles
1.7 | Monitor PIPA Counter Values
2.0 | DAP (Digital Autopilot) Data Initialization
2.1 | DAP Activation and Modes
2.2 | DAP - V49 Crew Defined Maneuver
2.3 | DAP - FDAI Error Needle Modes
3.0 | Show Alarm Codes & Data
4.0 | Useful Verbs & Nouns

0.0 Fast Start:
If you want to do a real fast startup without doing 0.1 to 1.4 then you should execute the following steps:
- Switch the DAP to "ATTITUDE HOLD MODE ON" (AGC Crew Inputs)
- Wait until "DRIVE CDU Z to X" goes on (AGC Outputs)
- Type into the DSKY: V37E 00E (VERB 37 ENTR 00 ENTR) to send the AGC into the idle loop
- DSKY: V77E (Normal DAP Mode) or V76E (Minimum Impulse Mode)
- DSKY: V37E 00E to be sure that the AGC is in the idle mode
Now the vessel can be controlled by the RHC (Rotational Hand Controller) which can be found within the AGC Crew Inputs window.
0.1 AGC/LGC Initialization:
After a fresh AGC start there is a need to do a reset by typing V36E. To go into the idle loop it is necessary to change the program by V37E 00E. Probably that has to be repeated a couple of times until "PROG" shows 00.
1.0 IMU Introduction:
The IMU is constructed of a navigational platform gimbaled by a three axis system.
The following mapping is valid after setting the IMU to zero degrees:
X-Gimbal-Axis = Outer Gimbal = X-LM-Axis = YAW
Y-Gimbal-Axis = Inner Gimbal = Y-LM-Axis = PITCH
Z-Gimbal-Axis = Middle Gimbal = Z-LM-Axis = Roll (Gimbal Lock Warning +/-70 Degrees)
1.1 IMU Start:
After a fresh start of yaAGC and LM Simulator the AGC assumes an aligned IMU.
That means that the steps 1.1 to 1.4 are not urgently necessary if you want to do a fast start.
- AGC Crew Inputs: Set "ISS TURN ON REQUESTED" to ON
- Wait for about 90 sec until the DSKY "NO ATT" signal goes off
1.2 IMU Pre-flight Checkout:
Pre-flight check-out of the FDAI display interface -> DSKY: V43E
All values should be set to +00000.
1.3 IMU Coarse Align:
- Type the following sequence into the DSKY: V41N20E (V = VERB; N = NOUN; E = ENTR)
- Now the AGC asks for the angles in the format 000.00 Deg. The sequence is X, Y, Z. Don't forget the "+" or "-" sign!
- The AGC drives the IMU to the absolute position given
- Use the "FDAI/IMU" window to control the angle changes
1.4 IMU Fine Align:
After IMU Coarse Align the "NO ATT" light indicates that the platform is not completely aligned.
To finalize the alignment the following procedure is needed:
- DSKY: V42E
- Give the relative angles in format 00.000 Deg (e.g. three times +00000)
1.5 Zero IMU:
Here are three possible scenarios to reset the IMU to zero degrees:
1.) AGC Crew Inputs => Activate: "IMU CAGE COMMAND TO DRIVE IMU GIMBAL ANGLES TO 0"
2.) DSKY: V40N20E (AGC sends ZERO CAGE COMMAND)
3.) DSKY: V36E (AGC RESET which automatically resets the IMU)
1.6 Monitor Gimbal Angles:
DSKY: V16N20E
1.7 Monitor PIPA Counter Values:
DSKY: V16N21E
2.0 DAP (Digital Autopilot) Data Initialization:
The DAP needs some initialization values to work correctly (e.g. LM Weight etc.).
- Start Spezial Software Routine R03 => DSKY: V48E
- The Register R1 (F06 46) shows the following value 21122 = ABCDE
Spacecraft Configuration:

A = 1 | Ascent Stage Only
A = 2 | Ascent and Descent Stage
A = 3 | Ascent and Descent Stages docked with CSM

RCS Configuration:

B = 0 | 2 Jet Translation RCS System A
B = 1 | 2 Jet Translation RCS System B
B = 2 | 4 Jet Translation RCS System A
B = 3 | 4 Jet Translation RCS System B

ACA Scaling:

C = 0 | Fine Scaling ACA (4 Deg/Sec)
C = 1 | Normal Scaling ACA (20 Deg/Sec)

Deadband Configuration:

D = 0 | ATT Deadband 0.3 Degrees
D = 1 | ATT Deadband 1.0 Degrees
D = 2 | ATT Deadband 5.0 Degrees

KALCMANU Rate:

E = 0 | 0.2 Deg/Sec
E = 1 | 0.5 Deg/Sec
E = 2 | 2 Deg/Sec
E = 3 | 10 Deg/Sec

- To change the value type V21E
- Press "PRO" on the DSKY to start the entry of (F06 47) LM & CSM Weight
- Use V21E or V22E to change the individual values
- V24E allows to change both values sequencially (don't forget the leading + sign)
- Press "PRO" to proceed
- F06 48 allows the entry of the Engine Gimbal Angles.
2.1 DAP Activation and Modes:
DAP Activation:
- AGC Crew Inputs => "ATTITUDE HOLD MODE ON" or "AUTO STABILIZATION OF ATTITUDE ON"
DAP Modes:
- DSKY: V76E Minimun Impulse Command Mode (each RHC deflection fires the thrusters for 14ms)
- DSKY: V77E Rate Command and Attitude Hold Mode
2.2 DAP - V49 Crew Defined Maneuver:
0.) Crew Inputs -> Dap Switch to "AUTO STABILIZATION OF ATTITUDE ON"
1.) V37E 00E
2.) V62E (Display Angular Difference to N22 on Error Needles)
3.) V49E
4.) F 06 22 New ICDU Angles (e.g. V24E to load the Sequence ICDUX, ICDUY and ICDUZ)
5.) PRO
6.) F 50 18 New FDAI Angles in the Sequence Roll, Pitch and Yaw
7.) PRO
8.) The DAP steers the LM to the new orientation
2.3 DAP - FDAI Error Needle Modes:
1.) DSKY: V61E -> DISPLAY DAP FOLLOWING ATTITUDE ERRORS
This is the standard mode. The needles show how far the DAP is away from the wished axes positions.
2.) DSKY: V62E -> DISPLAY TOTAL ATTITUDE ERRORS WITH RESPECT TO NOUN 22
Here the needles display the absolute difference between the entry shown by V16N22E and V16N20E.
Normally used for automatic positioning (please see V49 Crew Defined Maneuver).
3.) DSKY: V60E -> DISPLAY VEHICLE ATTITUDE RATES ON FDAI ERROR NEEDLES.
These outputs should provide the same information as the FDAI rate indicators do.
The Roll, Yaw and Pitch rate shown by the FDAI bases on a separate Rate Gyro Assembly fixed mounted to the LM body, whereas the Information on the needles shown by V60E is derived from the AGC measurement of the angular changes. This is also a backup mode in case of a Rate Gyro Assembly Fault.
3.0 Display Alarm Codes and Data:
- Alarm Codes => DSKY: V05N09E
- Alarm Data => DSKY: V05N08E
4.0 Useful Verbs & Nouns:

DSKY | Function
--- | ---
V35E | Lamp Test
V36E | AGC Reset
V34E | Terminate an ongoing function like IMU Angle Monitoring (V16N20E)
V16N36E | Monitor the AGC time (R1=Hours; R2=Minutes; R3=100ths of a Second)
V37E | Changes the AGC Program (e.g. V37E00E = Idling Program)

Back to the Index

## 5 Software License

Copyright 2005-2007 Stephan Hotto <stephan.hotto@web.de>
"LM_Simulator" is part of yaAGC.
yaAGC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
yaAGC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with yaAGC; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Back to the Index