[fix] refactors Testrockets to clone existing fins from Alpha III, instead of replacing with new ones

This commit is contained in:
Daniel_M_Williams 2020-03-31 22:06:49 -04:00 committed by Daniel Williams
parent b24184afc7
commit ebf4d35299
2 changed files with 13 additions and 10 deletions

View File

@ -530,19 +530,22 @@ public class TestRockets {
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){
public static final void splitRocketFins( BodyTube body, TrapezoidFinSet fins, int finCount){
// actually remove the fins
body.removeChild(fins);
FinSet template = fins;
TrapezoidFinSet 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);
// and manually add in the equivalent the others
for(int finNumber=1; finNumber<finCount; ++finNumber){
final double rootChord = template.getRootChord();
final double tipChord = template.getTipChord();
final double sweep = template.getSweep();
final double height = template.getHeight();
final TrapezoidFinSet singleFin = new TrapezoidFinSet(1, rootChord, tipChord, sweep, height);
singleFin.setAngleOffset( finNumber * Math.PI * 2.0 / finCount);
singleFin.setThickness( 0.0032);
singleFin.setAxialMethod(AxialMethod.BOTTOM);
singleFin.setThickness( template.getThickness());
singleFin.setAxialMethod( template.getAxialMethod());
singleFin.setName(String.format("Single Fin #%d", finNumber));
body.addChild(singleFin);
}

View File

@ -190,7 +190,7 @@ public class BarrowmanCalculatorTest {
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);
final TrapezoidFinSet fins = (TrapezoidFinSet)body.getChild(0);
fins.setAngleOffset(0);
TestRockets.splitRocketFins(body, fins, 3);
@ -216,7 +216,7 @@ public class BarrowmanCalculatorTest {
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);
final TrapezoidFinSet fins = (TrapezoidFinSet)body.getChild(0);
TestRockets.splitRocketFins(body, fins, 4);
final Coordinate wholeRocketCP = calc.getCP(config, conditions, warnings);