Make exceptions show up in plots. Use the exception text in the

warnings.
This commit is contained in:
kruland2607 2013-05-23 12:08:03 -05:00
parent f0ae25615e
commit f19044f08d
5 changed files with 69 additions and 63 deletions

View File

@ -36,8 +36,8 @@ public abstract class Warning {
*/
@Override
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.
@ -85,8 +85,8 @@ public abstract class Warning {
if (!(other instanceof LargeAOA))
return false;
LargeAOA o = (LargeAOA)other;
if (Double.isNaN(this.aoa)) // If this has value NaN then replace
LargeAOA o = (LargeAOA) other;
if (Double.isNaN(this.aoa)) // If this has value NaN then replace
return true;
return (o.aoa > this.aoa);
}
@ -272,7 +272,7 @@ public abstract class Warning {
if (!(other instanceof Other))
return false;
Other o = (Other)other;
Other o = (Other) other;
return (o.description.equals(this.description));
}
@ -289,43 +289,40 @@ public abstract class Warning {
/** 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 =
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. */
////Thick fins may not be modeled accurately.
////Thick fins may not be modeled accurately.
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. */
////Jagged-edged fin predictions may be inaccurate.
////Jagged-edged fin predictions may be inaccurate.
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 */
////Listeners modified the flight simulation
////Listeners modified the flight simulation
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 =
new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING"));
//// Invalid parameter encountered, ignoring.
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 =
new Other(trans.get("Warning.PARALLEL_FINS"));
new Other(trans.get("Warning.PARALLEL_FINS"));
public static final Warning SUPERSONIC =
new Other(trans.get("Warning.SUPERSONIC"));
new Other(trans.get("Warning.SUPERSONIC"));
public static final Warning RECOVERY_LAUNCH_ROD =
new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
public static final Warning SIMULATION_EXCEPTION =
new Other("Exception during simulation");
new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
}

View File

@ -37,6 +37,7 @@ public class PlotConfiguration implements Cloneable {
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// Total motion vs. time
@ -51,6 +52,7 @@ public class PlotConfiguration implements Cloneable {
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// Flight side profile
@ -63,6 +65,7 @@ public class PlotConfiguration implements Cloneable {
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// Stability vs. time
@ -77,6 +80,7 @@ public class PlotConfiguration implements Cloneable {
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// 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_BASE_DRAG_COEFF, 0);
config.addPlotDataType(FlightDataType.TYPE_PRESSURE_DRAG_COEFF, 0);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// Roll characteristics
@ -102,6 +107,7 @@ public class PlotConfiguration implements Cloneable {
config.setEvent(FlightEvent.Type.STAGE_SEPARATION, true);
config.setEvent(FlightEvent.Type.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// 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.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
//// 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.GROUND_HIT, true);
config.setEvent(FlightEvent.Type.TUMBLE, true);
config.setEvent(FlightEvent.Type.EXCEPTION, true);
configs.add(config);
DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]);

View File

@ -38,7 +38,7 @@ public class SimulationPlotDialog extends JDialog {
private SimulationPlotDialog(Window parent, Simulation simulation, PlotConfiguration config) {
//// Flight data plot
super(parent, simulation.getName());
this.setModalityType(ModalityType.MODELESS);
this.setModalityType(ModalityType.DOCUMENT_MODAL);
final boolean initialShowPoints = Application.getPreferences().getBoolean(Preferences.PLOT_SHOW_POINTS, false);

View File

@ -395,6 +395,7 @@ public class SimulationRunDialog extends JDialog {
log.debug("Simulation done");
setSimulationProgress(1.0);
updateProgress();
SimulationWarningDialog.showWarningDialog(SimulationRunDialog.this, simulation);
}

View File

@ -224,7 +224,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
SimulationListenerHelper.fireEndSimulation(status, e);
// Add FlightEvent for Abort.
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();