1
$\begingroup$

I am using the GMAT Python API to run scripts, fx the Ex_R2022a_TLE_Propagation.script can be used as an example, as this is included in GMAT/samples.

import gmatpy as gmat
# Run setup script

gmat.LoadScript('Ex_R2022a_TLE_Propagation.script')
gmat.RunScript()

In this script a report file is created with the propagation results (time, X, Y, Z, VX, VY, VZ).

I can access the last X element for example by

x = orp.gmat.GetRuntimeObject("ExampleSat.X")
x.GetTypeAndValue(8)
ans[0]: '            Real   -244.1779559915077'

Is it possible to access the results (all X, Y, Z, ... values) written in the report file through the objects loaded in GMAT from the script? (I would like to avoid opening the report file.)

Bonus question: Is it possible to load a script by loading the content of the script-file itself and not the path to the file? I am pretty sure the answer is no, but I will give it a try.

$\endgroup$

1 Answer 1

1
$\begingroup$

The GMAT API RunScript() command acts as a sort of "black box" when it comes to the processes happening during execution of the mission sequence, so you would not be able to access intermediary state information after the run. If you want to access the results during each step of the propagation, you could load the script and use the pre-designed propagator to step the spacecraft inside the Python environment and retrieve/store the states at each step. The examples in the api and api/Jupyter demonstrate stepping the propagator in the Python environment and should provide some insight in how to set things up.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.