Customize output variables

De Wiki
Révision de 23 septembre 2019 à 14:22 par Admin (discussion | contributions) (Creating a class implementing the INewVarsFunction interface)

Aller à : navigation, rechercher

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 INewVarsFunction 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 addNewVars(), computeNewVars() and getNames() 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;
    }
 
}

Adding a constructor

As we will need information on the equatorial radius, we will add a constructor allowing to store a ExtendedOneAxisEllipsoid object as well as a list including the names of the new variables (this list will be returned by the getNames() method:

public class MyNewMeanVars implements INewVarsFunction {
 
    private final ExtendedOneAxisEllipsoid earth;
    private final ArrayList<String> listOfNames;
 
    public MyNewMeanVars ( final ExtendedOneAxisEllipsoid earth ) {
 
       this.earth = earth;
       listOfNames = new ArrayList<String>();
 
    }
 
    …
 
    @Override
    public List<String> getNames() {
        return listOfNames;
    }

Implementing the addNewVars() method =

 

Implementing the computeNewVars() method =