1 package net.sf.openrocket.masscalc;
5 import net.sf.openrocket.motor.Motor;
6 import net.sf.openrocket.motor.MotorInstanceConfiguration;
7 import net.sf.openrocket.rocketcomponent.Configuration;
8 import net.sf.openrocket.rocketcomponent.RocketComponent;
9 import net.sf.openrocket.util.Coordinate;
10 import net.sf.openrocket.util.Monitorable;
12 public interface MassCalculator extends Monitorable {
14 public static enum MassCalcType {
17 public Coordinate getCG(Motor motor) {
18 return Coordinate.NUL;
23 public Coordinate getCG(Motor motor) {
24 return motor.getLaunchCG();
29 public Coordinate getCG(Motor motor) {
30 return motor.getEmptyCG();
34 public abstract Coordinate getCG(Motor motor);
38 * Compute the CG of the provided configuration.
40 * @param configuration the rocket configuration
41 * @param type the state of the motors (none, launch mass, burnout mass)
42 * @return the CG of the configuration
44 public Coordinate getCG(Configuration configuration, MassCalcType type);
47 * Compute the CG of the provided configuration with specified motors.
49 * @param configuration the rocket configuration
50 * @param motors the motor configuration
51 * @return the CG of the configuration
53 public Coordinate getCG(Configuration configuration, MotorInstanceConfiguration motors);
56 * Compute the longitudinal inertia of the provided configuration with specified motors.
58 * @param configuration the rocket configuration
59 * @param motors the motor configuration
60 * @return the longitudinal inertia of the configuration
62 public double getLongitudinalInertia(Configuration configuration, MotorInstanceConfiguration motors);
65 * Compute the rotational inertia of the provided configuration with specified motors.
67 * @param configuration the rocket configuration
68 * @param motors the motor configuration
69 * @return the rotational inertia of the configuration
71 public double getRotationalInertia(Configuration configuration, MotorInstanceConfiguration motors);
74 * Return the total mass of the motors
76 * @param motors the motor configuration
77 * @param configuration the current motor instance configuration
78 * @return the total mass of all motors
80 public double getPropellantMass(Configuration configuration, MotorInstanceConfiguration motors);
83 * Compute an analysis of the per-component CG's of the provided configuration.
84 * The returned map will contain an entry for each physical rocket component (not stages)
85 * with its corresponding (best-effort) CG. Overriding of subcomponents is ignored.
86 * The CG of the entire configuration with motors is stored in the entry with the corresponding
89 * @param configuration the rocket configuration
90 * @param type the state of the motors (none, launch mass, burnout mass)
91 * @return a map from each rocket component to its corresponding CG.
93 public Map<RocketComponent, Coordinate> getCGAnalysis(Configuration configuration, MassCalcType type);