adds documentation to aerodynmics package and some refactoring of classes
This commit is contained in:
parent
aeb2a3cd97
commit
c9dadc10fa
@ -71,12 +71,36 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
|||||||
|
|
||||||
private int modID = 0;
|
private int modID = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates an empty bean of AerodynamicForces with NaN values
|
||||||
|
*/
|
||||||
|
public AerodynamicForces() {
|
||||||
|
//all done in members declarations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initializes an AerodynamicForces already at zero
|
||||||
|
* @param zero flag to iniatilize value to zero or not
|
||||||
|
*/
|
||||||
|
public AerodynamicForces(boolean zero) {
|
||||||
|
if (zero)
|
||||||
|
this.zero();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gives a new component to be linked with
|
||||||
|
* changes it's modification id
|
||||||
|
* @param component The rocket component
|
||||||
|
*/
|
||||||
public void setComponent(RocketComponent component) {
|
public void setComponent(RocketComponent component) {
|
||||||
this.component = component;
|
this.component = component;
|
||||||
modID++;
|
modID++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the actual component linked with this
|
||||||
|
*/
|
||||||
public RocketComponent getComponent() {
|
public RocketComponent getComponent() {
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@ -273,7 +297,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
|||||||
@Override
|
@Override
|
||||||
public AerodynamicForces clone() {
|
public AerodynamicForces clone() {
|
||||||
try {
|
try {
|
||||||
return (AerodynamicForces)super.clone();
|
return (AerodynamicForces) super.clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
throw new BugException("CloneNotSupportedException?!?");
|
throw new BugException("CloneNotSupportedException?!?");
|
||||||
}
|
}
|
||||||
@ -308,13 +332,13 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (int) (1000*(this.getCD()+this.getCaxial()+this.getCNa())) + this.getCP().hashCode();
|
return (int) (1000 * (this.getCD() + this.getCaxial() + this.getCNa())) + this.getCP().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String text="AerodynamicForces[";
|
String text = "AerodynamicForces[";
|
||||||
|
|
||||||
if (getComponent() != null)
|
if (getComponent() != null)
|
||||||
text += "component:" + getComponent() + ",";
|
text += "component:" + getComponent() + ",";
|
||||||
@ -341,8 +365,8 @@ public class AerodynamicForces implements Cloneable, Monitorable {
|
|||||||
if (!Double.isNaN(getCD()))
|
if (!Double.isNaN(getCD()))
|
||||||
text += "CD:" + getCD() + ",";
|
text += "CD:" + getCD() + ",";
|
||||||
|
|
||||||
if (text.charAt(text.length()-1) == ',')
|
if (text.charAt(text.length() - 1) == ',')
|
||||||
text = text.substring(0, text.length()-1);
|
text = text.substring(0, text.length() - 1);
|
||||||
|
|
||||||
text += "]";
|
text += "]";
|
||||||
return text;
|
return text;
|
||||||
|
@ -62,55 +62,72 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return forces.getCP();
|
return forces.getCP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<RocketComponent, AerodynamicForces> getForceAnalysis(Configuration configuration,
|
public Map<RocketComponent, AerodynamicForces> getForceAnalysis(Configuration configuration,
|
||||||
FlightConditions conditions, WarningSet warnings) {
|
FlightConditions conditions, WarningSet warnings) {
|
||||||
checkCache(configuration);
|
checkCache(configuration);
|
||||||
|
|
||||||
AerodynamicForces f;
|
Map<RocketComponent, AerodynamicForces> map = getComponentsMap(configuration);
|
||||||
Map<RocketComponent, AerodynamicForces> map =
|
|
||||||
new LinkedHashMap<RocketComponent, AerodynamicForces>();
|
|
||||||
|
|
||||||
// Add all components to the map
|
|
||||||
for (RocketComponent c : configuration) {
|
|
||||||
f = new AerodynamicForces();
|
|
||||||
f.setComponent(c);
|
|
||||||
|
|
||||||
map.put(c, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate non-axial force data
|
// Calculate non-axial force data
|
||||||
AerodynamicForces total = calculateNonAxialForces(configuration, conditions, map, warnings);
|
AerodynamicForces total = calculateNonAxialForces(configuration, conditions, map, warnings);
|
||||||
|
|
||||||
|
calculateFrictionData(total, configuration, conditions, warnings);
|
||||||
// Calculate friction data
|
|
||||||
total.setFrictionCD(calculateFrictionDrag(configuration, conditions, map, warnings));
|
|
||||||
total.setPressureCD(calculatePressureDrag(configuration, conditions, map, warnings));
|
|
||||||
total.setBaseCD(calculateBaseDrag(configuration, conditions, map, warnings));
|
|
||||||
|
|
||||||
total.setComponent(configuration.getRocket());
|
total.setComponent(configuration.getRocket());
|
||||||
|
|
||||||
map.put(total.getComponent(), total);
|
map.put(total.getComponent(), total);
|
||||||
|
checkCDAndApplyFriction(map, conditions);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a map of rocket components with their own Aerodynamic forces bean
|
||||||
|
* TODO: LOW: maybe transfer the function to Configuration class?
|
||||||
|
* @param configuration The rocket configuration
|
||||||
|
* @return the map of rocket configuration with it's
|
||||||
|
* correspondent aerodynamic forces bean
|
||||||
|
*/
|
||||||
|
private Map<RocketComponent, AerodynamicForces> getComponentsMap(Configuration configuration) {
|
||||||
|
Map<RocketComponent, AerodynamicForces> map = new LinkedHashMap<RocketComponent, AerodynamicForces>();
|
||||||
|
// Add all components to the map
|
||||||
|
for (RocketComponent c : configuration) {
|
||||||
|
AerodynamicForces f = new AerodynamicForces();
|
||||||
|
f.setComponent(c);
|
||||||
|
map.put(c, f);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
for (RocketComponent c : map.keySet()) {
|
/**
|
||||||
f = map.get(c);
|
* check an analysis to fix possible invalid CDs and apply the actual friction
|
||||||
|
*
|
||||||
|
* @param forceAnalysis
|
||||||
|
* @param conditions
|
||||||
|
*/
|
||||||
|
private void checkCDAndApplyFriction(Map<RocketComponent, AerodynamicForces> forceAnalysis, FlightConditions conditions) {
|
||||||
|
for (RocketComponent c : forceAnalysis.keySet()) {
|
||||||
|
checkCDConsistency(forceAnalysis.get(c));
|
||||||
|
applyFriction(forceAnalysis.get(c), conditions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fixes possibles NaN in previous calculation of CDs
|
||||||
|
*
|
||||||
|
* @param f
|
||||||
|
* @param conditions
|
||||||
|
*/
|
||||||
|
private void checkCDConsistency(AerodynamicForces f) {
|
||||||
if (Double.isNaN(f.getBaseCD()) && Double.isNaN(f.getPressureCD()) &&
|
if (Double.isNaN(f.getBaseCD()) && Double.isNaN(f.getPressureCD()) &&
|
||||||
Double.isNaN(f.getFrictionCD()))
|
Double.isNaN(f.getFrictionCD()))
|
||||||
continue;
|
return;
|
||||||
if (Double.isNaN(f.getBaseCD()))
|
if (Double.isNaN(f.getBaseCD()))
|
||||||
f.setBaseCD(0);
|
f.setBaseCD(0);
|
||||||
if (Double.isNaN(f.getPressureCD()))
|
if (Double.isNaN(f.getPressureCD()))
|
||||||
f.setPressureCD(0);
|
f.setPressureCD(0);
|
||||||
if (Double.isNaN(f.getFrictionCD()))
|
if (Double.isNaN(f.getFrictionCD()))
|
||||||
f.setFrictionCD(0);
|
f.setFrictionCD(0);
|
||||||
f.setCD(f.getBaseCD() + f.getPressureCD() + f.getFrictionCD());
|
|
||||||
f.setCaxial(calculateAxialDrag(conditions, f.getCD()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,27 +144,53 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
AerodynamicForces total = calculateNonAxialForces(configuration, conditions, null, warnings);
|
AerodynamicForces total = calculateNonAxialForces(configuration, conditions, null, warnings);
|
||||||
|
|
||||||
// Calculate friction data
|
// Calculate friction data
|
||||||
total.setFrictionCD(calculateFrictionDrag(configuration, conditions, null, warnings));
|
calculateFrictionData(total, configuration, conditions, warnings);
|
||||||
total.setPressureCD(calculatePressureDrag(configuration, conditions, null, warnings));
|
applyFriction(total, conditions);
|
||||||
total.setBaseCD(calculateBaseDrag(configuration, conditions, null, warnings));
|
|
||||||
|
|
||||||
total.setCD(total.getFrictionCD() + total.getPressureCD() + total.getBaseCD());
|
|
||||||
|
|
||||||
total.setCaxial(calculateAxialDrag(conditions, total.getCD()));
|
|
||||||
|
|
||||||
// Calculate pitch and yaw damping moments
|
// Calculate pitch and yaw damping moments
|
||||||
calculateDampingMoments(configuration, conditions, total);
|
calculateDampingMoments(configuration, conditions, total);
|
||||||
|
applyDampingMoments(total);
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the actual influence of friction in an AerodynamicForces set
|
||||||
|
*
|
||||||
|
* @param force the Aerodynamic forces to be applied with friction
|
||||||
|
* @param conditions the flight conditions in consideration
|
||||||
|
*/
|
||||||
|
private void applyFriction(AerodynamicForces force, FlightConditions conditions) {
|
||||||
|
force.setCD(force.getFrictionCD() + force.getPressureCD() + force.getBaseCD());
|
||||||
|
force.setCaxial(calculateAxialDrag(conditions, force.getCD()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* does the actual action of damping into an AerodynamicForces set
|
||||||
|
*
|
||||||
|
* @param total the AerodynamicForces object to be applied with the damping
|
||||||
|
*/
|
||||||
|
private void applyDampingMoments(AerodynamicForces total) {
|
||||||
total.setCm(total.getCm() - total.getPitchDampingMoment());
|
total.setCm(total.getCm() - total.getPitchDampingMoment());
|
||||||
total.setCyaw(total.getCyaw() - total.getYawDampingMoment());
|
total.setCyaw(total.getCyaw() - total.getYawDampingMoment());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
return total;
|
* Will calculate all basic CD from an AerodynamicForces set
|
||||||
|
* @param total The AerodynamicForces that will be calculated
|
||||||
|
* @param configuration the Rocket configutarion
|
||||||
|
* @param conditions Flight conditions in the simulation
|
||||||
|
* @param warnings Warning set to handle special events
|
||||||
|
*/
|
||||||
|
private void calculateFrictionData(AerodynamicForces total, Configuration configuration, FlightConditions conditions, WarningSet warnings) {
|
||||||
|
total.setFrictionCD(calculateFrictionDrag(configuration, conditions, null, warnings));
|
||||||
|
total.setPressureCD(calculatePressureDrag(configuration, conditions, null, warnings));
|
||||||
|
total.setBaseCD(calculateBaseDrag(configuration, conditions, null, warnings));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Perform the actual CP calculation.
|
* Perform the actual CP calculation.
|
||||||
*/
|
*/
|
||||||
private AerodynamicForces calculateNonAxialForces(Configuration configuration, FlightConditions conditions,
|
private AerodynamicForces calculateNonAxialForces(Configuration configuration, FlightConditions conditions,
|
||||||
@ -155,8 +198,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
|
|
||||||
checkCache(configuration);
|
checkCache(configuration);
|
||||||
|
|
||||||
AerodynamicForces total = new AerodynamicForces();
|
AerodynamicForces total = new AerodynamicForces(true);
|
||||||
total.zero();
|
|
||||||
|
|
||||||
double radius = 0; // aft radius of previous component
|
double radius = 0; // aft radius of previous component
|
||||||
double componentX = 0; // aft coordinate of previous component
|
double componentX = 0; // aft coordinate of previous component
|
||||||
@ -169,8 +211,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
warnings.add(new Warning.LargeAOA(conditions.getAOA()));
|
warnings.add(new Warning.LargeAOA(conditions.getAOA()));
|
||||||
|
|
||||||
|
|
||||||
if (calcMap == null)
|
checkCalcMap(configuration);
|
||||||
buildCalcMap(configuration);
|
|
||||||
|
|
||||||
for (RocketComponent component : configuration) {
|
for (RocketComponent component : configuration) {
|
||||||
|
|
||||||
@ -207,6 +248,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
forces.setCP(component.toAbsolute(forces.getCP())[0]);
|
forces.setCP(component.toAbsolute(forces.getCP())[0]);
|
||||||
forces.setCm(forces.getCN() * forces.getCP().x / conditions.getRefLength());
|
forces.setCm(forces.getCN() * forces.getCP().x / conditions.getRefLength());
|
||||||
|
|
||||||
|
//TODO: LOW: Why is it here? was this the todo from above? Vicilu
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
AerodynamicForces f = map.get(component);
|
AerodynamicForces f = map.get(component);
|
||||||
|
|
||||||
@ -219,6 +261,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
f.setCroll(forces.getCroll());
|
f.setCroll(forces.getCroll());
|
||||||
f.setCrollDamp(forces.getCrollDamp());
|
f.setCrollDamp(forces.getCrollDamp());
|
||||||
f.setCrollForce(forces.getCrollForce());
|
f.setCrollForce(forces.getCrollForce());
|
||||||
|
map.replace(component, f); //have you forgotten to add this?
|
||||||
}
|
}
|
||||||
|
|
||||||
total.setCP(total.getCP().average(forces.getCP()));
|
total.setCP(total.getCP().average(forces.getCP()));
|
||||||
@ -239,8 +282,16 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
|
|
||||||
|
|
||||||
//////////////// DRAG CALCULATIONS ////////////////
|
//////////////// DRAG CALCULATIONS ////////////////
|
||||||
|
//TODO: LOW: clarify what map is doing here, or use it
|
||||||
|
/**
|
||||||
|
* Calculation of drag coefficient due to air friction
|
||||||
|
*
|
||||||
|
* @param configuration Rocket configuration
|
||||||
|
* @param conditions Flight conditions taken into account
|
||||||
|
* @param map ?
|
||||||
|
* @param set Set to handle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private double calculateFrictionDrag(Configuration configuration, FlightConditions conditions,
|
private double calculateFrictionDrag(Configuration configuration, FlightConditions conditions,
|
||||||
Map<RocketComponent, AerodynamicForces> map, WarningSet set) {
|
Map<RocketComponent, AerodynamicForces> map, WarningSet set) {
|
||||||
double c1 = 1.0, c2 = 1.0;
|
double c1 = 1.0, c2 = 1.0;
|
||||||
@ -249,8 +300,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
double Re;
|
double Re;
|
||||||
double Cf;
|
double Cf;
|
||||||
|
|
||||||
if (calcMap == null)
|
checkCalcMap(configuration);
|
||||||
buildCalcMap(configuration);
|
|
||||||
|
|
||||||
Re = conditions.getVelocity() * configuration.getLength() /
|
Re = conditions.getVelocity() * configuration.getLength() /
|
||||||
conditions.getAtmosphericConditions().getKinematicViscosity();
|
conditions.getAtmosphericConditions().getKinematicViscosity();
|
||||||
@ -371,8 +421,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
// Calculate the roughness-limited friction coefficient
|
// Calculate the roughness-limited friction coefficient
|
||||||
Finish finish = ((ExternalComponent) c).getFinish();
|
Finish finish = ((ExternalComponent) c).getFinish();
|
||||||
if (Double.isNaN(roughnessLimited[finish.ordinal()])) {
|
if (Double.isNaN(roughnessLimited[finish.ordinal()])) {
|
||||||
roughnessLimited[finish.ordinal()] =
|
roughnessLimited[finish.ordinal()] = 0.032 * Math.pow(finish.getRoughnessSize() / configuration.getLength(), 0.2) *
|
||||||
0.032 * Math.pow(finish.getRoughnessSize() / configuration.getLength(), 0.2) *
|
|
||||||
roughnessCorrection;
|
roughnessCorrection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,16 +497,32 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return (finFriction + correction * bodyFriction) / conditions.getRefArea();
|
return (finFriction + correction * bodyFriction) / conditions.getRefArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* method to avoid repetition, create the calcMap if null
|
||||||
|
* @param configuration the rocket configuration
|
||||||
|
*/
|
||||||
|
private void checkCalcMap(Configuration configuration) {
|
||||||
|
if (calcMap == null)
|
||||||
|
buildCalcMap(configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: LOW: clarify what map is doing here, or use it
|
||||||
|
/**
|
||||||
|
* Calculation of drag coefficient due to pressure
|
||||||
|
*
|
||||||
|
* @param configuration Rocket configuration
|
||||||
|
* @param conditions Flight conditions taken into account
|
||||||
|
* @param map ?
|
||||||
|
* @param set Set to handle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private double calculatePressureDrag(Configuration configuration, FlightConditions conditions,
|
private double calculatePressureDrag(Configuration configuration, FlightConditions conditions,
|
||||||
Map<RocketComponent, AerodynamicForces> map, WarningSet warnings) {
|
Map<RocketComponent, AerodynamicForces> map, WarningSet warnings) {
|
||||||
|
|
||||||
double stagnation, base, total;
|
double stagnation, base, total;
|
||||||
double radius = 0;
|
double radius = 0;
|
||||||
|
|
||||||
if (calcMap == null)
|
checkCalcMap(configuration);
|
||||||
buildCalcMap(configuration);
|
|
||||||
|
|
||||||
stagnation = calculateStagnationCD(conditions.getMach());
|
stagnation = calculateStagnationCD(conditions.getMach());
|
||||||
base = calculateBaseCD(conditions.getMach());
|
base = calculateBaseCD(conditions.getMach());
|
||||||
@ -497,7 +562,16 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: LOW: clarify what map is doing here, or use it
|
||||||
|
/**
|
||||||
|
* Calculation of drag coefficient due to base
|
||||||
|
*
|
||||||
|
* @param configuration Rocket configuration
|
||||||
|
* @param conditions Flight conditions taken into account
|
||||||
|
* @param map ?
|
||||||
|
* @param set Set to handle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private double calculateBaseDrag(Configuration configuration, FlightConditions conditions,
|
private double calculateBaseDrag(Configuration configuration, FlightConditions conditions,
|
||||||
Map<RocketComponent, AerodynamicForces> map, WarningSet warnings) {
|
Map<RocketComponent, AerodynamicForces> map, WarningSet warnings) {
|
||||||
|
|
||||||
@ -505,8 +579,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
double radius = 0;
|
double radius = 0;
|
||||||
RocketComponent prevComponent = null;
|
RocketComponent prevComponent = null;
|
||||||
|
|
||||||
if (calcMap == null)
|
checkCalcMap(configuration);
|
||||||
buildCalcMap(configuration);
|
|
||||||
|
|
||||||
base = calculateBaseCD(conditions.getMach());
|
base = calculateBaseCD(conditions.getMach());
|
||||||
total = 0;
|
total = 0;
|
||||||
@ -543,7 +616,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets CD by the speed
|
||||||
|
* @param m Mach number for calculation
|
||||||
|
* @return Stagnation CD
|
||||||
|
*/
|
||||||
public static double calculateStagnationCD(double m) {
|
public static double calculateStagnationCD(double m) {
|
||||||
double pressure;
|
double pressure;
|
||||||
if (m <= 1) {
|
if (m <= 1) {
|
||||||
@ -554,7 +631,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return 0.85 * pressure;
|
return 0.85 * pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates base CD
|
||||||
|
* @param m Mach number for calculation
|
||||||
|
* @return Base CD
|
||||||
|
*/
|
||||||
public static double calculateBaseCD(double m) {
|
public static double calculateBaseCD(double m) {
|
||||||
if (m <= 1) {
|
if (m <= 1) {
|
||||||
return 0.12 + 0.13 * m * m;
|
return 0.12 + 0.13 * m * m;
|
||||||
@ -570,15 +651,13 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
PolyInterpolator interpolator;
|
PolyInterpolator interpolator;
|
||||||
interpolator = new PolyInterpolator(
|
interpolator = new PolyInterpolator(
|
||||||
new double[] { 0, 17 * Math.PI / 180 },
|
new double[] { 0, 17 * Math.PI / 180 },
|
||||||
new double[] { 0, 17 * Math.PI / 180 }
|
new double[] { 0, 17 * Math.PI / 180 });
|
||||||
);
|
|
||||||
axialDragPoly1 = interpolator.interpolator(1, 1.3, 0, 0);
|
axialDragPoly1 = interpolator.interpolator(1, 1.3, 0, 0);
|
||||||
|
|
||||||
interpolator = new PolyInterpolator(
|
interpolator = new PolyInterpolator(
|
||||||
new double[] { 17 * Math.PI / 180, Math.PI / 2 },
|
new double[] { 17 * Math.PI / 180, Math.PI / 2 },
|
||||||
new double[] { 17 * Math.PI / 180, Math.PI / 2 },
|
new double[] { 17 * Math.PI / 180, Math.PI / 2 },
|
||||||
new double[] { Math.PI / 2 }
|
new double[] { Math.PI / 2 });
|
||||||
);
|
|
||||||
axialDragPoly2 = interpolator.interpolator(1.3, 0, 0, 0, 0);
|
axialDragPoly2 = interpolator.interpolator(1.3, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +690,12 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return -mul * cd;
|
return -mul * cd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get damping moments from a rocket in a flight
|
||||||
|
* @param configuration Rocket configuration
|
||||||
|
* @param conditions flight conditions in consideration
|
||||||
|
* @param total acting aerodynamic forces
|
||||||
|
*/
|
||||||
private void calculateDampingMoments(Configuration configuration, FlightConditions conditions,
|
private void calculateDampingMoments(Configuration configuration, FlightConditions conditions,
|
||||||
AerodynamicForces total) {
|
AerodynamicForces total) {
|
||||||
|
|
||||||
@ -665,7 +749,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
mul += 0.6 * Math.min(f.getFinCount(), 4) * f.getFinArea() *
|
mul += 0.6 * Math.min(f.getFinCount(), 4) * f.getFinArea() *
|
||||||
MathUtil.pow3(Math.abs(f.toAbsolute(new Coordinate(
|
MathUtil.pow3(Math.abs(f.toAbsolute(new Coordinate(
|
||||||
((FinSetCalc) calcMap.get(f)).getMidchordPos()))[0].x
|
((FinSetCalc) calcMap.get(f)).getMidchordPos()))[0].x
|
||||||
- cgx)) /
|
- cgx))
|
||||||
|
/
|
||||||
(conditions.getRefArea() * conditions.getRefLength());
|
(conditions.getRefArea() * conditions.getRefLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,7 +761,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
|
|
||||||
|
|
||||||
//////// The calculator map
|
//////// The calculator map
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void voidAerodynamicCache() {
|
protected void voidAerodynamicCache() {
|
||||||
super.voidAerodynamicCache();
|
super.voidAerodynamicCache();
|
||||||
@ -686,7 +770,10 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
cacheLength = -1;
|
cacheLength = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* caches the map for aerodynamics calculations
|
||||||
|
* @param configuration the rocket configuration
|
||||||
|
*/
|
||||||
private void buildCalcMap(Configuration configuration) {
|
private void buildCalcMap(Configuration configuration) {
|
||||||
Iterator<RocketComponent> iterator;
|
Iterator<RocketComponent> iterator;
|
||||||
|
|
||||||
|
@ -63,9 +63,12 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
/** Current roll rate. */
|
/** Current roll rate. */
|
||||||
private double rollRate = 0;
|
private double rollRate = 0;
|
||||||
|
|
||||||
|
/** Current pitch rate. */
|
||||||
private double pitchRate = 0;
|
private double pitchRate = 0;
|
||||||
|
/** Current yaw rate. */
|
||||||
private double yawRate = 0;
|
private double yawRate = 0;
|
||||||
|
|
||||||
|
|
||||||
private Coordinate pitchCenter = Coordinate.NUL;
|
private Coordinate pitchCenter = Coordinate.NUL;
|
||||||
|
|
||||||
|
|
||||||
@ -102,6 +105,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reference length and area.
|
* Set the reference length and area.
|
||||||
|
* fires change event
|
||||||
*/
|
*/
|
||||||
public void setRefLength(double length) {
|
public void setRefLength(double length) {
|
||||||
refLength = length;
|
refLength = length;
|
||||||
@ -111,7 +115,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the reference length.
|
* @return the reference length.
|
||||||
*/
|
*/
|
||||||
public double getRefLength() {
|
public double getRefLength() {
|
||||||
return refLength;
|
return refLength;
|
||||||
@ -119,6 +123,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reference area and length.
|
* Set the reference area and length.
|
||||||
|
* fires change event
|
||||||
*/
|
*/
|
||||||
public void setRefArea(double area) {
|
public void setRefArea(double area) {
|
||||||
refArea = area;
|
refArea = area;
|
||||||
@ -127,7 +132,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the reference area.
|
* @return the reference area.
|
||||||
*/
|
*/
|
||||||
public double getRefArea() {
|
public double getRefArea() {
|
||||||
return refArea;
|
return refArea;
|
||||||
@ -137,7 +142,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
/**
|
/**
|
||||||
* Sets the angle of attack. It calculates values also for the methods
|
* Sets the angle of attack. It calculates values also for the methods
|
||||||
* {@link #getSinAOA()} and {@link #getSincAOA()}.
|
* {@link #getSinAOA()} and {@link #getSincAOA()}.
|
||||||
*
|
* fires change event if it's different from previous value
|
||||||
* @param aoa the angle of attack.
|
* @param aoa the angle of attack.
|
||||||
*/
|
*/
|
||||||
public void setAOA(double aoa) {
|
public void setAOA(double aoa) {
|
||||||
@ -162,6 +167,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
* to be the sine of <code>aoa</code> for cases in which this value is known.
|
* to be the sine of <code>aoa</code> for cases in which this value is known.
|
||||||
* The AOA must still be specified, as the sine is not unique in the range
|
* The AOA must still be specified, as the sine is not unique in the range
|
||||||
* of 0..180 degrees.
|
* of 0..180 degrees.
|
||||||
|
* fires change event if it's different from previous value
|
||||||
*
|
*
|
||||||
* @param aoa the angle of attack in radians.
|
* @param aoa the angle of attack in radians.
|
||||||
* @param sinAOA the sine of the angle of attack.
|
* @param sinAOA the sine of the angle of attack.
|
||||||
@ -186,21 +192,21 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the angle of attack.
|
* @return the angle of attack.
|
||||||
*/
|
*/
|
||||||
public double getAOA() {
|
public double getAOA() {
|
||||||
return aoa;
|
return aoa;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the sine of the angle of attack.
|
* @return the sine of the angle of attack.
|
||||||
*/
|
*/
|
||||||
public double getSinAOA() {
|
public double getSinAOA() {
|
||||||
return sinAOA;
|
return sinAOA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the sinc of the angle of attack (sin(AOA) / AOA). This method returns
|
* @return the sinc of the angle of attack (sin(AOA) / AOA). This method returns
|
||||||
* one if the angle of attack is zero.
|
* one if the angle of attack is zero.
|
||||||
*/
|
*/
|
||||||
public double getSincAOA() {
|
public double getSincAOA() {
|
||||||
@ -210,6 +216,8 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the direction of the lateral airflow.
|
* Set the direction of the lateral airflow.
|
||||||
|
* fires change event if it's different from previous value
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public void setTheta(double theta) {
|
public void setTheta(double theta) {
|
||||||
if (MathUtil.equals(this.theta, theta))
|
if (MathUtil.equals(this.theta, theta))
|
||||||
@ -219,7 +227,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the direction of the lateral airflow.
|
* @return the direction of the lateral airflow.
|
||||||
*/
|
*/
|
||||||
public double getTheta() {
|
public double getTheta() {
|
||||||
return theta;
|
return theta;
|
||||||
@ -229,6 +237,8 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
/**
|
/**
|
||||||
* Set the current Mach speed. This should be (but is not required to be) in
|
* Set the current Mach speed. This should be (but is not required to be) in
|
||||||
* reference to the speed of sound of the atmospheric conditions.
|
* reference to the speed of sound of the atmospheric conditions.
|
||||||
|
*
|
||||||
|
* fires change event if it's different from previous value
|
||||||
*/
|
*/
|
||||||
public void setMach(double mach) {
|
public void setMach(double mach) {
|
||||||
mach = Math.max(mach, 0);
|
mach = Math.max(mach, 0);
|
||||||
@ -244,7 +254,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current Mach speed.
|
* @return the current Mach speed.
|
||||||
*/
|
*/
|
||||||
public double getMach() {
|
public double getMach() {
|
||||||
return mach;
|
return mach;
|
||||||
@ -272,7 +282,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return sqrt(abs(1 - Mach^2)). This is calculated in the setting call and is
|
* @return sqrt(abs(1 - Mach^2)). This is calculated in the setting call and is
|
||||||
* therefore fast.
|
* therefore fast.
|
||||||
*/
|
*/
|
||||||
public double getBeta() {
|
public double getBeta() {
|
||||||
@ -281,7 +291,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current roll rate.
|
* @return the current roll rate.
|
||||||
*/
|
*/
|
||||||
public double getRollRate() {
|
public double getRollRate() {
|
||||||
return rollRate;
|
return rollRate;
|
||||||
@ -290,6 +300,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current roll rate.
|
* Set the current roll rate.
|
||||||
|
* fires change event if it's different from previous
|
||||||
*/
|
*/
|
||||||
public void setRollRate(double rate) {
|
public void setRollRate(double rate) {
|
||||||
if (MathUtil.equals(this.rollRate, rate))
|
if (MathUtil.equals(this.rollRate, rate))
|
||||||
@ -300,11 +311,19 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return current pitch rate
|
||||||
|
*/
|
||||||
public double getPitchRate() {
|
public double getPitchRate() {
|
||||||
return pitchRate;
|
return pitchRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the pitch rate
|
||||||
|
* fires change event if it's different from previous
|
||||||
|
* @param pitchRate
|
||||||
|
*/
|
||||||
public void setPitchRate(double pitchRate) {
|
public void setPitchRate(double pitchRate) {
|
||||||
if (MathUtil.equals(this.pitchRate, pitchRate))
|
if (MathUtil.equals(this.pitchRate, pitchRate))
|
||||||
return;
|
return;
|
||||||
@ -312,7 +331,10 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return current yaw rate
|
||||||
|
*/
|
||||||
public double getYawRate() {
|
public double getYawRate() {
|
||||||
return yawRate;
|
return yawRate;
|
||||||
}
|
}
|
||||||
@ -402,7 +424,7 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a copy of the flight conditions. The copy has no listeners. The
|
* @return a copy of the flight conditions. The copy has no listeners. The
|
||||||
* atmospheric conditions is also cloned.
|
* atmospheric conditions is also cloned.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -454,6 +476,9 @@ public class FlightConditions implements Cloneable, ChangeSource, Monitorable {
|
|||||||
listenerList.remove(listener);
|
listenerList.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wake up call to listeners
|
||||||
|
*/
|
||||||
protected void fireChangeEvent() {
|
protected void fireChangeEvent() {
|
||||||
modID = UniqueID.next();
|
modID = UniqueID.next();
|
||||||
// Copy the list before iterating to prevent concurrent modification exceptions.
|
// Copy the list before iterating to prevent concurrent modification exceptions.
|
||||||
|
@ -7,10 +7,11 @@ import net.sf.openrocket.unit.UnitGroup;
|
|||||||
|
|
||||||
public abstract class Warning {
|
public abstract class Warning {
|
||||||
|
|
||||||
|
/** support to multiple languages warning */
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a Warning with the specific text.
|
* @return a Warning with the specific text.
|
||||||
*/
|
*/
|
||||||
public static Warning fromString(String text) {
|
public static Warning fromString(String text) {
|
||||||
return new Warning.Other(text);
|
return new Warning.Other(text);
|
||||||
@ -321,43 +322,33 @@ public abstract class Warning {
|
|||||||
|
|
||||||
/** A <code>Warning</code> that the body diameter is discontinuous. */
|
/** A <code>Warning</code> that the body diameter is discontinuous. */
|
||||||
////Discontinuity in rocket body diameter.
|
////Discontinuity in rocket body diameter.
|
||||||
public static final Warning DISCONTINUITY =
|
public static final Warning DISCONTINUITY = new Other(trans.get("Warning.DISCONTINUITY"));
|
||||||
new Other(trans.get("Warning.DISCONTINUITY"));
|
|
||||||
|
|
||||||
/** A <code>Warning</code> that the fins are thick compared to the rocket body. */
|
/** A <code>Warning</code> that the fins are thick compared to the rocket body. */
|
||||||
////Thick fins may not be modeled accurately.
|
////Thick fins may not be modeled accurately.
|
||||||
public static final Warning THICK_FIN =
|
public static final Warning THICK_FIN = new Other(trans.get("Warning.THICK_FIN"));
|
||||||
new Other(trans.get("Warning.THICK_FIN"));
|
|
||||||
|
|
||||||
/** A <code>Warning</code> that the fins have jagged edges. */
|
/** A <code>Warning</code> that the fins have jagged edges. */
|
||||||
////Jagged-edged fin predictions may be inaccurate.
|
////Jagged-edged fin predictions may be inaccurate.
|
||||||
public static final Warning JAGGED_EDGED_FIN =
|
public static final Warning JAGGED_EDGED_FIN = new Other(trans.get("Warning.JAGGED_EDGED_FIN"));
|
||||||
new Other(trans.get("Warning.JAGGED_EDGED_FIN"));
|
|
||||||
|
|
||||||
/** A <code>Warning</code> that simulation listeners have affected the simulation */
|
/** A <code>Warning</code> that simulation listeners have affected the simulation */
|
||||||
////Listeners modified the flight simulation
|
////Listeners modified the flight simulation
|
||||||
public static final Warning LISTENERS_AFFECTED =
|
public static final Warning LISTENERS_AFFECTED = new Other(trans.get("Warning.LISTENERS_AFFECTED"));
|
||||||
new Other(trans.get("Warning.LISTENERS_AFFECTED"));
|
|
||||||
|
|
||||||
////Recovery device opened while motor still burning.
|
////Recovery device opened while motor still burning.
|
||||||
public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING =
|
public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING = new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
|
||||||
new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
|
|
||||||
|
|
||||||
|
|
||||||
//// Invalid parameter encountered, ignoring.
|
//// Invalid parameter encountered, ignoring.
|
||||||
public static final Warning FILE_INVALID_PARAMETER =
|
public static final Warning FILE_INVALID_PARAMETER = new Other(trans.get("Warning.FILE_INVALID_PARAMETER"));
|
||||||
new Other(trans.get("Warning.FILE_INVALID_PARAMETER"));
|
|
||||||
|
|
||||||
public static final Warning PARALLEL_FINS =
|
public static final Warning PARALLEL_FINS = new Other(trans.get("Warning.PARALLEL_FINS"));
|
||||||
new Other(trans.get("Warning.PARALLEL_FINS"));
|
|
||||||
|
|
||||||
public static final Warning SUPERSONIC =
|
public static final Warning SUPERSONIC = new Other(trans.get("Warning.SUPERSONIC"));
|
||||||
new Other(trans.get("Warning.SUPERSONIC"));
|
|
||||||
|
|
||||||
public static final Warning RECOVERY_LAUNCH_ROD =
|
public static final Warning RECOVERY_LAUNCH_ROD = new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
|
||||||
new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
|
|
||||||
|
|
||||||
public static final Warning TUMBLE_UNDER_THRUST =
|
public static final Warning TUMBLE_UNDER_THRUST = new Other(trans.get("Warning.TUMBLE_UNDER_THRUST"));
|
||||||
new Other(trans.get("Warning.TUMBLE_UNDER_THRUST"));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@ public class AbstractChangeSource implements ChangeSource {
|
|||||||
log.trace("Removing change listeners, listener count is now " + listeners.size());
|
log.trace("Removing change listeners, listener count is now " + listeners.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* execute a change event from any listeners that are triggered by it
|
||||||
|
*/
|
||||||
public void fireChangeEvent(Object source) {
|
public void fireChangeEvent(Object source) {
|
||||||
EventObject event = new EventObject(source);
|
EventObject event = new EventObject(source);
|
||||||
// Copy the list before iterating to prevent concurrent modification exceptions.
|
// Copy the list before iterating to prevent concurrent modification exceptions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user