From 546e9b5ee8cf68cee306de77b190ec690bb34627 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 28 Mar 2023 23:09:34 +0200 Subject: [PATCH] Forgot conversions, doh! --- .../file/rasaero/RASAeroCommonConstants.java | 4 ++++ .../file/rasaero/export/SimulationDTO.java | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/src/net/sf/openrocket/file/rasaero/RASAeroCommonConstants.java b/core/src/net/sf/openrocket/file/rasaero/RASAeroCommonConstants.java index c33965e6d..4482c6f0c 100644 --- a/core/src/net/sf/openrocket/file/rasaero/RASAeroCommonConstants.java +++ b/core/src/net/sf/openrocket/file/rasaero/RASAeroCommonConstants.java @@ -200,6 +200,10 @@ public class RASAeroCommonConstants { * Angle conversion from OpenRocket units to RASAero units. RASAero is in degrees, OpenRocket in rad. */ public static final double OPENROCKET_TO_RASAERO_ANGLE = 180 / Math.PI; + /** + * Weight conversion from OpenRocket units to RASAero units. RASAero is in pounds (lb), OpenRocket in kilograms (kg). + */ + public static final double OPENROCKET_TO_RASAERO_WEIGHT = 2.20462262; /** * Temperature conversion from OpenRocket units to RASAero units. RASAero is in Fahrenheit, OpenRocket in Kelvin. */ diff --git a/core/src/net/sf/openrocket/file/rasaero/export/SimulationDTO.java b/core/src/net/sf/openrocket/file/rasaero/export/SimulationDTO.java index 30aeff7d5..6d2fdd4b3 100644 --- a/core/src/net/sf/openrocket/file/rasaero/export/SimulationDTO.java +++ b/core/src/net/sf/openrocket/file/rasaero/export/SimulationDTO.java @@ -140,12 +140,12 @@ public class SimulationDTO { // Sustainer case 0: setSustainerEngine(getRASAeroMotor(motors, motorConfig.getMotor(), warnings)); - setSustainerLaunchWt(stage.getSectionMass()); + setSustainerLaunchWt(stage.getSectionMass() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_WEIGHT); // Calculate CG of sustainer CGCalcConfig.setOnlyStage(0); double sustainerCG = MassCalculator.calculateStructure(CGCalcConfig).getCM().x; - setSustainerCG(sustainerCG); + setSustainerCG(sustainerCG * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setSustainerIgnitionDelay(motorConfig.getIgnitionDelay()); break; @@ -154,7 +154,8 @@ public class SimulationDTO { setBooster1Engine(getRASAeroMotor(motors, motorConfig.getMotor(), warnings)); // Aggregate mass of sustainer and booster 1 - setBooster1LaunchWt(rocket.getChild(0).getSectionMass() + stage.getSectionMass()); + setBooster1LaunchWt(rocket.getChild(0).getSectionMass() + stage.getSectionMass() + * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_WEIGHT); // Aggregate CG of sustainer and booster 1 CGCalcConfig.setOnlyStage(0); @@ -162,7 +163,7 @@ public class SimulationDTO { CGCalcConfig._setStageActive(i, true); } double totalCG = MassCalculator.calculateStructure(CGCalcConfig).getCM().x; - setBooster1CG(totalCG); + setBooster1CG(totalCG * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setBooster1IgnitionDelay(motorConfig.getIgnitionDelay()); setBooster1SeparationDelay(separationConfig.getSeparationDelay()); // TODO: this could be handled a bit better (look at separation delay, upper stage ignition event etc.) @@ -174,7 +175,7 @@ public class SimulationDTO { // Aggregate mass of sustainer, booster 1 and booster 2 setBooster2LaunchWt(rocket.getChild(0).getSectionMass() + rocket.getChild(1).getSectionMass() + - stage.getSectionMass()); + stage.getSectionMass() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_WEIGHT); // Calculate the aggregated CG of the sustainer, booster and booster 2 CGCalcConfig.setOnlyStage(0); @@ -182,7 +183,7 @@ public class SimulationDTO { CGCalcConfig._setStageActive(i, true); } totalCG = MassCalculator.calculateStructure(CGCalcConfig).getCM().x; - setBooster2CG(totalCG); + setBooster2CG(totalCG * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setBooster2Delay(separationConfig.getSeparationDelay()); // TODO: this could be handled a bit better (look at separation delay, upper stage ignition event etc.) setIncludeBooster2(mount.isMotorMount());