Package org.opentrafficsim.core.dsol
Interface OTSSimulatorInterface
-
- All Superinterfaces:
Contextualized
,DEVSSimulatorInterface<Duration>
,EventProducerInterface
,Remote
,Serializable
,SimulatorInterface<Duration>
- All Known Subinterfaces:
OTSAnimatorInterface
- All Known Implementing Classes:
OTSAnimator
,OTSLoggingAnimator
,OTSSimulator
public interface OTSSimulatorInterface extends DEVSSimulatorInterface<Duration>, Contextualized
Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate$, @version $Revision$, by $Author$, initial version 11 mei 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Field Summary
-
Fields inherited from interface nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface
EVENTLIST_CHANGED_EVENT
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields inherited from interface nl.tudelft.simulation.dsol.simulators.SimulatorInterface
START_EVENT, STARTING_EVENT, STOP_EVENT, STOPPING_EVENT, TIME_CHANGED_EVENT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ContextInterface
getContext()
OTSReplication
getReplication()
default Time
getSimulatorAbsTime()
Return the absolute simulator time rather than the relative one since the start of the simulation.default Time
getStartTimeAbs()
Return the absolute start time of the replication.void
initialize(Time startTime, Duration warmupPeriod, Duration runLength, OTSModelInterface model)
Initialize a simulation engine without animation; the easy way.void
initialize(Time startTime, Duration warmupPeriod, Duration runLength, OTSModelInterface model, int replicationNr)
Initialize a simulation engine without animation and prescribed replication number; the easy way.void
initialize(OTSModelInterface model, OTSReplication replication)
Initialize a simulation engine without animation; the easy way.default void
runUpTo(Time stopTime)
Runs the simulator up to a certain time; any events at that time, or the solving of the differential equation at that timestep, will not yet be executed.default void
runUpToAndIncluding(Time stopTime)
Runs the simulator up to a certain time; all events at that time, or the solving of the differential equation at that timestep, will be executed.default SimEvent<Duration>
scheduleEventAbsTime(Time executionTime, short priority, Object source, Object target, String method, Object[] args)
Construct and schedule a SimEvent using a Time to specify the execution time.default SimEvent<Duration>
scheduleEventAbsTime(Time executionTime, Object source, Object target, String method, Object[] args)
Construct and schedule a SimEvent using a Time to specify the execution time.-
Methods inherited from interface nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface
cancelEvent, getEventList, isPauseOnError, scheduleEvent, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventRel, scheduleEventRel, scheduleEventRel, scheduleEventRel, setEventList, setPauseOnError
-
Methods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListener
-
Methods inherited from interface nl.tudelft.simulation.dsol.simulators.SimulatorInterface
addScheduledMethodOnInitialize, cleanUp, endReplication, getErrorLogLevel, getErrorStrategy, getLogger, getModel, getReplicationState, getRunState, getSimulatorTime, getSourceId, initialize, isInitialized, isStartingOrRunning, isStoppingOrStopped, runUpTo, runUpToAndIncluding, setErrorLogLevel, setErrorStrategy, setErrorStrategy, start, step, stop
-
-
-
-
Method Detail
-
initialize
void initialize(OTSModelInterface model, OTSReplication replication) throws SimRuntimeException
Initialize a simulation engine without animation; the easy way. PauseOnError is set to true;- Parameters:
model
- OTSModelInterface; the simulation to executereplication
- OTSReplication; the replication with the run control parameters- Throws:
SimRuntimeException
- when e.g., warmupPeriod is larger than runLength
-
initialize
void initialize(Time startTime, Duration warmupPeriod, Duration runLength, OTSModelInterface model) throws SimRuntimeException, NamingException
Initialize a simulation engine without animation; the easy way. PauseOnError is set to true;- Parameters:
startTime
- Time; the start time of the simulationwarmupPeriod
- Duration; the warm up period of the simulation (use new Duration(0, SECOND) if you don't know what this is)runLength
- Duration; the duration of the simulationmodel
- OTSModelInterface; the simulation to execute- Throws:
SimRuntimeException
- when e.g., warmupPeriod is larger than runLengthNamingException
- when the context for the replication cannot be created
-
initialize
void initialize(Time startTime, Duration warmupPeriod, Duration runLength, OTSModelInterface model, int replicationNr) throws SimRuntimeException, NamingException
Initialize a simulation engine without animation and prescribed replication number; the easy way. PauseOnError is set to true;- Parameters:
startTime
- Time; the start time of the simulationwarmupPeriod
- Duration; the warm up period of the simulation (use new Duration(0, SECOND) if you don't know what this is)runLength
- Duration; the duration of the simulationmodel
- OTSModelInterface; the simulation to executereplicationNr
- int; the replication number- Throws:
SimRuntimeException
- when e.g., warmupPeriod is larger than runLengthNamingException
- when context for the animation cannot be created
-
scheduleEventAbsTime
default SimEvent<Duration> scheduleEventAbsTime(Time executionTime, short priority, Object source, Object target, String method, Object[] args) throws SimRuntimeException
Construct and schedule a SimEvent using a Time to specify the execution time.- Parameters:
executionTime
- Time; the time at which the event must happenpriority
- short; should be between SimEventInterface.MAX_PRIORITY and SimEventInterface.MIN_PRIORITY; most normal events should use SimEventInterface.NORMAL_PRIORITYsource
- Object; the object that creates/schedules the eventtarget
- Object; the object that must execute the eventmethod
- String; the name of the method oftarget
that must execute the eventargs
- Object[]; the arguments of themethod
that must execute the event- Returns:
- SimEvent<Duration>; the event that was scheduled (the caller should save this if a need to cancel the event may arise later)
- Throws:
SimRuntimeException
- when theexecutionTime
is in the past
-
scheduleEventAbsTime
default SimEvent<Duration> scheduleEventAbsTime(Time executionTime, Object source, Object target, String method, Object[] args) throws SimRuntimeException
Construct and schedule a SimEvent using a Time to specify the execution time.- Parameters:
executionTime
- Time; the time at which the event must happensource
- Object; the object that creates/schedules the eventtarget
- Object; the object that must execute the eventmethod
- String; the name of the method oftarget
that must execute the eventargs
- Object[]; the arguments of themethod
that must execute the event- Returns:
- SimEvent<Duration>; the event that was scheduled (the caller should save this if a need to cancel the event may arise later)
- Throws:
SimRuntimeException
- when theexecutionTime
is in the past
-
getSimulatorAbsTime
default Time getSimulatorAbsTime()
Return the absolute simulator time rather than the relative one since the start of the simulation.- Returns:
- Time; the absolute simulator time rather than the relative one since the start of the simulation
-
getStartTimeAbs
default Time getStartTimeAbs()
Return the absolute start time of the replication.- Returns:
- Time; the absolute start time of the replication
-
runUpTo
default void runUpTo(Time stopTime) throws SimRuntimeException
Runs the simulator up to a certain time; any events at that time, or the solving of the differential equation at that timestep, will not yet be executed.- Parameters:
stopTime
- Time; the absolute time till when we want to run the simulation, coded as a SimTime object- Throws:
SimRuntimeException
- whenever starting fails. Possible occasions include starting a started simulator
-
runUpToAndIncluding
default void runUpToAndIncluding(Time stopTime) throws SimRuntimeException
Runs the simulator up to a certain time; all events at that time, or the solving of the differential equation at that timestep, will be executed.- Parameters:
stopTime
- Time; the absolute time till when we want to run the simulation, coded as a SimTime object- Throws:
SimRuntimeException
- whenever starting fails. Possible occasions include starting a started simulator
-
getReplication
OTSReplication getReplication()
- Specified by:
getReplication
in interfaceSimulatorInterface<Duration>
-
getContext
default ContextInterface getContext()
- Specified by:
getContext
in interfaceContextualized
-
-