ContinuousManeuverByDuration 4.5.1

De Wiki
Aller à : navigation, rechercher
public class ContinuousManeuverByDuration {
 
    public static void main(String[] args) throws PatriusException, IOException, URISyntaxException {
 
        // 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)
        builder.addPart("TANK", "MAIN", Transform.IDENTITY);
        final double ergolsMass = 100.;
        final TankProperty tank = new TankProperty(ergolsMass);
        builder.addProperty(tank, "TANK");
 
        // Engine part
        builder.addPart("PROP", "MAIN", Transform.IDENTITY);
        final double isp = 300.;
        final double thrust = 400.;
        final PropulsiveProperty prop = new PropulsiveProperty(thrust, isp); // au lieu de new PropulsiveProperty("PROP", thrust, isp);
        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;
        // 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(startDate, duration, 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());
 
    }
 
}