Customize output variables : Différence entre versions

De Wiki
Aller à : navigation, rechercher
Ligne 1 : Ligne 1 :
 
TBW (for V11.4 version) …
 
TBW (for V11.4 version) …
  
''<font color=#FF0000>'''Warning: this section is only relevant for <font color=#556B2F>'''PSIMU'''</font> version 11.4 (and or more recent ones).'''</font>''
+
''<font color=#FF0000>'''Warning: this section is only relevant for PSIMU version 11.4 (and or more recent ones).'''</font>''
 +
 
 +
Create new specific variables in the output list is relatively simple. As an example, we are goinf to show how to add twoo additional variables '''HPM''' and '''HAM''', corresponding respectively the the perigee and apogee mean altitudes considering the mean semi-major axis and eccentricity already computed by <font color=#556B2F>'''PSIMU'''</font>.
 +
 
 +
== Creating a class implementing the INewVarsFunction interface ==
 +
 
 +
As explained in the title of this paragraph, we have to create a new class implementing the font color=#4169E1>INewVarsFunction</font> interface where we will be able to compute the new variables. On the code below, we see that this interface forces us to have the font color=#4169E1>addNewVars()</font>, font color=#4169E1>computeNewVars()</font> and font color=#4169E1>getNames()</font> methods:
 +
 
 +
<syntaxhighlight lang="java">
 +
public class MyNewMeanVars implements INewVarsFunction {
 +
 
 +
    @Override
 +
    public void addNewVars(ResultWriter resultWriter) throws SqliteException {
 +
        // TODO Auto-generated method stub
 +
    }
 +
 
 +
    @Override
 +
    public void computeNewVars(ResultWriter resultWriter, String tableName,
 +
            SpacecraftState currentState,
 +
            HashMap<String, Object> currentVarsList) throws SqliteException {
 +
        // TODO Auto-generated method stub
 +
    }
 +
 
 +
    @Override
 +
    public List<String> getNames() {
 +
        // TODO Auto-generated method stub
 +
        return null;
 +
    }
 +
 
 +
}
 +
</syntaxhighlight>

Version du 23 septembre 2019 à 14:12

TBW (for V11.4 version) …

Warning: this section is only relevant for PSIMU version 11.4 (and or more recent ones).

Create new specific variables in the output list is relatively simple. As an example, we are goinf to show how to add twoo additional variables HPM and HAM, corresponding respectively the the perigee and apogee mean altitudes considering the mean semi-major axis and eccentricity already computed by PSIMU.

Creating a class implementing the INewVarsFunction interface

As explained in the title of this paragraph, we have to create a new class implementing the font color=#4169E1>INewVarsFunction</font> interface where we will be able to compute the new variables. On the code below, we see that this interface forces us to have the font color=#4169E1>addNewVars()</font>, font color=#4169E1>computeNewVars()</font> and font color=#4169E1>getNames()</font> methods:

public class MyNewMeanVars implements INewVarsFunction {
 
    @Override
    public void addNewVars(ResultWriter resultWriter) throws SqliteException {
        // TODO Auto-generated method stub
    }
 
    @Override
    public void computeNewVars(ResultWriter resultWriter, String tableName,
            SpacecraftState currentState,
            HashMap<String, Object> currentVarsList) throws SqliteException {
        // TODO Auto-generated method stub
    }
 
    @Override
    public List<String> getNames() {
        // TODO Auto-generated method stub
        return null;
    }
 
}