Propagation : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(New fashion (since V11.4))
(New fashion (since V11.4))
Ligne 51 : Ligne 51 :
 
=== New fashion (since V11.4) ===
 
=== New fashion (since V11.4) ===
  
Now, it is possible to combine any kind of output modes, using the following states:
+
Now, it is possible to combine any kind of output modes as explained [[Propagation#New_fashion_(since_V11.4)|here]].
 
+
* 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).
+
  
 
== Some new util methods ==
 
== Some new util methods ==

Version du 24 septembre 2019 à 12:47

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)

Now, it is possible to combine any kind of output modes as explained here.

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 )