2011-08-28 Richard Graham
* Patch for geodetic computations + coriolis effect
+ * Patch for enhanced gravity model
2011-08-25 Sampo Niskanen
!RocketCompCfg.lbl.Length = Length:
! BulkheadConfig
-BulkheadCfg.tab.Radius = Radius:
+BulkheadCfg.tab.Diameter = Diameter:
BulkheadCfg.tab.Thickness = Thickness:
BulkheadCfg.tab.General = General
BulkheadCfg.tab.Generalproperties = General properties
ParachuteCfg.lbl.plusdelay = plus
! ShockCordConfig
-ShockCordCfg.lbl.Shockcordlength = Shock cord length
+ShockCordCfg.lbl.Shockcordlength = Shock cord length:
ShockCordCfg.lbl.Shockcordmaterial = Shock cord material:
ShockCordCfg.lbl.Posrelativeto = Position relative to:
ShockCordCfg.lbl.plus = plus
public class BulkheadConfig extends RingComponentConfig {
private static final Translator trans = Application.getTranslator();
-
+
public BulkheadConfig(RocketComponent c) {
super(c);
JPanel tab;
- //// Radius: and "Thickness:
- tab = generalTab(trans.get("BulkheadCfg.tab.Radius"), null, null,
+ tab = generalTab(trans.get("BulkheadCfg.tab.Diameter"), null, null,
trans.get("BulkheadCfg.tab.Thickness"));
//// General and General properties
- tabbedPane.insertTab(trans.get("BulkheadCfg.tab.General"), null, tab,
+ tabbedPane.insertTab(trans.get("BulkheadCfg.tab.General"), null, tab,
trans.get("BulkheadCfg.tab.Generalproperties"), 0);
tabbedPane.setSelectedIndex(0);
}
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
+import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
menu.add(item);
+ menu.addSeparator();
+
+
+ item = new JMenuItem("Test popup");
+ item.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.user("Test popup selected");
+ JPanel panel = new JPanel();
+ panel.add(new JTextField(40));
+ panel.add(new JSpinner());
+ JPopupMenu popup = new JPopupMenu();
+ popup.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
+ popup.add(panel);
+ popup.show(BasicFrame.this, -50, 100);
+ }
+ });
+ menu.add(item);
+
+
+
+
return menu;
}
private static final Translator trans = Application.getTranslator();
+ // FIXME: NPE if FlightDataType has disappeared
+
public SimulationEditDialog(Window parent, Simulation s) {
this(parent, s, 0);
}
+++ /dev/null
-package net.sf.openrocket.models.gravity;
-
-import net.sf.openrocket.util.WorldCoordinate;
-
-@Deprecated
-
-/**
- * A gravity model based on the International Gravity Formula of 1967. The gravity
- * value is computed when the object is constructed and later returned as a static
- * value.
- *
- * @author Sampo Niskanen <sampo.niskanen@iki.fi>
- */
-
-public class BasicGravityModel implements GravityModel {
-
- private final double g;
-
- /**
- * Construct the static gravity model at the specific latitude (in degrees).
- * @param latitude the latitude in degrees (-90 ... 90)
- */
- public BasicGravityModel(double latitude) {
- // TODO: HIGH: This model is wrong!! Increases monotonically from -90 to 90
- double sin = Math.sin(latitude * Math.PI / 180);
- double sin2 = Math.sin(2 * latitude * Math.PI / 180);
- g = 9.780327 * (1 + 0.0053024 * sin - 0.0000058 * sin2);
- }
-
- //@Override
- public double getGravity(double altitude) {
- return g;
- }
-
- //@Override
- public int getModID() {
- // Return constant mod ID
- return (int) (g * 1000000);
- }
-
- @Override
- public double getGravity(WorldCoordinate wc) {
- // TODO Auto-generated method stub
- return 0;
- }
-
-}
package net.sf.openrocket.models.gravity;
//import net.sf.openrocket.util.Monitorable;
+import net.sf.openrocket.util.Monitorable;
import net.sf.openrocket.util.WorldCoordinate;
/**
*
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
*/
-public interface GravityModel { //extends Monitorable {
-
- /**
- * Compute the gravity at a specific altitude above equator.
- *
- * @param altitude the altitude at which to compute the gravity
- * @return the gravitational acceleration
- */
- //public double getGravity(double altitude);
-
+public interface GravityModel extends Monitorable {
/**
* Compute the gravity at a given world coordinate
- * @param wc
- * @return gravitational acceleration in m/s/s
+ * @param wc the world coordinate location
+ * @return gravitational acceleration in m/s/s
*/
public double getGravity(WorldCoordinate wc);
*
* @author Richard Graham <richard@rdg.cc>
*/
-
public class WGSGravityModel implements GravityModel {
private WorldCoordinate lastWorldCoordinate;
private double lastg;
+
+ private static int hit = 0;
+ private static int miss = 0;
+
+
@Override
public double getGravity(WorldCoordinate wc) {
if (wc != this.lastWorldCoordinate) {
this.lastg = calcGravity(wc);
this.lastWorldCoordinate = wc;
+
+ miss++;
+ } else {
+ hit++;
}
+ System.out.println("GRAVITY MODEL: hit=" + hit + " miss=" + miss);
return this.lastg;
}
+
+ @Override
+ public int getModID() {
+ // The model is immutable, so it can return a constant mod ID
+ return 0;
+ }
+
+
private double calcGravity(WorldCoordinate wc) {
double sin2lat = MathUtil.pow2(Math.sin(wc.getLatitudeRad()));
public class Bulkhead extends RadiusRingComponent {
private static final Translator trans = Application.getTranslator();
-
+
public Bulkhead() {
setOuterRadiusAutomatic(true);
setLength(0.002);
private static final LogHelper log = Application.getLogger();
- // TODO: HIGH: Allow selecting steppers
+ // TODO: MEDIUM: Allow selecting steppers
private SimulationStepper flightStepper = new RK4SimulationStepper();
private SimulationStepper landingStepper = new BasicLandingStepper();
private static final double RECOVERY_TIME_STEP = 0.5;
+ // FIXME: Add lat/lon code here as well
@Override
public SimulationStatus initialize(SimulationStatus status) throws SimulationException {
conditions.setAtmosphericModel(getAtmosphericModel());
- //BasicGravityModel gravityModel = new BasicGravityModel(getLaunchLatitude());
GravityModel gravityModel = new WGSGravityModel();
conditions.setGravityModel(gravityModel);
UNITS_ANGLE = new UnitGroup();
UNITS_ANGLE.addUnit(new DegreeUnit());
UNITS_ANGLE.addUnit(new FixedPrecisionUnit("rad", 0.01));
- UNITS_ANGLE.addUnit(new GeneralUnit(1.0/3437.74677078, "arcmin"));
+ UNITS_ANGLE.addUnit(new GeneralUnit(1.0 / 3437.74677078, "arcmin"));
UNITS_DENSITY_BULK = new UnitGroup();
UNITS_DENSITY_BULK.addUnit(new GeneralUnit(1000, "g/cm" + CUBED));
return units.indexOf(u);
}
- private void addUnit(Unit u) {
+ public void addUnit(Unit u) {
units.add(u);
}
@Override
public int hashCode() {
- return ((int) (1000 * lat * lon * alt));
+ return ((int) (1000 * (lat + lon + alt)));
}
}
rgb(55,156,14) 8%,
rgb(102,221,17) 90%
);
+
+ white-space: nowrap;
}
div.downloadbox a.main {
</div>
- <p><strong>OpenRocket</strong> is an free, fully featured model
+ <p><strong>OpenRocket</strong> is a free, fully featured model
rocket simulator that allows you to design and simulate your
rockets before actually building and flying them.</p>