public class SimpleAnimator extends OTSDEVSRealTimeClock implements SimpleSimulation
Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights
reserved.
BSD-style license. See OpenTrafficSim License.
nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.CalendarDouble, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.CalendarFloat, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.CalendarLong, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeDouble, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeDoubleUnit, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeFloat, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeFloatUnit, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeLong, nl.tudelft.simulation.dsol.simulators.DEVSRealTimeClock.TimeLongUnit
nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.CalendarDouble, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.CalendarFloat, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.CalendarLong, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDouble, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeDoubleUnit, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeFloat, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeFloatUnit, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeLong, nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface.TimeLongUnit
replication, running, semaphore, simulatorTime, worker
EVENTLIST_CHANGED_EVENT
END_OF_REPLICATION_EVENT, START_EVENT, START_REPLICATION_EVENT, STEP_EVENT, STOP_EVENT, TIME_CHANGED_EVENT, WARMUP_EVENT
Constructor and Description |
---|
SimpleAnimator(DoubleScalar.Abs<TimeUnit> startTime,
DoubleScalar.Rel<TimeUnit> warmupPeriod,
DoubleScalar.Rel<TimeUnit> runLength,
OTSModelInterface model,
Rectangle2D extent)
Create a simulation engine with animation; the easy way.
|
Modifier and Type | Method and Description |
---|---|
nl.tudelft.simulation.dsol.animation.D2.AnimationPanel |
getAnimationPanel()
Easy access to the AnimationPanel.
|
nl.tudelft.simulation.dsol.gui.swing.DSOLPanel<DoubleScalar.Abs<TimeUnit>,DoubleScalar.Rel<TimeUnit>,OTSSimTimeDouble> |
getPanel()
To use in a Swing application add the DSOLPanel to a JFrame.
|
nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEvent<OTSSimTimeDouble> |
scheduleEvent(DoubleScalar.Abs<TimeUnit> executionTime,
short priority,
Object source,
Object target,
String method,
Object[] args)
Construct and schedule a SimEvent using a DoubleScalar.Abs<TimeUnit> to specify the execution time.
|
void |
setPanel(nl.tudelft.simulation.dsol.gui.swing.DSOLPanel<DoubleScalar.Abs<TimeUnit>,DoubleScalar.Rel<TimeUnit>,OTSSimTimeDouble> panel) |
relativeMillis
getSpeedFactor, isCatchup, run, setCatchup, setSpeedFactor
getAnimationDelay, setAnimationDelay, updateAnimation
cancelEvent, getEventList, initialize, isPauseOnError, scheduleEvent, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventNow, scheduleEventNow, scheduleEventRel, scheduleEventRel, setEventList, setPauseOnError, step, stop
getContext, getReplication, getSimulatorTime, isRunning, start
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelEvent, getEventList, isPauseOnError, scheduleEvent, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventAbs, scheduleEventNow, scheduleEventNow, scheduleEventRel, scheduleEventRel, setEventList, setPauseOnError
getContext, getReplication, getSimulatorTime, initialize, isRunning, start, step, stop
public SimpleAnimator(DoubleScalar.Abs<TimeUnit> startTime, DoubleScalar.Rel<TimeUnit> warmupPeriod, DoubleScalar.Rel<TimeUnit> runLength, OTSModelInterface model, Rectangle2D extent) throws RemoteException, nl.tudelft.simulation.dsol.SimRuntimeException, NamingException
startTime
- DoubleScalar.Abs<TimeUnit>; the start time of the simulationwarmupPeriod
- DoubleScalar.Rel<TimeUnit>; the warm up period of the simulation (use new
DoubleScalar.Rel<TimeUnit>(0, TimeUnit.SECOND) if you don't know what this is)runLength
- DoubleScalar.Rel<TimeUnit>; the duration of the simulationmodel
- OTSModelInterface; the simulation to executeextent
- Rectangle2D; bottom left corner, length and width of the area (world) to animate.RemoteException
- on communications failurenl.tudelft.simulation.dsol.SimRuntimeException
- on ???NamingException
- when context for the animation cannot be createdpublic final nl.tudelft.simulation.dsol.gui.swing.DSOLPanel<DoubleScalar.Abs<TimeUnit>,DoubleScalar.Rel<TimeUnit>,OTSSimTimeDouble> getPanel()
getPanel
in interface SimpleSimulation
public final nl.tudelft.simulation.dsol.animation.D2.AnimationPanel getAnimationPanel()
public final nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEvent<OTSSimTimeDouble> scheduleEvent(DoubleScalar.Abs<TimeUnit> executionTime, short priority, Object source, Object target, String method, Object[] args) throws nl.tudelft.simulation.dsol.SimRuntimeException
scheduleEvent
in interface SimpleSimulation
executionTime
- DoubleScalar.Abs<TimeUnit>; 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 of target
that must execute the eventargs
- Object[]; the arguments of the method
that must execute the eventnl.tudelft.simulation.dsol.SimRuntimeException
- when the executionTime
is in the pastpublic final void setPanel(nl.tudelft.simulation.dsol.gui.swing.DSOLPanel<DoubleScalar.Abs<TimeUnit>,DoubleScalar.Rel<TimeUnit>,OTSSimTimeDouble> panel)
panel
- set panel.Copyright © 2014–2015 Delft University of Technology. All rights reserved.