Modify FinSetCalc to only produce result for one fin, to be summed in
BarrowmanCalculator Modify BarrowmanCalculator to actually sum fin nonaxial forces Modify FinSetCalcTest to sum fins in test3Fin() and test4Fin() Extra bonus: if at some point we allow fins to be other than radially symmetrical, this code should still work (not tested)
This commit is contained in:
parent
13f7c583fd
commit
eb3a129e67
@ -392,7 +392,6 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AerodynamicForces merge(AerodynamicForces other) {
|
public AerodynamicForces merge(AerodynamicForces other) {
|
||||||
|
|
||||||
this.cp = cp.average(other.getCP());
|
this.cp = cp.average(other.getCP());
|
||||||
this.CNa = CNa + other.getCNa();
|
this.CNa = CNa + other.getCNa();
|
||||||
this.CN = CN + other.getCN();
|
this.CN = CN + other.getCN();
|
||||||
|
@ -194,12 +194,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
final ArrayList<InstanceContext> contextList = entry.getValue();
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
|
|
||||||
for(InstanceContext context: contextList ) {
|
for(InstanceContext context: contextList ) {
|
||||||
// since FinSetCalc calculates forces for entire FinSet
|
|
||||||
// only consider first fin in each set (happily,
|
|
||||||
// in each instance of a PodSet or similar
|
|
||||||
// instanceable RocketComponent with childre, the
|
|
||||||
// child FinSets all start numbering with 0
|
|
||||||
if (!(comp instanceof FinSet) || (context.instanceNumber == 0)) {
|
|
||||||
AerodynamicForces instanceForces = new AerodynamicForces().zero();
|
AerodynamicForces instanceForces = new AerodynamicForces().zero();
|
||||||
|
|
||||||
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
||||||
@ -217,7 +211,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// System.err.println("assemblyForces=" + assemblyForces);
|
// System.err.println("assemblyForces=" + assemblyForces);
|
||||||
return assemblyForces;
|
return assemblyForces;
|
||||||
|
@ -117,18 +117,7 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
double angle = baseRotation + transform.getXrotation();
|
double angle = baseRotation + transform.getXrotation();
|
||||||
|
|
||||||
// Compute basic CNa without interference effects
|
// Compute basic CNa without interference effects
|
||||||
if (finCount == 1 || finCount == 2) {
|
cna = cna1 * MathUtil.pow2(Math.sin(theta - angle));
|
||||||
// Basic CNa from geometry
|
|
||||||
double mul = 0;
|
|
||||||
for (int i = 0; i < finCount; i++) {
|
|
||||||
mul += MathUtil.pow2(Math.sin(theta - angle));
|
|
||||||
angle += 2 * Math.PI / finCount;
|
|
||||||
}
|
|
||||||
cna = cna1 * mul;
|
|
||||||
} else {
|
|
||||||
// Basic CNa assuming full efficiency
|
|
||||||
cna = cna1 * finCount / 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// logger.debug("Component cna = {}", cna);
|
// logger.debug("Component cna = {}", cna);
|
||||||
|
|
||||||
|
@ -38,6 +38,27 @@ public class FinSetCalcTest {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AerodynamicForces sumFins(TrapezoidFinSet fins, Rocket rocket)
|
||||||
|
{
|
||||||
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
|
FlightConditions conditions = new FlightConditions(config);
|
||||||
|
WarningSet warnings = new WarningSet();
|
||||||
|
AerodynamicForces assemblyForces = new AerodynamicForces().zero();
|
||||||
|
AerodynamicForces componentForces = new AerodynamicForces();
|
||||||
|
|
||||||
|
FinSetCalc calcObj = new FinSetCalc( fins );
|
||||||
|
|
||||||
|
// Need to sum forces for fins
|
||||||
|
for (Integer i = 0; i < fins.getFinCount(); i++) {
|
||||||
|
calcObj.calculateNonaxialForces(conditions,
|
||||||
|
Transformation.rotate_x(Math.PI * i / fins.getFinCount()),
|
||||||
|
componentForces, warnings);
|
||||||
|
assemblyForces.merge(componentForces);
|
||||||
|
}
|
||||||
|
|
||||||
|
return assemblyForces;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test3Fin() {
|
public void test3Fin() {
|
||||||
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
@ -50,17 +71,8 @@ public class FinSetCalcTest {
|
|||||||
assertEquals(" Estes Alpha III fins have wrong sweep: ", 0.02, fins.getSweep(), EPSILON);
|
assertEquals(" Estes Alpha III fins have wrong sweep: ", 0.02, fins.getSweep(), EPSILON);
|
||||||
assertEquals(" Estes Alpha III fins have wrong height: ", 0.05, fins.getHeight(), EPSILON);
|
assertEquals(" Estes Alpha III fins have wrong height: ", 0.05, fins.getHeight(), EPSILON);
|
||||||
|
|
||||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
// get the forces for the three fins
|
||||||
Transformation transform = Transformation.IDENTITY;
|
AerodynamicForces forces = sumFins(fins, rocket);
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
|
||||||
WarningSet warnings = new WarningSet();
|
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
|
||||||
FinSetCalc calcObj = new FinSetCalc( fins );
|
|
||||||
|
|
||||||
|
|
||||||
// vvv TEST MEH! vvv
|
|
||||||
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
|
||||||
// ^^^
|
|
||||||
|
|
||||||
double exp_cna_fins = 24.146933;
|
double exp_cna_fins = 24.146933;
|
||||||
double exp_cpx_fins = 0.0193484;
|
double exp_cpx_fins = 0.0193484;
|
||||||
@ -85,17 +97,8 @@ public class FinSetCalcTest {
|
|||||||
assertEquals(" Estes Alpha III fins have wrong sweep: ", 0.02, fins.getSweep(), EPSILON);
|
assertEquals(" Estes Alpha III fins have wrong sweep: ", 0.02, fins.getSweep(), EPSILON);
|
||||||
assertEquals(" Estes Alpha III fins have wrong height: ", 0.05, fins.getHeight(), EPSILON);
|
assertEquals(" Estes Alpha III fins have wrong height: ", 0.05, fins.getHeight(), EPSILON);
|
||||||
|
|
||||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
// get the forces for the four fins
|
||||||
Transformation transform = Transformation.IDENTITY;
|
AerodynamicForces forces = sumFins(fins, rocket);
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
|
||||||
WarningSet warnings = new WarningSet();
|
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
|
||||||
FinSetCalc calcObj = new FinSetCalc( fins );
|
|
||||||
|
|
||||||
|
|
||||||
// vvv TEST MEH! vvv
|
|
||||||
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
|
||||||
// ^^^
|
|
||||||
|
|
||||||
double exp_cna_fins = 32.195911;
|
double exp_cna_fins = 32.195911;
|
||||||
double exp_cpx_fins = 0.0193484;
|
double exp_cpx_fins = 0.0193484;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user