motor updates
[debian/openrocket] / src / net / sf / openrocket / motor / Motor.java
1 package net.sf.openrocket.motor;
2
3 import net.sf.openrocket.util.Coordinate;
4
5 public interface Motor {
6
7         /**
8          * Enum of rocket motor types.
9          * 
10          * @author Sampo Niskanen <sampo.niskanen@iki.fi>
11          */
12         public enum Type {
13                 SINGLE("Single-use", "Single-use solid propellant motor"), 
14                 RELOAD("Reloadable", "Reloadable solid propellant motor"), 
15                 HYBRID("Hybrid", "Hybrid rocket motor engine"), 
16                 UNKNOWN("Unknown", "Unknown motor type");
17                 
18                 private final String name;
19                 private final String description;
20                 
21                 Type(String name, String description) {
22                         this.name = name;
23                         this.description = description;
24                 }
25
26                 /**
27                  * Return a short name of this motor type.
28                  * @return  a short name of the motor type.
29                  */
30                 public String getName() {
31                         return name;
32                 }
33                 
34                 /**
35                  * Return a long description of this motor type.
36                  * @return  a description of the motor type.
37                  */
38                 public String getDescription() {
39                         return description;
40                 }
41                 
42                 @Override
43                 public String toString() {
44                         return name;
45                 }
46         }
47         
48         
49         /**
50          * Ejection charge delay value signifying a "plugged" motor with no ejection charge.
51          * The value is that of <code>Double.POSITIVE_INFINITY</code>.
52          */
53         public static final double PLUGGED = Double.POSITIVE_INFINITY;
54         
55         
56         /**
57          * Below what portion of maximum thrust is the motor chosen to be off when
58          * calculating average thrust and burn time.  NFPA 1125 defines the "official"
59          * burn time to be the time which the motor produces over 5% of its maximum thrust.
60          */
61         public static final double MARGINAL_THRUST = 0.05;
62         
63
64
65         /**
66          * Return the motor type.
67          * 
68          * @return  the motorType
69          */
70         public Type getMotorType();
71
72
73         /**
74          * Return the designation of the motor.
75          * 
76          * @return the designation
77          */
78         public String getDesignation();
79         
80         /**
81          * Return the designation of the motor, including a delay.
82          * 
83          * @param delay  the delay of the motor.
84          * @return               designation with delay.
85          */
86         public String getDesignation(double delay);
87         
88
89         /**
90          * Return extra description for the motor.  This may include for example 
91          * comments on the source of the thrust curve.  The returned <code>String</code>
92          * may include new-lines.
93          * 
94          * @return the description
95          */
96         public String getDescription();
97         
98         
99         /**
100          * Return the maximum diameter of the motor.
101          * 
102          * @return the diameter
103          */
104         public double getDiameter();
105
106         /**
107          * Return the length of the motor.  This should be a "characteristic" length,
108          * and the exact definition may depend on the motor type.  Typically this should
109          * be the length from the bottom of the motor to the end of the maximum diameter
110          * portion, ignoring any smaller ejection charge compartments.
111          * 
112          * @return the length
113          */
114         public double getLength();
115         
116
117         public MotorInstance getInstance();
118         
119         
120         public Coordinate getLaunchCG();
121         public Coordinate getEmptyCG();
122         
123         
124         public double getBurnTimeEstimate();
125         public double getAverageThrustEstimate();
126         public double getMaxThrustEstimate();
127         public double getTotalImpulseEstimate();
128         
129         
130 }