ContinuousManeuverByEvents

De Wiki
Révision de 13 février 2018 à 10:43 par Admin (discussion | contributions) (Page créée avec « <syntaxhighlight lang="java"> public class ContinuousManeuverByEvents { public static void main(String[] args) throws PatriusException { // Patrius D... »)

(diff) ← Version précédente | Voir la version courante (diff) | Version suivante → (diff)
Aller à : navigation, rechercher
public class ContinuousManeuverByEvents {
 
    public static void main(String[] args) throws PatriusException {
 
        // Patrius Dataset initialization (needed for example to get the UTC time)
        PatriusDataset.addResourcesFromPatriusDataset() ;
 
        // Recovery of the UTC time scale using a "factory" (not to duplicate such unique object)
        final TimeScale TUC = TimeScalesFactory.getUTC();
 
        // Creating a mass model with a main part and with a tank
        final AssemblyBuilder builder = new AssemblyBuilder();
 
        // Main part (dry mass)
        final double dryMass = 1000.;
        builder.addMainPart("MAIN");
        builder.addProperty(new MassProperty(dryMass), "MAIN");
 
        // Tank part (ergols mass)
        final double ergolsMass = 100.;
        final TankProperty tank = new TankProperty("TANK", ergolsMass);
        builder.addPart("TANK", "MAIN", Transform.IDENTITY);
        builder.addProperty(tank, "TANK");
 
        // Engine part
        final double isp = 300.;
        final double thrust = 400.;
        final PropulsiveProperty prop = new PropulsiveProperty("PROP", thrust, isp);
        builder.addPart("PROP", "MAIN", Transform.IDENTITY);
        builder.addProperty(prop, "PROP");
 
        final Assembly assembly = builder.returnAssembly();
        final MassProvider mm = new MassModel(assembly);
 
//SPECIFIC
        // Duration of the maneuver to get a 20 m/s boost
        final AbsoluteDate startDate = new AbsoluteDate("2010-01-01T12:00:00.000", TUC);
        final double G0 = 9.80665;
        final double duration = G0*isp*mm.getTotalMass()*(1. - FastMath.exp(-20/(G0*isp)))/thrust;
        // Start and end thrust events
        final EventDetector eventStart = new DateDetector(startDate);
        final EventDetector eventEnd = new DateDetector(startDate.shiftedBy(duration));
        // Direction of the thrust in the X vehicle axis
        final Vector3D direction = new Vector3D(1., 0., 0.);
        // Creation of the continuous thrust maneuver
        final ContinuousThrustManeuver man = new ContinuousThrustManeuver(eventStart, eventEnd, prop, direction, mm, tank, LOFType.TNW);
//SPECIFIC
 
        System.out.println("End of the thrust: "+man.getEndDate());
        System.out.println("Duration of the thrust: "+duration+" s");
        System.out.println("Duration of the thrust: "+man.getEndDate().durationFrom(startDate)+" s");
        // The getFrame() method is returning "null" as a LOF frame is not define as a frame.
        // Nevertheless, an attitude law will not be mandatory when propagating the orbit.
        System.out.println("Maneuver frame: "+man.getFrame());
 
    }
 
}