VehicleWithMassPropertyAndTank 4.4 : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(Page créée avec « <syntaxhighlight lang="java"> public class VehicleWithMassPropertyAndTank { public static void main(String[] args) throws PatriusException { // Using an... »)
 
(Aucune différence)

Version actuelle en date du 3 octobre 2019 à 12:34

public class VehicleWithMassPropertyAndTank {
 
    public static void main(String[] args) throws PatriusException {
 
        // Using an assembly builder
        final AssemblyBuilder builder = new AssemblyBuilder();
 
        // Main part (for example dry mass)
        final double dryMass = 1000.;
        builder.addMainPart("MAIN");
        builder.addProperty(new MassProperty(dryMass), "MAIN");
 
// SPECIFIC
        // Tank part (ergols mass) ; considering centered vs the main part
        final double ergolsMass = 100.;
        builder.addPart("TANK", "MAIN", Transform.IDENTITY);
        builder.addProperty(new MassProperty(ergolsMass), "TANK");
// SPECIFIC
 
        // Getting the corresponding assembly
        final Assembly assembly = builder.returnAssembly();
 
        // Getting the corresponding mass model (useful for propagation, maneuvres, ...)
        final MassProvider mm = new MassModel(assembly);
 
        int iPart = 0;
        for (String name : mm.getAllPartsNames()) {
            System.out.println("Part #"+ (iPart++));
            System.out.println("  Name :" + name);
            System.out.println("  Mass :" + mm.getMass(name));
        }
 
        System.out.println("\nTotal mass: " + mm.getTotalMass());
 
    }
 
}