1 package net.sf.openrocket.aerodynamics;
3 import net.sf.openrocket.rocketcomponent.RocketComponent;
4 import net.sf.openrocket.util.BugException;
5 import net.sf.openrocket.util.Coordinate;
7 public class AerodynamicForces implements Cloneable {
10 * The component this data is referring to. Used in analysis methods.
11 * A total value is indicated by the component being the Rocket component.
13 public RocketComponent component = null;
17 public Coordinate cg = null;
19 /** Longitudal moment of inertia with reference to the CG. */
20 public double longitudalInertia = Double.NaN;
22 /** Rotational moment of inertia with reference to the CG. */
23 public double rotationalInertia = Double.NaN;
28 public Coordinate cp = null;
32 * Normal force coefficient derivative. At values close to zero angle of attack
33 * this value may be poorly defined or NaN if the calculation method does not
34 * compute CNa directly.
36 public double CNa = Double.NaN;
39 /** Normal force coefficient. */
40 public double CN = Double.NaN;
42 /** Pitching moment coefficient, relative to the coordinate origin. */
43 public double Cm = Double.NaN;
45 /** Side force coefficient, Cy */
46 public double Cside = Double.NaN;
48 /** Yaw moment coefficient, Cn, relative to the coordinate origin. */
49 public double Cyaw = Double.NaN;
51 /** Roll moment coefficient, Cl, relative to the coordinate origin. */
52 public double Croll = Double.NaN;
54 /** Roll moment damping coefficient */
55 public double CrollDamp = Double.NaN;
57 /** Roll moment forcing coefficient */
58 public double CrollForce = Double.NaN;
62 /** Axial drag coefficient, CA */
63 public double Caxial = Double.NaN;
65 /** Total drag force coefficient, parallel to the airflow. */
66 public double CD = Double.NaN;
68 /** Drag coefficient due to fore pressure drag. */
69 public double pressureCD = Double.NaN;
71 /** Drag coefficient due to base drag. */
72 public double baseCD = Double.NaN;
74 /** Drag coefficient due to friction drag. */
75 public double frictionCD = Double.NaN;
78 public double pitchDampingMoment = Double.NaN;
79 public double yawDampingMoment = Double.NaN;
83 * Reset all values to null/NaN.
88 longitudalInertia = Double.NaN;
89 rotationalInertia = Double.NaN;
98 CrollDamp = Double.NaN;
99 CrollForce = Double.NaN;
102 pitchDampingMoment = Double.NaN;
103 yawDampingMoment = Double.NaN;
107 * Zero all values to 0 / Coordinate.NUL. Component is left as it was.
110 // component untouched
112 longitudalInertia = 0;
113 rotationalInertia = 0;
126 pitchDampingMoment = 0;
127 yawDampingMoment = 0;
132 public AerodynamicForces clone() {
134 return (AerodynamicForces)super.clone();
135 } catch (CloneNotSupportedException e) {
136 throw new BugException("CloneNotSupportedException?!?");
141 public String toString() {
142 String text="AerodynamicForces[";
144 if (component != null)
145 text += "component:" + component + ",";
147 text += "cg:" + cg + ",";
149 text += "cp:" + cp + ",";
150 if (!Double.isNaN(longitudalInertia))
151 text += "longIn:" + longitudalInertia + ",";
152 if (!Double.isNaN(rotationalInertia))
153 text += "rotIn:" + rotationalInertia + ",";
155 if (!Double.isNaN(CNa))
156 text += "CNa:" + CNa + ",";
157 if (!Double.isNaN(CN))
158 text += "CN:" + CN + ",";
159 if (!Double.isNaN(Cm))
160 text += "Cm:" + Cm + ",";
162 if (!Double.isNaN(Cside))
163 text += "Cside:" + Cside + ",";
164 if (!Double.isNaN(Cyaw))
165 text += "Cyaw:" + Cyaw + ",";
167 if (!Double.isNaN(Croll))
168 text += "Croll:" + Croll + ",";
169 if (!Double.isNaN(Caxial))
170 text += "Caxial:" + Caxial + ",";
172 if (!Double.isNaN(CD))
173 text += "CD:" + CD + ",";
175 if (text.charAt(text.length()-1) == ',')
176 text = text.substring(0, text.length()-1);