Addresses Issue 481
Modify BarrowmanCalculator to use InstanceMap and InstanceContext to iterate through all components. This addresses 481 by actually computing nonaxial forces for all components, instead of computing a single instanceable component and using it as a representative of all instances. Modify calculateNonAxialForces to accept a Transformation argument, so they can use rotations from instances (only actually affects FinSetCalc and TubeFinSetCalc)
This commit is contained in:
parent
1abf0d3834
commit
2e7b3da1c0
@ -2,6 +2,7 @@ package net.sf.openrocket.aerodynamics;
|
|||||||
|
|
||||||
import static net.sf.openrocket.util.MathUtil.pow2;
|
import static net.sf.openrocket.util.MathUtil.pow2;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -10,6 +11,9 @@ import java.util.LinkedList;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import net.sf.openrocket.aerodynamics.barrowman.FinSetCalc;
|
import net.sf.openrocket.aerodynamics.barrowman.FinSetCalc;
|
||||||
import net.sf.openrocket.aerodynamics.barrowman.RocketComponentCalc;
|
import net.sf.openrocket.aerodynamics.barrowman.RocketComponentCalc;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
|
import net.sf.openrocket.rocketcomponent.ComponentAssembly;
|
||||||
@ -17,6 +21,8 @@ import net.sf.openrocket.rocketcomponent.ExternalComponent;
|
|||||||
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
|
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
|
||||||
import net.sf.openrocket.rocketcomponent.FinSet;
|
import net.sf.openrocket.rocketcomponent.FinSet;
|
||||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||||
|
import net.sf.openrocket.rocketcomponent.InstanceContext;
|
||||||
|
import net.sf.openrocket.rocketcomponent.InstanceMap;
|
||||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
||||||
@ -24,6 +30,7 @@ import net.sf.openrocket.util.Coordinate;
|
|||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.PolyInterpolator;
|
import net.sf.openrocket.util.PolyInterpolator;
|
||||||
import net.sf.openrocket.util.Reflection;
|
import net.sf.openrocket.util.Reflection;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An aerodynamic calculator that uses the extended Barrowman method to
|
* An aerodynamic calculator that uses the extended Barrowman method to
|
||||||
@ -36,6 +43,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
private static final String BARROWMAN_PACKAGE = "net.sf.openrocket.aerodynamics.barrowman";
|
private static final String BARROWMAN_PACKAGE = "net.sf.openrocket.aerodynamics.barrowman";
|
||||||
private static final String BARROWMAN_SUFFIX = "Calc";
|
private static final String BARROWMAN_SUFFIX = "Calc";
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(BarrowmanCalculator.class);
|
||||||
|
|
||||||
|
|
||||||
private Map<RocketComponent, RocketComponentCalc> calcMap = null;
|
private Map<RocketComponent, RocketComponentCalc> calcMap = null;
|
||||||
|
|
||||||
@ -176,64 +185,49 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
warnings.add( Warning.DIAMETER_DISCONTINUITY);
|
warnings.add( Warning.DIAMETER_DISCONTINUITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
AerodynamicForces total = calculateAssemblyNonAxialForces(configuration.getRocket(), configuration, conditions, calculators, warnings, "");
|
final InstanceMap imap = configuration.getActiveInstances();
|
||||||
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
private AerodynamicForces calculateAssemblyNonAxialForces( final RocketComponent component,
|
|
||||||
FlightConfiguration configuration, FlightConditions conditions,
|
|
||||||
Map<RocketComponent, AerodynamicForces> calculators, WarningSet warnings,
|
|
||||||
String indent) {
|
|
||||||
|
|
||||||
final AerodynamicForces assemblyForces= new AerodynamicForces().zero();
|
final AerodynamicForces assemblyForces= new AerodynamicForces().zero();
|
||||||
|
|
||||||
// System.err.println(String.format("%s@@ %s <%s>", indent, component.getName(), component.getClass().getSimpleName()));
|
// iterate through all components
|
||||||
|
for(Map.Entry<RocketComponent, ArrayList<InstanceContext>> entry: imap.entrySet() ) {
|
||||||
|
final RocketComponent comp = entry.getKey();
|
||||||
|
RocketComponentCalc calcObj = calcMap.get(comp);
|
||||||
|
log.debug("comp=" + comp);
|
||||||
|
|
||||||
// ==== calculate child forces ====
|
|
||||||
for (RocketComponent child: component.getChildren()) {
|
|
||||||
AerodynamicForces childForces = calculateAssemblyNonAxialForces( child, configuration, conditions, calculators, warnings, indent+" ");
|
|
||||||
assemblyForces.merge(childForces);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate *this* component's forces
|
|
||||||
RocketComponentCalc calcObj = calcMap.get(component);
|
|
||||||
if (null != calcObj) {
|
if (null != calcObj) {
|
||||||
AerodynamicForces componentForces = new AerodynamicForces().zero();
|
// iterate across component instances
|
||||||
calcObj.calculateNonaxialForces(conditions, componentForces, warnings);
|
final ArrayList<InstanceContext> contextList = entry.getValue();
|
||||||
|
|
||||||
Coordinate cp_comp = componentForces.getCP();
|
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();
|
||||||
|
|
||||||
Coordinate cp_weighted = cp_comp.setWeight(cp_comp.weight);
|
calcObj.calculateNonaxialForces(conditions, context.transform, instanceForces, warnings);
|
||||||
Coordinate cp_absolute = component.toAbsolute(cp_weighted)[0];
|
log.debug("instanceForces[" + context.instanceNumber + "]=" + instanceForces);
|
||||||
if(1 < component.getInstanceCount()) {
|
Coordinate cp_comp = instanceForces.getCP();
|
||||||
cp_absolute = cp_absolute.setY(0.).setZ(0.);
|
|
||||||
|
Coordinate cp_abs = context.transform.transform(cp_comp);
|
||||||
|
|
||||||
|
instanceForces.setCP(cp_abs);
|
||||||
|
double CN_instanced = instanceForces.getCN();
|
||||||
|
instanceForces.setCm(CN_instanced * instanceForces.getCP().x / conditions.getRefLength());
|
||||||
|
|
||||||
|
log.debug("instanceForces=" + instanceForces);
|
||||||
|
assemblyForces.merge(instanceForces);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentForces.setCP(cp_absolute);
|
log.debug("assemblyForces=" + assemblyForces);
|
||||||
double CN_instanced = componentForces.getCN();
|
|
||||||
componentForces.setCm(CN_instanced * componentForces.getCP().x / conditions.getRefLength());
|
|
||||||
|
|
||||||
// if( 0.0001 < Math.abs(componentForces.getCNa())){
|
|
||||||
// final Coordinate cp = assemblyForces.getCP();
|
|
||||||
// System.err.println(String.format("%s....Component.CNa: %g @ CP: { %f, %f, %f}", indent, componentForces.getCNa(), cp.x, cp.y, cp.z));
|
|
||||||
// }
|
|
||||||
|
|
||||||
assemblyForces.merge(componentForces);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if( 0.0001 < Math.abs(0 - assemblyForces.getCNa())){
|
|
||||||
// final Coordinate cp = assemblyForces.getCP();
|
|
||||||
// System.err.println(String.format("%s....Assembly.CNa: %g @ CP: { %f, %f, %f}", indent, assemblyForces.getCNa(), cp.x, cp.y, cp.z));
|
|
||||||
// }
|
|
||||||
|
|
||||||
if( component.allowsChildren() && (component.getInstanceCount() > 1)) {
|
|
||||||
return assemblyForces.multiplex(component.getInstanceCount());
|
|
||||||
}else {
|
|
||||||
return assemblyForces;
|
return assemblyForces;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContinuous( final Rocket rkt){
|
public boolean isContinuous( final Rocket rkt){
|
||||||
|
@ -16,7 +16,7 @@ import net.sf.openrocket.util.Coordinate;
|
|||||||
import net.sf.openrocket.util.LinearInterpolator;
|
import net.sf.openrocket.util.LinearInterpolator;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.PolyInterpolator;
|
import net.sf.openrocket.util.PolyInterpolator;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public class FinSetCalc extends RocketComponentCalc {
|
public class FinSetCalc extends RocketComponentCalc {
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
* (normal and side forces, pitch, yaw and roll moments, CP position, CNa).
|
* (normal and side forces, pitch, yaw and roll moments, CP position, CNa).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void calculateNonaxialForces(FlightConditions conditions,
|
public void calculateNonaxialForces(FlightConditions conditions, Transformation transform,
|
||||||
AerodynamicForces forces, WarningSet warnings) {
|
AerodynamicForces forces, WarningSet warnings) {
|
||||||
|
|
||||||
if (span < 0.001) {
|
if (span < 0.001) {
|
||||||
@ -114,7 +114,7 @@ public class FinSetCalc extends RocketComponentCalc {
|
|||||||
// Multiple fins with fin-fin interference
|
// Multiple fins with fin-fin interference
|
||||||
double cna;
|
double cna;
|
||||||
double theta = conditions.getTheta();
|
double theta = conditions.getTheta();
|
||||||
double angle = baseRotation;
|
double angle = baseRotation + transform.getXrotation();
|
||||||
|
|
||||||
// Compute basic CNa without interference effects
|
// Compute basic CNa without interference effects
|
||||||
if (finCount == 1 || finCount == 2) {
|
if (finCount == 1 || finCount == 2) {
|
||||||
|
@ -6,6 +6,7 @@ import net.sf.openrocket.aerodynamics.WarningSet;
|
|||||||
import net.sf.openrocket.rocketcomponent.LaunchLug;
|
import net.sf.openrocket.rocketcomponent.LaunchLug;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public class LaunchLugCalc extends RocketComponentCalc {
|
public class LaunchLugCalc extends RocketComponentCalc {
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class LaunchLugCalc extends RocketComponentCalc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateNonaxialForces(FlightConditions conditions,
|
public void calculateNonaxialForces(FlightConditions conditions, Transformation transform,
|
||||||
AerodynamicForces forces, WarningSet warnings) {
|
AerodynamicForces forces, WarningSet warnings) {
|
||||||
// Nothing to be done
|
// Nothing to be done
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import net.sf.openrocket.aerodynamics.AerodynamicForces;
|
|||||||
import net.sf.openrocket.aerodynamics.FlightConditions;
|
import net.sf.openrocket.aerodynamics.FlightConditions;
|
||||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public abstract class RocketComponentCalc {
|
public abstract class RocketComponentCalc {
|
||||||
|
|
||||||
@ -20,10 +21,11 @@ public abstract class RocketComponentCalc {
|
|||||||
* computed around the local origin.
|
* computed around the local origin.
|
||||||
*
|
*
|
||||||
* @param conditions the flight conditions.
|
* @param conditions the flight conditions.
|
||||||
|
* @param transform transformation from InstanceMap to get rotations rotations
|
||||||
* @param forces the object in which to store the values.
|
* @param forces the object in which to store the values.
|
||||||
* @param warnings set in which to store possible warnings.
|
* @param warnings set in which to store possible warnings.
|
||||||
*/
|
*/
|
||||||
public abstract void calculateNonaxialForces(FlightConditions conditions,
|
public abstract void calculateNonaxialForces(FlightConditions conditions, Transformation transform,
|
||||||
AerodynamicForces forces, WarningSet warnings);
|
AerodynamicForces forces, WarningSet warnings);
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import net.sf.openrocket.util.Coordinate;
|
|||||||
import net.sf.openrocket.util.LinearInterpolator;
|
import net.sf.openrocket.util.LinearInterpolator;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.PolyInterpolator;
|
import net.sf.openrocket.util.PolyInterpolator;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
|
|||||||
* subsonic speeds.
|
* subsonic speeds.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void calculateNonaxialForces(FlightConditions conditions,
|
public void calculateNonaxialForces(FlightConditions conditions, Transformation transform,
|
||||||
AerodynamicForces forces, WarningSet warnings) {
|
AerodynamicForces forces, WarningSet warnings) {
|
||||||
|
|
||||||
// Pre-calculate and store the results
|
// Pre-calculate and store the results
|
||||||
|
@ -17,6 +17,7 @@ import net.sf.openrocket.util.Coordinate;
|
|||||||
import net.sf.openrocket.util.LinearInterpolator;
|
import net.sf.openrocket.util.LinearInterpolator;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.PolyInterpolator;
|
import net.sf.openrocket.util.PolyInterpolator;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -92,7 +93,7 @@ public class TubeFinSetCalc extends RocketComponentCalc {
|
|||||||
* pitch, yaw and roll moments, CP position, CNa).
|
* pitch, yaw and roll moments, CP position, CNa).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void calculateNonaxialForces(FlightConditions conditions,
|
public void calculateNonaxialForces(FlightConditions conditions, Transformation transform,
|
||||||
AerodynamicForces forces, WarningSet warnings) {
|
AerodynamicForces forces, WarningSet warnings) {
|
||||||
|
|
||||||
if (span < 0.001) {
|
if (span < 0.001) {
|
||||||
@ -124,7 +125,7 @@ public class TubeFinSetCalc extends RocketComponentCalc {
|
|||||||
// Multiple fins with fin-fin interference
|
// Multiple fins with fin-fin interference
|
||||||
double cna;
|
double cna;
|
||||||
double theta = conditions.getTheta();
|
double theta = conditions.getTheta();
|
||||||
double angle = baseRotation;
|
double angle = baseRotation + transform.getXrotation();
|
||||||
|
|
||||||
// Compute basic CNa without interference effects
|
// Compute basic CNa without interference effects
|
||||||
if (finCount == 1 || finCount == 2) {
|
if (finCount == 1 || finCount == 2) {
|
||||||
|
@ -375,4 +375,24 @@ public class Transformation implements java.io.Serializable {
|
|||||||
return this.translate;
|
return this.translate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate X, Y, and Z rotation angles from rotation matrices
|
||||||
|
*/
|
||||||
|
public double getXrotation() {
|
||||||
|
return Math.atan2((rotation[2][1] - rotation[1][2])/2.0,
|
||||||
|
(rotation[1][1] + rotation[2][2])/2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getYrotation() {
|
||||||
|
return Math.atan2((rotation[0][2] - rotation[2][0])/2.0,
|
||||||
|
(rotation[0][0] + rotation[2][2])/2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getZrotation() {
|
||||||
|
return Math.atan2((rotation[1][0] - rotation[0][1])/2.0,
|
||||||
|
(rotation[0][0] + rotation[1][1])/2.0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import net.sf.openrocket.rocketcomponent.Rocket;
|
|||||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.TestRockets;
|
import net.sf.openrocket.util.TestRockets;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public class FinSetCalcTest {
|
public class FinSetCalcTest {
|
||||||
protected final double EPSILON = 0.0001;
|
protected final double EPSILON = 0.0001;
|
||||||
@ -50,6 +51,7 @@ public class FinSetCalcTest {
|
|||||||
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();
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
|
Transformation transform = Transformation.IDENTITY;
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
FlightConditions conditions = new FlightConditions(config);
|
||||||
WarningSet warnings = new WarningSet();
|
WarningSet warnings = new WarningSet();
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
AerodynamicForces forces = new AerodynamicForces();
|
||||||
@ -57,7 +59,7 @@ public class FinSetCalcTest {
|
|||||||
|
|
||||||
|
|
||||||
// vvv TEST MEH! vvv
|
// vvv TEST MEH! vvv
|
||||||
calcObj.calculateNonaxialForces(conditions, forces, warnings);
|
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
||||||
// ^^^
|
// ^^^
|
||||||
|
|
||||||
double exp_cna_fins = 24.146933;
|
double exp_cna_fins = 24.146933;
|
||||||
@ -84,6 +86,7 @@ public class FinSetCalcTest {
|
|||||||
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();
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
|
Transformation transform = Transformation.IDENTITY;
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
FlightConditions conditions = new FlightConditions(config);
|
||||||
WarningSet warnings = new WarningSet();
|
WarningSet warnings = new WarningSet();
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
AerodynamicForces forces = new AerodynamicForces();
|
||||||
@ -91,7 +94,7 @@ public class FinSetCalcTest {
|
|||||||
|
|
||||||
|
|
||||||
// vvv TEST MEH! vvv
|
// vvv TEST MEH! vvv
|
||||||
calcObj.calculateNonaxialForces(conditions, forces, warnings);
|
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
||||||
// ^^^
|
// ^^^
|
||||||
|
|
||||||
double exp_cna_fins = 32.195911;
|
double exp_cna_fins = 32.195911;
|
||||||
|
@ -18,6 +18,7 @@ import net.sf.openrocket.rocketcomponent.Transition;
|
|||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.TestRockets;
|
import net.sf.openrocket.util.TestRockets;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public class SymmetricComponentCalcTest {
|
public class SymmetricComponentCalcTest {
|
||||||
protected final double EPSILON = MathUtil.EPSILON*1000;
|
protected final double EPSILON = MathUtil.EPSILON*1000;
|
||||||
@ -52,13 +53,14 @@ public class SymmetricComponentCalcTest {
|
|||||||
|
|
||||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
FlightConditions conditions = new FlightConditions(config);
|
||||||
|
Transformation transform = Transformation.IDENTITY;
|
||||||
WarningSet warnings = new WarningSet();
|
WarningSet warnings = new WarningSet();
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
AerodynamicForces forces = new AerodynamicForces();
|
||||||
SymmetricComponentCalc calcObj = new SymmetricComponentCalc( nose );
|
SymmetricComponentCalc calcObj = new SymmetricComponentCalc( nose );
|
||||||
|
|
||||||
conditions.setAOA(0.0);
|
conditions.setAOA(0.0);
|
||||||
// vvv TEST MEH! vvv
|
// vvv TEST MEH! vvv
|
||||||
calcObj.calculateNonaxialForces(conditions, forces, warnings);
|
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
||||||
// ^^^
|
// ^^^
|
||||||
|
|
||||||
double cna_nose = 2;
|
double cna_nose = 2;
|
||||||
@ -82,13 +84,14 @@ public class SymmetricComponentCalcTest {
|
|||||||
|
|
||||||
FlightConfiguration config = rocket.getSelectedConfiguration();
|
FlightConfiguration config = rocket.getSelectedConfiguration();
|
||||||
FlightConditions conditions = new FlightConditions(config);
|
FlightConditions conditions = new FlightConditions(config);
|
||||||
|
Transformation transform = Transformation.IDENTITY;
|
||||||
WarningSet warnings = new WarningSet();
|
WarningSet warnings = new WarningSet();
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
AerodynamicForces forces = new AerodynamicForces();
|
||||||
SymmetricComponentCalc calcObj = new SymmetricComponentCalc( nose );
|
SymmetricComponentCalc calcObj = new SymmetricComponentCalc( nose );
|
||||||
|
|
||||||
conditions.setAOA(0.0);
|
conditions.setAOA(0.0);
|
||||||
// vvv TEST vvv
|
// vvv TEST vvv
|
||||||
calcObj.calculateNonaxialForces(conditions, forces, warnings);
|
calcObj.calculateNonaxialForces(conditions, transform, forces, warnings);
|
||||||
// ^^^ ^^^
|
// ^^^ ^^^
|
||||||
|
|
||||||
double l_nose = nose.getLength();
|
double l_nose = nose.getLength();
|
||||||
|
@ -23,6 +23,7 @@ import net.sf.openrocket.util.Color;
|
|||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.LineStyle;
|
import net.sf.openrocket.util.LineStyle;
|
||||||
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
||||||
|
import net.sf.openrocket.util.Transformation;
|
||||||
|
|
||||||
public class FreeformFinSetTest extends BaseTestCase {
|
public class FreeformFinSetTest extends BaseTestCase {
|
||||||
|
|
||||||
@ -1203,9 +1204,10 @@ public class FreeformFinSetTest extends BaseTestCase {
|
|||||||
bt.addChild(fins);
|
bt.addChild(fins);
|
||||||
FinSetCalc calc = new FinSetCalc(fins);
|
FinSetCalc calc = new FinSetCalc(fins);
|
||||||
FlightConditions conditions = new FlightConditions(null);
|
FlightConditions conditions = new FlightConditions(null);
|
||||||
|
Transformation transform = Transformation.IDENTITY;
|
||||||
AerodynamicForces forces = new AerodynamicForces();
|
AerodynamicForces forces = new AerodynamicForces();
|
||||||
WarningSet warnings = new WarningSet();
|
WarningSet warnings = new WarningSet();
|
||||||
calc.calculateNonaxialForces(conditions, forces, warnings);
|
calc.calculateNonaxialForces(conditions, transform, forces, warnings);
|
||||||
//System.out.println(forces);
|
//System.out.println(forces);
|
||||||
assertEquals(0.023409, forces.getCP().x, 0.0001);
|
assertEquals(0.023409, forces.getCP().x, 0.0001);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user