Package gov.nasa.jpl.aerie.merlin.driver
Class CheckpointSimulationDriver
java.lang.Object
gov.nasa.jpl.aerie.merlin.driver.CheckpointSimulationDriver
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<Pair<CachedSimulationEngine, Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, gov.nasa.jpl.aerie.types.ActivityDirectiveId>>> bestCachedEngine(Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, gov.nasa.jpl.aerie.types.ActivityDirective> schedule, List<CachedSimulationEngine> cachedEngines, gov.nasa.jpl.aerie.merlin.protocol.types.Duration planDuration) Selects the best cached engine for simulating a given plan.checkpointAtEnd(Function<CheckpointSimulationDriver.SimulationState, Boolean> stoppingCondition) desiredCheckpoints(List<gov.nasa.jpl.aerie.merlin.protocol.types.Duration> desiredCheckpoints) static <Model> SimulationResultsComputerInputssimulateWithCheckpoints(MissionModel<Model> missionModel, Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, gov.nasa.jpl.aerie.types.ActivityDirective> schedule, Instant simulationStartTime, gov.nasa.jpl.aerie.merlin.protocol.types.Duration simulationDuration, Instant planStartTime, gov.nasa.jpl.aerie.merlin.protocol.types.Duration planDuration, Consumer<gov.nasa.jpl.aerie.merlin.protocol.types.Duration> simulationExtentConsumer, Supplier<Boolean> simulationCanceled, CachedSimulationEngine cachedEngine, Function<CheckpointSimulationDriver.SimulationState, Boolean> shouldTakeCheckpoint, Function<CheckpointSimulationDriver.SimulationState, Boolean> stopConditionOnPlan, CachedEngineStore cachedEngineStore, SimulationEngineConfiguration configuration) Simulates a plan/schedule while using and creating simulation checkpoints.stopOnceActivityHasFinished(gov.nasa.jpl.aerie.types.ActivityDirectiveId activityDirectiveId)
-
Constructor Details
-
CheckpointSimulationDriver
public CheckpointSimulationDriver()
-
-
Method Details
-
bestCachedEngine
public static Optional<Pair<CachedSimulationEngine,Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, bestCachedEnginegov.nasa.jpl.aerie.types.ActivityDirectiveId>>> (Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, gov.nasa.jpl.aerie.types.ActivityDirective> schedule, List<CachedSimulationEngine> cachedEngines, gov.nasa.jpl.aerie.merlin.protocol.types.Duration planDuration) Selects the best cached engine for simulating a given plan.- Parameters:
schedule- the schedule/plancachedEngines- a list of cached engines- Returns:
- the best cached engine as well as the map of corresponding activity ids for this engine
-
desiredCheckpoints
public static Function<CheckpointSimulationDriver.SimulationState,Boolean> desiredCheckpoints(List<gov.nasa.jpl.aerie.merlin.protocol.types.Duration> desiredCheckpoints) -
checkpointAtEnd
public static Function<CheckpointSimulationDriver.SimulationState,Boolean> checkpointAtEnd(Function<CheckpointSimulationDriver.SimulationState, Boolean> stoppingCondition) -
simulateWithCheckpoints
public static <Model> SimulationResultsComputerInputs simulateWithCheckpoints(MissionModel<Model> missionModel, Map<gov.nasa.jpl.aerie.types.ActivityDirectiveId, gov.nasa.jpl.aerie.types.ActivityDirective> schedule, Instant simulationStartTime, gov.nasa.jpl.aerie.merlin.protocol.types.Duration simulationDuration, Instant planStartTime, gov.nasa.jpl.aerie.merlin.protocol.types.Duration planDuration, Consumer<gov.nasa.jpl.aerie.merlin.protocol.types.Duration> simulationExtentConsumer, Supplier<Boolean> simulationCanceled, CachedSimulationEngine cachedEngine, Function<CheckpointSimulationDriver.SimulationState, Boolean> shouldTakeCheckpoint, Function<CheckpointSimulationDriver.SimulationState, Boolean> stopConditionOnPlan, CachedEngineStore cachedEngineStore, SimulationEngineConfiguration configuration) Simulates a plan/schedule while using and creating simulation checkpoints.- Parameters:
missionModel- the mission modelschedule- the plan/schedulesimulationStartTime- the start time of the simulationsimulationDuration- the simulation durationplanStartTime- the plan overall start timeplanDuration- the plan overall durationsimulationExtentConsumer- consumer to report simulation progresssimulationCanceled- provider of an external stop signalcachedEngine- the simulation engine that is going to be usedshouldTakeCheckpoint- a function from state of the simulation to boolean deciding when to take checkpointsstopConditionOnPlan- a function from state of the simulation to boolean deciding when to stop simulationcachedEngineStore- a store for simulation engine checkpoints taken. If capacity is 1, the simulation will behave like a resumable simulation.configuration- the simulation configuration- Returns:
- all the information to compute simulation results if needed
-
onceAllActivitiesAreFinished
public static Function<CheckpointSimulationDriver.SimulationState,Boolean> onceAllActivitiesAreFinished() -
noCondition
-
stopOnceActivityHasFinished
public static Function<CheckpointSimulationDriver.SimulationState,Boolean> stopOnceActivityHasFinished(gov.nasa.jpl.aerie.types.ActivityDirectiveId activityDirectiveId)
-