Propagation : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(Master mode)
(New fashion (since V11.4))
 
(15 révisions intermédiaires par le même utilisateur non affichées)
Ligne 25 : Ligne 25 :
 
Then, the propagation will be done by calling the <font color=#4169E1>propagateInMasterMode</font> method.
 
Then, the propagation will be done by calling the <font color=#4169E1>propagateInMasterMode</font> method.
  
=== Old fashion (before V11.4) ===
+
=== Old fashion (before V11.4 but still available) ===
  
 
The list of <font color=#4169E1>SpacecraftState</font> (see [[https://logiciels.cnes.fr/en/node/62?type=desc PATRIUS]] definition) could be recover using the <font color=#4169E1>getSpacecraftStateList()</font> method. In the following example, we have no additional events (reason why of the null second argument).
 
The list of <font color=#4169E1>SpacecraftState</font> (see [[https://logiciels.cnes.fr/en/node/62?type=desc PATRIUS]] definition) could be recover using the <font color=#4169E1>getSpacecraftStateList()</font> method. In the following example, we have no additional events (reason why of the null second argument).
Ligne 31 : Ligne 31 :
 
The last argument allows to specify how results will be stored. We may choose between the following options:
 
The last argument allows to specify how results will be stored. We may choose between the following options:
 
* StorageType.'''MEMORY''' => only the spacecraft states in memory
 
* StorageType.'''MEMORY''' => only the spacecraft states in memory
* StorageType.'''FILE_SC_BINARY''' => only the spacecraft states but directly written in a sqlLite file (to avoid to use too much RAM memory)
+
* StorageType.'''FILE_SC_BINARY''' => only the spacecraft states but directly written in a [https://www.sqlite.org/ SQLite] file (to avoid to use too much <font color=#FF8C00 title="Random Access Memory">RAM</font>)
 
* StorageType.'''FILE_COLUMNS''' => all output variables (see [[Output#List of available variables|here]]) are computed and stored in a [https://www.sqlite.org/ SQLite] file (since V11.1).
 
* StorageType.'''FILE_COLUMNS''' => all output variables (see [[Output#List of available variables|here]]) are computed and stored in a [https://www.sqlite.org/ SQLite] file (since V11.1).
 
  
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
Ligne 51 : Ligne 50 :
  
 
=== New fashion (since V11.4) ===
 
=== New fashion (since V11.4) ===
 +
 +
* StorageType.'''MEMORY_SC''' (ex StorageType.'''MEMORY''') ⇒ spacecraft states memory stored
 +
* StorageType.'''MEMORY_COL''' ⇒ output variables memory stored; possibility to get them using <font color=#4169E1>getVarsList()</font>, <font color=#4169E1>getVars(index)</font>, <font color=#4169E1>getVar(index,key)</font> methods
 +
* StorageType.'''MEMORY_ALL''' ⇒ '''MEMORY_SC''' et '''MEMORY_COL'''
 +
* StorageType.'''NONE''' ⇒ no memory storage
 +
 +
* StorageType.'''FILE_SC''' (ex StorageType.'''FILE_SC_BINARY''') ⇒ spacecraft states stored in a file
 +
* StorageType.'''FILE_COL''' (ex StorageType.'''FILE_COLUMNS''') ⇒ output variables stored in a file
 +
* StorageType.'''FILE_ALL''' ⇒ StorageType.'''FILE_SC''' et StorageType.'''FILE_COL'''
 +
* StorageType.'''NONE''' ⇒ no files
 +
 +
In order to differentiate memory vs file choice, the <font color=#4169E1>propagateInMasterMode()</font> method can accept both states as in the examples below:
 +
 +
<syntaxhighlight lang="java">
 +
test.propagateInMasterMode(output, events, StorageType.MEMORY_SC, StorageType.NONE);
 +
</syntaxhighlight>
 +
 +
⇒ only spacecraft states memory stored (equivalent to the old '''MEMORY''' state)
 +
 +
<syntaxhighlight lang="java">
 +
test.propagateInMasterMode(output, events, StorageType.NONE, StorageType.File_COL);
 +
</syntaxhighlight>
 +
 +
⇒ no memory storage and output variables stored in a file (as the old '''FILE_COLUMNS''' state)
 +
 +
<syntaxhighlight lang="java">
 +
test.propagateInMasterMode(output, events, StorageType.MEMORY_SC, StorageType.File_ALL);
 +
</syntaxhighlight>
 +
 +
⇒ spacecraft states stored both in memory and file as output variables will be stored in a file.
 +
 +
At last, to manage output variables as spacecraft states, these methods are available:
 +
 +
* <font color=#4169E1>getVariablesList()</font>, <font color=#4169E1>getVariablesWithoutEventsList()</font>, <font color=#4169E1>getVariablesOnlyEventsList()</font>
 +
* <font color=#4169E1>getVariables(index)</font>, <font color=#4169E1>getVariablesWithoutEvents(index)</font>, <font color=#4169E1>getVariablesOnlyEvents(index)</font>
 +
* <font color=#4169E1>getVariable (index, key)</font>, <font color=#4169E1>getVariableWithoutEvents(index, key)</font>, <font color=#4169E1>getVariableOnlyEvents(index, key)</font>
 +
 +
Note that to get those lists of spacecraft states and/or variables, it is not necessary to have stored them in memory. Indeed, <font color=#556B2F>'''PSIMU'''</font> is able to know if data has been directly stored in a file and, if it is the case, it will read in this file rather than in memory (using the methods described below).
 +
 +
<font color=#FF0000>Important remark : data stored in files are using units as described in the list [[Output#List of available variables|here]]. On the contrary, when we get data directly from Java code, these data will be always in '''<font color=#FF8C00 title="from the French Système International (d'unités)">SI</font>''' units !</font>
 +
.
 +
 +
== Some new util methods ==
 +
 +
The following methods have been declared as "public":
 +
 +
* to read a [http://genius.cnes.fr/index.php/ResultsFileManagement#SqLite_files SQLite format] file and extract  spacecraft states:
 +
 +
<syntaxhighlight lang="java">
 +
public static List<SpacecraftState> readSpacecraftStatesFromFile ( final boolean isEphem, final boolean isEvent, final String outputDirectory, final String nameFile, final String varName )
 +
</syntaxhighlight>
 +
 +
* to convert a spacecraft state in String and vice versa:
 +
 +
<syntaxhighlight lang="java">
 +
public static SpacecraftState fromBase64(final String spacecraftStateString)
 +
public static String toBase64(final SpacecraftState currentState)
 +
</syntaxhighlight>
 +
 +
* to read a [http://genius.cnes.fr/index.php/ResultsFileManagement#SqLite_files SQLite format] file and extract a list of variables:
 +
 +
<syntaxhighlight lang="java">
 +
public static List<HashMap<String, Object>> readVariablesFromFile( final boolean isEphem, final boolean isEvent, final String outputDirectory, final String nameFile, final ArrayList<String> listOfVarnames )
 +
</syntaxhighlight>

Version actuelle en date du 16 décembre 2020 à 11:42

Slave mode

The simplest way to propagate is to use the “slave mode”. The final result (at the date of the end of the propagation will be stored in a [PATRIUS] SpacecraftState object.

System.out.println("Initial orbit:");
System.out.println("Date:"+iniOrbit.getDate());
System.out.println("SMA:"+iniOrbit.getA());
 
final SpacecraftState sc = test.propagateInSlaveMode();
 
System.out.println("Final orbit:");
System.out.println("Date:"+sc.getDate());
System.out.println("SMA:"+sc.getA());

Master mode

On the other side, if the user wants to store intermediate data all along the propagation, it is possible to use the “master mode”. To do it, it will have to create an OutputConfig object as below, giving the output frames (inertial and local ones) as well as the output step (here 60s):

final OutputConfig output = new OutputConfig(FramesFactory.getEME2000(), LOFType.LVLH, 60.);

Then, the propagation will be done by calling the propagateInMasterMode method.

Old fashion (before V11.4 but still available)

The list of SpacecraftState (see [PATRIUS] definition) could be recover using the getSpacecraftStateList() method. In the following example, we have no additional events (reason why of the null second argument).

The last argument allows to specify how results will be stored. We may choose between the following options:

  • StorageType.MEMORY => only the spacecraft states in memory
  • StorageType.FILE_SC_BINARY => only the spacecraft states but directly written in a SQLite file (to avoid to use too much RAM)
  • StorageType.FILE_COLUMNS => all output variables (see here) are computed and stored in a SQLite file (since V11.1).
test.propagateInMasterMode(output, null, StorageType.MEMORY);
List<SpacecraftState> listOfSc = test.getSpacecraftStateList();

The user may now use this list …

final int nb = listOfSc.size();
System.out.println("Amount of S/C states = "+nb);
System.out.println("Final orbit:");
System.out.println("Date:"+listOfSc.get(nb-1).getDate());
System.out.println("SMA:"+listOfSc.get(nb-1).getA());

New fashion (since V11.4)

  • StorageType.MEMORY_SC (ex StorageType.MEMORY) ⇒ spacecraft states memory stored
  • StorageType.MEMORY_COL ⇒ output variables memory stored; possibility to get them using getVarsList(), getVars(index), getVar(index,key) methods
  • StorageType.MEMORY_ALLMEMORY_SC et MEMORY_COL
  • StorageType.NONE ⇒ no memory storage
  • StorageType.FILE_SC (ex StorageType.FILE_SC_BINARY) ⇒ spacecraft states stored in a file
  • StorageType.FILE_COL (ex StorageType.FILE_COLUMNS) ⇒ output variables stored in a file
  • StorageType.FILE_ALL ⇒ StorageType.FILE_SC et StorageType.FILE_COL
  • StorageType.NONE ⇒ no files

In order to differentiate memory vs file choice, the propagateInMasterMode() method can accept both states as in the examples below:

test.propagateInMasterMode(output, events, StorageType.MEMORY_SC, StorageType.NONE);

⇒ only spacecraft states memory stored (equivalent to the old MEMORY state)

test.propagateInMasterMode(output, events, StorageType.NONE, StorageType.File_COL);

⇒ no memory storage and output variables stored in a file (as the old FILE_COLUMNS state)

test.propagateInMasterMode(output, events, StorageType.MEMORY_SC, StorageType.File_ALL);

⇒ spacecraft states stored both in memory and file as output variables will be stored in a file.

At last, to manage output variables as spacecraft states, these methods are available:

  • getVariablesList(), getVariablesWithoutEventsList(), getVariablesOnlyEventsList()
  • getVariables(index), getVariablesWithoutEvents(index), getVariablesOnlyEvents(index)
  • getVariable (index, key), getVariableWithoutEvents(index, key), getVariableOnlyEvents(index, key)

Note that to get those lists of spacecraft states and/or variables, it is not necessary to have stored them in memory. Indeed, PSIMU is able to know if data has been directly stored in a file and, if it is the case, it will read in this file rather than in memory (using the methods described below).

Important remark : data stored in files are using units as described in the list here. On the contrary, when we get data directly from Java code, these data will be always in SI units ! .

Some new util methods

The following methods have been declared as "public":

public static List<SpacecraftState> readSpacecraftStatesFromFile ( final boolean isEphem, final boolean isEvent, final String outputDirectory, final String nameFile, final String varName )
  • to convert a spacecraft state in String and vice versa:
public static SpacecraftState fromBase64(final String spacecraftStateString)
public static String toBase64(final SpacecraftState currentState)
public static List<HashMap<String, Object>> readVariablesFromFile( final boolean isEphem, final boolean isEvent, final String outputDirectory, final String nameFile, final ArrayList<String> listOfVarnames )