« GPVehicle » : différence entre les versions
(2 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 15 : | Ligne 15 : | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Since the '''<font color=#FF0000>V2.0</font>''' | Since the '''<font color=#FF0000>V2.0</font>''' version (and thus the [[http://patrius.cnes.fr PATRIUS]] V4.1.1), it is now possible to use directly the <font color=#4169E1>Vehicle</font> class. So, it is possible to search in [[http://patrius.cnes.fr PATRIUS]] documentation how it is possible to initialize such an object. We have then to instantiate this class using all the previous sub-objects described in the following paragraphs. | ||
''<font color=#FF0000>Note: for the previous '''<font color=#FF0000>V1.3(.1)</font>''' versions, it was mandatory to use the specific <font color=#556B2F>'''GENOPUS'''</font> [{{CurrentServer}}/uploads/JavaDocs/V1.3.1/fr/cnes/genopus/nonWidget/vehicle/CustomVehicle.html CustomVehicle] class.</font>'' | ''<font color=#FF0000>Note: for the previous '''<font color=#FF0000>V1.3(.1)</font>''' versions, it was mandatory to use the specific <font color=#556B2F>'''GENOPUS'''</font> [{{CurrentServer}}/uploads/JavaDocs/V1.3.1/fr/cnes/genopus/nonWidget/vehicle/CustomVehicle.html CustomVehicle] class.</font>'' | ||
Ligne 122 : | Ligne 122 : | ||
Vehicle vehicle = veh.getPatriusObject(); | Vehicle vehicle = veh.getPatriusObject(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
''<font color=#FF0000>Note: for the previous '''<font color=#FF0000>V1.3(.1)</font>''' versions, the <font color=#4169E1>getPatriusObject()</font> method was returning a [{{CurrentServer}}/uploads/JavaDocs/V1.3.1/fr/cnes/genopus/nonWidget/vehicle/CustomVehicle.html CustomVehicle] object.</font>'' | |||
== How it is stored == | == How it is stored == |
Dernière version du 9 octobre 2018 à 15:38
How to call it
For using the GPVehicle class, the developer has only to create such an object with these two possibilities:
- With no vehicle initialization
veh = new GPVehicle("My Vehicle");
- Or, if we want to initialize the widget with a predefined vehicle:
final CustomVehicle vehicle = new Vehicle(…);
veh = new GPVehicle("My Vehicle", vehicle);
Since the V2.0 version (and thus the [PATRIUS] V4.1.1), it is now possible to use directly the Vehicle class. So, it is possible to search in [PATRIUS] documentation how it is possible to initialize such an object. We have then to instantiate this class using all the previous sub-objects described in the following paragraphs.
Note: for the previous V1.3(.1) versions, it was mandatory to use the specific GENOPUS CustomVehicle class.
Dry mass initialization
// DRY MASS
final double dryMass = 1000.;
MassProperty dryMassProperty = new MassProperty(dryMass);
Propulsive properties initialization
// PROPULSION
final ArrayList<PropulsiveProperty> enginesList = new ArrayList<PropulsiveProperty>();
PropulsiveProperty prop1 = new PropulsiveProperty(1000., 320.);
prop1.setPartName("OCS");
enginesList.add(prop1);
PropulsiveProperty prop2 = new PropulsiveProperty(270., 150.);
prop2.setPartName("ACS");
enginesList.add(prop2);
final ArrayList<TankProperty> fuelTankList = new ArrayList<TankProperty>();
TankProperty tank = new TankProperty(500.);
tank.setPartName("TANK");
fuelTankList.add(tank);
Note: for the previous V1.3(.1) versions, it was mandatory to use the specific GENOPUS CustomEngine and CustomFuelTank classes.
Shape characteristics initializaton
// SHAPE (HERE PARALLELEPIPED + SOLAR PANELS)
final RightParallelepiped parall = new RightParallelepiped(4.0, 1.0, 2.0);
final RightParallelepiped solarPanels = new RightParallelepiped(10.0, 0.0, 0.0);
VehicleSurfaceModel vehicleRefSurface = new VehicleSurfaceModel(parall, solarPanels);
Note: for the previous V1.3(.1) versions, it was mandatory to use the specific GENOPUS classes for shape (as for example CustomParallelepiped as well as the CustomVehicleSurfaceModel class.""
Aerodynamic properties initialization
// AERODYNAMIC PROPERTIES (CONSTANT COEFFICIENTS)
final double cd = 2.0;
final double cl = 0.;
final CustomAerodynamicProperties aerodynamicProperties =
new CustomAerodynamicProperties(vehicleRefSurface, cd, cl);
Note #1: we need the shape model previously defined
Note #2: for the previous V1.3(.1) versions, it was mandatory to use the specific GENOPUS CustomAerodynamicProperties class.
Radiative properties initialization
// RADIATIVE PROPERTIES
final double ka = 1.0;
final double ks = 0.0;
final double kd = 0.0;
final RadiativeProperty rp = new RadiativeProperty(ka, ks, kd);
final double absorptionCoef = 1.0;
final double specularCoef = 0.0;
final double diffuseCoef = 0.0;
final RadiativeIRProperty rpIr =
new RadiativeIRProperty(absorptionCoef, specularCoef, diffuseCoef);
final RadiativeProperties radiativeProperties =
new RadiativeProperties(rp, rpIr, vehicleRefSurface);
Note #1: we need the shape model previously defined
Note #2: for the previous V1.3(.1) versions, it was mandatory to use the specific GENOPUS CustomRadiativeProperties class.
Vehicle initialization
At last, when all sub-objects are available, we have just to write this:
final Vehicle vehicle =
new Vehicle(vehicleRefSurface, null, dryMassProperty,
aerodynamicProperties, radiativeProperties,
enginesList, fuelTankList);
Note: of course, possible to put null to some of them except for dry mass properties (a zero value for it will raise a warning as a negative one an error).
Display
With the previous initialization and by clicking on the engines and/or tanks for more information, we will have this display:
How to use it
To get a [PATRIUS] Vehicle object, we will just have to call for the getPatriusObject() method as below:
Vehicle vehicle = veh.getPatriusObject();
Note: for the previous V1.3(.1) versions, the getPatriusObject() method was returning a CustomVehicle object.
How it is stored
Here is the XML format for such a vehicle:
<Vehicle name="My_Vehicle">
<Boolean name="hasMassProperties">true</Boolean>
<MassProperties name="massProperties">
<Real name="dryMass" unit="kg">1.0E3</Real>
</MassProperties>
<Boolean name="hasPropulsiveProperties">true</Boolean>
<PropulsiveProperties name="PropulsiveProperties">
<Real name="ergMass" unit="kg">5.0E2</Real>
<ComponentList name="listOfEngines">
<!--Amount of items-->
<Integer name="nbItems">2</Integer>
<ComponentListItem name="Item_1">
<Engine name="Engine">
<String name="name">OCS</String>
<Real name="isp" unit="s">3.2E2</Real>
<Real name="thrust" unit="N">1.0E3</Real>
</Engine>
</ComponentListItem>
<ComponentListItem name="Item_2">
<Engine name="Engine">
<String name="name">ACS</String>
<Real name="isp" unit="s">1.5E2</Real>
<Real name="thrust" unit="N">2.7E2</Real>
</Engine>
</ComponentListItem>
</ComponentList>
<ComponentList name="listOfTanks">
<!--Amount of items-->
<Integer name="nbItems">1</Integer>
<ComponentListItem name="Item_1">
<FuelTank name="Fuel_Tank">
<String name="name">Tank1</String>
<Real name="propMass" unit="kg">5.0E2</Real>
</FuelTank>
</ComponentListItem>
</ComponentList>
</PropulsiveProperties>
<Boolean name="hasAerodynamicProperties">true</Boolean>
<AerodynamicProperties name="AerodynamicProperties">
<Real name="dragCoefficient">2.0E0</Real>
<Real name="liftCoefficient">0.0E0</Real>
</AerodynamicProperties>
<Boolean name="hasRadiativeProperties">false</Boolean>
<Shape name="VehicleShape">
<String name="shapeType">Parallelepiped</String>
<String name="shapeDefinitionType">Surface</String>
<Real name="sx" unit="m^2">4.0E0</Real>
<Real name="sy" unit="m^2">1.0E0</Real>
<Real name="sz" unit="m^2">2.0E0</Real>
<Boolean name="withSolarPanels">false</Boolean>
</Shape>
</Vehicle>