From 46d01c6dc28b1e82392644e99f4fdc56bf21822f Mon Sep 17 00:00:00 2001
From: hcraigmiller <68821492+hcraigmiller@users.noreply.github.com>
Date: Sun, 10 Apr 2022 12:56:24 -0700
Subject: [PATCH 1/4] Fin marking guide -- Fixes Issue #1259 No Rail Button
location on Fin Marking Guide
---
.../openrocket/gui/print/FinMarkingGuide.java | 68 ++++++++++++++-----
1 file changed, 50 insertions(+), 18 deletions(-)
diff --git a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
index 7c1e5540a..3b3b8615a 100644
--- a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
+++ b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
@@ -23,17 +23,18 @@ import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.LaunchLug;
+import net.sf.openrocket.rocketcomponent.RailButton; // ADD IMPORT Rail Buttons
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
/**
* This is the core Swing representation of a fin marking guide. It can handle multiple fin sets on the same or
- * different body tubes. One marking guide will be created for any body tube that has a finset. If a tube has multiple
- * finsets, then they are combined onto one marking guide. It also includes launch lug marking line(s) if lugs are
- * present. If (and only if) a launch lug exists, then the word 'Front' is affixed to the leading edge of the guide to
- * give orientation.
- *
+ * different body tubes. One marking guide will be created for any body tube that has a fin set. If a tube has multiple
+ * fin sets, then they are combined onto one marking guide. It also includes launch lug and rail button marking line(s)
+ * if lugs and buttons are present. If (and only if) a launch lug or rail button exists, then the word 'Front' is
+ * affixed to the leading edge of the guide to give orientation.
+ *
*/
@SuppressWarnings("serial")
public class FinMarkingGuide extends JPanel {
@@ -82,7 +83,7 @@ public class FinMarkingGuide extends JPanel {
private int maxHeight = 0;
/**
- * A map of body tubes, to a list of components that contains finsets and launch lugs.
+ * A map of body tubes, to a list of components that contain fin sets, and launch lugs and rail buttons.
*/
private Map> markingGuideItems;
@@ -102,9 +103,10 @@ public class FinMarkingGuide extends JPanel {
/**
* Initialize the marking guide class by iterating over a rocket and finding all finsets.
*
- * @param component the root rocket component - this is iterated to find all finset and launch lugs
+ * @param component the root rocket component - this is iterated to find all fin sets, and launch lugs and
+ * rail buttons
*
- * @return a map of body tubes to lists of finsets and launch lugs.
+ * @return a map of body tubes to lists of fin sets, and launch lugs and rail buttons.
*/
private Map> init(Rocket component) {
Iterator iter = component.iterator(false);
@@ -119,7 +121,9 @@ public class FinMarkingGuide extends JPanel {
if (next instanceof BodyTube) {
current = (BodyTube) next;
}
- else if (next instanceof FinSet || next instanceof LaunchLug) {
+
+ // ACTION If Fin Set or Launch Lug or Rail Button
+ else if (next instanceof FinSet || next instanceof LaunchLug || next instanceof RailButton) {
java.util.List list = results.get(current);
if (list == null && current != null) {
list = new ArrayList();
@@ -202,8 +206,8 @@ public class FinMarkingGuide extends JPanel {
* | | + +
* | | + +
* | | +<------Launch Lug --------->+
- * | | + +
- * | | + +
+ * | | + and/or +
+ * | | + Rail Buttons +
* | | + +
* | | +<----------Fin------------->+
* | | + +
@@ -217,8 +221,8 @@ public class FinMarkingGuide extends JPanel {
* yLLOffset is computed from the difference between the base rotation of the fin and the radial direction of the
* lug.
*
- * Note: There is a current limitation that a tube with multiple launch lugs may not render the lug lines
- * correctly.
+ * Note: There is a current limitation that a tube with multiple launch lugs and/or rail buttons may not render
+ * the lug and/or rail button lines correctly.
*
*
* @param g the Graphics context
@@ -285,6 +289,8 @@ public class FinMarkingGuide extends JPanel {
// }
}
}
+
+ //BEGIN Launch Lug
else if (externalComponent instanceof LaunchLug) {
LaunchLug lug = (LaunchLug) externalComponent;
double angle = lug.getAngleOffset() - radialOrigin;
@@ -296,6 +302,21 @@ public class FinMarkingGuide extends JPanel {
g2.drawString(lug.getName(), x + (width / 3), (int) yLLOffset - 2);
}
+ //END Launch Lug
+
+ //BEGIN Rail Button
+ else if (externalComponent instanceof RailButton) {
+ RailButton button = (RailButton) externalComponent;
+ double angle = button.getAngleOffset() - radialOrigin;
+ while (angle < 0) {
+ angle += TWO_PI;
+ }
+ int yLLOffset = (int) Math.round(y + angle / TWO_PI * circumferenceInPoints);
+ drawDoubleArrowLine(g2, x, (int) yLLOffset, x + width, (int) yLLOffset);
+ g2.drawString(button.getName(), x + (width / 3), (int) yLLOffset - 2);
+
+ }
+ //END Rail Button
}
//Only if the tube has a lug or multiple finsets does the orientation of the marking guide matter. So print 'Front'.
if (hasMultipleComponents) {
@@ -318,8 +339,8 @@ public class FinMarkingGuide extends JPanel {
/**
* This function finds a origin in radians for the template so no component is on the template seam.
*
- * If no fin or launch lug is at 0.0 radians, then the origin is 0. If there is one, then half the distance
- * between the two are taken.
+ * If no fin, or launch lug or rail button is at 0.0 radians, then the origin is 0. If there is one, then half
+ * the distance between the two are taken.
*
* @param components
* @return
@@ -329,12 +350,22 @@ public class FinMarkingGuide extends JPanel {
ArrayList positions = new ArrayList(3 * components.size());
for (ExternalComponent component : components) {
-
+
+ // BEGIN Launch Lug
if (component instanceof LaunchLug) {
double componentPosition = ((LaunchLug) component).getAngleOffset();
positions.add(makeZeroTwoPi(componentPosition));
}
+ // END Launch Lug
+
+ // BEGIN Rail Button
+ if (component instanceof RailButton) {
+ double componentPosition = ((RailButton) component).getAngleOffset();
+
+ positions.add(makeZeroTwoPi(componentPosition));
+ }
+ // END Rail Button
if (component instanceof FinSet) {
FinSet fins = (FinSet) component;
@@ -434,8 +465,9 @@ public class FinMarkingGuide extends JPanel {
}
/**
- * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug exists to give
- * proper orientation of the guide (assuming that the lug is asymmetrically positioned with respect to a fin).
+ * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug and/or
+ * rail button exists to give proper orientation of the guide (assuming that the lug and/or button is
+ * asymmetrically positioned with respect to a fin).
*
* @param g2 the graphics context
* @param x the starting x coordinate
From 530dc980163211cd57e5c44a4a800cd29f82d352 Mon Sep 17 00:00:00 2001
From: hcraigmiller <68821492+hcraigmiller@users.noreply.github.com>
Date: Sun, 10 Apr 2022 12:56:24 -0700
Subject: [PATCH 2/4] Fin marking guide -- Fixes Issue #1259 No Rail Button
location on Fin Marking Guide
---
.../openrocket/gui/print/FinMarkingGuide.java | 76 ++++++++++++++-----
1 file changed, 55 insertions(+), 21 deletions(-)
diff --git a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
index 7c1e5540a..256cb90e9 100644
--- a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
+++ b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
@@ -23,17 +23,18 @@ import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.LaunchLug;
+import net.sf.openrocket.rocketcomponent.RailButton; // ADD IMPORT Rail Buttons
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
/**
* This is the core Swing representation of a fin marking guide. It can handle multiple fin sets on the same or
- * different body tubes. One marking guide will be created for any body tube that has a finset. If a tube has multiple
- * finsets, then they are combined onto one marking guide. It also includes launch lug marking line(s) if lugs are
- * present. If (and only if) a launch lug exists, then the word 'Front' is affixed to the leading edge of the guide to
- * give orientation.
- *
+ * different body tubes. One marking guide will be created for any body tube that has a fin set. If a tube has multiple
+ * fin sets, then they are combined onto one marking guide. It also includes launch lug and rail button marking line(s)
+ * if lugs and buttons are present. If (and only if) a launch lug or rail button exists, then the word 'Front' is
+ * affixed to the leading edge of the guide to give orientation.
+ *
*/
@SuppressWarnings("serial")
public class FinMarkingGuide extends JPanel {
@@ -77,12 +78,12 @@ public class FinMarkingGuide extends JPanel {
private static final int MARGIN = (int) PrintUnit.INCHES.toPoints(0.25f);
/**
- * The height (circumference) of the biggest body tube with a finset.
+ * The height (circumference) of the biggest body tube with a fin set.
*/
private int maxHeight = 0;
/**
- * A map of body tubes, to a list of components that contains finsets and launch lugs.
+ * A map of body tubes, to a list of components that contain fin sets, and launch lugs and rail buttons.
*/
private Map> markingGuideItems;
@@ -100,11 +101,12 @@ public class FinMarkingGuide extends JPanel {
}
/**
- * Initialize the marking guide class by iterating over a rocket and finding all finsets.
+ * Initialize the marking guide class by iterating over a rocket and finding all fin sets.
*
- * @param component the root rocket component - this is iterated to find all finset and launch lugs
+ * @param component the root rocket component - this is iterated to find all fin sets, and launch lugs and
+ * rail buttons
*
- * @return a map of body tubes to lists of finsets and launch lugs.
+ * @return a map of body tubes to lists of fin sets, and launch lugs and rail buttons.
*/
private Map> init(Rocket component) {
Iterator iter = component.iterator(false);
@@ -119,7 +121,9 @@ public class FinMarkingGuide extends JPanel {
if (next instanceof BodyTube) {
current = (BodyTube) next;
}
- else if (next instanceof FinSet || next instanceof LaunchLug) {
+
+ // ACTION If Fin Set or Launch Lug or Rail Button
+ else if (next instanceof FinSet || next instanceof LaunchLug || next instanceof RailButton) {
java.util.List list = results.get(current);
if (list == null && current != null) {
list = new ArrayList();
@@ -202,8 +206,8 @@ public class FinMarkingGuide extends JPanel {
* | | + +
* | | + +
* | | +<------Launch Lug --------->+
- * | | + +
- * | | + +
+ * | | + and/or +
+ * | | + Rail Buttons +
* | | + +
* | | +<----------Fin------------->+
* | | + +
@@ -217,8 +221,8 @@ public class FinMarkingGuide extends JPanel {
* yLLOffset is computed from the difference between the base rotation of the fin and the radial direction of the
* lug.
*
- * Note: There is a current limitation that a tube with multiple launch lugs may not render the lug lines
- * correctly.
+ * Note: There is a current limitation that a tube with multiple launch lugs and/or rail buttons may not render
+ * the lug and/or rail button lines correctly.
*
*
* @param g the Graphics context
@@ -285,6 +289,8 @@ public class FinMarkingGuide extends JPanel {
// }
}
}
+
+ //BEGIN Launch Lug
else if (externalComponent instanceof LaunchLug) {
LaunchLug lug = (LaunchLug) externalComponent;
double angle = lug.getAngleOffset() - radialOrigin;
@@ -296,8 +302,25 @@ public class FinMarkingGuide extends JPanel {
g2.drawString(lug.getName(), x + (width / 3), (int) yLLOffset - 2);
}
+ //END Launch Lug
+
+ //BEGIN Rail Button
+ else if (externalComponent instanceof RailButton) {
+ RailButton button = (RailButton) externalComponent;
+ double angle = button.getAngleOffset() - radialOrigin;
+ while (angle < 0) {
+ angle += TWO_PI;
+ }
+ int yLLOffset = (int) Math.round(y + angle / TWO_PI * circumferenceInPoints);
+ drawDoubleArrowLine(g2, x, (int) yLLOffset, x + width, (int) yLLOffset);
+ g2.drawString(button.getName(), x + (width / 3), (int) yLLOffset - 2);
+
+ }
+ //END Rail Button
}
- //Only if the tube has a lug or multiple finsets does the orientation of the marking guide matter. So print 'Front'.
+ /* Only if the tube has a lug or button multiple fin sets does the orientation of the marking guide
+ matter. So print 'Front'.
+ */
if (hasMultipleComponents) {
drawFrontIndication(g2, x, y, 0, (int) circumferenceInPoints, width);
}
@@ -318,8 +341,8 @@ public class FinMarkingGuide extends JPanel {
/**
* This function finds a origin in radians for the template so no component is on the template seam.
*
- * If no fin or launch lug is at 0.0 radians, then the origin is 0. If there is one, then half the distance
- * between the two are taken.
+ * If no fin, or launch lug or rail button is at 0.0 radians, then the origin is 0. If there is one, then half
+ * the distance between the two are taken.
*
* @param components
* @return
@@ -329,12 +352,22 @@ public class FinMarkingGuide extends JPanel {
ArrayList positions = new ArrayList(3 * components.size());
for (ExternalComponent component : components) {
-
+
+ // BEGIN Launch Lug
if (component instanceof LaunchLug) {
double componentPosition = ((LaunchLug) component).getAngleOffset();
positions.add(makeZeroTwoPi(componentPosition));
}
+ // END Launch Lug
+
+ // BEGIN Rail Button
+ if (component instanceof RailButton) {
+ double componentPosition = ((RailButton) component).getAngleOffset();
+
+ positions.add(makeZeroTwoPi(componentPosition));
+ }
+ // END Rail Button
if (component instanceof FinSet) {
FinSet fins = (FinSet) component;
@@ -434,8 +467,9 @@ public class FinMarkingGuide extends JPanel {
}
/**
- * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug exists to give
- * proper orientation of the guide (assuming that the lug is asymmetrically positioned with respect to a fin).
+ * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug and/or
+ * rail button exists to give proper orientation of the guide (assuming that the lug and/or button is
+ * asymmetrically positioned with respect to a fin).
*
* @param g2 the graphics context
* @param x the starting x coordinate
From 6f0a6f41270f556551617688024de0d65972a4b9 Mon Sep 17 00:00:00 2001
From: JoePfeiffer
Date: Thu, 31 Mar 2022 16:04:05 -0600
Subject: [PATCH 3/4] Refer to drag coefficient consistently as CD
---
.../aerodynamics/AerodynamicForces.java | 22 +++++------
.../aerodynamics/BarrowmanCalculator.java | 38 +++++++++----------
.../aerodynamics/barrowman/FinSetCalc.java | 24 ++++++------
.../aerodynamics/barrowman/LaunchLugCalc.java | 2 +-
.../barrowman/RocketComponentCalc.java | 2 +-
.../barrowman/SymmetricComponentCalc.java | 2 +-
.../barrowman/TubeFinSetCalc.java | 22 +++++------
.../simulation/RK4SimulationStepper.java | 4 +-
.../SymmetricComponentCalcTest.java | 2 +-
9 files changed, 57 insertions(+), 61 deletions(-)
diff --git a/core/src/net/sf/openrocket/aerodynamics/AerodynamicForces.java b/core/src/net/sf/openrocket/aerodynamics/AerodynamicForces.java
index dfddd1376..a28a95ca0 100644
--- a/core/src/net/sf/openrocket/aerodynamics/AerodynamicForces.java
+++ b/core/src/net/sf/openrocket/aerodynamics/AerodynamicForces.java
@@ -51,7 +51,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
/** Axial drag coefficient, CA */
- private double Caxial = Double.NaN;
+ private double CDaxial = Double.NaN;
/** Total drag force coefficient, parallel to the airflow. */
private double CD = Double.NaN;
@@ -181,13 +181,13 @@ public class AerodynamicForces implements Cloneable, Monitorable {
return CrollForce;
}
- public void setCaxial(double caxial) {
- Caxial = caxial;
+ public void setCDaxial(double cdaxial) {
+ CDaxial = cdaxial;
modID++;
}
- public double getCaxial() {
- return Caxial;
+ public double getCDaxial() {
+ return CDaxial;
}
public void setCD(double cD) {
@@ -277,7 +277,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
setCroll(Double.NaN);
setCrollDamp(Double.NaN);
setCrollForce(Double.NaN);
- setCaxial(Double.NaN);
+ setCDaxial(Double.NaN);
setCD(Double.NaN);
setPitchDampingMoment(Double.NaN);
setYawDampingMoment(Double.NaN);
@@ -299,7 +299,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
setCroll(0);
setCrollDamp(0);
setCrollForce(0);
- setCaxial(0);
+ setCDaxial(0);
setCD(0);
setPitchDampingMoment(0);
setYawDampingMoment(0);
@@ -334,7 +334,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
MathUtil.equals(this.getCroll(), other.getCroll()) &&
MathUtil.equals(this.getCrollDamp(), other.getCrollDamp()) &&
MathUtil.equals(this.getCrollForce(), other.getCrollForce()) &&
- MathUtil.equals(this.getCaxial(), other.getCaxial()) &&
+ MathUtil.equals(this.getCDaxial(), other.getCDaxial()) &&
MathUtil.equals(this.getCD(), other.getCD()) &&
MathUtil.equals(this.getPressureCD(), other.getPressureCD()) &&
MathUtil.equals(this.getBaseCD(), other.getBaseCD()) &&
@@ -346,7 +346,7 @@ public class AerodynamicForces implements Cloneable, Monitorable {
@Override
public int hashCode() {
- return (int) (1000*(this.getCD()+this.getCaxial()+this.getCNa())) + this.getCP().hashCode();
+ return (int) (1000*(this.getCD()+this.getCDaxial()+this.getCNa())) + this.getCP().hashCode();
}
@@ -373,8 +373,8 @@ public class AerodynamicForces implements Cloneable, Monitorable {
if (!Double.isNaN(getCroll()))
text += "Croll:" + getCroll() + ",";
- if (!Double.isNaN(getCaxial()))
- text += "Caxial:" + getCaxial() + ",";
+ if (!Double.isNaN(getCDaxial()))
+ text += "CDaxial:" + getCDaxial() + ",";
if (!Double.isNaN(getCD()))
text += "CD:" + getCD() + ",";
diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java
index af76e37ff..93e1a3632 100644
--- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java
+++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java
@@ -82,11 +82,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
// Calculate non-axial force data
calculateForceAnalysis(conditions, configuration.getRocket(), instMap, eachMap, assemblyMap, warnings);
- // Calculate friction data
+ // Calculate drag coefficient data
AerodynamicForces rocketForces = assemblyMap.get(configuration.getRocket());
- rocketForces.setFrictionCD(calculateFrictionDrag(configuration, conditions, eachMap, warnings));
- rocketForces.setPressureCD(calculatePressureDrag(configuration, conditions, eachMap, warnings));
- rocketForces.setBaseCD(calculateBaseDrag(configuration, conditions, eachMap, warnings));
+ rocketForces.setFrictionCD(calculateFrictionCD(configuration, conditions, eachMap, warnings));
+ rocketForces.setPressureCD(calculatePressureCD(configuration, conditions, eachMap, warnings));
+ rocketForces.setBaseCD(calculateBaseCD(configuration, conditions, eachMap, warnings));
Map finalMap = new LinkedHashMap<>();
for(final RocketComponent comp : instMap.keySet()){
@@ -117,7 +117,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
f.setFrictionCD(0);
f.setCD(f.getBaseCD() + f.getPressureCD() + f.getFrictionCD());
- f.setCaxial(calculateAxialDrag(conditions, f.getCD()));
+ f.setCDaxial(calculateAxialCD(conditions, f.getCD()));
finalMap.put(comp, f);
}
@@ -177,13 +177,13 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
AerodynamicForces total = calculateNonAxialForces(configuration, conditions, warnings);
// Calculate friction data
- total.setFrictionCD(calculateFrictionDrag(configuration, conditions, null, warnings));
- total.setPressureCD(calculatePressureDrag(configuration, conditions, null, warnings));
- total.setBaseCD(calculateBaseDrag(configuration, conditions, null, warnings));
+ total.setFrictionCD(calculateFrictionCD(configuration, conditions, null, warnings));
+ total.setPressureCD(calculatePressureCD(configuration, conditions, null, warnings));
+ total.setBaseCD(calculateBaseCD(configuration, conditions, null, warnings));
total.setCD(total.getFrictionCD() + total.getPressureCD() + total.getBaseCD());
- total.setCaxial(calculateAxialDrag(conditions, total.getCD()));
+ total.setCDaxial(calculateAxialCD(conditions, total.getCD()));
// Calculate pitch and yaw damping moments
calculateDampingMoments(configuration, conditions, total);
@@ -322,7 +322,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
* @param set Set to handle
* @return friction drag for entire rocket
*/
- private double calculateFrictionDrag(FlightConfiguration configuration, FlightConditions conditions,
+ private double calculateFrictionCD(FlightConfiguration configuration, FlightConditions conditions,
Map map, WarningSet set) {
double c1 = 1.0, c2 = 1.0;
@@ -523,9 +523,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
if (map != null) {
map.get(c).setFrictionCD(cd / conditions.getRefArea());
}
-
}
-
}
}
@@ -555,7 +553,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
* @param warningSet all current warnings
* @return
*/
- private double calculatePressureDrag(FlightConfiguration configuration, FlightConditions conditions,
+ private double calculatePressureCD(FlightConfiguration configuration, FlightConditions conditions,
Map forceMap, WarningSet warningSet) {
double stagnation, base, total;
@@ -578,8 +576,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
for(InstanceContext context: contextList ) {
// Pressure fore drag
- double cd = calcMap.get(c).calculatePressureDragForce(conditions, stagnation, base,
- warningSet);
+ double cd = calcMap.get(c).calculatePressureCD(conditions, stagnation, base,
+ warningSet);
total += cd;
if (forceMap != null) {
@@ -624,8 +622,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
* @param warnings all current warnings
* @return
*/
- private double calculateBaseDrag(FlightConfiguration configuration, FlightConditions conditions,
- Map map, WarningSet warnings) {
+ private double calculateBaseCD(FlightConfiguration configuration, FlightConditions conditions,
+ Map map, WarningSet warnings) {
double base, total;
@@ -687,8 +685,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
return total;
}
-
-
/**
* gets CD by the speed
* @param m Mach number for calculation
@@ -739,13 +735,13 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
/**
- * Calculate the axial drag from the total drag coefficient.
+ * Calculate the axial drag coefficient from the total drag coefficient.
*
* @param conditions
* @param cd
* @return
*/
- private double calculateAxialDrag(FlightConditions conditions, double cd) {
+ private double calculateAxialCD(FlightConditions conditions, double cd) {
double aoa = MathUtil.clamp(conditions.getAOA(), 0, Math.PI);
double mul;
diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java
index bccffa1c4..b863e6138 100644
--- a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java
+++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java
@@ -623,11 +623,11 @@ public class FinSetCalc extends RocketComponentCalc {
// }
@Override
- public double calculatePressureDragForce(FlightConditions conditions,
- double stagnationCD, double baseCD, WarningSet warnings) {
+ public double calculatePressureCD(FlightConditions conditions,
+ double stagnationCD, double baseCD, WarningSet warnings) {
double mach = conditions.getMach();
- double drag = 0;
+ double cd = 0;
// Pressure fore-drag
if (crossSection == FinSet.CrossSection.AIRFOIL ||
@@ -635,34 +635,34 @@ public class FinSetCalc extends RocketComponentCalc {
// Round leading edge
if (mach < 0.9) {
- drag = Math.pow(1 - pow2(mach), -0.417) - 1;
+ cd = Math.pow(1 - pow2(mach), -0.417) - 1;
} else if (mach < 1) {
- drag = 1 - 1.785 * (mach - 0.9);
+ cd = 1 - 1.785 * (mach - 0.9);
} else {
- drag = 1.214 - 0.502 / pow2(mach) + 0.1095 / pow2(pow2(mach));
+ cd = 1.214 - 0.502 / pow2(mach) + 0.1095 / pow2(pow2(mach));
}
} else if (crossSection == FinSet.CrossSection.SQUARE) {
- drag = stagnationCD;
+ cd = stagnationCD;
} else {
throw new UnsupportedOperationException("Unsupported fin profile: " + crossSection);
}
// Slanted leading edge
- drag *= pow2(cosGammaLead);
+ cd *= pow2(cosGammaLead);
// Trailing edge drag
if (crossSection == FinSet.CrossSection.SQUARE) {
- drag += baseCD;
+ cd += baseCD;
} else if (crossSection == FinSet.CrossSection.ROUNDED) {
- drag += baseCD / 2;
+ cd += baseCD / 2;
}
// Airfoil assumed to have zero base drag
// Scale to correct reference area
- drag *= span * thickness / conditions.getRefArea();
+ cd *= span * thickness / conditions.getRefArea();
- return drag;
+ return cd;
}
private void calculateInterferenceFinCount(FinSet component) {
diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/LaunchLugCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/LaunchLugCalc.java
index aeac39076..7563574b6 100644
--- a/core/src/net/sf/openrocket/aerodynamics/barrowman/LaunchLugCalc.java
+++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/LaunchLugCalc.java
@@ -31,7 +31,7 @@ public class LaunchLugCalc extends RocketComponentCalc {
}
@Override
- public double calculatePressureDragForce(FlightConditions conditions,
+ public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) {
return CDmul*stagnationCD * refArea / conditions.getRefArea();
diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/RocketComponentCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/RocketComponentCalc.java
index 900b507d9..e24ab8785 100644
--- a/core/src/net/sf/openrocket/aerodynamics/barrowman/RocketComponentCalc.java
+++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/RocketComponentCalc.java
@@ -39,6 +39,6 @@ public abstract class RocketComponentCalc {
* @param warnings set in which to store possible warnings
* @return the pressure drag of the component
*/
- public abstract double calculatePressureDragForce(FlightConditions conditions,
+ public abstract double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings);
}
diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java
index c6a16dc38..679215b90 100644
--- a/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java
+++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/SymmetricComponentCalc.java
@@ -179,7 +179,7 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
private LinearInterpolator interpolator = null;
@Override
- public double calculatePressureDragForce(FlightConditions conditions,
+ public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) {
// Check for simple cases first
diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java
index 4b3e3eb60..f9a1ecf4f 100644
--- a/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java
+++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/TubeFinSetCalc.java
@@ -622,11 +622,11 @@ public class TubeFinSetCalc extends RocketComponentCalc {
// }
@Override
- public double calculatePressureDragForce(FlightConditions conditions,
+ public double calculatePressureCD(FlightConditions conditions,
double stagnationCD, double baseCD, WarningSet warnings) {
double mach = conditions.getMach();
- double drag = 0;
+ double cd = 0;
// Pressure fore-drag
if (crossSection == FinSet.CrossSection.AIRFOIL ||
@@ -634,34 +634,34 @@ public class TubeFinSetCalc extends RocketComponentCalc {
// Round leading edge
if (mach < 0.9) {
- drag = Math.pow(1 - pow2(mach), -0.417) - 1;
+ cd = Math.pow(1 - pow2(mach), -0.417) - 1;
} else if (mach < 1) {
- drag = 1 - 1.785 * (mach - 0.9);
+ cd = 1 - 1.785 * (mach - 0.9);
} else {
- drag = 1.214 - 0.502 / pow2(mach) + 0.1095 / pow2(pow2(mach));
+ cd = 1.214 - 0.502 / pow2(mach) + 0.1095 / pow2(pow2(mach));
}
} else if (crossSection == FinSet.CrossSection.SQUARE) {
- drag = stagnationCD;
+ cd = stagnationCD;
} else {
throw new UnsupportedOperationException("Unsupported fin profile: " + crossSection);
}
// Slanted leading edge
- drag *= pow2(cosGammaLead);
+ cd *= pow2(cosGammaLead);
// Trailing edge drag
if (crossSection == FinSet.CrossSection.SQUARE) {
- drag += baseCD;
+ cd += baseCD;
} else if (crossSection == FinSet.CrossSection.ROUNDED) {
- drag += baseCD / 2;
+ cd += baseCD / 2;
}
// Airfoil assumed to have zero base drag
// Scale to correct reference area
- drag *= finCount * span * thickness / conditions.getRefArea();
+ cd *= finCount * span * thickness / conditions.getRefArea();
- return drag;
+ return cd;
}
private static int calculateInterferenceFinCount(TubeFinSet component) {
diff --git a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java
index 4acf3094a..6a1d99e8a 100644
--- a/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java
+++ b/core/src/net/sf/openrocket/simulation/RK4SimulationStepper.java
@@ -341,7 +341,7 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
// Linear forces in rocket coordinates
- store.dragForce = store.forces.getCaxial() * dynP * refArea;
+ store.dragForce = store.forces.getCDaxial() * dynP * refArea;
double fN = store.forces.getCN() * dynP * refArea;
double fSide = store.forces.getCside() * dynP * refArea;
@@ -646,7 +646,7 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
if (store.forces != null) {
data.setValue(FlightDataType.TYPE_DRAG_COEFF, store.forces.getCD());
- data.setValue(FlightDataType.TYPE_AXIAL_DRAG_COEFF, store.forces.getCaxial());
+ data.setValue(FlightDataType.TYPE_AXIAL_DRAG_COEFF, store.forces.getCDaxial());
data.setValue(FlightDataType.TYPE_FRICTION_DRAG_COEFF, store.forces.getFrictionCD());
data.setValue(FlightDataType.TYPE_PRESSURE_DRAG_COEFF, store.forces.getPressureCD());
data.setValue(FlightDataType.TYPE_BASE_DRAG_COEFF, store.forces.getBaseCD());
diff --git a/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java b/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java
index e3ffa1dc3..6c9bf7cf8 100644
--- a/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java
+++ b/core/test/net/sf/openrocket/aerodynamics/SymmetricComponentCalcTest.java
@@ -136,7 +136,7 @@ public class SymmetricComponentCalcTest {
double m = i/20.0;
String buf = "SymmetricComponentCalc produces bad Cd at index " + i + "(m=" + m +")";
conditions.setMach(m);
- double testcd = calcObj.calculatePressureDragForce(conditions, 0.0, 0.0, warnings) *
+ double testcd = calcObj.calculatePressureCD(conditions, 0.0, 0.0, warnings) *
conditions.getRefArea() / frontalArea;
assertEquals(buf, cd[(int) Math.round(m*20)], testcd, EPSILON);
}
From bf16d1b7c50114ff78d84bd6c89e2f1a7a40e7fc Mon Sep 17 00:00:00 2001
From: SiboVG
Date: Thu, 14 Apr 2022 05:42:30 +0200
Subject: [PATCH 4/4] Remove import comment FinMarkingGuide
---
swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
index 256cb90e9..355270389 100644
--- a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
+++ b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
@@ -23,7 +23,7 @@ import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.LaunchLug;
-import net.sf.openrocket.rocketcomponent.RailButton; // ADD IMPORT Rail Buttons
+import net.sf.openrocket.rocketcomponent.RailButton;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;