Merge pull request #492 from teyrana/fix_387_offaxis_cp

[fixes #387] Fixes one source of off-axis CP error
This commit is contained in:
Wes Cravens 2018-12-08 12:30:12 -06:00 committed by GitHub
commit 5e3d8013e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -202,15 +202,20 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
AerodynamicForces componentForces = new AerodynamicForces().zero();
calcObj.calculateNonaxialForces(conditions, componentForces, warnings);
Coordinate x_cp_comp = componentForces.getCP();
Coordinate x_cp_weighted = x_cp_comp.setWeight(x_cp_comp.weight);
Coordinate x_cp_absolute = component.toAbsolute(x_cp_weighted)[0];
componentForces.setCP(x_cp_absolute);
Coordinate cp_comp = componentForces.getCP();
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.);
}
componentForces.setCP(cp_absolute);
double CN_instanced = componentForces.getCN();
componentForces.setCm(CN_instanced * componentForces.getCP().x / conditions.getRefLength());
// if( 0.0001 < Math.abs(0 - componentForces.getCNa())){
// System.err.println(String.format("%s....Component.CNa: %g @ CPx: %g", indent, componentForces.getCNa(), componentForces.getCP().x));
// 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));
// }
assemblyForces.merge(componentForces);

View File

@ -86,6 +86,7 @@ public class BarrowmanCalculatorTest {
assertEquals(" Estes Alpha III CNa value is incorrect:", exp_cna, cp_calc.weight, EPSILON);
assertEquals(" Estes Alpha III cp x value is incorrect:", exp_cpx, cp_calc.x, EPSILON);
assertEquals(" Estes Alpha III cp x value is incorrect:", 0.0, cp_calc.y, EPSILON);
}
@Test