1 package net.sf.openrocket.rocketcomponent;
3 import net.sf.openrocket.util.MathUtil;
5 public class Streamer extends RecoveryDevice {
7 public static final double DEFAULT_CD = 0.6;
9 public static final double MAX_COMPUTED_CD = 0.4;
12 private double stripLength;
13 private double stripWidth;
17 this.stripLength = 0.5;
18 this.stripWidth = 0.05;
22 public double getStripLength() {
26 public void setStripLength(double stripLength) {
27 if (MathUtil.equals(this.stripLength, stripLength))
29 this.stripLength = stripLength;
30 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
33 public double getStripWidth() {
37 public void setStripWidth(double stripWidth) {
38 if (MathUtil.equals(this.stripWidth, stripWidth))
40 this.stripWidth = stripWidth;
41 this.length = stripWidth;
42 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
46 public void setLength(double length) {
47 setStripWidth(length);
51 public double getAspectRatio() {
52 if (stripWidth > 0.0001)
53 return stripLength / stripWidth;
57 public void setAspectRatio(double ratio) {
58 if (MathUtil.equals(getAspectRatio(), ratio))
61 ratio = Math.max(ratio, 0.01);
62 double area = getArea();
63 stripWidth = MathUtil.safeSqrt(area / ratio);
64 stripLength = ratio * stripWidth;
65 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
70 public double getArea() {
71 return stripWidth * stripLength;
74 public void setArea(double area) {
75 if (MathUtil.equals(getArea(), area))
78 double ratio = Math.max(getAspectRatio(), 0.01);
79 stripWidth = MathUtil.safeSqrt(area / ratio);
80 stripLength = ratio * stripWidth;
81 fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
87 public double getComponentCD(double mach) {
88 double density = this.getMaterial().getDensity();
91 cd = 0.034 * ((density + 0.025) / 0.105) * (stripLength + 1) / stripLength;
92 cd = MathUtil.min(cd, MAX_COMPUTED_CD);
97 public String getComponentName() {
102 public boolean allowsChildren() {
107 public boolean isCompatible(Class<? extends RocketComponent> type) {