UsingVehicleClass : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(Page créée avec « <syntaxhighlight lang="java"> public class UsingVehicleClass { public static void main(String[] args) throws PatriusException { Vehicle veh = new Veh... »)
 
Ligne 23 : Ligne 23 :
 
         // Tanks
 
         // Tanks
 
         final double merg1 = 100.;
 
         final double merg1 = 100.;
         final TankProperty tank1 = new TankProperty("TANK1", merg1);
+
         final TankProperty tank1 = new TankProperty(merg1);
 
         final double merg2 = 200.;
 
         final double merg2 = 200.;
         final TankProperty tank2 = new TankProperty("TANK2", merg2);
+
         final TankProperty tank2 = new TankProperty(merg2);
         veh.addTank(tank1);
+
         veh.addTank("TANK1", tank1);
         veh.addTank(tank2);
+
         veh.addTank("TANK2", tank2);
 
          
 
          
 
         // Engine
 
         // Engine
 
         final double thrust = 400.;
 
         final double thrust = 400.;
 
         final double isp = 320.;
 
         final double isp = 320.;
         final PropulsiveProperty engine = new PropulsiveProperty("PROP", thrust, isp);
+
         final PropulsiveProperty engine = new PropulsiveProperty(thrust, isp);
         veh.addEngine(engine);
+
         veh.addEngine("PROP", engine);
 
                
 
                
 
         // Getting the corresponding assembly
 
         // Getting the corresponding assembly

Version du 28 juin 2018 à 08:25

public class UsingVehicleClass {
 
    public static void main(String[] args) throws PatriusException {
 
        Vehicle veh = new Vehicle();
 
        // Dry mass
        final double dryMass = 1000.;
        veh.setDryMass(dryMass);
 
        // Shape
        final double lref = 1.;
        veh.setMainShape(new Sphere(Vector3D.ZERO, lref));
 
        // Aerodynamic properties
        final double cd = 2.;
        final double cl = 2.;
        veh.setAerodynamicsProperties(cd, cl);
 
        // Propulsive properties
 
        // Tanks
        final double merg1 = 100.;
        final TankProperty tank1 = new TankProperty(merg1);
        final double merg2 = 200.;
        final TankProperty tank2 = new TankProperty(merg2);
        veh.addTank("TANK1", tank1);
        veh.addTank("TANK2", tank2);
 
        // Engine
        final double thrust = 400.;
        final double isp = 320.;
        final PropulsiveProperty engine = new PropulsiveProperty(thrust, isp);
        veh.addEngine("PROP", engine);
 
        // Getting the corresponding assembly
        final Assembly assembly = veh.createAssembly(FramesFactory.getCIRF());
 
        // Getting the corresponding mass model (useful for propagation, maneuvres, ...)
        final MassProvider mm = new MassModel(assembly);
 
        System.out.println("Name of the main part: " + assembly.getMainPart().getName());        
        System.out.println("Total mass: " + mm.getTotalMass());
 
        for (int i = 0; i < veh.getTanksList().size(); i++) {
            System.out.println(veh.getTanksList().get(i).getName()+": "+veh.getTanksList().get(i).getMass());
        }
 
    }
 
}