1 package net.sf.openrocket.aerodynamics;
3 import net.sf.openrocket.rocketcomponent.RocketComponent;
4 import net.sf.openrocket.util.Coordinate;
6 public class AerodynamicForces implements Cloneable {
9 * The component this data is referring to. Used in analysis methods.
10 * A total value is indicated by the component being the Rocket component.
12 public RocketComponent component = null;
16 public Coordinate cg = null;
18 /** Longitudal moment of inertia with reference to the CG. */
19 public double longitudalInertia = Double.NaN;
21 /** Rotational moment of inertia with reference to the CG. */
22 public double rotationalInertia = Double.NaN;
27 public Coordinate cp = null;
31 * Normal force coefficient derivative. At values close to zero angle of attack
32 * this value may be poorly defined or NaN if the calculation method does not
33 * compute CNa directly.
35 public double CNa = Double.NaN;
38 /** Normal force coefficient. */
39 public double CN = Double.NaN;
41 /** Pitching moment coefficient, relative to the coordinate origin. */
42 public double Cm = Double.NaN;
44 /** Side force coefficient, Cy */
45 public double Cside = Double.NaN;
47 /** Yaw moment coefficient, Cn, relative to the coordinate origin. */
48 public double Cyaw = Double.NaN;
50 /** Roll moment coefficient, Cl, relative to the coordinate origin. */
51 public double Croll = Double.NaN;
53 /** Roll moment damping coefficient */
54 public double CrollDamp = Double.NaN;
56 /** Roll moment forcing coefficient */
57 public double CrollForce = Double.NaN;
61 /** Axial drag coefficient, CA */
62 public double Caxial = Double.NaN;
64 /** Total drag force coefficient, parallel to the airflow. */
65 public double CD = Double.NaN;
67 /** Drag coefficient due to fore pressure drag. */
68 public double pressureCD = Double.NaN;
70 /** Drag coefficient due to base drag. */
71 public double baseCD = Double.NaN;
73 /** Drag coefficient due to friction drag. */
74 public double frictionCD = Double.NaN;
77 public double pitchDampingMoment = Double.NaN;
78 public double yawDampingMoment = Double.NaN;
82 * Reset all values to null/NaN.
87 longitudalInertia = Double.NaN;
88 rotationalInertia = Double.NaN;
97 CrollDamp = Double.NaN;
98 CrollForce = Double.NaN;
101 pitchDampingMoment = Double.NaN;
102 yawDampingMoment = Double.NaN;
106 * Zero all values to 0 / Coordinate.NUL. Component is left as it was.
109 // component untouched
111 longitudalInertia = 0;
112 rotationalInertia = 0;
125 pitchDampingMoment = 0;
126 yawDampingMoment = 0;
131 public AerodynamicForces clone() {
133 return (AerodynamicForces)super.clone();
134 } catch (CloneNotSupportedException e) {
135 throw new RuntimeException("CloneNotSupportedException?!?");
140 public String toString() {
141 String text="AerodynamicForces[";
143 if (component != null)
144 text += "component:" + component + ",";
146 text += "cg:" + cg + ",";
148 text += "cp:" + cp + ",";
149 if (!Double.isNaN(longitudalInertia))
150 text += "longIn:" + longitudalInertia + ",";
151 if (!Double.isNaN(rotationalInertia))
152 text += "rotIn:" + rotationalInertia + ",";
154 if (!Double.isNaN(CNa))
155 text += "CNa:" + CNa + ",";
156 if (!Double.isNaN(CN))
157 text += "CN:" + CN + ",";
158 if (!Double.isNaN(Cm))
159 text += "Cm:" + Cm + ",";
161 if (!Double.isNaN(Cside))
162 text += "Cside:" + Cside + ",";
163 if (!Double.isNaN(Cyaw))
164 text += "Cyaw:" + Cyaw + ",";
166 if (!Double.isNaN(Croll))
167 text += "Croll:" + Croll + ",";
168 if (!Double.isNaN(Caxial))
169 text += "Caxial:" + Caxial + ",";
171 if (!Double.isNaN(CD))
172 text += "CD:" + CD + ",";
174 if (text.charAt(text.length()-1) == ',')
175 text = text.substring(0, text.length()-1);