Merge pull request #2284 from SiboVG/issue-2282

[#2282] Update shoulder diameter when transition diameter changes
This commit is contained in:
Sibo Van Gool 2023-08-08 02:05:58 +02:00 committed by GitHub
commit e0c6812087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 25 deletions

View File

@ -118,6 +118,8 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
clearPreset(); clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
setForeShoulderRadius(getForeShoulderRadius());
} }
public void setForeRadius(double radius) { public void setForeRadius(double radius) {
@ -207,6 +209,8 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
clearPreset(); clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
setAftShoulderRadius(getAftShoulderRadius());
} }
public void setAftRadius(double radius) { public void setAftRadius(double radius) {
@ -398,6 +402,7 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
((Transition) listener).setForeShoulderRadius(foreShoulderRadius); ((Transition) listener).setForeShoulderRadius(foreShoulderRadius);
} }
} }
foreShoulderRadius = Math.min(foreShoulderRadius, getForeRadius());
if (MathUtil.equals(this.foreShoulderRadius, foreShoulderRadius)) if (MathUtil.equals(this.foreShoulderRadius, foreShoulderRadius))
return; return;
@ -471,6 +476,8 @@ public class Transition extends SymmetricComponent implements InsideColorCompone
} }
} }
aftShoulderRadius = Math.min(aftShoulderRadius, getAftRadius());
if (MathUtil.equals(this.aftShoulderRadius, aftShoulderRadius)) if (MathUtil.equals(this.aftShoulderRadius, aftShoulderRadius))
return; return;
this.aftShoulderRadius = aftShoulderRadius; this.aftShoulderRadius = aftShoulderRadius;

View File

@ -1049,7 +1049,7 @@ public class TestRockets {
boosterCone.setThickness(0.002); boosterCone.setThickness(0.002);
//payloadFairingNoseCone.setLength(0.118); //payloadFairingNoseCone.setLength(0.118);
//payloadFairingNoseCone.setAftRadius(0.052); //payloadFairingNoseCone.setAftRadius(0.052);
boosterCone.setAftShoulderRadius( 0.051 ); boosterCone.setAftShoulderRadius( 0.0375 );
boosterCone.setAftShoulderLength( 0.02 ); boosterCone.setAftShoulderLength( 0.02 );
boosterCone.setAftShoulderThickness( 0.001 ); boosterCone.setAftShoulderThickness( 0.001 );
boosterCone.setAftShoulderCapped( false ); boosterCone.setAftShoulderCapped( false );

View File

@ -498,7 +498,7 @@ public class MassCalculatorTest extends BaseTestCase {
// ====== ====== ====== // ====== ====== ======
ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0); ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0);
{ {
expMass = 0.0222459863653; expMass = 0.0210923935430;
// think of the casts as an assert that ( child instanceof NoseCone) == true // think of the casts as an assert that ( child instanceof NoseCone) == true
NoseCone nose = (NoseCone) boosters.getChild(0); NoseCone nose = (NoseCone) boosters.getChild(0);
compMass = nose.getComponentMass(); compMass = nose.getComponentMass();
@ -582,7 +582,7 @@ public class MassCalculatorTest extends BaseTestCase {
// ====== ====== ====== // ====== ====== ======
ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0); ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0);
{ {
expCMx = 0.055710581052; expCMx = 0.053835211739;
// think of the casts as an assert that ( child instanceof NoseCone) == true // think of the casts as an assert that ( child instanceof NoseCone) == true
NoseCone nose = (NoseCone) boosters.getChild(0); NoseCone nose = (NoseCone) boosters.getChild(0);
actCMx = nose.getComponentCG().x; actCMx = nose.getComponentCG().x;
@ -692,10 +692,10 @@ public class MassCalculatorTest extends BaseTestCase {
ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0); ParallelStage boosters = (ParallelStage) coreStage.getChild(0).getChild(0);
{ {
final NoseCone boosterNose = (NoseCone) boosters.getChild(0); final NoseCone boosterNose = (NoseCone) boosters.getChild(0);
expInertia = 1.82665797857e-5; expInertia = 1.73189409900e-5;
compInertia = boosterNose.getRotationalInertia(); compInertia = boosterNose.getRotationalInertia();
assertEquals(boosterNose.getName() + " Rotational MOI calculated incorrectly: ", expInertia, compInertia, EPSILON); assertEquals(boosterNose.getName() + " Rotational MOI calculated incorrectly: ", expInertia, compInertia, EPSILON);
expInertia = 1.96501191666e-7; expInertia = 4.51796586171e-6;
compInertia = boosterNose.getLongitudinalInertia(); compInertia = boosterNose.getLongitudinalInertia();
assertEquals(boosterNose.getName() + " Longitudinal MOI calculated incorrectly: ", expInertia, compInertia, EPSILON); assertEquals(boosterNose.getName() + " Longitudinal MOI calculated incorrectly: ", expInertia, compInertia, EPSILON);
@ -832,8 +832,8 @@ public class MassCalculatorTest extends BaseTestCase {
final RigidBody actualData = MassCalculator.calculateStructure(config); final RigidBody actualData = MassCalculator.calculateStructure(config);
final Coordinate actualCM = actualData.getCM(); final Coordinate actualCM = actualData.getCM();
double expMass = 0.608663395; double expMass = 0.6063562096;
double expCMx = 1.073157592; double expCMx = 1.075056887;
assertEquals("Heavy Booster Mass is incorrect: ", expMass, actualCM.weight, EPSILON); assertEquals("Heavy Booster Mass is incorrect: ", expMass, actualCM.weight, EPSILON);
assertEquals("Heavy Booster CM.x is incorrect: ", expCMx, actualCM.x, EPSILON); assertEquals("Heavy Booster CM.x is incorrect: ", expCMx, actualCM.x, EPSILON);
@ -852,11 +852,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody actualBoosterLaunchData = MassCalculator.calculateLaunch(config); RigidBody actualBoosterLaunchData = MassCalculator.calculateLaunch(config);
double actualMass = actualBoosterLaunchData.getMass(); double actualMass = actualBoosterLaunchData.getMass();
double expectedMass = 1.592663395; double expectedMass = 1.5903562096;
assertEquals(" Booster Launch Mass is incorrect: ", expectedMass, actualMass, EPSILON); assertEquals(" Booster Launch Mass is incorrect: ", expectedMass, actualMass, EPSILON);
final Coordinate actualCM = actualBoosterLaunchData.getCM(); final Coordinate actualCM = actualBoosterLaunchData.getCM();
double expectedCMx = 1.22216804; double expectedCMx = 1.22310836;
Coordinate expCM = new Coordinate(expectedCMx, 0, 0, expectedMass); Coordinate expCM = new Coordinate(expectedCMx, 0, 0, expectedMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, actualCM.x, EPSILON); assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, actualCM.x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, actualCM.y, EPSILON); assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, actualCM.y, EPSILON);
@ -876,8 +876,8 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody spentData = MassCalculator.calculateBurnout(config); RigidBody spentData = MassCalculator.calculateBurnout(config);
Coordinate spentCM = spentData.getCM(); Coordinate spentCM = spentData.getCM();
double expSpentMass = 1.12066339; double expSpentMass = 1.11835621;
double expSpentCMx = 1.18334714; double expSpentCMx = 1.18460423;
Coordinate expLaunchCM = new Coordinate(expSpentCMx, 0, 0, expSpentMass); Coordinate expLaunchCM = new Coordinate(expSpentCMx, 0, 0, expSpentMass);
assertEquals(" Booster Launch Mass is incorrect: ", expLaunchCM.weight, spentCM.weight, EPSILON); assertEquals(" Booster Launch Mass is incorrect: ", expLaunchCM.weight, spentCM.weight, EPSILON);
assertEquals(" Booster Launch CM.x is incorrect: ", expLaunchCM.x, spentCM.x, EPSILON); assertEquals(" Booster Launch CM.x is incorrect: ", expLaunchCM.x, spentCM.x, EPSILON);
@ -942,11 +942,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody spent = MassCalculator.calculateBurnout(config); RigidBody spent = MassCalculator.calculateBurnout(config);
double expMOIRotational = 0.009205665421431532; double expMOIRotational = 0.00919009169;
double boosterMOIRotational = spent.getRotationalInertia(); double boosterMOIRotational = spent.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOIRotational, boosterMOIRotational, EPSILON); assertEquals(" Booster x-axis MOI is incorrect: ", expMOIRotational, boosterMOIRotational, EPSILON);
double expMOI_tr = 0.0582250994240395; double expMOI_tr = 0.0573781722;
double boosterMOI_tr = spent.getLongitudinalInertia(); double boosterMOI_tr = spent.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON); assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
} }
@ -962,9 +962,9 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody launchData = MassCalculator.calculateLaunch(config); RigidBody launchData = MassCalculator.calculateLaunch(config);
final double expIxx = 0.01226617242143153; final double expIxx = 0.0122505987;
final double actIxx = launchData.getRotationalInertia(); final double actIxx = launchData.getRotationalInertia();
final double expIyy = 0.06455356411879717; final double expIyy = 0.0635943662;
final double actIyy = launchData.getLongitudinalInertia(); final double actIyy = launchData.getLongitudinalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expIxx, actIxx, EPSILON); assertEquals(" Booster x-axis MOI is incorrect: ", expIxx, actIxx, EPSILON);
@ -1006,11 +1006,11 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(" Booster Launch CM is incorrect: ", expCM, boosterSetCM); assertEquals(" Booster Launch CM is incorrect: ", expCM, boosterSetCM);
// Validate MOI // Validate MOI
double expMOI_axial = 0.005885793421431532; double expMOI_axial = 0.00587021969016;
double boosterMOI_xx = burnout.getRotationalInertia(); double boosterMOI_xx = burnout.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON); assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
double expMOI_tr = 17.86133586701; double expMOI_tr = 17.78076176335;
double boosterMOI_tr = burnout.getLongitudinalInertia(); double boosterMOI_tr = burnout.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON); assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
} }
@ -1052,7 +1052,7 @@ public class MassCalculatorTest extends BaseTestCase {
double expTotalMass = 3.3565872; double expTotalMass = 3.3565872;
assertEquals(" Booster Launch Mass is incorrect: ", expTotalMass, boosterData.getMass(), EPSILON); assertEquals(" Booster Launch Mass is incorrect: ", expTotalMass, boosterData.getMass(), EPSILON);
double expCMx = 0.2835089882645608; double expCMx = 0.2827156156318;
Coordinate expCM = new Coordinate(expCMx, 0, 0, expTotalMass); Coordinate expCM = new Coordinate(expCMx, 0, 0, expTotalMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, boosterCM.x, EPSILON); assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, boosterCM.x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, boosterCM.y, EPSILON); assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, boosterCM.y, EPSILON);
@ -1064,7 +1064,7 @@ public class MassCalculatorTest extends BaseTestCase {
double boosterMOI_xx = boosterData.getRotationalInertia(); double boosterMOI_xx = boosterData.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON); assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
double expMOI_tr = 0.34567788938578525; double expMOI_tr = 0.347611843243;
double boosterMOI_tr = boosterData.getLongitudinalInertia(); double boosterMOI_tr = boosterData.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON); assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
} }
@ -1095,11 +1095,11 @@ public class MassCalculatorTest extends BaseTestCase {
RigidBody structure = MassCalculator.calculateStructure(config); RigidBody structure = MassCalculator.calculateStructure(config);
final double expMass = 0.6086633952494; final double expMass = 0.6063562096046;
double calcTotalMass = structure.getMass(); double calcTotalMass = structure.getMass();
assertEquals(" Booster Launch Mass is incorrect: ", expMass, calcTotalMass, EPSILON); assertEquals(" Booster Launch Mass is incorrect: ", expMass, calcTotalMass, EPSILON);
final double expCMx = 0.5551303646438673; final double expCMx = 0.55670993586431;
Coordinate expCM = new Coordinate(expCMx, 0, 0, expMass); Coordinate expCM = new Coordinate(expCMx, 0, 0, expMass);
assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, structure.getCM().x, EPSILON); assertEquals(" Booster Launch CM.x is incorrect: ", expCM.x, structure.getCM().x, EPSILON);
assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, structure.getCM().y, EPSILON); assertEquals(" Booster Launch CM.y is incorrect: ", expCM.y, structure.getCM().y, EPSILON);
@ -1107,11 +1107,11 @@ public class MassCalculatorTest extends BaseTestCase {
assertEquals(" Booster Launch CM is incorrect: ", expCM, structure.getCM()); assertEquals(" Booster Launch CM is incorrect: ", expCM, structure.getCM());
// Validate MOI // Validate MOI
final double expMOI_axial = 0.005885793421; final double expMOI_axial = 0.005870219690;
double boosterMOI_xx = structure.getRotationalInertia(); double boosterMOI_xx = structure.getRotationalInertia();
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON); assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
final double expMOI_tr = 0.040989095911; final double expMOI_tr = 0.040598624476;
double boosterMOI_tr = structure.getLongitudinalInertia(); double boosterMOI_tr = structure.getLongitudinalInertia();
assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON); assertEquals(" Booster transverse MOI is incorrect: ", expMOI_tr, boosterMOI_tr, EPSILON);
} }

View File

@ -117,7 +117,7 @@ public class FlightEventsTest extends BaseTestCase {
new FlightEvent(FlightEvent.Type.IGNITION, 0.0, coreBody), new FlightEvent(FlightEvent.Type.IGNITION, 0.0, coreBody),
new FlightEvent(FlightEvent.Type.LIFTOFF, 0.1225, null), new FlightEvent(FlightEvent.Type.LIFTOFF, 0.1225, null),
new FlightEvent(FlightEvent.Type.LAUNCHROD, 0.125, null), new FlightEvent(FlightEvent.Type.LAUNCHROD, 0.125, null),
new FlightEvent(FlightEvent.Type.APOGEE, 1.86, rocket), new FlightEvent(FlightEvent.Type.APOGEE, 1.867, rocket),
new FlightEvent(FlightEvent.Type.BURNOUT, 2.0, boosterMotorTubes), new FlightEvent(FlightEvent.Type.BURNOUT, 2.0, boosterMotorTubes),
new FlightEvent(FlightEvent.Type.EJECTION_CHARGE, 2.0, boosterStage), new FlightEvent(FlightEvent.Type.EJECTION_CHARGE, 2.0, boosterStage),
new FlightEvent(FlightEvent.Type.STAGE_SEPARATION, 2.0, boosterStage), new FlightEvent(FlightEvent.Type.STAGE_SEPARATION, 2.0, boosterStage),
@ -147,7 +147,7 @@ public class FlightEventsTest extends BaseTestCase {
new FlightEvent(FlightEvent.Type.BURNOUT, 2.0, boosterMotorTubes), new FlightEvent(FlightEvent.Type.BURNOUT, 2.0, boosterMotorTubes),
new FlightEvent(FlightEvent.Type.EJECTION_CHARGE, 2.0, boosterStage), new FlightEvent(FlightEvent.Type.EJECTION_CHARGE, 2.0, boosterStage),
new FlightEvent(FlightEvent.Type.STAGE_SEPARATION, 2.0, boosterStage), new FlightEvent(FlightEvent.Type.STAGE_SEPARATION, 2.0, boosterStage),
new FlightEvent(FlightEvent.Type.TUMBLE, 3.551, null), new FlightEvent(FlightEvent.Type.TUMBLE, 3.428, null),
new FlightEvent(FlightEvent.Type.GROUND_HIT, 1200, null), new FlightEvent(FlightEvent.Type.GROUND_HIT, 1200, null),
new FlightEvent(FlightEvent.Type.SIMULATION_END, 1200, null) new FlightEvent(FlightEvent.Type.SIMULATION_END, 1200, null)
}; };