Add 0-second delay suffic to RASAero motor export

This commit is contained in:
SiboVG 2023-04-01 09:51:04 +02:00
parent a7c63260c5
commit 7cad04653d
2 changed files with 12 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package net.sf.openrocket.file.rasaero;
import net.sf.openrocket.logging.WarningSet;
import net.sf.openrocket.motor.Manufacturer;
import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.MotorConfiguration;
import net.sf.openrocket.motor.ThrustCurveMotor;
import net.sf.openrocket.rocketcomponent.DeploymentConfiguration;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
@ -378,9 +379,11 @@ public class RASAeroCommonConstants {
* Format an OpenRocket motor as a RASAero motor.
* @param motors list of available RASAero motors
* @param ORMotor OpenRocket motor
* @param motorConfig motor configuration of the selected motor
* @return a RASAero String representation of a motor
*/
public static String OPENROCKET_TO_RASAERO_MOTOR(List<ThrustCurveMotor> motors, Motor ORMotor, WarningSet warnings) {
public static String OPENROCKET_TO_RASAERO_MOTOR(List<ThrustCurveMotor> motors, Motor ORMotor, MotorConfiguration motorConfig,
WarningSet warnings) {
if (!(ORMotor instanceof ThrustCurveMotor)) {
return null;
}
@ -388,8 +391,11 @@ public class RASAeroCommonConstants {
for (ThrustCurveMotor motor : motors) {
if (ORMotor.getDesignation().equals(motor.getDesignation()) &&
((ThrustCurveMotor) ORMotor).getManufacturer().matches(motor.getManufacturer().getDisplayName())) {
return motor.getDesignation() +
" (" + OPENROCKET_TO_RASAERO_MANUFACTURER(motor.getManufacturer()) + ")";
String motorName = motor.getDesignation();
if (motorConfig.getEjectionDelay() == 0) {
motorName += "-0";
}
return motorName + " (" + OPENROCKET_TO_RASAERO_MANUFACTURER(motor.getManufacturer()) + ")";
}
}

View File

@ -139,7 +139,7 @@ public class SimulationDTO {
switch (stageNr) {
// Sustainer
case 0:
setSustainerEngine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), warnings));
setSustainerEngine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), motorConfig, warnings));
setSustainerLaunchWt(stage.getSectionMass() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_WEIGHT);
// Calculate CG of sustainer
@ -151,7 +151,7 @@ public class SimulationDTO {
break;
// Booster 1
case 1:
setBooster1Engine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), warnings));
setBooster1Engine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), motorConfig, warnings));
// Aggregate mass of sustainer and booster 1
setBooster1LaunchWt(rocket.getChild(0).getSectionMass() + stage.getSectionMass()
@ -171,7 +171,7 @@ public class SimulationDTO {
break;
// Booster 2
case 2:
setBooster2Engine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), warnings));
setBooster2Engine(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_MOTOR(motors, motorConfig.getMotor(), motorConfig, warnings));
// Aggregate mass of sustainer, booster 1 and booster 2
setBooster2LaunchWt(rocket.getChild(0).getSectionMass() + rocket.getChild(1).getSectionMass() +