« UsingVehicleClass » : différence entre les versions

De Patrius
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 10 : Ligne 10 :
         veh.setDryMass(dryMass);
         veh.setDryMass(dryMass);
          
          
         // Shape
         // Shape : A vehicle object must have a main shape !
         final double lref = 1.;
         final double lref = 1.;
         veh.setMainShape(new Sphere(Vector3D.ZERO, lref));
         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
         // Getting the corresponding assembly
         final Assembly assembly = veh.createAssembly(FramesFactory.getCIRF());
         final Assembly assembly = veh.createAssembly(FramesFactory.getCIRF());
Ligne 43 : Ligne 22 :
         System.out.println("Name of the main part: " + assembly.getMainPart().getName());         
         System.out.println("Name of the main part: " + assembly.getMainPart().getName());         
         System.out.println("Total mass: " + mm.getTotalMass());
         System.out.println("Total mass: " + mm.getTotalMass());
       
        for (int i = 0; i < veh.getEnginesList().size(); i++) {
            System.out.println(veh.getEnginesList().get(i).getPartName());
            System.out.println("Thrust = "+veh.getEnginesList().get(i).getThrust(null)+" N");
            System.out.println("Isp = "+veh.getEnginesList().get(i).getIsp(null)+ "s");
        }
       
        for (int i = 0; i < veh.getTanksList().size(); i++) {
            System.out.println(veh.getTanksList().get(i).getPartName()+": "+veh.getTanksList().get(i).getMass()+" kg");
        }
          
          
     }
     }

Version du 21 décembre 2018 à 10:04

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 : A vehicle object must have a main shape !
        final double lref = 1.;
        veh.setMainShape(new Sphere(Vector3D.ZERO, lref));
//              
        // 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());
        
    }

}