[fix] Adds 4-fin splits to unittests
This commit is contained in:
parent
b8172305f8
commit
b24184afc7
@ -180,9 +180,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final InstanceMap imap = configuration.getActiveInstances();
|
final InstanceMap imap = configuration.getActiveInstances();
|
||||||
|
|
||||||
final AerodynamicForces assemblyForces= new AerodynamicForces().zero();
|
final AerodynamicForces assemblyForces= new AerodynamicForces().zero();
|
||||||
|
|
||||||
|
// System.err.println("======================================");
|
||||||
|
// System.err.println("==== Iterating through components ====");
|
||||||
// iterate through all components
|
// iterate through all components
|
||||||
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
||||||
final RocketComponent comp = entry.getKey();
|
final RocketComponent comp = entry.getKey();
|
||||||
@ -192,8 +194,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
if (null != calcObj) {
|
if (null != calcObj) {
|
||||||
// iterate across component instances
|
// iterate across component instances
|
||||||
final ArrayList<InstanceContext> contextList = entry.getValue();
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
|
|
||||||
for(InstanceContext context: contextList ) {
|
for(InstanceContext context: contextList ) {
|
||||||
AerodynamicForces instanceForces = new AerodynamicForces().zero();
|
AerodynamicForces instanceForces = new AerodynamicForces().zero();
|
||||||
|
// System.err.println(String.format("@ [%s]:[%d/%d]", comp.getName(), context.instanceNumber + 1, comp.getInstanceCount()));
|
||||||
|
// System.err.println("_________ inst/ctxt: xrotation: " + context.transform.getXrotation());
|
||||||
|
|
||||||
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
||||||
|
|
||||||
@ -202,14 +207,21 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
if ((comp instanceof FinSet) && (((FinSet)comp).getFinCount() > 2))
|
if ((comp instanceof FinSet) && (((FinSet)comp).getFinCount() > 2))
|
||||||
cp_abs = cp_abs.setY(0.0).setZ(0.0);
|
cp_abs = cp_abs.setY(0.0).setZ(0.0);
|
||||||
|
|
||||||
|
// if( 1e-6 < cp_inst.weight) {
|
||||||
|
// System.err.println("_________ cp:inst: (rel): " + cp_inst.toString());
|
||||||
|
// System.err.println("_________ cp:inst: (abs): " + cp_abs.toString());
|
||||||
|
// }
|
||||||
|
|
||||||
instanceForces.setCP(cp_abs);
|
instanceForces.setCP(cp_abs);
|
||||||
double CN_instanced = instanceForces.getCN();
|
double CN_instanced = instanceForces.getCN();
|
||||||
instanceForces.setCm(CN_instanced * instanceForces.getCP().x / conditions.getRefLength());
|
instanceForces.setCm(CN_instanced * instanceForces.getCP().x / conditions.getRefLength());
|
||||||
assemblyForces.merge(instanceForces);
|
assemblyForces.merge(instanceForces);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// System.err.println("____ cp:asbly: " + assemblyForces.getCP().toString());
|
||||||
return assemblyForces;
|
return assemblyForces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
private final double thickness;
|
private final double thickness;
|
||||||
private final double bodyRadius;
|
private final double bodyRadius;
|
||||||
private final int finCount;
|
private final int finCount;
|
||||||
private final double baseRotation;
|
|
||||||
private final double cantAngle;
|
private final double cantAngle;
|
||||||
private final FinSet.CrossSection crossSection;
|
private final FinSet.CrossSection crossSection;
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
bodyRadius = fin.getBodyRadius();
|
bodyRadius = fin.getBodyRadius();
|
||||||
finCount = fin.getFinCount();
|
finCount = fin.getFinCount();
|
||||||
|
|
||||||
baseRotation = fin.getBaseRotation();
|
|
||||||
cantAngle = fin.getCantAngle();
|
cantAngle = fin.getCantAngle();
|
||||||
span = fin.getSpan();
|
span = fin.getSpan();
|
||||||
finArea = fin.getPlanformArea();
|
finArea = fin.getPlanformArea();
|
||||||
@ -114,10 +112,12 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
// Multiple fins with fin-fin interference
|
// Multiple fins with fin-fin interference
|
||||||
double cna;
|
double cna;
|
||||||
double theta = conditions.getTheta();
|
double theta = conditions.getTheta();
|
||||||
double angle = baseRotation + transform.getXrotation();
|
double angle = transform.getXrotation();
|
||||||
|
|
||||||
// Compute basic CNa without interference effects
|
// Compute basic CNa without interference effects
|
||||||
cna = cna1 * MathUtil.pow2(Math.sin(theta - angle));
|
cna = cna1 * MathUtil.pow2(Math.sin(theta - angle));
|
||||||
|
// final double cna_x = cna1 * MathUtil.pow2(Math.sin(theta - angle));
|
||||||
|
// final double cna_y = cna1 * MathUtil.pow2(Math.sin(theta - angle));
|
||||||
|
|
||||||
// logger.debug("Component cna = {}", cna);
|
// logger.debug("Component cna = {}", cna);
|
||||||
|
|
||||||
@ -166,7 +166,6 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
// (Barrowman thesis pdf-page 40)
|
// (Barrowman thesis pdf-page 40)
|
||||||
|
|
||||||
// TODO: LOW: fin-fin mach cone effect, MIL-HDBK page 5-25
|
// TODO: LOW: fin-fin mach cone effect, MIL-HDBK page 5-25
|
||||||
|
|
||||||
// Calculate CP position
|
// Calculate CP position
|
||||||
double x = macLead + calculateCPPos(conditions) * macLength;
|
double x = macLead + calculateCPPos(conditions) * macLength;
|
||||||
// logger.debug("Component macLead = {}", macLead);
|
// logger.debug("Component macLead = {}", macLead);
|
||||||
|
@ -1036,12 +1036,6 @@ public class TestRockets {
|
|||||||
boosterFins.setSweep(0.18);
|
boosterFins.setSweep(0.18);
|
||||||
boosterFins.setAxialMethod(AxialMethod.BOTTOM);
|
boosterFins.setAxialMethod(AxialMethod.BOTTOM);
|
||||||
boosterFins.setAxialOffset(0.0);
|
boosterFins.setAxialOffset(0.0);
|
||||||
// cp:(1.17873,0.10422,0.02722,w=6.07405) (1 fin case)
|
|
||||||
// cp:(1.17873,-0.10422,-0.02722,w=6.07405) (1 fin case)
|
|
||||||
// cp:(1.17873,0.10422,0.02722,w=12.14810) (2 fin case)
|
|
||||||
// cp:(1.17873,-0.10422,-0.02722,w=12.14810) (2 fin case)
|
|
||||||
// cp:(1.17873,0.00000,0.00000,w=9.11107) (3 fin case)
|
|
||||||
// cp:(1.17873,0.00000,0.00000,w=9.11107) (3 fin case)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,22 +130,51 @@ public class BarrowmanCalculatorTest {
|
|||||||
}{
|
}{
|
||||||
boosterFins.setFinCount(2);
|
boosterFins.setFinCount(2);
|
||||||
final Coordinate cp_2fin = calc.getCP(config, conditions, warnings);
|
final Coordinate cp_2fin = calc.getCP(config, conditions, warnings);
|
||||||
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 27.585207667168696, cp_2fin.weight, EPSILON);
|
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 15.43711196967902, cp_2fin.weight, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 1.0757127676940474, cp_2fin.x, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.9946423753010524, cp_2fin.x, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0.0, cp_2fin.y, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0.0, cp_2fin.y, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0.0, cp_2fin.z, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0.0, cp_2fin.z, EPSILON);
|
||||||
}{
|
}{
|
||||||
boosterFins.setFinCount(1);
|
boosterFins.setFinCount(1);
|
||||||
final Coordinate cp_1fin = calc.getCP(config, conditions, warnings);
|
final Coordinate cp_1fin = calc.getCP(config, conditions, warnings);
|
||||||
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 15.43711196967902, cp_1fin.weight, EPSILON);
|
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 9.36306412, cp_1fin.weight, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.99464, cp_1fin.x, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP x value is incorrect:", 0.87521867, cp_1fin.x, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0f, cp_1fin.y, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP y value is incorrect:", 0f, cp_1fin.y, EPSILON);
|
||||||
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0f, cp_1fin.z, EPSILON);
|
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0f, cp_1fin.z, EPSILON);
|
||||||
}{
|
|
||||||
// absent -- 3.28901627g @[0.31469937,0.05133333,0.00000000]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFinCountEffect() {
|
||||||
|
final BarrowmanCalculator calc = new BarrowmanCalculator();
|
||||||
|
final WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
|
final Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
|
final FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
|
final FlightConditions conditions = new FlightConditions(config);
|
||||||
|
{
|
||||||
|
((FinSet)rocket.getChild(0).getChild(1).getChild(0)).setFinCount(4);
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 34.19591165, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22724216, wholeRocketCP.x, EPSILON);
|
||||||
|
}{
|
||||||
|
((FinSet)rocket.getChild(0).getChild(1).getChild(0)).setFinCount(3);
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 26.14693374, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22351541, wholeRocketCP.x, EPSILON);
|
||||||
|
}{
|
||||||
|
((FinSet)rocket.getChild(0).getChild(1).getChild(0)).setFinCount(2);
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 2.0, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.032356, wholeRocketCP.x, EPSILON);
|
||||||
|
}{
|
||||||
|
((FinSet)rocket.getChild(0).getChild(1).getChild(0)).setFinCount(1);
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 2.0, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.032356, wholeRocketCP.x, EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCpSplitTripleFin() {
|
public void testCpSplitTripleFin() {
|
||||||
final BarrowmanCalculator calc = new BarrowmanCalculator();
|
final BarrowmanCalculator calc = new BarrowmanCalculator();
|
||||||
@ -164,13 +193,37 @@ public class BarrowmanCalculatorTest {
|
|||||||
final FinSet fins = (FinSet)body.getChild(0);
|
final FinSet fins = (FinSet)body.getChild(0);
|
||||||
fins.setAngleOffset(0);
|
fins.setAngleOffset(0);
|
||||||
TestRockets.splitRocketFins(body, fins, 3);
|
TestRockets.splitRocketFins(body, fins, 3);
|
||||||
|
|
||||||
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
assertEquals("Split-Fin Rocket CNa value is incorrect:", 26.14693374, wholeRocketCP.weight, EPSILON);
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 26.14693374, wholeRocketCP.weight, EPSILON);
|
||||||
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22351541, wholeRocketCP.x, EPSILON);
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22351541, wholeRocketCP.x, EPSILON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCpSplitQuadrupleFin() {
|
||||||
|
final BarrowmanCalculator calc = new BarrowmanCalculator();
|
||||||
|
final WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
|
final Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
|
final FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
|
final FlightConditions conditions = new FlightConditions(config);
|
||||||
|
|
||||||
|
{
|
||||||
|
((FinSet)rocket.getChild(0).getChild(1).getChild(0)).setFinCount(4);
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 34.19591165, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22724, wholeRocketCP.x, EPSILON);
|
||||||
|
}{
|
||||||
|
final BodyTube body = (BodyTube)rocket.getChild(0).getChild(1);
|
||||||
|
final FinSet fins = (FinSet)body.getChild(0);
|
||||||
|
TestRockets.splitRocketFins(body, fins, 4);
|
||||||
|
|
||||||
|
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);
|
||||||
|
assertEquals("Split-Fin Rocket CNa value is incorrect:", 34.19591165, wholeRocketCP.weight, EPSILON);
|
||||||
|
assertEquals("Split-Fin Rocket CP x value is incorrect:", 0.22724, wholeRocketCP.x, EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
// test rocket with endplates on fins. Comments tracing
|
// test rocket with endplates on fins. Comments tracing
|
||||||
// calculation of CP are in TestRockets.makeEndPlateRocket().
|
// calculation of CP are in TestRockets.makeEndPlateRocket().
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user