Class DevDessAnimator<T extends Number & Comparable<T>>
java.lang.Object
org.djutils.event.LocalEventProducer
nl.tudelft.simulation.dsol.simulators.Simulator<T>
nl.tudelft.simulation.dsol.simulators.DevsSimulator<T>
nl.tudelft.simulation.dsol.simulators.DevDessSimulator<T>
nl.tudelft.simulation.dsol.simulators.DevDessAnimator<T>
- Type Parameters:
T
- the time type
- All Implemented Interfaces:
Serializable
,Runnable
,Remote
,AnimatorInterface
,DessSimulatorInterface<T>
,DevsSimulatorInterface<T>
,SimulatorInterface<T>
,org.djutils.event.EventProducer
public class DevDessAnimator<T extends Number & Comparable<T>>
extends DevDessSimulator<T>
implements AnimatorInterface
The reference implementation of the animator.
Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Since:
- 1.5
- Author:
- Peter Jacobs , Alexander Verbraeck
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class nl.tudelft.simulation.dsol.simulators.Simulator
Simulator.SimulatorWorkerThread
Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.simulators.AnimatorInterface
AnimatorInterface.AnimationThread
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
AnimationDelay refers to the delay in milliseconds between timeSteps.Fields inherited from class nl.tudelft.simulation.dsol.simulators.DevDessSimulator
timeStep
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 interface nl.tudelft.simulation.dsol.simulators.AnimatorInterface
ANIMATION_DELAY_CHANGED_EVENT, DEFAULT_ANIMATION_DELAY, UPDATE_ANIMATION_EVENT
Fields inherited from interface nl.tudelft.simulation.dsol.simulators.DessSimulatorInterface
TIME_STEP_CHANGED_EVENT
Fields inherited from interface nl.tudelft.simulation.dsol.simulators.DevsSimulatorInterface
EVENTLIST_CHANGED_EVENT
Fields inherited from interface org.djutils.event.EventProducer
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
-
Method Summary
Modifier and TypeMethodDescriptionlong
returns the animation delay in milliseconds between each consecutive animation update.void
run()
The run method defines the actual time step mechanism of the simulator.void
setAnimationDelay
(long animationDelay) sets the animationDelay using wallclock time in milliseconds.void
updateAnimation takes care of firing the UPDATE_ANIMATION_EVENT.Methods inherited from class nl.tudelft.simulation.dsol.simulators.DevDessSimulator
getTimeStep, setTimeStep
Methods inherited from class nl.tudelft.simulation.dsol.simulators.DevsSimulator
cancelEvent, endReplication, getEventList, initialize, isPauseOnError, 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, getReplication, getReplicationState, getRunState, getSimulatorTime, handleSimulationException, runUpTo, runUpToAndIncluding, setErrorLogLevel, setErrorStrategy, setErrorStrategy, start, startImpl, step, stop, stopImpl, warmup
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nl.tudelft.simulation.dsol.simulators.DevsSimulatorInterface
cancelEvent, getEventList, isPauseOnError, scheduleEvent, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventNow, scheduleEventRel, scheduleEventRel, scheduleEventRel, scheduleEventRel, scheduleEventRel, scheduleEventRel, setEventList, setPauseOnError
Methods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from interface nl.tudelft.simulation.dsol.simulators.SimulatorInterface
addScheduledMethodOnInitialize, addScheduledMethodOnInitialize, cleanUp, endReplication, getErrorLogLevel, getErrorStrategy, getLogger, getModel, getReplication, getReplicationState, getRunState, getSimulatorTime, initialize, isInitialized, isStartingOrRunning, isStoppingOrStopped, runUpTo, runUpToAndIncluding, setErrorLogLevel, setErrorStrategy, setErrorStrategy, start, step, stop
-
Field Details
-
animationDelay
protected long animationDelayAnimationDelay refers to the delay in milliseconds between timeSteps.
-
-
Constructor Details
-
DevDessAnimator
- Parameters:
initialTimeStep
- T; the initial time step to use in the integration.id
- the id of the simulator, used in logging and firing of events.- Throws:
SimRuntimeException
- when initialTimeStep <= 0, NaN, or Infinity
-
-
Method Details
-
getAnimationDelay
public long getAnimationDelay()returns the animation delay in milliseconds between each consecutive animation update.- Specified by:
getAnimationDelay
in interfaceAnimatorInterface
- Returns:
- long; the animation delay in milliseconds of wallclock time
-
setAnimationDelay
public void setAnimationDelay(long animationDelay) sets the animationDelay using wallclock time in milliseconds.- Specified by:
setAnimationDelay
in interfaceAnimatorInterface
- Parameters:
animationDelay
- long; the animation delay in milliseconds
-
updateAnimation
public void updateAnimation()updateAnimation takes care of firing the UPDATE_ANIMATION_EVENT.- Specified by:
updateAnimation
in interfaceAnimatorInterface
-
run
public void run()The run method defines the actual time step mechanism of the simulator. The implementation of this method depends on the formalism. Where discrete event formalisms loop over an event list, continuous simulators take predefined time steps. Make sure that:
- SimulatorInterface.TIME_CHANGED_EVENT is fired when the time of the simulator changes
- the warmup() method is called when the warmup period has expired (through an event or based on simulation time)
- the endReplication() method is called when the replication has ended
- the simulator runs until the runUntil time, which is also set by the start() method.- Specified by:
run
in interfaceRunnable
- Overrides:
run
in classDevDessSimulator<T extends Number & Comparable<T>>
-