From f0e5902e004742cc9746cc68d71947a3415dcaf2 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Wed, 6 May 2020 16:57:04 -0600 Subject: [PATCH] Pin CP to axis when calculating in BarrowmanCalculator.calculateNonAxialForces() It turns out that the assumption of radial symmetry is absolutely pervasive in our CP calculations. Looking at FinSetCalc.calculateNonAxialForces(), we don't actually compute the CP of a fin -- we calculate its X value, and pin it to Y=Z=0. The only exception to this is in BarrowmanCalculator.calculateNonAxialForces(), where the pinning only takes place if there are three or more fins in a FinSet. If we remove the test for number of fins in the FinSet, we are in essence making the assumption that there are more fins *somewhere* which will end up being radially symmetric. --- .../sf/openrocket/aerodynamics/BarrowmanCalculator.java | 3 +-- .../openrocket/aerodynamics/BarrowmanCalculatorTest.java | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 60d8eec6c..0afe28222 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -204,8 +204,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { Coordinate cp_inst = instanceForces.getCP(); Coordinate cp_abs = context.transform.transform(cp_inst); - 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()); diff --git a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java index c54d5cfba..f4c638b50 100644 --- a/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java +++ b/core/test/net/sf/openrocket/aerodynamics/BarrowmanCalculatorTest.java @@ -338,20 +338,13 @@ public class BarrowmanCalculatorTest { // results with and without it // cpNoPods (0.34125,0.00000,0.00000,w=16.20502) -- interference disabled // cpNoPods (0.34797,0.00000,0.00000,w=19.34773) -- interference enabled - - // another note: the fact that this is seen as three one-fin - // FinSets instead of a single three-fin FinSet means the CP - // will be off-axis (one of the fins is taken as having an - // angle of 0 to the airstream, so it has no contribution). - // This doesn't turn out to cause a problem in an actual - // simulation. final Coordinate cpNoPods = calcNoPods.getCP(configNoPods, conditionsNoPods, warningsNoPods); final Coordinate cpPods = calcPods.getCP(configPods, conditionsPods, warningsPods); System.out.printf("with pods %s\n", cpPods.toString()); System.out.printf("without pods %s\n", cpNoPods.toString()); assertEquals(" Alpha III With Pods rocket cp x value is incorrect:", cpNoPods.x - 0.002788761352, cpPods.x, EPSILON); - assertEquals(" Alpha III With Pods rocket cp y value is incorrect:", cpNoPods.y - 0.005460218430206499, cpPods.y, EPSILON); + assertEquals(" Alpha III With Pods rocket cp y value is incorrect:", cpNoPods.y, cpPods.y, EPSILON); assertEquals(" Alpha III With Pods rocket cp z value is incorrect:", cpNoPods.z, cpPods.z, EPSILON); assertEquals(" Alpha III With Pods rocket CNa value is incorrect:", cpPods.weight, cpNoPods.weight - 3.91572, EPSILON); }