SequenceOfManeuvers 4.4

De Wiki
Aller à : navigation, rechercher
public class SequenceOfManeuvers {
 
    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)
        final double ergolsMass = 100.;
        final TankProperty tank = new TankProperty(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(thrust, isp); // au lieu de 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 IMPULSIVE MANEUVER
        // Event corresponding to the criteria to trigger the impulsive maneuver
        // (when the S/C is at the apogee)
        final EventDetector event = new AnomalyDetector(PositionAngle.TRUE, FastMath.PI);
        // Creation of the impulsive maneuver (20 m/s int the x vehicle direction)
        final Vector3D deltaV = new Vector3D(20., 0., 0.);
        final ImpulseManeuver imp = new ImpulseManeuver(event, deltaV, prop, mm, tank, LOFType.TNW);
 
// SPECIFIC CONTINUOUS MANEUVER
        // Duration of the continuous 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 SEQUENCE OF MANEUVERS
        ManeuversSequence seq = new ManeuversSequence(10., 10.);
        seq.add(imp);
        seq.add(man);
 
        System.out.println("Amount of maneuvers: "+seq.getSize());
 
    }
 
}