- Implemented copying of custom expressions to other simulations in expression builder dialog. Note the small changes to various files are to allow simulations access to parent document.
- Switched to unicode char escapes - Removed dynamic setting of flightdatatype priority - Now hiding up down arrows in custom expression pane when unusable - Localized custom expression operator discriptions.
This commit is contained in:
parent
225d502896
commit
71b36bc481
@ -469,6 +469,8 @@ ExpressionBuilderDialog.InsertOperator = Insert Operator
|
|||||||
ExpressionBuilderDialog.led.ttip.Name = Name must not have already been used
|
ExpressionBuilderDialog.led.ttip.Name = Name must not have already been used
|
||||||
ExpressionBuilderDialog.led.ttip.Symbol = Symbol must not have already been used
|
ExpressionBuilderDialog.led.ttip.Symbol = Symbol must not have already been used
|
||||||
ExpressionBuilderDialog.led.ttip.Expression = Expression must use only known symbols and operators
|
ExpressionBuilderDialog.led.ttip.Expression = Expression must use only known symbols and operators
|
||||||
|
ExpressionBuilderDialog.CopyToOtherSimulations = Copy to other simulations
|
||||||
|
ExpressionBuilderDialog.CopyToOtherSimulations.ttip = <html>Make a copy of this expression in other simulations in this document.<br>Will not overwrite or modify any existing expressions in other simulations.
|
||||||
|
|
||||||
! Custom expression variable selector
|
! Custom expression variable selector
|
||||||
CustomVariableSelector.title = Variable Selector
|
CustomVariableSelector.title = Variable Selector
|
||||||
@ -476,6 +478,30 @@ CustomVariableSelector.title = Variable Selector
|
|||||||
! Custom operator selector
|
! Custom operator selector
|
||||||
CustomOperatorSelector.title = Operator Selector
|
CustomOperatorSelector.title = Operator Selector
|
||||||
|
|
||||||
|
! Operators
|
||||||
|
Operator.plus = Addition
|
||||||
|
Operator.minus = Subtraction
|
||||||
|
Operator.star = Multiplication
|
||||||
|
Operator.div = Divison
|
||||||
|
Operator.mod = Modulo
|
||||||
|
Operator.pow = Exponentiation
|
||||||
|
Operator.abs = Absolute value
|
||||||
|
Operator.ceil = Ceiling (next integer value
|
||||||
|
Operator.floor = Floor (previous integer value
|
||||||
|
Operator.sqrt = Square root
|
||||||
|
Operator.cbrt = Cubic root
|
||||||
|
Operator.exp = Euler\'s number raised to the value (e^x)
|
||||||
|
Operator.ln = Natural logarithm
|
||||||
|
Operator.sin = Sine
|
||||||
|
Operator.cos = Cosine
|
||||||
|
Operator.tan = Tangent
|
||||||
|
Operator.asin = Arc sine
|
||||||
|
Operator.acos = Arc cosine
|
||||||
|
Operator.atan = Arc tangent
|
||||||
|
Operator.hsin = Hyerbolic sine
|
||||||
|
Operator.hcos = Hyperbolic cosine
|
||||||
|
Operator.htan = Hyperbolic tangent
|
||||||
|
|
||||||
! MotorPlot
|
! MotorPlot
|
||||||
MotorPlot.title.Motorplot = Motor plot
|
MotorPlot.title.Motorplot = Motor plot
|
||||||
MotorPlot.but.Select = Select
|
MotorPlot.but.Select = Select
|
||||||
|
@ -61,6 +61,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
private SafetyMutex mutex = SafetyMutex.newInstance();
|
private SafetyMutex mutex = SafetyMutex.newInstance();
|
||||||
|
|
||||||
private final Rocket rocket;
|
private final Rocket rocket;
|
||||||
|
private final OpenRocketDocument document;
|
||||||
|
|
||||||
private String name = "";
|
private String name = "";
|
||||||
|
|
||||||
@ -90,12 +91,16 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new simulation for the rocket. The initial motor configuration is
|
* Create a new simulation for the rocket. Parent document should also be provided.
|
||||||
* taken from the default rocket configuration.
|
* The initial motor configuration is taken from the default rocket configuration.
|
||||||
*
|
*
|
||||||
* @param rocket the rocket associated with the simulation.
|
* @param rocket the rocket associated with the simulation.
|
||||||
*/
|
*/
|
||||||
public Simulation(Rocket rocket) {
|
public Simulation(OpenRocketDocument doc, Rocket rocket) {
|
||||||
|
// It may seem silly to pass in the document and rocket, since usually when called we
|
||||||
|
// use doc.getRocket, but I guess there is some reason; when cloning a simulation + rocket we don't need
|
||||||
|
// to make a duplicate of the undo data etc stored in the document. --Richard
|
||||||
|
this.document = doc;
|
||||||
this.rocket = rocket;
|
this.rocket = rocket;
|
||||||
this.status = Status.NOT_SIMULATED;
|
this.status = Status.NOT_SIMULATED;
|
||||||
|
|
||||||
@ -106,7 +111,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Simulation(Rocket rocket, Status status, String name, SimulationOptions options,
|
public Simulation(OpenRocketDocument doc, Rocket rocket, Status status, String name, SimulationOptions options,
|
||||||
List<String> listeners, FlightData data) {
|
List<String> listeners, FlightData data) {
|
||||||
|
|
||||||
if (rocket == null)
|
if (rocket == null)
|
||||||
@ -119,6 +124,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
throw new IllegalArgumentException("options cannot be null");
|
throw new IllegalArgumentException("options cannot be null");
|
||||||
|
|
||||||
this.rocket = rocket;
|
this.rocket = rocket;
|
||||||
|
this.document = doc;
|
||||||
|
|
||||||
if (status == Status.UPTODATE) {
|
if (status == Status.UPTODATE) {
|
||||||
this.status = Status.LOADED;
|
this.status = Status.LOADED;
|
||||||
@ -148,6 +154,13 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the parent document for this simulation
|
||||||
|
*/
|
||||||
|
public OpenRocketDocument getDocument(){
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
public void addCustomExpression(CustomExpression expression){
|
public void addCustomExpression(CustomExpression expression){
|
||||||
this.status = Simulation.Status.OUTDATED;
|
this.status = Simulation.Status.OUTDATED;
|
||||||
log.debug("Simulation must be run again to update custom expression.");
|
log.debug("Simulation must be run again to update custom expression.");
|
||||||
@ -427,7 +440,7 @@ public class Simulation implements ChangeSource, Cloneable {
|
|||||||
public Simulation duplicateSimulation(Rocket newRocket) {
|
public Simulation duplicateSimulation(Rocket newRocket) {
|
||||||
mutex.lock("duplicateSimulation");
|
mutex.lock("duplicateSimulation");
|
||||||
try {
|
try {
|
||||||
Simulation copy = new Simulation(newRocket);
|
Simulation copy = new Simulation(document, newRocket);
|
||||||
|
|
||||||
copy.name = this.name;
|
copy.name = this.name;
|
||||||
copy.options.copyFrom(this.options);
|
copy.options.copyFrom(this.options);
|
||||||
|
@ -1299,7 +1299,7 @@ class SingleSimulationHandler extends AbstractElementHandler {
|
|||||||
else
|
else
|
||||||
data = dataHandler.getFlightData();
|
data = dataHandler.getFlightData();
|
||||||
|
|
||||||
Simulation simulation = new Simulation(doc.getRocket(), status, name,
|
Simulation simulation = new Simulation(doc, doc.getRocket(), status, name,
|
||||||
conditions, listeners, data);
|
conditions, listeners, data);
|
||||||
|
|
||||||
// Note : arraylist implementation in simulation different from standard one
|
// Note : arraylist implementation in simulation different from standard one
|
||||||
@ -1704,7 +1704,15 @@ class FlightDataBranchHandler extends AbstractElementHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look in custom expressions
|
||||||
|
for (CustomExpression exp : simHandler.getCustomExpressions()){
|
||||||
|
if (exp.getName().equals(name) ){
|
||||||
|
return exp.getType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Look in custom expressions, meanwhile set priority based on order in file
|
// Look in custom expressions, meanwhile set priority based on order in file
|
||||||
|
/*
|
||||||
int totalExpressions = simHandler.getCustomExpressions().size();
|
int totalExpressions = simHandler.getCustomExpressions().size();
|
||||||
for (int i=0; i<totalExpressions; i++){
|
for (int i=0; i<totalExpressions; i++){
|
||||||
CustomExpression exp = simHandler.getCustomExpressions().get(i);
|
CustomExpression exp = simHandler.getCustomExpressions().get(i);
|
||||||
@ -1714,6 +1722,7 @@ class FlightDataBranchHandler extends AbstractElementHandler {
|
|||||||
return exp.getType();
|
return exp.getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
log.warn("Could not find the flight data type '"+name+"' used in the XML file. Substituted type with unknown symbol and units.");
|
log.warn("Could not find the flight data type '"+name+"' used in the XML file. Substituted type with unknown symbol and units.");
|
||||||
return FlightDataType.getType(name, "Unknown", UnitGroup.UNITS_NONE);
|
return FlightDataType.getType(name, "Unknown", UnitGroup.UNITS_NONE);
|
||||||
|
@ -69,16 +69,15 @@ public class CustomExpressionPanel extends JPanel {
|
|||||||
private void updateExpressions(){
|
private void updateExpressions(){
|
||||||
|
|
||||||
expressionSelectorPanel.removeAll();
|
expressionSelectorPanel.removeAll();
|
||||||
for (CustomExpression expression : simulation.getCustomExpressions()){
|
int totalExpressions = simulation.getCustomExpressions().size();
|
||||||
SingleExpression se = new SingleExpression(expression);
|
for (int i=0; i<totalExpressions; i++){
|
||||||
|
SingleExpression se = new SingleExpression(simulation.getCustomExpressions().get(i), i != 0, i != totalExpressions-1);
|
||||||
expressionSelectorPanel.add(se, "wrap");
|
expressionSelectorPanel.add(se, "wrap");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: High : Find out why repaint method not working properly here.
|
//TODO: High : Find out why repaint method not working properly here.
|
||||||
//expressionSelectorPanel.repaint();
|
//expressionSelectorPanel.repaint();
|
||||||
expressionSelectorPanel.updateUI(); // Not the correct method to use but works
|
expressionSelectorPanel.updateUI(); // Not the correct method to use but works
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteExpression(CustomExpression expression){
|
private void deleteExpression(CustomExpression expression){
|
||||||
@ -114,7 +113,7 @@ public class CustomExpressionPanel extends JPanel {
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SingleExpression(final CustomExpression expression) {
|
private SingleExpression(final CustomExpression expression, boolean showUp, boolean showDown) {
|
||||||
super(new MigLayout("ins 0"));
|
super(new MigLayout("ins 0"));
|
||||||
// name: aName symbol: a Unit: m/s
|
// name: aName symbol: a Unit: m/s
|
||||||
//super(new MigLayout("","[::100][:200:400][::100][:100:200][::100][:100:200]",""));
|
//super(new MigLayout("","[::100][:200:400][::100][:100:200][::100][:100:200]",""));
|
||||||
@ -145,6 +144,7 @@ public class CustomExpressionPanel extends JPanel {
|
|||||||
JButton upButton = new JButton(Icons.UP);
|
JButton upButton = new JButton(Icons.UP);
|
||||||
upButton.setToolTipText(trans.get("customExpression.Units.but.ttip.MoveUp"));
|
upButton.setToolTipText(trans.get("customExpression.Units.but.ttip.MoveUp"));
|
||||||
upButton.setBorderPainted(false);
|
upButton.setBorderPainted(false);
|
||||||
|
upButton.setVisible(showUp);
|
||||||
upButton.addActionListener( new ActionListener() {
|
upButton.addActionListener( new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -156,6 +156,7 @@ public class CustomExpressionPanel extends JPanel {
|
|||||||
JButton downButton = new JButton(Icons.DOWN);
|
JButton downButton = new JButton(Icons.DOWN);
|
||||||
downButton.setToolTipText(trans.get("customExpression.Units.but.ttip.MoveDown"));
|
downButton.setToolTipText(trans.get("customExpression.Units.but.ttip.MoveDown"));
|
||||||
downButton.setBorderPainted(false);
|
downButton.setBorderPainted(false);
|
||||||
|
downButton.setVisible(showDown);
|
||||||
downButton.addActionListener( new ActionListener() {
|
downButton.addActionListener( new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -10,10 +10,12 @@ import java.awt.event.KeyListener;
|
|||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@ -172,13 +174,23 @@ public class ExpressionBuilderDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//// Copy expression check box
|
||||||
|
final JCheckBox copyCheckBox = new JCheckBox(trans.get("ExpressionBuilderDialog.CopyToOtherSimulations"));
|
||||||
|
copyCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
|
||||||
|
copyCheckBox.setToolTipText(trans.get("ExpressionBuilderDialog.CopyToOtherSimulations.ttip"));
|
||||||
|
|
||||||
//// OK Button
|
//// OK Button
|
||||||
okButton.setEnabled(false);
|
okButton.setEnabled(false);
|
||||||
okButton.addActionListener(new ActionListener() {
|
okButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
// add to this simulation
|
||||||
expression.addToSimulation();
|
expression.addToSimulation();
|
||||||
|
if (copyCheckBox.isSelected()){
|
||||||
|
expression.copyToOtherSimulations();
|
||||||
|
}
|
||||||
|
|
||||||
|
// close window
|
||||||
ExpressionBuilderDialog.this.dispose();
|
ExpressionBuilderDialog.this.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -214,6 +226,7 @@ public class ExpressionBuilderDialog extends JDialog {
|
|||||||
mainPanel.add(expressionCheck, "wrap, center");
|
mainPanel.add(expressionCheck, "wrap, center");
|
||||||
mainPanel.add(insertOperatorButton, "span 2, right, split 2");
|
mainPanel.add(insertOperatorButton, "span 2, right, split 2");
|
||||||
mainPanel.add(insertVariableButton, "right, wrap");
|
mainPanel.add(insertVariableButton, "right, wrap");
|
||||||
|
mainPanel.add(copyCheckBox, "span 2, right, wrap");
|
||||||
mainPanel.add(cancelButton, "span 2, right, width :50:100");
|
mainPanel.add(cancelButton, "span 2, right, width :50:100");
|
||||||
mainPanel.add(okButton, "right, width :50:100, wrap");
|
mainPanel.add(okButton, "right, width :50:100, wrap");
|
||||||
|
|
||||||
|
@ -1000,14 +1000,14 @@ public class GeneralOptimizationDialog extends JDialog {
|
|||||||
if (id == null) {
|
if (id == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Simulation sim = new Simulation(rocket);
|
Simulation sim = new Simulation(documentCopy, rocket);
|
||||||
sim.getConfiguration().setMotorConfigurationID(id);
|
sim.getConfiguration().setMotorConfigurationID(id);
|
||||||
String name = createSimulationName(trans.get("basicSimulationName"), rocket.getMotorConfigurationNameOrDescription(id));
|
String name = createSimulationName(trans.get("basicSimulationName"), rocket.getMotorConfigurationNameOrDescription(id));
|
||||||
simulations.add(new Named<Simulation>(sim, name));
|
simulations.add(new Named<Simulation>(sim, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Simulation sim = new Simulation(rocket);
|
Simulation sim = new Simulation(documentCopy, rocket);
|
||||||
sim.getConfiguration().setMotorConfigurationID(null);
|
sim.getConfiguration().setMotorConfigurationID(null);
|
||||||
String name = createSimulationName(trans.get("noSimulationName"), rocket.getMotorConfigurationNameOrDescription(null));
|
String name = createSimulationName(trans.get("noSimulationName"), rocket.getMotorConfigurationNameOrDescription(null));
|
||||||
simulations.add(new Named<Simulation>(sim, name));
|
simulations.add(new Named<Simulation>(sim, name));
|
||||||
|
@ -82,7 +82,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Simulation sim = new Simulation(document.getRocket());
|
Simulation sim = new Simulation(document, document.getRocket());
|
||||||
sim.setName(document.getNextSimulationName());
|
sim.setName(document.getNextSimulationName());
|
||||||
|
|
||||||
int n = document.getSimulationCount();
|
int n = document.getSimulationCount();
|
||||||
|
@ -15,6 +15,7 @@ import java.util.prefs.BackingStoreException;
|
|||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
import net.sf.openrocket.arch.SystemInfo;
|
import net.sf.openrocket.arch.SystemInfo;
|
||||||
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.logging.LogHelper;
|
import net.sf.openrocket.logging.LogHelper;
|
||||||
import net.sf.openrocket.material.Material;
|
import net.sf.openrocket.material.Material;
|
||||||
@ -398,7 +399,7 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Simulation getBackgroundSimulation(Rocket rocket) {
|
public Simulation getBackgroundSimulation(Rocket rocket) {
|
||||||
Simulation s = new Simulation(rocket);
|
Simulation s = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
SimulationOptions cond = s.getOptions();
|
SimulationOptions cond = s.getOptions();
|
||||||
|
|
||||||
cond.setTimeStep(RK4SimulationStepper.RECOMMENDED_TIME_STEP * 2);
|
cond.setTimeStep(RK4SimulationStepper.RECOMMENDED_TIME_STEP * 2);
|
||||||
|
@ -126,7 +126,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
|||||||
Rocket rocket = document.getRocket();
|
Rocket rocket = document.getRocket();
|
||||||
|
|
||||||
// Simulation is used to calculate default min/max values
|
// Simulation is used to calculate default min/max values
|
||||||
Simulation simulation = new Simulation(rocket);
|
Simulation simulation = new Simulation(document, rocket);
|
||||||
simulation.getConfiguration().setMotorConfigurationID(null);
|
simulation.getConfiguration().setMotorConfigurationID(null);
|
||||||
|
|
||||||
for (RocketComponent c : rocket) {
|
for (RocketComponent c : rocket) {
|
||||||
|
@ -4,6 +4,7 @@ import java.util.SortedMap;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.logging.LogHelper;
|
import net.sf.openrocket.logging.LogHelper;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.FixedUnitGroup;
|
import net.sf.openrocket.unit.FixedUnitGroup;
|
||||||
@ -21,6 +22,7 @@ import de.congrace.exp4j.ExpressionBuilder;
|
|||||||
public class CustomExpression implements Cloneable{
|
public class CustomExpression implements Cloneable{
|
||||||
|
|
||||||
private static final LogHelper log = Application.getLogger();
|
private static final LogHelper log = Application.getLogger();
|
||||||
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
private String name, symbol, unit, expression;
|
private String name, symbol, unit, expression;
|
||||||
private ExpressionBuilder builder;
|
private ExpressionBuilder builder;
|
||||||
@ -28,31 +30,30 @@ public class CustomExpression implements Cloneable{
|
|||||||
|
|
||||||
// A map of available operator strings (keys) and description of function (value)
|
// A map of available operator strings (keys) and description of function (value)
|
||||||
public static final SortedMap<String, String> AVAILABLE_OPERATORS = new TreeMap<String, String>() {{
|
public static final SortedMap<String, String> AVAILABLE_OPERATORS = new TreeMap<String, String>() {{
|
||||||
put("+" , "Addition");
|
put("+" , trans.get("Operator.plus"));
|
||||||
put("-" , "Subtraction");
|
put("-" , trans.get("Operator.minus"));
|
||||||
put("*" , "Multiplication");
|
put("*" , trans.get("Operator.star"));
|
||||||
put("/" , "Divison");
|
put("/" , trans.get("Operator.div"));
|
||||||
put("%" , "Modulo");
|
put("%" , trans.get("Operator.mod"));
|
||||||
put("^" , "Exponentiation");
|
put("^" , trans.get("Operator.pow"));
|
||||||
put("abs()" , "Absolute value");
|
put("abs()" , trans.get("Operator.abs"));
|
||||||
put("ceil()" , "Ceiling (next integer value");
|
put("ceil()" , trans.get("Operator.ceil"));
|
||||||
put("floor()" , "Floor (previous integer value");
|
put("floor()" , trans.get("Operator.floor"));
|
||||||
put("sqrt()" , "Square root");
|
put("sqrt()" , trans.get("Operator.sqrt"));
|
||||||
put("cbrt()" , "Cubic root");
|
put("cbrt()" , trans.get("Operator.cbrt"));
|
||||||
put("exp()" , "Euler\'s number raised to the value (e^x)");
|
put("exp()" , trans.get("Operator.exp"));
|
||||||
put("log()" , "Natural logarithm");
|
put("log()" , trans.get("Operator.ln"));
|
||||||
put("sin()" , "Sine");
|
put("sin()" , trans.get("Operator.sin"));
|
||||||
put("cos()" , "Cosine");
|
put("cos()" , trans.get("Operator.cos"));
|
||||||
put("tan()" , "Tangent");
|
put("tan()" , trans.get("Operator.tan"));
|
||||||
put("asin()" , "Arc sine");
|
put("asin()" , trans.get("Operator.asin"));
|
||||||
put("acos()" , "Arc cosine");
|
put("acos()" , trans.get("Operator.acos"));
|
||||||
put("atan()" , "Arc tangent");
|
put("atan()" , trans.get("Operator.atan"));
|
||||||
put("sinh()" , "Hyerbolic sine");
|
put("sinh()" , trans.get("Operator.hsin"));
|
||||||
put("cosh()" , "Hyperbolic cosine");
|
put("cosh()" , trans.get("Operator.hcos"));
|
||||||
put("tanh()" , "Hyperbolic tangent");
|
put("tanh()" , trans.get("Operator.htan"));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
public CustomExpression(){
|
public CustomExpression(){
|
||||||
setName("");
|
setName("");
|
||||||
setSymbol("");
|
setSymbol("");
|
||||||
@ -94,7 +95,6 @@ public class CustomExpression implements Cloneable{
|
|||||||
return new FlightDataBranch();
|
return new FlightDataBranch();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Using existing branch");
|
|
||||||
return sim.getSimulatedData().getBranch(0);
|
return sim.getSimulatedData().getBranch(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ public class CustomExpression implements Cloneable{
|
|||||||
ArrayList<String> names = getAllNames().clone();
|
ArrayList<String> names = getAllNames().clone();
|
||||||
if (names.contains(name.trim())){
|
if (names.contains(name.trim())){
|
||||||
int index = names.indexOf(name.trim());
|
int index = names.indexOf(name.trim());
|
||||||
log.user("Symbol "+symbol+" already exists, found "+names.get(index));
|
log.user("Name "+name+" already exists, found "+names.get(index));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,20 +271,21 @@ public class CustomExpression implements Cloneable{
|
|||||||
FlightDataType type = FlightDataType.getType(name, symbol, ug);
|
FlightDataType type = FlightDataType.getType(name, symbol, ug);
|
||||||
|
|
||||||
// If in a simulation, figure out priority from order in array so that customs expressions are always at the top
|
// If in a simulation, figure out priority from order in array so that customs expressions are always at the top
|
||||||
if (sim != null && sim.getCustomExpressions().contains(this)){
|
//if (sim != null && sim.getCustomExpressions().contains(this)){
|
||||||
int totalExpressions = sim.getCustomExpressions().size();
|
// int totalExpressions = sim.getCustomExpressions().size();
|
||||||
int p = -1*(totalExpressions-sim.getCustomExpressions().indexOf(this));
|
// int p = -1*(totalExpressions-sim.getCustomExpressions().indexOf(this));
|
||||||
type.setPriority(p);
|
// type.setPriority(p);
|
||||||
}
|
//}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add this expression to the simulation if not already added
|
* Add this expression to the simulation if valid and not already added
|
||||||
*/
|
*/
|
||||||
public void addToSimulation(){
|
public void addToSimulation(){
|
||||||
if (! sim.getCustomExpressions().contains(this))
|
// Abort if exact expression already in
|
||||||
|
if ( !sim.getCustomExpressions().contains(this) && this.checkAll() )
|
||||||
sim.addCustomExpression( this );
|
sim.addCustomExpression( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,6 +301,18 @@ public class CustomExpression implements Cloneable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a copy to other simulations in this document if possible
|
||||||
|
* Will not overwrite existing expressions
|
||||||
|
*/
|
||||||
|
public void copyToOtherSimulations(){
|
||||||
|
for (Simulation s : this.getSimulation().getDocument().getSimulations()){
|
||||||
|
CustomExpression newExpression = (CustomExpression) this.clone();
|
||||||
|
newExpression.setSimulation(s);
|
||||||
|
newExpression.addToSimulation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return "Custom expression : "+this.name.toString()+ " " + this.expression.toString();
|
return "Custom expression : "+this.name.toString()+ " " + this.expression.toString();
|
||||||
@ -307,7 +320,8 @@ public class CustomExpression implements Cloneable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
/*
|
/*
|
||||||
* Clone method makes a deep copy of everything except the simulation
|
* Clone method makes a deep copy of everything except the simulation.
|
||||||
|
* If you want to apply this to another simulation, set simulation manually after cloning.
|
||||||
* @see java.lang.Object#clone()
|
* @see java.lang.Object#clone()
|
||||||
*/
|
*/
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
|
@ -59,25 +59,25 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
//// Lateral distance
|
//// Lateral distance
|
||||||
public static final FlightDataType TYPE_POSITION_XY = newType(trans.get("FlightDataType.TYPE_POSITION_XY"), "Pl", UnitGroup.UNITS_DISTANCE, 32);
|
public static final FlightDataType TYPE_POSITION_XY = newType(trans.get("FlightDataType.TYPE_POSITION_XY"), "Pl", UnitGroup.UNITS_DISTANCE, 32);
|
||||||
//// Lateral direction
|
//// Lateral direction
|
||||||
public static final FlightDataType TYPE_POSITION_DIRECTION = newType(trans.get("FlightDataType.TYPE_POSITION_DIRECTION"), "θl", UnitGroup.UNITS_ANGLE, 33);
|
public static final FlightDataType TYPE_POSITION_DIRECTION = newType(trans.get("FlightDataType.TYPE_POSITION_DIRECTION"), "\u03b8l", UnitGroup.UNITS_ANGLE, 33);
|
||||||
//// Lateral velocity
|
//// Lateral velocity
|
||||||
public static final FlightDataType TYPE_VELOCITY_XY = newType(trans.get("FlightDataType.TYPE_VELOCITY_XY"), "Vl", UnitGroup.UNITS_VELOCITY, 34);
|
public static final FlightDataType TYPE_VELOCITY_XY = newType(trans.get("FlightDataType.TYPE_VELOCITY_XY"), "Vl", UnitGroup.UNITS_VELOCITY, 34);
|
||||||
//// Lateral acceleration
|
//// Lateral acceleration
|
||||||
public static final FlightDataType TYPE_ACCELERATION_XY = newType(trans.get("FlightDataType.TYPE_ACCELERATION_XY"), "Al", UnitGroup.UNITS_ACCELERATION, 35);
|
public static final FlightDataType TYPE_ACCELERATION_XY = newType(trans.get("FlightDataType.TYPE_ACCELERATION_XY"), "Al", UnitGroup.UNITS_ACCELERATION, 35);
|
||||||
//// Latitude
|
//// Latitude
|
||||||
public static final FlightDataType TYPE_LATITUDE = newType(trans.get("FlightDataType.TYPE_LATITUDE"), "φ", UnitGroup.UNITS_ANGLE, 36);
|
public static final FlightDataType TYPE_LATITUDE = newType(trans.get("FlightDataType.TYPE_LATITUDE"), "\u03c6", UnitGroup.UNITS_ANGLE, 36);
|
||||||
//// Longitude
|
//// Longitude
|
||||||
public static final FlightDataType TYPE_LONGITUDE = newType(trans.get("FlightDataType.TYPE_LONGITUDE"), "λ", UnitGroup.UNITS_ANGLE, 37);
|
public static final FlightDataType TYPE_LONGITUDE = newType(trans.get("FlightDataType.TYPE_LONGITUDE"), "\u03bb", UnitGroup.UNITS_ANGLE, 37);
|
||||||
|
|
||||||
//// Angular motion
|
//// Angular motion
|
||||||
//// Angle of attack
|
//// Angle of attack
|
||||||
public static final FlightDataType TYPE_AOA = newType(trans.get("FlightDataType.TYPE_AOA"), "α", UnitGroup.UNITS_ANGLE, 40);
|
public static final FlightDataType TYPE_AOA = newType(trans.get("FlightDataType.TYPE_AOA"), "\u03b1", UnitGroup.UNITS_ANGLE, 40);
|
||||||
//// Roll rate
|
//// Roll rate
|
||||||
public static final FlightDataType TYPE_ROLL_RATE = newType(trans.get("FlightDataType.TYPE_ROLL_RATE"), "dΦ", UnitGroup.UNITS_ROLL, 41);
|
public static final FlightDataType TYPE_ROLL_RATE = newType(trans.get("FlightDataType.TYPE_ROLL_RATE"), "d\u03a6", UnitGroup.UNITS_ROLL, 41);
|
||||||
//// Pitch rate
|
//// Pitch rate
|
||||||
public static final FlightDataType TYPE_PITCH_RATE = newType(trans.get("FlightDataType.TYPE_PITCH_RATE"), "dθ", UnitGroup.UNITS_ROLL, 42);
|
public static final FlightDataType TYPE_PITCH_RATE = newType(trans.get("FlightDataType.TYPE_PITCH_RATE"), "d\u03b8", UnitGroup.UNITS_ROLL, 42);
|
||||||
//// Yaw rate
|
//// Yaw rate
|
||||||
public static final FlightDataType TYPE_YAW_RATE = newType(trans.get("FlightDataType.TYPE_YAW_RATE"), "dΨ", UnitGroup.UNITS_ROLL, 43);
|
public static final FlightDataType TYPE_YAW_RATE = newType(trans.get("FlightDataType.TYPE_YAW_RATE"), "d\u03a8", UnitGroup.UNITS_ROLL, 43);
|
||||||
|
|
||||||
|
|
||||||
//// Stability information
|
//// Stability information
|
||||||
@ -126,22 +126,22 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
//// Normal force coefficient
|
//// Normal force coefficient
|
||||||
public static final FlightDataType TYPE_NORMAL_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_NORMAL_FORCE_COEFF"), "Cn", UnitGroup.UNITS_COEFFICIENT, 90);
|
public static final FlightDataType TYPE_NORMAL_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_NORMAL_FORCE_COEFF"), "Cn", UnitGroup.UNITS_COEFFICIENT, 90);
|
||||||
//// Pitch moment coefficient
|
//// Pitch moment coefficient
|
||||||
public static final FlightDataType TYPE_PITCH_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_MOMENT_COEFF"), "Cθ", UnitGroup.UNITS_COEFFICIENT, 91);
|
public static final FlightDataType TYPE_PITCH_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_MOMENT_COEFF"), "C\u03b8", UnitGroup.UNITS_COEFFICIENT, 91);
|
||||||
//// Yaw moment coefficient
|
//// Yaw moment coefficient
|
||||||
public static final FlightDataType TYPE_YAW_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_MOMENT_COEFF"), "CτΨ", UnitGroup.UNITS_COEFFICIENT, 92);
|
public static final FlightDataType TYPE_YAW_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_MOMENT_COEFF"), "C\u03c4\u03a8", UnitGroup.UNITS_COEFFICIENT, 92);
|
||||||
//// Side force coefficient
|
//// Side force coefficient
|
||||||
public static final FlightDataType TYPE_SIDE_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_SIDE_FORCE_COEFF"), "Cτs", UnitGroup.UNITS_COEFFICIENT, 93);
|
public static final FlightDataType TYPE_SIDE_FORCE_COEFF = newType(trans.get("FlightDataType.TYPE_SIDE_FORCE_COEFF"), "C\u03c4s", UnitGroup.UNITS_COEFFICIENT, 93);
|
||||||
//// Roll moment coefficient
|
//// Roll moment coefficient
|
||||||
public static final FlightDataType TYPE_ROLL_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_MOMENT_COEFF"), "CτΦ", UnitGroup.UNITS_COEFFICIENT, 94);
|
public static final FlightDataType TYPE_ROLL_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_MOMENT_COEFF"), "C\u03c4\u03a6", UnitGroup.UNITS_COEFFICIENT, 94);
|
||||||
//// Roll forcing coefficient
|
//// Roll forcing coefficient
|
||||||
public static final FlightDataType TYPE_ROLL_FORCING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_FORCING_COEFF"), "CfΦ", UnitGroup.UNITS_COEFFICIENT, 95);
|
public static final FlightDataType TYPE_ROLL_FORCING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_FORCING_COEFF"), "Cf\u03a6", UnitGroup.UNITS_COEFFICIENT, 95);
|
||||||
//// Roll damping coefficient
|
//// Roll damping coefficient
|
||||||
public static final FlightDataType TYPE_ROLL_DAMPING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_DAMPING_COEFF"), "CζΦ", UnitGroup.UNITS_COEFFICIENT, 96);
|
public static final FlightDataType TYPE_ROLL_DAMPING_COEFF = newType(trans.get("FlightDataType.TYPE_ROLL_DAMPING_COEFF"), "C\u03b6\u03a6", UnitGroup.UNITS_COEFFICIENT, 96);
|
||||||
|
|
||||||
//// Pitch damping coefficient
|
//// Pitch damping coefficient
|
||||||
public static final FlightDataType TYPE_PITCH_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_DAMPING_MOMENT_COEFF"), "Cζθ", UnitGroup.UNITS_COEFFICIENT, 97);
|
public static final FlightDataType TYPE_PITCH_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_PITCH_DAMPING_MOMENT_COEFF"), "C\u03b6\u03b8", UnitGroup.UNITS_COEFFICIENT, 97);
|
||||||
//// Yaw damping coefficient
|
//// Yaw damping coefficient
|
||||||
public static final FlightDataType TYPE_YAW_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_DAMPING_MOMENT_COEFF"), "CζΨ", UnitGroup.UNITS_COEFFICIENT, 98);
|
public static final FlightDataType TYPE_YAW_DAMPING_MOMENT_COEFF = newType(trans.get("FlightDataType.TYPE_YAW_DAMPING_MOMENT_COEFF"), "C\u03b6\u03a8", UnitGroup.UNITS_COEFFICIENT, 98);
|
||||||
|
|
||||||
//// Coriolis acceleration
|
//// Coriolis acceleration
|
||||||
public static final FlightDataType TYPE_CORIOLIS_ACCELERATION = newType(trans.get("FlightDataType.TYPE_CORIOLIS_ACCELERATION"), "Ac", UnitGroup.UNITS_ACCELERATION, 99);
|
public static final FlightDataType TYPE_CORIOLIS_ACCELERATION = newType(trans.get("FlightDataType.TYPE_CORIOLIS_ACCELERATION"), "Ac", UnitGroup.UNITS_ACCELERATION, 99);
|
||||||
@ -156,9 +156,9 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
|
|
||||||
//// Orientation
|
//// Orientation
|
||||||
//// Vertical orientation (zenith)
|
//// Vertical orientation (zenith)
|
||||||
public static final FlightDataType TYPE_ORIENTATION_THETA = newType(trans.get("FlightDataType.TYPE_ORIENTATION_THETA"), "Θ", UnitGroup.UNITS_ANGLE, 106);
|
public static final FlightDataType TYPE_ORIENTATION_THETA = newType(trans.get("FlightDataType.TYPE_ORIENTATION_THETA"), "\u0398", UnitGroup.UNITS_ANGLE, 106);
|
||||||
//// Lateral orientation (azimuth)
|
//// Lateral orientation (azimuth)
|
||||||
public static final FlightDataType TYPE_ORIENTATION_PHI = newType(trans.get("FlightDataType.TYPE_ORIENTATION_PHI"), "Φ", UnitGroup.UNITS_ANGLE, 107);
|
public static final FlightDataType TYPE_ORIENTATION_PHI = newType(trans.get("FlightDataType.TYPE_ORIENTATION_PHI"), "\u03a6", UnitGroup.UNITS_ANGLE, 107);
|
||||||
|
|
||||||
|
|
||||||
//// Atmospheric conditions
|
//// Atmospheric conditions
|
||||||
@ -177,7 +177,6 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
//// Computation time
|
//// Computation time
|
||||||
public static final FlightDataType TYPE_COMPUTATION_TIME = newType(trans.get("FlightDataType.TYPE_COMPUTATION_TIME"), "tc", UnitGroup.UNITS_SHORT_TIME, 201);
|
public static final FlightDataType TYPE_COMPUTATION_TIME = newType(trans.get("FlightDataType.TYPE_COMPUTATION_TIME"), "tc", UnitGroup.UNITS_SHORT_TIME, 201);
|
||||||
|
|
||||||
|
|
||||||
// An array of all the built in types
|
// An array of all the built in types
|
||||||
public static final FlightDataType[] ALL_TYPES = {
|
public static final FlightDataType[] ALL_TYPES = {
|
||||||
TYPE_TIME,
|
TYPE_TIME,
|
||||||
@ -273,7 +272,7 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final String symbol;
|
private final String symbol;
|
||||||
private final UnitGroup units;
|
private final UnitGroup units;
|
||||||
private int priority;
|
private final int priority;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
|
|
||||||
@ -289,10 +288,11 @@ public class FlightDataType implements Comparable<FlightDataType> {
|
|||||||
this.hashCode = this.name.toLowerCase(Locale.ENGLISH).hashCode();
|
this.hashCode = this.name.toLowerCase(Locale.ENGLISH).hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public void setPriority(int p){
|
public void setPriority(int p){
|
||||||
this.priority = p;
|
this.priority = p;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.sf.openrocket.optimization.rocketoptimization;
|
package net.sf.openrocket.optimization.rocketoptimization;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.optimization.general.OptimizationException;
|
import net.sf.openrocket.optimization.general.OptimizationException;
|
||||||
import net.sf.openrocket.optimization.general.Point;
|
import net.sf.openrocket.optimization.general.Point;
|
||||||
@ -39,7 +40,7 @@ public class TestRocketOptimizationFunction {
|
|||||||
@Test
|
@Test
|
||||||
public void testNormalEvaluation() throws InterruptedException, OptimizationException {
|
public void testNormalEvaluation() throws InterruptedException, OptimizationException {
|
||||||
final Rocket rocket = new Rocket();
|
final Rocket rocket = new Rocket();
|
||||||
final Simulation simulation = new Simulation(rocket);
|
final Simulation simulation = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
|
|
||||||
final double p1 = 0.4;
|
final double p1 = 0.4;
|
||||||
final double p2 = 0.7;
|
final double p2 = 0.7;
|
||||||
@ -85,7 +86,7 @@ public class TestRocketOptimizationFunction {
|
|||||||
@Test
|
@Test
|
||||||
public void testNaNValue() throws InterruptedException, OptimizationException {
|
public void testNaNValue() throws InterruptedException, OptimizationException {
|
||||||
final Rocket rocket = new Rocket();
|
final Rocket rocket = new Rocket();
|
||||||
final Simulation simulation = new Simulation(rocket);
|
final Simulation simulation = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
|
|
||||||
final double p1 = 0.4;
|
final double p1 = 0.4;
|
||||||
final double p2 = 0.7;
|
final double p2 = 0.7;
|
||||||
@ -122,7 +123,7 @@ public class TestRocketOptimizationFunction {
|
|||||||
@Test
|
@Test
|
||||||
public void testOutsideDomain() throws InterruptedException, OptimizationException {
|
public void testOutsideDomain() throws InterruptedException, OptimizationException {
|
||||||
final Rocket rocket = new Rocket();
|
final Rocket rocket = new Rocket();
|
||||||
final Simulation simulation = new Simulation(rocket);
|
final Simulation simulation = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
|
|
||||||
final double p1 = 0.4;
|
final double p1 = 0.4;
|
||||||
final double p2 = 0.7;
|
final double p2 = 0.7;
|
||||||
@ -163,7 +164,7 @@ public class TestRocketOptimizationFunction {
|
|||||||
@Test
|
@Test
|
||||||
public void testOutsideDomain2() throws InterruptedException, OptimizationException {
|
public void testOutsideDomain2() throws InterruptedException, OptimizationException {
|
||||||
final Rocket rocket = new Rocket();
|
final Rocket rocket = new Rocket();
|
||||||
final Simulation simulation = new Simulation(rocket);
|
final Simulation simulation = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
|
|
||||||
final double p1 = 0.4;
|
final double p1 = 0.4;
|
||||||
final double p2 = 0.7;
|
final double p2 = 0.7;
|
||||||
@ -196,7 +197,7 @@ public class TestRocketOptimizationFunction {
|
|||||||
public void testNewSimulationInstance() {
|
public void testNewSimulationInstance() {
|
||||||
final Rocket rocket = new Rocket();
|
final Rocket rocket = new Rocket();
|
||||||
rocket.setName("Foobar");
|
rocket.setName("Foobar");
|
||||||
final Simulation simulation = new Simulation(rocket);
|
final Simulation simulation = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
simulation.setName("MySim");
|
simulation.setName("MySim");
|
||||||
|
|
||||||
RocketOptimizationFunction function = new RocketOptimizationFunction(simulation,
|
RocketOptimizationFunction function = new RocketOptimizationFunction(simulation,
|
||||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.optimization.rocketoptimization.modifiers;
|
|||||||
|
|
||||||
import static net.sf.openrocket.util.MathUtil.EPSILON;
|
import static net.sf.openrocket.util.MathUtil.EPSILON;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.optimization.general.OptimizationException;
|
import net.sf.openrocket.optimization.general.OptimizationException;
|
||||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
@ -20,7 +21,9 @@ public class TestGenericModifier {
|
|||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
value = new TestValue();
|
value = new TestValue();
|
||||||
sim = new Simulation(new Rocket());
|
Rocket rocket = new Rocket();
|
||||||
|
|
||||||
|
sim = new Simulation(new OpenRocketDocument(rocket), rocket);
|
||||||
|
|
||||||
Object related = new Object();
|
Object related = new Object();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user