Simulation of Apollo 11 lunar landing

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
Hi all,

I've managed to simulate the Apollo 11 landing and events (prog alarms, etc.) fairly close to the original, real-life timeline. You can see the result in this video:
[ame="https://www.youtube.com/watch?v=QRBi-39jPyc"]https://www.youtube.com/watch?v=QRBi-39jPyc[/ame]
The next step in this story is to make my developments available for the community. The novelties you can see on this video could be grouped into three more-or-less independent sets:
  1. High resolution texture and elevation maps for Tranquility Base (Apollo 11 landing site) based on LROC NAC imagery. Publication of this one is the simplest: a bunch of texture files, so could be zipped together and uploaded to some addon site. Another option to make it a part of NASSP (as it is historically strongly connected to Project Apollo). So the only question here is where should I upload it? I am open for any suggestion.
  2. To be able to see the elevation map in their full beauty I had to tweak the D3D9Client in a way that it uses floats instead of integers when doing elevation calculations. It is not related directly to my NASSP developments and even with the normal D3D9Client one will see improvement with the textures above, however it'd be needed if you want to see the same finely detailed terrain around Tranquility Base as on this video. After I finished with the publication of my NASSP developments I'll turn my attention on how to make my D3D9Client hack public. As I've done this circa in Nov 2019 and not looked after since, it could be even possible that the D3D9Client guys have already solved this issue.
  3. So the largest part of the development was the improvement which made the simulation more accurate. I've touched a lot of source files of NASSP and - as I began this development in January - I out of sync with the main (Orbiter2016) branch since then. I'm not sure how to proceed from here: either I can upload my changes to my own github page based on the 2020 Jan status of main branch and it could be merged with the current main version; or I can try to sew in my changes into the current version and that version could be merged into the current main branch. Sorry, I am not a git expert so maybe I'm using inaccurate terminology. Again I am open for any idea here.

And here is an appetizer (or maybe a de-appetizer) on what I changed to improve the accuracy of the simulation:
  1. CDU implementation based on the schematics and other detailed documentation. I haven't simulated every logical gate or transistor in the CDU (though the schematics are available), I rather focused on the parts which were involved in the 1201/1202 errors. I've also taken care of the correct nominal behaviour in the different modes (not only the usual A-D conversion, but the support for coarse aligning and the D-A output of CDUs like error needles, TVC in CSM and the velocity indicator in LM).
  2. As the coarse aligning now done through CDUs I reworked that in the IMU implementation. I haven't touched fine alignment as it is done outside of the CDUs.
  3. I've also changed the RR and CSM optics behaviour when under AGC control just to fit into this AGC-CDU-peripheral architecture. For optics I've used the mathematical models described in Apollo 15 Delco documentation.
  4. The PIPAs even in normal condition are giving significant load on the AGC through involuntary counter increments-decrements. So I've implemented that one and additionally I simulated the PIPA as a physical (pendulous) system. One positive side-effect of the new implementation, that the AGC is more accurately keeps up the state vector when DeltaV is small, e.g. when trimming after burns.
  5. Another significant load on AGC is the DPS thurst control: when LGC want to make it work in FTP (pedal-to-metal) mode, it continuously bombarding it with control pulses with ~2000pps and that comes with the same number of involuntary counter decrements as well.
  6. I also implemented the serial data transfer of LR and RR. It turned out that it doesn't make too much load on LGC (8pps during PDI), the now proper timing of radar interrupts makes the simulation one step closer to the real hardware.
  7. To make all the above to work I have to deeply rework the interface handling of the AGC emulator itself (agc_engince.c and agc_engince.h). I've added counter request logic according to the schematics and I've also implemented a simple scaler (the timer module of the real AGC) to let the computer beat the drum for the devices (CDU, PIPA, radars).
  8. Changed the DPS thrust function: there are inconsistencies in different documents (simulator data; actual scanned simulation outputs; Luminary source code; etc.) up to a few percent on the maximum thrust and erosion caused thrust increment. I tried to come up with a value as an "average" of the available data and also to fit the throttle down time to the historical value. Additionally I've improved the DPS dynamics with the famous 0.08 seconds lag as the overloaded computer caused heavy oscillations without that.
You may guess that the above changes had made a devastating blow on the performance but surprisingly the contrary is the true. The physical implementation of the CDU and PIPA could be done in a way that the more time-consuming calculations are done at initialization and in the real time part only some quick lookups are happening. And when I touched the AGC emulator itself I found some opportunities to optimize it for performance so I took my chance and in total the result was sensibly quicker: I cannot run the older version with 100x acceleration on my machine, now I have no problem to do that with the current version.
I've tested my version with many scenarios both involving CSM and LM (launch, reentry, SPS burns, P52, lunar ascent and landing) but haven't seen any problem with that.
The only significant disadvantage of the current version is the lack of multithreaded AGC capability. As the AGC is now more tightly integrated with the peripherals(IMU, Radars, Optics), these at least partially should be incorporated into the AGC's thread. I don't know how many people are relying on this feature, actually I've never used this multihtread option, so this is again something open for discussion.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Hi ggalfi, and :welcome: to the forum.

I briefly saw you earlier today on IRC and wanted to welcome you to the forum and NASSP developers.

That's a very impressive list of features you've implemented; I can't wait to play around with it once you and Indy91 get it merged.

:cheers:
 

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
Hi all, if anyone is interested, I uploaded my developments to my github page here: https://github.com/ggalfi/NASSP. The branch which contains the novelties called agcio, as most of the changes was related to AGC IO and peripheral devices, however there is also a commit with DPS changes to make the PDI profile closer to LM5's. There is another branch upon agcio called vkbstick, it is a quick and dirty solution for my VKB Gladiator flight stick. You don't want to use that unless you are using the same type of joystick. Up to my knowledge the agcio branch could be compiled as it is and all the standard scenarios I've tested could be run without any problem on it. There is a new scenario in WIP Scenarios/Apollo - Mission Scenarios/Apollo 11/ which I've used to make my previously linked video. I had changed the actual state vector of the vessel in a way that the LGC will make the historical 3mile westward error and it will aim the LM to the northern edge of the West Crater. I haven't included the Tranquility Base scenery, so don't expect too much eye candies there (yet).
Safe lunar landings!
 

Sverige

Active member
Joined
Apr 26, 2018
Messages
107
Reaction score
13
Points
33
Where can I find your high resolution texture files and elevation maps for Tranquility Base?

/Mikael
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Hi all, if anyone is interested, I uploaded my developments to my github page here: https://github.com/ggalfi/NASSP. The branch which contains the novelties called agcio, as most of the changes was related to AGC IO and peripheral devices, however there is also a commit with DPS changes to make the PDI profile closer to LM5's. There is another branch upon agcio called vkbstick, it is a quick and dirty solution for my VKB Gladiator flight stick. You don't want to use that unless you are using the same type of joystick. Up to my knowledge the agcio branch could be compiled as it is and all the standard scenarios I've tested could be run without any problem on it. There is a new scenario in WIP Scenarios/Apollo - Mission Scenarios/Apollo 11/ which I've used to make my previously linked video. I had changed the actual state vector of the vessel in a way that the LGC will make the historical 3mile westward error and it will aim the LM to the northern edge of the West Crater. I haven't included the Tranquility Base scenery, so don't expect too much eye candies there (yet).
Safe lunar landings!

I'll checkout your branch and play with it. There's a lottt of new code here!!:tiphat:

Have you talked with Indy91 again about merging the changes?
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Here's the scenario you requested:

https://drive.google.com/file/d/1gG2OpJQygNhY8ZWb0zBH5KRNuag6vkhO/view?usp=sharing

I had a lot of attitude control action in the first 10 or so seconds, and then it was semi-stable (RP and Y always hunt) until about PDI+30, when I changed to external view. The LM became very unstable and did several complete back-flips. Turning multi-threading off actually made it worse.
 

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
Hi n72.75, thanks. I've tested your scenario and I have seen that there were some departure before saving, but it settled down pretty quickly. I've looked into the scenario file (I compared it to a scenario I saved at approximately the same moment) but I haven't seen any serious anomaly. There could be some initialization problem of some sort. I plan to make a commit with some debug logging right after initialization to find out what is going on here.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Hi n72.75, thanks. I've tested your scenario and I have seen that there were some departure before saving, but it settled down pretty quickly. I've looked into the scenario file (I compared it to a scenario I saved at approximately the same moment) but I haven't seen any serious anomaly. There could be some initialization problem of some sort. I plan to make a commit with some debug logging right after initialization to find out what is going on here.

Okay. Cool.

I'm thinking that my issue is probably my computer being too slow.
 

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
Okay. Cool.

I'm thinking that my issue is probably my computer being too slow.

I think I have found the root cause of these mysterious errors. There was a bug with the AGC initialization code, which I have corrected. If you'd test the new version of the agcio branch, I'd greatly appreciate it.

It is very unlikely with agcio branch you'd have any controllability issues due to computer speed when starting up the test scenario (unless you have some with the main branch): first, my AGC version is slightly faster than the original one. Second, during the pre-PDI phase there isn't a single RCS firing happening, so I can use 10x time accel till ignition without going into some lunar aerobatics mode.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
I think I have found the root cause of these mysterious errors. There was a bug with the AGC initialization code, which I have corrected. If you'd test the new version of the agcio branch, I'd greatly appreciate it.

It is very unlikely with agcio branch you'd have any controllability issues due to computer speed when starting up the test scenario (unless you have some with the main branch): first, my AGC version is slightly faster than the original one. Second, during the pre-PDI phase there isn't a single RCS firing happening, so I can use 10x time accel till ignition without going into some lunar aerobatics mode.

We'll I tried your latest commit, and I'm sad to say it isn't much better, but I'm really struggling to figure out why, if it works for you, and I believe it works for Indy and Alex iirc.

I'm running Orbiter on a machine with a Xeon E3110 3GHz, with 8GB DDR2.
It's fairly old. but shouldn't have a hard time with Orbiter or NASSP, or this commit/pr.

It immediately starts a roll to the right when the simulation starts, and wobbles all over the place until ignition with amplitude increasing until at about PDI+1:20ish...usually. then it flips over, usually causing a gimbal lock and I start getting repeated 1201 alarms (V05N09).

We'll figure it out, I'm sure of it.

I haven't been in IRC lately. Can someone remind me if I'm the only one having problems.

---------- Post added 06-15-20 at 01:05 AM ---------- Previous post was 06-14-20 at 11:04 PM ----------

Not to be that guy...but you are running the latest Orbiter Beta right? Not 2016. Sorry if this is a dumb question...
 

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
Where can I find your high resolution texture files and elevation maps for Tranquility Base?

/Mikael
Hi Mikael,

and anybody who is interested in the scenery used in my video:
sorry for not coming back for so long time, I was engulfed with the tasks of my normal job. I planned to publish it after my AGC improvements are integrated into the official NASSP, but it seem to take much longer time than I expected (if it ever happens at all). So it make no sense to further hold back the textures. You may find everything on this page:
http://absimp.org/orbitersim/apollo11ls.html.
I posted this link to here, so if you have any questions or comments regarding specifically this scenery, I suggest to post it there. I'll try to pay attention on both threads.
 

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,224
Reaction score
582
Points
128
It's still going to happen, sorry that it's taking so long. I was in a middle of a big LVDC update which is now done, although I am getting a bunch of (mesh related?) bugs and CTDs that I first want to figure out before I push that update. And I definitely wanted thewonderidiot to check on your Virtual AGC changes. I am not familiar with that code, I only ever copy & pasted Virtual AGC commits that were done to the standalone Virtual AGC, but he has been busy with the Sundance reconstruction, which I am now assisting him with.

After we are through with Sundance, maybe in 1-2 weeks, we will take a look at your PR again and hopefully get it merged. I didn't want to interrupt my LVDC work or only partially look through the code of your PR, because in the past any larger project for NASSP that I "paused" partway through just never got done at all.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
I did manage to get this to work on my end with a faster computer. Also, I might have been accidentally building this one in debug mode, for some reason.
 

ggalfi

Well-known member
Joined
May 31, 2020
Messages
74
Reaction score
131
Points
48
Location
Budapest
It's still going to happen, sorry that it's taking so long. I was in a middle of a big LVDC update which is now done, although I am getting a bunch of (mesh related?) bugs and CTDs that I first want to figure out before I push that update. And I definitely wanted thewonderidiot to check on your Virtual AGC changes. I am not familiar with that code, I only ever copy & pasted Virtual AGC commits that were done to the standalone Virtual AGC, but he has been busy with the Sundance reconstruction, which I am now assisting him with.

After we are through with Sundance, maybe in 1-2 weeks, we will take a look at your PR again and hopefully get it merged. I didn't want to interrupt my LVDC work or only partially look through the code of your PR, because in the past any larger project for NASSP that I "paused" partway through just never got done at all.

Even if it may have sounded so, I didn't want to urge you. Just I hadn't seen the roadmap, but you've well clarified it now. Certainly I can see the tremendous amount of work you all put into the NASSP (and as a user I'm pretty grateful for it), and I also know that with such a limited resources there is no other way to proceed than the good old step-by-step method. So take your time, and whenever you can fit into schedule this agcio stuff, I'd be happy with that.

---------- Post added at 10:35 PM ---------- Previous post was at 10:19 PM ----------

I did manage to get this to work on my end with a faster computer. Also, I might have been accidentally building this one in debug mode, for some reason.
Hey,

that sounds good! I want to make sure: the build what was working well was the debug instead of release version?
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
Hey,

that sounds good! I want to make sure: the build what was working well was the debug instead of release version?

Other way around.
 
Top