[fixes #387] Increases accuracy of Center-Of-Pressure calculations on instanced assemblies
This commit is contained in:
parent
055132aa99
commit
eed5863790
@ -411,6 +411,9 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
||||
public AerodynamicForces multiplex(final int instanceCount) {
|
||||
|
||||
this.cp = cp.setWeight(cp.weight*instanceCount);
|
||||
if(1 < instanceCount) {
|
||||
this.cp = cp.setY(0f).setZ(0f);
|
||||
}
|
||||
this.CNa = CNa*instanceCount;
|
||||
this.CN = CN*instanceCount;
|
||||
this.Cm = Cm*instanceCount;
|
||||
|
@ -207,7 +207,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
Coordinate cp_weighted = cp_comp.setWeight(cp_comp.weight);
|
||||
Coordinate cp_absolute = component.toAbsolute(cp_weighted)[0];
|
||||
if(1 < component.getInstanceCount()) {
|
||||
cp_absolute = cp_absolute.setY(0.);
|
||||
cp_absolute = cp_absolute.setY(0.).setZ(0.);
|
||||
}
|
||||
|
||||
componentForces.setCP(cp_absolute);
|
||||
@ -215,19 +215,18 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
componentForces.setCm(CN_instanced * componentForces.getCP().x / conditions.getRefLength());
|
||||
|
||||
// if( 0.0001 < Math.abs(componentForces.getCNa())){
|
||||
// System.err.println(String.format("%s....Component.CNa: %g @ CP: %g, %g", indent, componentForces.getCNa(), componentForces.getCP().x, componentForces.getCP().y));
|
||||
// final Coordinate cp = assemblyForces.getCP();
|
||||
// System.err.println(String.format("%s....Component.CNa: %g @ CP: { %f, %f, %f}", indent, componentForces.getCNa(), cp.x, cp.y, cp.z));
|
||||
// }
|
||||
|
||||
assemblyForces.merge(componentForces);
|
||||
}
|
||||
|
||||
// if( 0.0001 < Math.abs(0 - assemblyForces.getCNa())){
|
||||
// System.err.println(String.format("%s....Assembly.CNa: %g @ CPx: %g", indent, assemblyForces.getCNa(), assemblyForces.getCP().x));
|
||||
// final Coordinate cp = assemblyForces.getCP();
|
||||
// System.err.println(String.format("%s....Assembly.CNa: %g @ CP: { %f, %f, %f}", indent, assemblyForces.getCNa(), cp.x, cp.y, cp.z));
|
||||
// }
|
||||
|
||||
// fetches instanced versions
|
||||
// int instanceCount = component.getLocations().length;
|
||||
|
||||
if( component.allowsChildren() && (component.getInstanceCount() > 1)) {
|
||||
return assemblyForces.multiplex(component.getInstanceCount());
|
||||
}else {
|
||||
|
@ -97,7 +97,6 @@ public class BarrowmanCalculatorTest {
|
||||
FlightConditions conditions = new FlightConditions(config);
|
||||
WarningSet warnings = new WarningSet();
|
||||
|
||||
|
||||
// calculated from OpenRocket 15.03:
|
||||
//double expCPx = 0.225;
|
||||
// verified from the equations:
|
||||
@ -110,7 +109,7 @@ public class BarrowmanCalculatorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCPDoubleStrapOn() {
|
||||
public void testCPParallelBoosters() {
|
||||
final Rocket rocket = TestRockets.makeFalcon9Heavy();
|
||||
final ParallelStage boosterStage = (ParallelStage) rocket.getChild(1).getChild(0).getChild(0);
|
||||
final TrapezoidFinSet boosterFins = (TrapezoidFinSet) boosterStage.getChild(1).getChild(1);
|
||||
@ -138,8 +137,8 @@ public class BarrowmanCalculatorTest {
|
||||
final Coordinate cp_1fin = calc.getCP(config, conditions, warnings);
|
||||
assertEquals(" Falcon 9 Heavy CNa value is incorrect:", 9.36306412, cp_1fin.weight, 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:", 0.08564455, cp_1fin.y, EPSILON);
|
||||
assertEquals(" Falcon 9 Heavy CP z value is incorrect:", 0.01766062, cp_1fin.z, 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);
|
||||
}{
|
||||
// absent -- 3.28901627g @[0.31469937,0.05133333,0.00000000]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user