Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Tutorials & Challenges
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Tutorials & Challenges Feel free to publish your tutorials, challenges, & flight scenarios in this forum.

Reply
 
Thread Tools
Old 02-04-2019, 01:43 PM   #1
MontBlanc2012
Orbinaut
Default Station-keeping at Earth-Moon L2 scenario example

Following directly on from An update on all things Lissajous and Halo, attached is a zip file containing a scenario and associated script and data files for a demonstration scenario of station-keeping at Earth-Moon L2 Lagrange point.

Download the zip file and, in the usual file, copy the files into the relevant Orbiter directories. Then:

* open Orbiter and run the 'EML2.scn' scenario;

* open the Lua Console using the Scenario Editor and type <run 'Lissajous/EML2'>

You should now have two stock Delta-Gliders docked to each other at Earth-Moon L2. The motion of one of the Delta-Gliders ('GL-NT') is 'slaved' to EML2 and will remain firmly anchored to the Lagrange point even at high time acceleration. The motion of the other Delta-Glider ('GL-01') is unconstrained and can be manoeuvred at will. It will not, however, remain at the L2 Lagrange point without active station-keeping on your part.

In the top right-hand portion of the screen you should see some blue text recording the cumulative amount of station-keeping dV required to keep GL-NT on-station at the Lagrange point. If you do not see this, the station-keeping script has not been loaded correctly.

Enjoy.
Attached Files
File Type: zip Station-keeping EML2.zip (442.4 KB, 2 views)

Last edited by MontBlanc2012; 02-05-2019 at 02:10 AM.
MontBlanc2012 is offline   Reply With Quote
Thanked by:
Old 02-04-2019, 02:11 PM   #2
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So how hard would it be to do this for Satellites?
gattispilot is offline   Reply With Quote
Old 02-04-2019, 02:36 PM   #3
MontBlanc2012
Orbinaut
Default

Quote:
So how hard would it be to do this for Satellites?
Not quite sure what you mean. Delta-Glider's were used in the posted scenario simply because they are stock - so anyone should be able to run the file. But the same algorithm can be applied to any vessel.

If you look in the 'Script/Lissajous' directory, you'll find a file called 'EML2.lua'. If you open this in a text editor, near the bottom of the file, you'll see a few lines that read:

Code:
local base    = "Script/Lissajous/Earth-Moon/EM L2 - Lissajous - ER3BP - "
local sys     = "Earth-Moon"
local v       = vessel.get_interface("GL-NT")
The last of these lines references "GL-NT", which is the name of the Delta-Glider that is being 'slaved' to L2. Change the reference to a different vessel and that vessel will be slaved to L2 instead.

(The other two lines of code simply provide references to the appropriate dataset. For example, if you want to slave the motion to L1, simply change the first line to:

Code:
local base    = "Script/Lissajous/Earth-Moon/EM L1 - Lissajous - ER3BP - "
MontBlanc2012 is offline   Reply With Quote
Old 02-04-2019, 02:37 PM   #4
Notebook
Donator
 
Notebook's Avatar


Default

Hello MontBlanc2012.

I've installed the files, but getting a "Execution Error"? in Lua Console.

N.
Notebook is online now   Reply With Quote
Old 02-04-2019, 02:41 PM   #5
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

I was thinking for this my Queqiao in part of the Change4 project. As I believe the satellite was placed there?

So can only 1 vessel be placed there or does it need that slave vessel?
gattispilot is offline   Reply With Quote
Old 02-04-2019, 02:50 PM   #6
MontBlanc2012
Orbinaut
Default

Quote:
Hello MontBlanc2012.

I've installed the files, but getting a "Execution Error"? in Lua Console.

N.
Hmmm. I've just downloaded the .zip and installed on my Orbiter installation. Opened Lua Console and typed in:

Code:
%run 'Lissajous/EML2'
All works fine at my end. Can you check your installation and the Lua Console command? Thanks

MB


Last edited by MontBlanc2012; 02-04-2019 at 02:53 PM. Reason: Adding image
MontBlanc2012 is offline   Reply With Quote
Old 02-04-2019, 02:59 PM   #7
Notebook
Donator
 
Notebook's Avatar


Default

Its fine, I was putting in the <> characters.

Thanks, N.
Notebook is online now   Reply With Quote
Thanked by:
Old 02-04-2019, 03:04 PM   #8
MontBlanc2012
Orbinaut
Default

Quote:
I was thinking for this my Queqiao in part of the Change4 project. As I believe the satellite was placed there?

So can only 1 vessel be placed there or does it need that slave vessel?
Any number of vessels can be 'locked' to L2. However, the routine slaves each vessel to L2 with sub-millimetre precision (such is the power of floating point arithmetic). To lock two or more vessels to L2, and to avoid a non-physical overlap, one would need to add a small spatial offset to the position of the vessels. But this is an easy adjustment to make.
MontBlanc2012 is offline   Reply With Quote
Thanked by:
Old 02-05-2019, 02:17 AM   #9
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

I will give her a try. then try to put my satellite there

---------- Post added at 08:17 PM ---------- Previous post was at 09:41 AM ----------

I guess I need the Lua Console
gattispilot is offline   Reply With Quote
Old 02-05-2019, 02:22 AM   #10
MontBlanc2012
Orbinaut
Default

Code:
I guess I need the Lua Console
Yes, I'm afraid so. It should be simply be a matter of going to the 'Modules' pane and checking the 'LuaConsole' box. Then, when Orbiter is running, Lua Console should be accessible via the 'function' button at the top of the screen and should appear as one of the listed 'custom functions'.

[As an aside, using Lua here to run this station-keeping algorithm probably isn't state-of-the-art and a more robust housing would be via Orbiter's C/C++ api interface. However, this scenario was intended as a simple demonstration piece using a straightforward, and easy to build, application of the Lua api interface. It works, but it isn't pretty.]

Last edited by MontBlanc2012; 02-05-2019 at 02:29 AM.
MontBlanc2012 is offline   Reply With Quote
Old 02-05-2019, 03:02 AM   #11
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. But I got that Execution Error

But I am not sure if installed correctly

---------- Post added at 09:02 PM ---------- Previous post was at 08:35 PM ----------

Got it to work

So I t edited the script
Code:
local base    = "Script/Lissajous/Earth-Moon/EM L2 - Lissajous - ER3BP - "
local sys     = "Earth-Moon"
local v       = vessel.get_interface("Queqiao")
and saved as EMQL2

So will place the Queqiao at the L2 position?
gattispilot is offline   Reply With Quote
Old 02-05-2019, 03:06 AM   #12
MontBlanc2012
Orbinaut
Default

Code:
Thanks. But I got that Execution Error

But I am not sure if installed correctly
Chances are that you didn't install correctly. The 'EML2.scn' file needs to be appear directly under the 'Scenarios' directory in your installation; and the whole of the 'Lissajous' directory needs to be copied over so that the Lissajous directory now appears directly under the 'Script' directory in your Orbiter installation. In other words, you need to preserve the directory structure of the entire contents of the .zip file when you copy things over.

When running the Lua Console script, it is important to type in the correct command (as Notebook discovered). At the prompt, type:

Code:
%run 'Lissajous/EML2'
(N.B., Here, the '%' is the prompt , so you don't type that in.)

---------- Post added at 03:06 AM ---------- Previous post was at 03:04 AM ----------

Code:
So I t edited the script 
Code:
local base    = "Script/Lissajous/Earth-Moon/EM L2 - Lissajous - ER3BP - "
local sys     = "Earth-Moon"
local v       = vessel.get_interface("Queqiao")
and saved as EMQL2

So will place the Queqiao at the L2 position?
So long as there is a vessel 'Queqiao' in your scenario available to move to EM L2, then, yes, it will lock that vessel to the Lagrange point.
MontBlanc2012 is offline   Reply With Quote
Thanked by:
Old 02-05-2019, 01:12 PM   #13
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Thanks. So how would I /can I distribute it in an addon? For me it may be just place the satellite at the L2 spot. So the scn would start with the satellite at L2. For the Change4 it is really for looks.
gattispilot is offline   Reply With Quote
Old 02-06-2019, 02:39 AM   #14
MontBlanc2012
Orbinaut
Default

Quote:
anks. So how would I /can I distribute it in an addon? For me it may be just place the satellite at the L2 spot. So the scn would start with the satellite at L2. For the Change4 it is really for looks.
Sorry for the slow reply. I was flying most of yesterday and finally arrived at the hotel way too late for me to write a response.

In principle, one can get a scenario to auto run a Lau script. And, indeed, Iíve tried running these scripts in this fashion. However, these scripts are very precise in what they do and need to run in a very particular way: each time the core routines are run, Orbiter needs to suspend momentarily its standards time-stepping algorithm so that all of the scriptís computations can be completed and replace the vessel at the right spot. Then control is handed back to Orbiter so that it can continue doing its simulation until the next time the script needs to run the core routines to update the location of the vessel. This interruption occurs about once a second at low time accelerations and about 10 times a (real world) second at high time accelerations. When trying to automate running the script using the standard command set provided by Orbiter, the process control of the script changes so that the script appears to be run as a background task rather than the primary control task. This results in the vessel not being placed at the right location and, instead of being placed with sub-millimeter accuracy, large and erratic errors of 10-100 meters in placement of the vessel ensue. Not ideal.

At the moment, I donít know how to get around this loss of process control issue. Iím sure there is a way of doing it - I just havenít worked out how to do it yet. When I have a solution, Iíll let you know.
MontBlanc2012 is offline   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Tutorials & Challenges


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 07:58 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright ©2007 - 2017, Orbiter-Forum.com. All rights reserved.