Package org.opentrafficsim.core.dsol
Class OTSSimulator
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- nl.tudelft.simulation.dsol.simulators.Simulator<T>
-
- nl.tudelft.simulation.dsol.simulators.DEVSSimulator<Duration>
-
- org.opentrafficsim.core.dsol.OTSSimulator
-
- All Implemented Interfaces:
Serializable
,Runnable
,Remote
,DEVSSimulatorInterface<Duration>
,SimulatorInterface<Duration>
,Contextualized
,EventProducerInterface
,OTSSimulatorInterface
public class OTSSimulator extends DEVSSimulator<Duration> implements OTSSimulatorInterface, Serializable
Construct a DSOL DEVSSimulator the easy way.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: 2018-10-30 14:03:57 +0100 (Tue, 30 Oct 2018) $, @version $Revision: 4727 $, by $Author: pknoppers $, initial version 12 nov. 2014
- Author:
- Peter Knoppers
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class nl.tudelft.simulation.dsol.simulators.Simulator
Simulator.SimulatorWorkerThread
-
-
Field Summary
-
Fields inherited from class nl.tudelft.simulation.dsol.simulators.DEVSSimulator
eventList
-
Fields inherited from class nl.tudelft.simulation.dsol.simulators.Simulator
model, replication, replicationState, runflag, runState, runUntilIncluding, runUntilTime, semaphore, simulatorTime, worker
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
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
-
-
Constructor Summary
Constructors Constructor Description OTSSimulator(Serializable simulatorId)
Construct an OTSSimulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OTSReplication
getReplication()
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.String
toString()
-
Methods inherited from class nl.tudelft.simulation.dsol.simulators.DEVSSimulator
cancelEvent, endReplication, getEventList, initialize, isPauseOnError, run, scheduleEvent, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventRel, scheduleEventRel, scheduleEventRel, scheduleEventRel, setEventList, setPauseOnError, stepImpl
-
Methods inherited from class nl.tudelft.simulation.dsol.simulators.Simulator
addScheduledMethodOnInitialize, cleanUp, fireTimedEvent, getErrorLogLevel, getErrorStrategy, getLogger, getModel, getReplicationState, getRunState, getSimulatorTime, getSourceId, handleSimulationException, runUpTo, runUpToAndIncluding, setErrorLogLevel, setErrorStrategy, setErrorStrategy, start, startImpl, step, stop, stopImpl, warmup
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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 org.opentrafficsim.core.dsol.OTSSimulatorInterface
getContext, getSimulatorAbsTime, getStartTimeAbs, runUpTo, runUpToAndIncluding, scheduleEventAbsTime, scheduleEventAbsTime
-
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
-
-
-
-
Constructor Detail
-
OTSSimulator
public OTSSimulator(Serializable simulatorId)
Construct an OTSSimulator.- Parameters:
simulatorId
- the id of the simulator to use in remote communication
-
-
Method Detail
-
initialize
public 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;- Specified by:
initialize
in interfaceOTSSimulatorInterface
- 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
public 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;- Specified by:
initialize
in interfaceOTSSimulatorInterface
- 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
-
initialize
public void initialize(OTSModelInterface model, OTSReplication replication) throws SimRuntimeException
Initialize a simulation engine without animation; the easy way. PauseOnError is set to true;- Specified by:
initialize
in interfaceOTSSimulatorInterface
- 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
-
getReplication
public OTSReplication getReplication()
- Specified by:
getReplication
in interfaceOTSSimulatorInterface
- Specified by:
getReplication
in interfaceSimulatorInterface<Duration>
- Overrides:
getReplication
in classSimulator<Duration>
-
-