Tutorial SMEstimation

De Opera
Aller à la navigation Aller à la recherche
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.SortedSet;

import fr.cnes.dynvol.opera.calc.model.OperaReentryResult;
import fr.cnes.dynvol.opera.calc.model.OperaSolarActivityRow;
import fr.cnes.dynvol.opera.calc.model.OperaTLE;
import fr.cnes.dynvol.opera.calc.simulation.OperaReentrySimulation;
import fr.cnes.dynvol.opera.calc.util.OperaReadUtils;
import fr.cnes.dynvol.opera.calc.util.OperaSolarActivity;
import fr.cnes.dynvol.opera.calc.util.OperaTleManager;
import fr.cnes.dynvol.opera.configuration.OperaConfigurationProperties;
import fr.cnes.dynvol.opera.exceptions.OperaDurationException;
import fr.cnes.dynvol.opera.exceptions.OperaException;
import fr.cnes.dynvol.opera.exceptions.OperaInitialProcessException;
import fr.cnes.dynvol.opera.exceptions.OperaInterpolationException;
import fr.cnes.dynvol.opera.exceptions.OperaMaxIterationException;
import fr.cnes.dynvol.opera.exceptions.OperaOrbitDeterminationException;
import fr.cnes.dynvol.opera.exceptions.OperaOutOfStudyRegionException;
import fr.cnes.dynvol.opera.exceptions.OperaStelaPropagationException;
import fr.cnes.sirius.addons.patriusdataset.PatriusDataset;
import fr.cnes.sirius.patrius.propagation.analytical.tle.TLE;
import fr.cnes.sirius.patrius.utils.exception.PatriusException;

/**
 * Tutorial for estimating a surface on mass ratio with OPERA.
 * @author goesterjf
 *
 */
public class SMEstimation {

    public static void main(String[] args) throws IOException, PatriusException, OperaException,
        ParseException, OperaOrbitDeterminationException, OperaDurationException, OperaInterpolationException,
        OperaMaxIterationException, OperaStelaPropagationException, OperaOutOfStudyRegionException, OperaInitialProcessException {
        
        // Opera properties configuration
        final OperaConfigurationProperties conf = OperaReadUtils.getConfigurationProperties("data/opera-configuration.properties");

        // Patrius Dataset initialization (needed for example to get the UTC time)
        OperaReadUtils.iniPatriusDataset("data");

        // Patrius Dataset initialization (needed for example to get the UTC time)
        PatriusDataset.addResourcesFromPatriusDataset() ;
        
        // Solar activity initialization
        final String realPath = "data/solar/ACSOL_REAL.act";
        final String predPath = "data/solar/ACSOL_PREDICTED.act";
        final double switchCJD = 22700.0;                
        final List<OperaSolarActivityRow> solarActivity = OperaSolarActivity.getSolarActivityFromFile(realPath, predPath, switchCJD);
        
        // Reentry simulation creation
        final OperaReentrySimulation simulation = new OperaReentrySimulation(conf, solarActivity);
        
        // TLEs initialization
        final int noradId = 10479;
        final SortedSet<TLE> tlesSet = OperaTleManager.readTLEs("data/tles", noradId, true, "txt");
        
        // TLEs selection
        final double historyDuration = 40.;
        final double endOfHistoryCJD = 22605.0;                
        final List<OperaTLE> tles = OperaTleManager.selectTLEs(tlesSet, endOfHistoryCJD, historyDuration);

        // S/M estimation computation
        final OperaReentryResult result = simulation.estimateInitialSm(tles);
        System.out.println("A priori S/m: "+result.getSmDragApriori());
        System.out.println("Refined S/m: "+result.getSmDragRefined());
            
    }
 
}