diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 5951d39c5..106ceb46e 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1632,7 +1632,7 @@ FlightDataType.TYPE_ROLL_RATE = Roll rate FlightDataType.TYPE_PITCH_RATE = Pitch rate FlightDataType.TYPE_YAW_RATE = Yaw rate FlightDataType.TYPE_MASS = Mass -FlightDataType.TYPE_PROPELLANT_MASS = Propellant mass +FlightDataType.TYPE_MOTOR_MASS = Motor mass FlightDataType.TYPE_LONGITUDINAL_INERTIA = Longitudinal moment of inertia FlightDataType.TYPE_ROTATIONAL_INERTIA = Rotational moment of inertia FlightDataType.TYPE_CP_LOCATION = CP location diff --git a/core/resources/l10n/messages_es.properties b/core/resources/l10n/messages_es.properties index 2e9bd3c35..15416c61d 100644 --- a/core/resources/l10n/messages_es.properties +++ b/core/resources/l10n/messages_es.properties @@ -314,7 +314,7 @@ FlightDataType.TYPE_POSITION_X = Posici\u00f3n contra el viento FlightDataType.TYPE_POSITION_XY = Distancia lateral FlightDataType.TYPE_POSITION_Y = Posici\u00f3n a favor del viento FlightDataType.TYPE_PRESSURE_DRAG_COEFF = Presi\u00f3n del Coeficiente de rozamiento -FlightDataType.TYPE_PROPELLANT_MASS = Masa del propulsor +FlightDataType.TYPE_MOTOR_MASS = Masa del propulsor FlightDataType.TYPE_REFERENCE_AREA = \u00c1rea de referencia FlightDataType.TYPE_REFERENCE_LENGTH = Longitud de referencia FlightDataType.TYPE_REYNOLDS_NUMBER = N\u00famero de Reynolds diff --git a/core/resources/l10n/messages_fr.properties b/core/resources/l10n/messages_fr.properties index c5fd19271..181838f72 100644 --- a/core/resources/l10n/messages_fr.properties +++ b/core/resources/l10n/messages_fr.properties @@ -305,7 +305,7 @@ FlightDataType.TYPE_POSITION_X = Position contre le vent FlightDataType.TYPE_POSITION_XY = Distance lat\u00E9rale FlightDataType.TYPE_POSITION_Y = Position parall\u00E8le au vent FlightDataType.TYPE_PRESSURE_DRAG_COEFF = Coefficient de tra\u00EEn\u00E9e de pression -FlightDataType.TYPE_PROPELLANT_MASS = Masse du propergol +FlightDataType.TYPE_MOTOR_MASS = Masse du propergol FlightDataType.TYPE_REFERENCE_AREA = Surface de r\u00E9f\u00E9rence FlightDataType.TYPE_REFERENCE_LENGTH = Longueur de r\u00E9f\u00E9rence FlightDataType.TYPE_REYNOLDS_NUMBER = Nombre de Reynolds diff --git a/core/resources/l10n/messages_ja.properties b/core/resources/l10n/messages_ja.properties index 1b1133f77..09c788dc7 100644 --- a/core/resources/l10n/messages_ja.properties +++ b/core/resources/l10n/messages_ja.properties @@ -1385,7 +1385,7 @@ FlightDataType.TYPE_ROLL_RATE = \u89D2\u901F\u5EA6\uFF08\u30ED\u30FC\u30EB\uFF0 FlightDataType.TYPE_PITCH_RATE = \u89D2\u901F\u5EA6\uFF08\u30D4\u30C3\u30C1\uFF09 FlightDataType.TYPE_YAW_RATE = \u89D2\u901F\u5EA6\uFF08\u30E8\u30FC\uFF09 FlightDataType.TYPE_MASS = \u8CEA\u91CF -FlightDataType.TYPE_PROPELLANT_MASS = \u8EF8\u65B9\u5411\u6163\u6027\u30E2\u30FC\u30E1\u30F3\u30C8 +FlightDataType.TYPE_MOTOR_MASS = \u8EF8\u65B9\u5411\u6163\u6027\u30E2\u30FC\u30E1\u30F3\u30C8 FlightDataType.TYPE_LONGITUDINAL_INERTIA = \u9577\u624B\u65B9\u5411\u6163\u6027\u30E2\u30FC\u30E1\u30F3\u30C8 FlightDataType.TYPE_ROTATIONAL_INERTIA = \u30ED\u30FC\u30EB\u65B9\u5411\u6163\u6027\u30E2\u30FC\u30E1\u30F3\u30C8 FlightDataType.TYPE_CP_LOCATION = CP\u4F4D\u7F6E diff --git a/core/resources/l10n/messages_pt.properties b/core/resources/l10n/messages_pt.properties index 33b1c387a..fc1d3e0d4 100644 --- a/core/resources/l10n/messages_pt.properties +++ b/core/resources/l10n/messages_pt.properties @@ -294,7 +294,7 @@ FlightDataType.TYPE_POSITION_X = Posi\u00e7\u00e3o a favor do ve FlightDataType.TYPE_POSITION_XY = Dist\u00e2ncia lateral FlightDataType.TYPE_POSITION_Y = Posi\u00e7\u00e3o paralela ao vento FlightDataType.TYPE_PRESSURE_DRAG_COEFF = Coeficiente de arrasto de press\u00e3o -FlightDataType.TYPE_PROPELLANT_MASS = Massa do propelente +FlightDataType.TYPE_MOTOR_MASS = Massa do propelente FlightDataType.TYPE_REFERENCE_AREA = \u00c1rea de refer\u00eancia FlightDataType.TYPE_REFERENCE_LENGTH = Comprimento de refer\u00eancia FlightDataType.TYPE_REYNOLDS_NUMBER = N\u00famero de Reynolds diff --git a/core/resources/l10n/messages_ru.properties b/core/resources/l10n/messages_ru.properties index 9ae7b5970..a60b361d5 100644 --- a/core/resources/l10n/messages_ru.properties +++ b/core/resources/l10n/messages_ru.properties @@ -1477,7 +1477,7 @@ FlightDataType.TYPE_ROLL_RATE = \u0423\u0433\u043b\u043e\u0432\u0430\u044f \u044 FlightDataType.TYPE_PITCH_RATE = \u0423\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0442\u0430\u043d\u0433\u0430\u0436\u0430 FlightDataType.TYPE_YAW_RATE = \u0423\u0433\u043b\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u044b\u0441\u043a\u0430\u043d\u044c\u044f FlightDataType.TYPE_MASS = \u041c\u0430\u0441\u0441\u0430 -FlightDataType.TYPE_PROPELLANT_MASS = \u041c\u0430\u0441\u0441\u0430 \u0442\u043e\u043f\u043b\u0438\u0432\u0430 +FlightDataType.TYPE_MOTOR_MASS = \u041c\u0430\u0441\u0441\u0430 \u0442\u043e\u043f\u043b\u0438\u0432\u0430 FlightDataType.TYPE_LONGITUDINAL_INERTIA = \u041f\u0440\u043e\u0434\u043e\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u043d\u0435\u0440\u0446\u0438\u0438 FlightDataType.TYPE_ROTATIONAL_INERTIA = \u041a\u0440\u0443\u0442\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u043d\u0435\u0440\u0446\u0438\u0438 FlightDataType.TYPE_CP_LOCATION = \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0426\u0414 diff --git a/core/resources/l10n/messages_uk_UA.properties b/core/resources/l10n/messages_uk_UA.properties index 05fbebbc7..ed4b301c9 100644 --- a/core/resources/l10n/messages_uk_UA.properties +++ b/core/resources/l10n/messages_uk_UA.properties @@ -1483,7 +1483,7 @@ FlightDataType.TYPE_ROLL_RATE = Roll rate FlightDataType.TYPE_PITCH_RATE = Pitch rate FlightDataType.TYPE_YAW_RATE = Yaw rate FlightDataType.TYPE_MASS = Mass -FlightDataType.TYPE_PROPELLANT_MASS = Propellant mass +FlightDataType.TYPE_MOTOR_MASS = Motor mass FlightDataType.TYPE_LONGITUDINAL_INERTIA = Longitudinal moment of inertia FlightDataType.TYPE_ROTATIONAL_INERTIA = Rotational moment of inertia FlightDataType.TYPE_CP_LOCATION = CP location diff --git a/core/resources/l10n/messages_zh_CN.properties b/core/resources/l10n/messages_zh_CN.properties index d6fba3c2c..26b7181a4 100644 --- a/core/resources/l10n/messages_zh_CN.properties +++ b/core/resources/l10n/messages_zh_CN.properties @@ -330,7 +330,7 @@ FlightDataType.TYPE_POSITION_X = \u8FCE\u98CE\u4F4D\u7F6E FlightDataType.TYPE_POSITION_XY = \u6A2A\u5411\u8DE8\u8DDD FlightDataType.TYPE_POSITION_Y = \u5E73\u884C\u98CE\u4F4D\u7F6E FlightDataType.TYPE_PRESSURE_DRAG_COEFF = \u538B\u5DEE\u963B\u529B\u7CFB\u6570 -FlightDataType.TYPE_PROPELLANT_MASS = \u63A8\u8FDB\u5242\u8D28\u91CF +FlightDataType.TYPE_MOTOR_MASS = \u63A8\u8FDB\u5242\u8D28\u91CF FlightDataType.TYPE_REFERENCE_AREA = \u53C2\u8003\u9762\u79EF FlightDataType.TYPE_REFERENCE_LENGTH = \u53C2\u8003\u957F\u5EA6 FlightDataType.TYPE_REYNOLDS_NUMBER = \u96F7\u8BFA\u6570 diff --git a/core/src/net/sf/openrocket/masscalc/MassCalculation.java b/core/src/net/sf/openrocket/masscalc/MassCalculation.java index 0a318e350..1597c0b64 100644 --- a/core/src/net/sf/openrocket/masscalc/MassCalculation.java +++ b/core/src/net/sf/openrocket/masscalc/MassCalculation.java @@ -1,11 +1,13 @@ package net.sf.openrocket.masscalc; import java.util.ArrayList; +import java.util.Collection; import java.util.Map; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.MotorConfiguration; import net.sf.openrocket.rocketcomponent.*; +import net.sf.openrocket.simulation.MotorClusterState; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.Transformation; @@ -71,7 +73,7 @@ public class MassCalculation { } public MassCalculation copy( final RocketComponent _root, final Transformation _transform){ - return new MassCalculation( this.type, this.config, this.simulationTime, _root, _transform, this.analysisMap); + return new MassCalculation( this.type, this.config, this.simulationTime, this.activeMotorList, _root, _transform, this.analysisMap); } public Coordinate getCM() { @@ -108,12 +110,14 @@ public class MassCalculation { } public MassCalculation( final Type _type, final FlightConfiguration _config, final double _time, + final Collection _activeMotorList, final RocketComponent _root, final Transformation _transform, Map _map) { type = _type; config = _config; simulationTime = _time; + activeMotorList = _activeMotorList; root = _root; transform = _transform; analysisMap = _map; @@ -156,6 +160,7 @@ public class MassCalculation { // === package-private === final FlightConfiguration config; final double simulationTime; + final Collection activeMotorList; final RocketComponent root; final Transformation transform; final Type type; @@ -182,11 +187,24 @@ public class MassCalculation { final MotorMount mount = (MotorMount)root; MotorConfiguration motorConfig = mount.getMotorConfig( config.getId() ); - final Motor motor = motorConfig.getMotor(); if( motorConfig.isEmpty() ){ return this; } + final Motor motor = motorConfig.getMotor(); + // If we don't have any MotorClusterStates, + // we're using a synthetic time to do a static analysis. + // If we do have MotorClusterStates, we need to adjust + // time according to motor ignition time. + double motorTime = simulationTime; + if (activeMotorList != null) { + for (MotorClusterState currentMotorState : activeMotorList ) { + if (currentMotorState.getMotor() == motor) { + motorTime = currentMotorState.getMotorTime(simulationTime); + break; + } + } + } final double mountXPosition = root.getPosition().x; @@ -199,14 +217,14 @@ public class MassCalculation { double eachCMx; // CoM from beginning of motor if ( this.type.includesMotorCasing && this.type.includesPropellant ){ - eachMass = motor.getTotalMass( simulationTime ); - eachCMx = motor.getCMx( simulationTime); + eachMass = motor.getTotalMass( motorTime ); + eachCMx = motor.getCMx( motorTime); }else if( this.type.includesMotorCasing ) { eachMass = motor.getTotalMass( Motor.PSEUDO_TIME_BURNOUT ); eachCMx = motor.getCMx( Motor.PSEUDO_TIME_BURNOUT ); } else { - final double eachMotorMass = motor.getTotalMass( simulationTime ); - final double eachMotorCMx = motor.getCMx( simulationTime); // CoM from beginning of motor + final double eachMotorMass = motor.getTotalMass( motorTime ); + final double eachMotorCMx = motor.getCMx( motorTime ); // CoM from beginning of motor final double eachCasingMass = motor.getBurnoutMass(); final double eachCasingCMx = motor.getBurnoutCGx(); @@ -214,7 +232,7 @@ public class MassCalculation { eachCMx = (eachMotorCMx*eachMotorMass - eachCasingCMx*eachCasingMass)/eachMass; } -// System.err.println(String.format("%-40s|Motor: %s.... Mass @%f = %.6f", prefix, motorConfig.toDescription(), simulationTime, eachMass )); +// System.err.println(String.format("%-40s|Motor: %s.... Mass @%f = %.6f", prefix, motorConfig.toDescription(), motorTime, eachMass )); // coordinates in rocket frame; Ir, It about CoM. @@ -390,15 +408,15 @@ public class MassCalculation { // } if (component.isMotorMount()) { - MassCalculation propellant = this.copy(component, parentTransform); + MassCalculation motor = this.copy(component, parentTransform); - propellant.calculateMountData(); + motor.calculateMountData(); - this.merge( propellant ); + this.merge( motor ); // // vvv DEBUG -// if( 0 < propellant.getMass() ) { -// System.err.println(String.format( "%s........++ propellantData: %s", prefix, propellant.toCMDebug())); +// if( 0 < motor.getMass() ) { +// System.err.println(String.format( "%s........++ motorData: %s", prefix, propellant.toCMDebug())); // } } diff --git a/core/src/net/sf/openrocket/masscalc/MassCalculator.java b/core/src/net/sf/openrocket/masscalc/MassCalculator.java index 6036f853a..820de4967 100644 --- a/core/src/net/sf/openrocket/masscalc/MassCalculator.java +++ b/core/src/net/sf/openrocket/masscalc/MassCalculator.java @@ -1,11 +1,13 @@ package net.sf.openrocket.masscalc; +import java.util.Collection; import java.util.HashMap; import java.util.Map; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.simulation.MotorClusterState; import net.sf.openrocket.simulation.SimulationStatus; import net.sf.openrocket.util.*; @@ -19,7 +21,7 @@ public class MassCalculator implements Monitorable { */ // private HashMap< Integer, MassData> stageMassCache = new HashMap(); // private MassData rocketSpentMassCache; - // private MassData propellantMassCache; + // private MassData motorMassCache; private int modId = 0; @@ -97,20 +99,23 @@ public class MassCalculator implements Monitorable { ////////////////// Mass property Wrappers /////////////////// // all mass calculation calls should probably call through one of these two wrappers. - // convenience wrapper -- use this to implicitly create a plain MassCalculation object with common parameters + // convenience wrapper -- use this to implicitly create a plain MassCalculation object with common parameters, + // for calculations in the course of a simulation public static RigidBody calculate( final MassCalculation.Type _type, final SimulationStatus status ){ final FlightConfiguration config = status.getConfiguration(); final double time = status.getSimulationTime(); - MassCalculation calculation= new MassCalculation( _type, config, time, config.getRocket(), Transformation.IDENTITY, null); + final Collection activeMotorList = status.getMotors(); + MassCalculation calculation= new MassCalculation( _type, config, time, activeMotorList, config.getRocket(), Transformation.IDENTITY, null); calculation.calculateAssembly(); RigidBody result = calculation.calculateMomentOfInertia(); return result; } - // convenience wrapper -- use this to implicitly create a plain MassCalculation object with common parameters + // convenience wrapper -- use this to implicitly create a plain MassCalculation object with common parameters, + // for static mass calculations public static RigidBody calculate( final MassCalculation.Type _type, final FlightConfiguration _config, double _time){ - MassCalculation calculation = new MassCalculation( _type, _config, _time, _config.getRocket(), Transformation.IDENTITY, null); + MassCalculation calculation = new MassCalculation( _type, _config, _time, null, _config.getRocket(), Transformation.IDENTITY, null); calculation.calculateAssembly(); return calculation.calculateMomentOfInertia(); } @@ -141,6 +146,7 @@ public class MassCalculator implements Monitorable { MassCalculation.Type.LAUNCH, config, Motor.PSEUDO_TIME_LAUNCH, + null, config.getRocket(), Transformation.IDENTITY, analysisMap); diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 2cd14e701..3848d88de 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -204,7 +204,7 @@ public class FlightConfiguration implements FlightConfigurableParameter { //// Stability information //// Mass public static final FlightDataType TYPE_MASS = newType(trans.get("FlightDataType.TYPE_MASS"), "m", UnitGroup.UNITS_MASS, 50); - //// Propellant mass - public static final FlightDataType TYPE_PROPELLANT_MASS = newType(trans.get("FlightDataType.TYPE_PROPELLANT_MASS"), "mp", UnitGroup.UNITS_MASS, 51); + //// Motor mass + public static final FlightDataType TYPE_MOTOR_MASS = newType(trans.get("FlightDataType.TYPE_MOTOR_MASS"), "mp", UnitGroup.UNITS_MASS, 51); //// Longitudinal moment of inertia public static final FlightDataType TYPE_LONGITUDINAL_INERTIA = newType(trans.get("FlightDataType.TYPE_LONGITUDINAL_INERTIA"), "Il", UnitGroup.UNITS_INERTIA, 52); //// Rotational moment of inertia @@ -209,7 +209,7 @@ public class FlightDataType implements Comparable { TYPE_PITCH_RATE, TYPE_YAW_RATE, TYPE_MASS, - TYPE_PROPELLANT_MASS, + TYPE_MOTOR_MASS, TYPE_LONGITUDINAL_INERTIA, TYPE_ROTATIONAL_INERTIA, TYPE_CP_LOCATION, diff --git a/core/src/net/sf/openrocket/simulation/GroundStepper.java b/core/src/net/sf/openrocket/simulation/GroundStepper.java index 55355b324..27c50014f 100644 --- a/core/src/net/sf/openrocket/simulation/GroundStepper.java +++ b/core/src/net/sf/openrocket/simulation/GroundStepper.java @@ -62,7 +62,7 @@ public class GroundStepper extends AbstractSimulationStepper { data.setValue(FlightDataType.TYPE_MACH_NUMBER, 0.0); data.setValue(FlightDataType.TYPE_MASS, calculateStructureMass(status).getMass()); - data.setValue(FlightDataType.TYPE_PROPELLANT_MASS, 0.0); // Is this a reasonable assumption? Probably. + data.setValue(FlightDataType.TYPE_MOTOR_MASS, 0.0); // Is this a reasonable assumption? Probably. data.setValue(FlightDataType.TYPE_THRUST_FORCE, 0.0); data.setValue(FlightDataType.TYPE_DRAG_FORCE, 0.0); diff --git a/core/src/net/sf/openrocket/simulation/MotorClusterState.java b/core/src/net/sf/openrocket/simulation/MotorClusterState.java index ecf48f94d..43c73f9c3 100644 --- a/core/src/net/sf/openrocket/simulation/MotorClusterState.java +++ b/core/src/net/sf/openrocket/simulation/MotorClusterState.java @@ -115,7 +115,7 @@ public class MotorClusterState { } public double getMotorTime( final double _simulationTime ){ - return _simulationTime - this.getIgnitionTime(); + return Math.max(_simulationTime - this.getIgnitionTime(), 0.0); } /** diff --git a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java index 7625e113a..77a061662 100644 --- a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java +++ b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java @@ -613,9 +613,9 @@ public class RK4SimulationStepper extends AbstractSimulationStepper { } if( null != store.motorMass ){ - data.setValue(FlightDataType.TYPE_PROPELLANT_MASS, store.motorMass.getMass()); - //data.setValue(FlightDataType.TYPE_PROPELLANT_LONGITUDINAL_INERTIA, store.propellantMassData.getLongitudinalInertia()); - //data.setValue(FlightDataType.TYPE_PROPELLANT_ROTATIONAL_INERTIA, store.propellantMassData.getRotationalInertia()); + data.setValue(FlightDataType.TYPE_MOTOR_MASS, store.motorMass.getMass()); + //data.setValue(FlightDataType.TYPE_MOTOR_LONGITUDINAL_INERTIA, store.motorMassData.getLongitudinalInertia()); + //data.setValue(FlightDataType.TYPE_MOTOR_ROTATIONAL_INERTIA, store.motorMassData.getRotationalInertia()); } if (store.rocketMass != null) { // N.B.: These refer to total mass diff --git a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java index cb8bc78c8..0665766e6 100644 --- a/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java +++ b/core/src/net/sf/openrocket/simulation/listeners/example/DampingMoment.java @@ -41,7 +41,7 @@ public class DampingMoment extends AbstractSimulationListener { // dm/dt = (thrust - ma)/v FlightDataBranch data = status.getFlightData(); - List mpAll = data.get(FlightDataType.TYPE_PROPELLANT_MASS); + List mpAll = data.get(FlightDataType.TYPE_MOTOR_MASS); List time = data.get(FlightDataType.TYPE_TIME); if (mpAll == null || time == null) { return Double.NaN; diff --git a/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java b/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java index 078f7d963..f12d6e94a 100644 --- a/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java +++ b/core/test/net/sf/openrocket/masscalc/MassCalculatorTest.java @@ -2,6 +2,8 @@ package net.sf.openrocket.masscalc; import static org.junit.Assert.assertEquals; +import java.util.List; + import net.sf.openrocket.rocketcomponent.*; import net.sf.openrocket.rocketcomponent.position.AngleMethod; import net.sf.openrocket.rocketcomponent.position.AxialMethod; @@ -9,6 +11,7 @@ import net.sf.openrocket.rocketcomponent.position.RadiusMethod; import org.junit.Test; import net.sf.openrocket.motor.Motor; +import net.sf.openrocket.simulation.MotorClusterState; import net.sf.openrocket.simulation.SimulationConditions; import net.sf.openrocket.simulation.SimulationStatus; import net.sf.openrocket.util.Coordinate; @@ -135,26 +138,31 @@ public class MassCalculatorTest extends BaseTestCase { // this is probably not enough for a full-up simulation, but it IS enough for a motor-mass calculation. SimulationStatus status = new SimulationStatus(config, new SimulationConditions()); - + + // Ignite motor at 1.0 seconds + MotorClusterState currentMotorState = ((List) status.getMotors()).get(0); + final double ignitionTime = 1.0; + currentMotorState.ignite(ignitionTime); + { - final double simTime = 0.03; // almost launch + final double simTime = 1.03; // almost launch status.setSimulationTime(simTime); RigidBody actualMotorData = MassCalculator.calculateMotor(status); - double expMass = activeMotor.getTotalMass(simTime); + double expMass = activeMotor.getTotalMass(simTime - ignitionTime); assertEquals(" Motor Mass " + desig + " is incorrect: ", expMass, actualMotorData.getMass(), EPSILON); } { - final double simTime = 1.03; // middle + final double simTime = 2.03; // middle status.setSimulationTime(simTime); RigidBody actualMotorData = MassCalculator.calculateMotor(status); - double expMass = activeMotor.getTotalMass(simTime); + double expMass = activeMotor.getTotalMass(simTime - ignitionTime); assertEquals(" Motor Mass " + desig + " is incorrect: ", expMass, actualMotorData.getMass(), EPSILON); } { - final double simTime = 2.03; // after burnout + final double simTime = 3.03; // after burnout status.setSimulationTime(simTime); RigidBody actualMotorData = MassCalculator.calculateMotor(status); - double expMass = activeMotor.getTotalMass(simTime); + double expMass = activeMotor.getTotalMass(simTime - ignitionTime); assertEquals(" Motor Mass " + desig + " is incorrect: ", expMass, actualMotorData.getMass(), EPSILON); } } diff --git a/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java b/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java index ae7002db3..1c55e2003 100644 --- a/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java +++ b/core/test/net/sf/openrocket/rocketcomponent/FlightConfigurationTest.java @@ -350,6 +350,7 @@ public class FlightConfigurationTest extends BaseTestCase { FlightConfiguration selected = rocket.getSelectedConfiguration(); selected.clearAllStages(); + selected.toggleStage(1); selected.toggleStage(2); // vvvv Test Target vvvv diff --git a/swing/src/net/sf/openrocket/gui/print/DesignReport.java b/swing/src/net/sf/openrocket/gui/print/DesignReport.java index 84f9a854f..626b7a227 100644 --- a/swing/src/net/sf/openrocket/gui/print/DesignReport.java +++ b/swing/src/net/sf/openrocket/gui/print/DesignReport.java @@ -145,7 +145,7 @@ public class DesignReport { private static final String MAX_THRUST = "Max Thrust"; private static final String TOTAL_IMPULSE = "Total Impulse"; private static final String THRUST_TO_WT = "Thrust to Wt"; - private static final String PROPELLANT_WT = "Propellant Wt"; + private static final String MOTOR_WT = "Motor Wt"; private static final String SIZE = "Size"; private static final String ALTITUDE = "Altitude"; private static final String FLIGHT_TIME = "Flight Time"; @@ -377,7 +377,7 @@ public class DesignReport { motorTable.addCell(ITextHelper.createCell(MAX_THRUST, PdfPCell.BOTTOM, PrintUtilities.SMALL)); motorTable.addCell(ITextHelper.createCell(TOTAL_IMPULSE, PdfPCell.BOTTOM, PrintUtilities.SMALL)); motorTable.addCell(ITextHelper.createCell(THRUST_TO_WT, PdfPCell.BOTTOM, PrintUtilities.SMALL)); - motorTable.addCell(ITextHelper.createCell(PROPELLANT_WT, PdfPCell.BOTTOM, PrintUtilities.SMALL)); + motorTable.addCell(ITextHelper.createCell(MOTOR_WT, PdfPCell.BOTTOM, PrintUtilities.SMALL)); motorTable.addCell(ITextHelper.createCell(SIZE, PdfPCell.BOTTOM, PrintUtilities.SMALL)); DecimalFormat ttwFormat = new DecimalFormat("0.00");