[test] adds test to verify that splitting fins reproduces the same results
This commit is contained in:
parent
67f806492e
commit
b8172305f8
@ -192,27 +192,24 @@ 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();
|
||||||
|
|
||||||
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
||||||
Coordinate cp_comp = instanceForces.getCP();
|
|
||||||
|
|
||||||
Coordinate cp_abs = context.transform.transform(cp_comp);
|
Coordinate cp_inst = instanceForces.getCP();
|
||||||
|
Coordinate cp_abs = context.transform.transform(cp_inst);
|
||||||
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);
|
||||||
|
|
||||||
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());
|
||||||
// System.err.println("instanceForces=" + instanceForces);
|
|
||||||
assemblyForces.merge(instanceForces);
|
assemblyForces.merge(instanceForces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.err.println("assemblyForces=" + assemblyForces);
|
|
||||||
return assemblyForces;
|
return assemblyForces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,6 +530,24 @@ public class TestRockets {
|
|||||||
return rocket;
|
return rocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function is used for unit, integration tests, DO NOT CHANGE (without updating tests).
|
||||||
|
public static final void splitRocketFins( BodyTube body, FinSet fins, int finCount){
|
||||||
|
// actually remove the fins
|
||||||
|
body.removeChild(fins);
|
||||||
|
|
||||||
|
FinSet template = fins;
|
||||||
|
template.setFinCount(1);
|
||||||
|
// and manually add in the equivalent:
|
||||||
|
for(int finNumber=0; finNumber<finCount; ++finNumber){
|
||||||
|
final TrapezoidFinSet singleFin = new TrapezoidFinSet(1, 0.05, 0.03, 0.02, 0.05);
|
||||||
|
singleFin.setAngleOffset( finNumber * Math.PI * 2.0 / finCount);
|
||||||
|
singleFin.setThickness( 0.0032);
|
||||||
|
singleFin.setAxialMethod(AxialMethod.BOTTOM);
|
||||||
|
singleFin.setName(String.format("Single Fin #%d", finNumber));
|
||||||
|
body.addChild(singleFin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is an extra stage tacked onto the end of an Estes Alpha III
|
// This is an extra stage tacked onto the end of an Estes Alpha III
|
||||||
// http://www.rocketreviews.com/alpha-iii---estes-221256.html
|
// http://www.rocketreviews.com/alpha-iii---estes-221256.html
|
||||||
//
|
//
|
||||||
|
@ -15,6 +15,7 @@ import net.sf.openrocket.ServicesForTesting;
|
|||||||
import net.sf.openrocket.plugin.PluginModule;
|
import net.sf.openrocket.plugin.PluginModule;
|
||||||
import net.sf.openrocket.rocketcomponent.AxialStage;
|
import net.sf.openrocket.rocketcomponent.AxialStage;
|
||||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||||
|
import net.sf.openrocket.rocketcomponent.FinSet;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||||
import net.sf.openrocket.rocketcomponent.NoseCone;
|
import net.sf.openrocket.rocketcomponent.NoseCone;
|
||||||
import net.sf.openrocket.rocketcomponent.ParallelStage;
|
import net.sf.openrocket.rocketcomponent.ParallelStage;
|
||||||
@ -145,6 +146,31 @@ public class BarrowmanCalculatorTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCpSplitTripleFin() {
|
||||||
|
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);
|
||||||
|
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}{
|
||||||
|
final BodyTube body = (BodyTube)rocket.getChild(0).getChild(1);
|
||||||
|
final FinSet fins = (FinSet)body.getChild(0);
|
||||||
|
fins.setAngleOffset(0);
|
||||||
|
TestRockets.splitRocketFins(body, fins, 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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