Fix auto-run simulation NA values
This commit is contained in:
parent
46b974cae7
commit
b7dc313ee8
@ -300,7 +300,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
// Ignore events for components that are no longer attached to the rocket
|
// Ignore events for components that are no longer attached to the rocket
|
||||||
if (event.getSource() != null && event.getSource().getParent() != null &&
|
if (event.getSource() != null && event.getSource().getParent() != null &&
|
||||||
!currentStatus.getConfiguration().isComponentActive(event.getSource())) {
|
!currentStatus.getConfiguration().isComponentActive(event.getSource())) {
|
||||||
log.trace("Ignoring event from unattached componenent");
|
log.trace("Ignoring event from unattached component");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,6 +332,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
|
|
||||||
|
|
||||||
// Check for recovery device deployment, add events to queue
|
// Check for recovery device deployment, add events to queue
|
||||||
|
// TODO: LOW: check if deprecated function getActiveComponents needs to be replaced
|
||||||
for (RocketComponent c : currentStatus.getConfiguration().getActiveComponents()) {
|
for (RocketComponent c : currentStatus.getConfiguration().getActiveComponents()) {
|
||||||
if (!(c instanceof RecoveryDevice))
|
if (!(c instanceof RecoveryDevice))
|
||||||
continue;
|
continue;
|
||||||
|
@ -220,7 +220,7 @@ public class FlightData {
|
|||||||
timeToApogee = Double.NaN;
|
timeToApogee = Double.NaN;
|
||||||
|
|
||||||
|
|
||||||
// Launch rod velocity
|
// Launch rod velocity + deployment velocity + ground hit velocity
|
||||||
for (FlightEvent event : branch.getEvents()) {
|
for (FlightEvent event : branch.getEvents()) {
|
||||||
if (event.getType() == FlightEvent.Type.LAUNCHROD) {
|
if (event.getType() == FlightEvent.Type.LAUNCHROD) {
|
||||||
double t = event.getTime();
|
double t = event.getTime();
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package net.sf.openrocket.simulation.listeners.system;
|
||||||
|
|
||||||
|
import net.sf.openrocket.simulation.FlightEvent;
|
||||||
|
import net.sf.openrocket.simulation.SimulationStatus;
|
||||||
|
import net.sf.openrocket.simulation.listeners.AbstractSimulationListener;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simulation listeners that ends the simulation when the ground is hit.
|
||||||
|
*
|
||||||
|
* @author Sibo Van Gool <sibo.vangool@hotmail.com>
|
||||||
|
*/
|
||||||
|
public class GroundHitListener extends AbstractSimulationListener {
|
||||||
|
|
||||||
|
public static final GroundHitListener INSTANCE = new GroundHitListener();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleFlightEvent(SimulationStatus status, FlightEvent event) {
|
||||||
|
if (event.getType() == FlightEvent.Type.GROUND_HIT) {
|
||||||
|
status.getEventQueue().add(new FlightEvent(FlightEvent.Type.SIMULATION_END, status.getSimulationTime()));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSystemListener() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -66,7 +66,7 @@ import net.sf.openrocket.simulation.FlightData;
|
|||||||
import net.sf.openrocket.simulation.customexpression.CustomExpression;
|
import net.sf.openrocket.simulation.customexpression.CustomExpression;
|
||||||
import net.sf.openrocket.simulation.customexpression.CustomExpressionSimulationListener;
|
import net.sf.openrocket.simulation.customexpression.CustomExpressionSimulationListener;
|
||||||
import net.sf.openrocket.simulation.listeners.SimulationListener;
|
import net.sf.openrocket.simulation.listeners.SimulationListener;
|
||||||
import net.sf.openrocket.simulation.listeners.system.ApogeeEndListener;
|
import net.sf.openrocket.simulation.listeners.system.GroundHitListener;
|
||||||
import net.sf.openrocket.simulation.listeners.system.InterruptListener;
|
import net.sf.openrocket.simulation.listeners.system.InterruptListener;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
@ -770,7 +770,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
protected SimulationListener[] getExtraListeners() {
|
protected SimulationListener[] getExtraListeners() {
|
||||||
return new SimulationListener[] {
|
return new SimulationListener[] {
|
||||||
InterruptListener.INSTANCE,
|
InterruptListener.INSTANCE,
|
||||||
ApogeeEndListener.INSTANCE,
|
GroundHitListener.INSTANCE,
|
||||||
exprListener };
|
exprListener };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user