Make exceptions show up in plots. Use the exception text in the
warnings.
This commit is contained in:
parent
f0ae25615e
commit
f19044f08d
@ -8,7 +8,7 @@ import net.sf.openrocket.unit.UnitGroup;
|
|||||||
public abstract class Warning {
|
public abstract class Warning {
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a Warning with the specific text.
|
* Return a Warning with the specific text.
|
||||||
*/
|
*/
|
||||||
@ -36,8 +36,8 @@ public abstract class Warning {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
return o != null && (o.getClass() == this.getClass());
|
return o != null && (o.getClass() == this.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <code>hashCode</code> method compatible with the <code>equals</code> method.
|
* A <code>hashCode</code> method compatible with the <code>equals</code> method.
|
||||||
@ -79,21 +79,21 @@ public abstract class Warning {
|
|||||||
return (trans.get("Warning.LargeAOA.str2") +
|
return (trans.get("Warning.LargeAOA.str2") +
|
||||||
UnitGroup.UNITS_ANGLE.getDefaultUnit().toString(aoa) + ").");
|
UnitGroup.UNITS_ANGLE.getDefaultUnit().toString(aoa) + ").");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceBy(Warning other) {
|
public boolean replaceBy(Warning other) {
|
||||||
if (!(other instanceof LargeAOA))
|
if (!(other instanceof LargeAOA))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LargeAOA o = (LargeAOA)other;
|
LargeAOA o = (LargeAOA) other;
|
||||||
if (Double.isNaN(this.aoa)) // If this has value NaN then replace
|
if (Double.isNaN(this.aoa)) // If this has value NaN then replace
|
||||||
return true;
|
return true;
|
||||||
return (o.aoa > this.aoa);
|
return (o.aoa > this.aoa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MissingMotor extends Warning {
|
public static class MissingMotor extends Warning {
|
||||||
|
|
||||||
private Motor.Type type = null;
|
private Motor.Type type = null;
|
||||||
private String manufacturer = null;
|
private String manufacturer = null;
|
||||||
private String designation = null;
|
private String designation = null;
|
||||||
@ -101,7 +101,7 @@ public abstract class Warning {
|
|||||||
private double diameter = Double.NaN;
|
private double diameter = Double.NaN;
|
||||||
private double length = Double.NaN;
|
private double length = Double.NaN;
|
||||||
private double delay = Double.NaN;
|
private double delay = Double.NaN;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String str = "No motor with designation '" + designation + "'";
|
String str = "No motor with designation '" + designation + "'";
|
||||||
@ -110,82 +110,82 @@ public abstract class Warning {
|
|||||||
str += " found.";
|
str += " found.";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Motor.Type getType() {
|
public Motor.Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setType(Motor.Type type) {
|
public void setType(Motor.Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getManufacturer() {
|
public String getManufacturer() {
|
||||||
return manufacturer;
|
return manufacturer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setManufacturer(String manufacturer) {
|
public void setManufacturer(String manufacturer) {
|
||||||
this.manufacturer = manufacturer;
|
this.manufacturer = manufacturer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getDesignation() {
|
public String getDesignation() {
|
||||||
return designation;
|
return designation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDesignation(String designation) {
|
public void setDesignation(String designation) {
|
||||||
this.designation = designation;
|
this.designation = designation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getDigest() {
|
public String getDigest() {
|
||||||
return digest;
|
return digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDigest(String digest) {
|
public void setDigest(String digest) {
|
||||||
this.digest = digest;
|
this.digest = digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getDiameter() {
|
public double getDiameter() {
|
||||||
return diameter;
|
return diameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDiameter(double diameter) {
|
public void setDiameter(double diameter) {
|
||||||
this.diameter = diameter;
|
this.diameter = diameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getLength() {
|
public double getLength() {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setLength(double length) {
|
public void setLength(double length) {
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getDelay() {
|
public double getDelay() {
|
||||||
return delay;
|
return delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDelay(double delay) {
|
public void setDelay(double delay) {
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceBy(Warning other) {
|
public boolean replaceBy(Warning other) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
@ -206,7 +206,7 @@ public abstract class Warning {
|
|||||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
@ -272,7 +272,7 @@ public abstract class Warning {
|
|||||||
if (!(other instanceof Other))
|
if (!(other instanceof Other))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Other o = (Other)other;
|
Other o = (Other) other;
|
||||||
return (o.description.equals(this.description));
|
return (o.description.equals(this.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ public abstract class Warning {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return description.hashCode();
|
return description.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceBy(Warning other) {
|
public boolean replaceBy(Warning other) {
|
||||||
return false;
|
return false;
|
||||||
@ -289,43 +289,40 @@ public abstract class Warning {
|
|||||||
|
|
||||||
|
|
||||||
/** A <code>Warning</code> that the body diameter is discontinuous. */
|
/** A <code>Warning</code> that the body diameter is discontinuous. */
|
||||||
////Discontinuity in rocket body diameter.
|
////Discontinuity in rocket body diameter.
|
||||||
public static final Warning DISCONTINUITY =
|
public static final Warning DISCONTINUITY =
|
||||||
new Other(trans.get("Warning.DISCONTINUITY"));
|
new Other(trans.get("Warning.DISCONTINUITY"));
|
||||||
|
|
||||||
/** A <code>Warning</code> that the fins are thick compared to the rocket body. */
|
/** A <code>Warning</code> that the fins are thick compared to the rocket body. */
|
||||||
////Thick fins may not be modeled accurately.
|
////Thick fins may not be modeled accurately.
|
||||||
public static final Warning THICK_FIN =
|
public static final Warning THICK_FIN =
|
||||||
new Other(trans.get("Warning.THICK_FIN"));
|
new Other(trans.get("Warning.THICK_FIN"));
|
||||||
|
|
||||||
/** A <code>Warning</code> that the fins have jagged edges. */
|
/** A <code>Warning</code> that the fins have jagged edges. */
|
||||||
////Jagged-edged fin predictions may be inaccurate.
|
////Jagged-edged fin predictions may be inaccurate.
|
||||||
public static final Warning JAGGED_EDGED_FIN =
|
public static final Warning JAGGED_EDGED_FIN =
|
||||||
new Other(trans.get("Warning.JAGGED_EDGED_FIN"));
|
new Other(trans.get("Warning.JAGGED_EDGED_FIN"));
|
||||||
|
|
||||||
/** A <code>Warning</code> that simulation listeners have affected the simulation */
|
/** A <code>Warning</code> that simulation listeners have affected the simulation */
|
||||||
////Listeners modified the flight simulation
|
////Listeners modified the flight simulation
|
||||||
public static final Warning LISTENERS_AFFECTED =
|
public static final Warning LISTENERS_AFFECTED =
|
||||||
new Other(trans.get("Warning.LISTENERS_AFFECTED"));
|
new Other(trans.get("Warning.LISTENERS_AFFECTED"));
|
||||||
|
|
||||||
////Recovery device opened while motor still burning.
|
////Recovery device opened while motor still burning.
|
||||||
public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING =
|
public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING =
|
||||||
new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
|
new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
|
||||||
|
|
||||||
|
|
||||||
//// Invalid parameter encountered, ignoring.
|
//// Invalid parameter encountered, ignoring.
|
||||||
public static final Warning FILE_INVALID_PARAMETER =
|
public static final Warning FILE_INVALID_PARAMETER =
|
||||||
new Other(trans.get("Warning.FILE_INVALID_PARAMETER"));
|
new Other(trans.get("Warning.FILE_INVALID_PARAMETER"));
|
||||||
|
|
||||||
public static final Warning PARALLEL_FINS =
|
public static final Warning PARALLEL_FINS =
|
||||||
new Other(trans.get("Warning.PARALLEL_FINS"));
|
new Other(trans.get("Warning.PARALLEL_FINS"));
|
||||||
|
|
||||||
public static final Warning SUPERSONIC =
|
public static final Warning SUPERSONIC =
|
||||||
new Other(trans.get("Warning.SUPERSONIC"));
|
new Other(trans.get("Warning.SUPERSONIC"));
|
||||||
|
|
||||||
public static final Warning RECOVERY_LAUNCH_ROD =
|
public static final Warning RECOVERY_LAUNCH_ROD =
|
||||||
new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
|
new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
|
||||||
|
|
||||||
public static final Warning SIMULATION_EXCEPTION =
|
|
||||||
new Other("Exception during simulation");
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Total motion vs. time
|
//// Total motion vs. time
|
||||||
@ -51,6 +52,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Flight side profile
|
//// Flight side profile
|
||||||
@ -63,6 +65,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Stability vs. time
|
//// Stability vs. time
|
||||||
@ -77,6 +80,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Drag coefficients vs. Mach number
|
//// Drag coefficients vs. Mach number
|
||||||
@ -86,6 +90,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.addPlotDataType(FlightDataType.TYPE_FRICTION_DRAG_COEFF, 0);
|
config.addPlotDataType(FlightDataType.TYPE_FRICTION_DRAG_COEFF, 0);
|
||||||
config.addPlotDataType(FlightDataType.TYPE_BASE_DRAG_COEFF, 0);
|
config.addPlotDataType(FlightDataType.TYPE_BASE_DRAG_COEFF, 0);
|
||||||
config.addPlotDataType(FlightDataType.TYPE_PRESSURE_DRAG_COEFF, 0);
|
config.addPlotDataType(FlightDataType.TYPE_PRESSURE_DRAG_COEFF, 0);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Roll characteristics
|
//// Roll characteristics
|
||||||
@ -102,6 +107,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Angle of attack and orientation vs. time
|
//// Angle of attack and orientation vs. time
|
||||||
@ -116,6 +122,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
//// Simulation time step and computation time
|
//// Simulation time step and computation time
|
||||||
@ -129,6 +136,7 @@ public class PlotConfiguration implements Cloneable {
|
|||||||
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
|
||||||
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
|
||||||
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
config.setEvent(FlightEvent.Type.TUMBLE, true);
|
||||||
|
config.setEvent(FlightEvent.Type.EXCEPTION, true);
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
|
|
||||||
DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]);
|
DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]);
|
||||||
|
@ -38,7 +38,7 @@ public class SimulationPlotDialog extends JDialog {
|
|||||||
private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) {
|
private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) {
|
||||||
//// Flight data plot
|
//// Flight data plot
|
||||||
super(parent, simulation.getName());
|
super(parent, simulation.getName());
|
||||||
this.setModalityType(ModalityType.MODELESS);
|
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
||||||
|
|
||||||
final boolean initialShowPoints = Application.getPreferences().getBoolean(Preferences.PLOT_SHOW_POINTS, false);
|
final boolean initialShowPoints = Application.getPreferences().getBoolean(Preferences.PLOT_SHOW_POINTS, false);
|
||||||
|
|
||||||
|
@ -395,6 +395,7 @@ public class SimulationRunDialog extends JDialog {
|
|||||||
log.debug("Simulation done");
|
log.debug("Simulation done");
|
||||||
setSimulationProgress(1.0);
|
setSimulationProgress(1.0);
|
||||||
updateProgress();
|
updateProgress();
|
||||||
|
SimulationWarningDialog.showWarningDialog(SimulationRunDialog.this, simulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
SimulationListenerHelper.fireEndSimulation(status, e);
|
SimulationListenerHelper.fireEndSimulation(status, e);
|
||||||
// Add FlightEvent for Abort.
|
// Add FlightEvent for Abort.
|
||||||
status.getFlightData().addEvent(new FlightEvent(FlightEvent.Type.EXCEPTION, status.getSimulationTime(), status.getConfiguration().getRocket(), e.getLocalizedMessage()));
|
status.getFlightData().addEvent(new FlightEvent(FlightEvent.Type.EXCEPTION, status.getSimulationTime(), status.getConfiguration().getRocket(), e.getLocalizedMessage()));
|
||||||
status.getWarnings().add(Warning.SIMULATION_EXCEPTION);
|
status.getWarnings().add(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return status.getFlightData();
|
return status.getFlightData();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user