public abstract class AbstractSimulationScript extends Object implements nl.tudelft.simulation.event.EventListenerInterface
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
(package private) class |
AbstractSimulationScript.ScriptAnimation
Animated simulation.
|
(package private) class |
AbstractSimulationScript.ScriptSimulation
Simulation.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractSimulationScript(String name,
String description,
String[] properties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAnimationToggles(org.opentrafficsim.simulationengine.AbstractWrappableAnimation animation)
Sets the animation toggles.
|
protected void |
addTabs(org.opentrafficsim.simulationengine.SimpleSimulatorInterface sim)
Adds taps to the animation.
|
protected void |
animateNetwork(org.opentrafficsim.core.network.OTSNetwork net)
Creates animations for nodes, links and lanes.
|
boolean |
getBooleanProperty(String propertyName)
Returns the boolean value of given property.
|
double |
getDoubleProperty(String propertyName)
Returns the double value of given property.
|
org.djunits.value.vdouble.scalar.Duration |
getDurationProperty(String propertyName)
Returns the Duration value of given property.
|
org.opentrafficsim.core.gtu.animation.GTUColorer |
getGtuColorer()
Returns the GTU colorer.
|
int |
getIntegerProperty(String propertyName)
Returns the int value of given property.
|
org.opentrafficsim.core.network.OTSNetwork |
getNetwork()
Returns the network.
|
String |
getProperty(String propertyName)
Returns the String value of given property.
|
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface |
getSimulator()
Returns the simulator.
|
org.djunits.value.vdouble.scalar.Time |
getTimeProperty(String propertyName)
Returns the Time value of given property.
|
void |
notify(nl.tudelft.simulation.event.EventInterface event) |
protected void |
onSimulationEnd()
Method that is called when the simulation has ended.
|
protected void |
setDefaultProperties()
Sets the default properties.
|
void |
setGtuColorer(org.opentrafficsim.core.gtu.animation.GTUColorer colorer)
Set GTU colorer.
|
void |
setProperty(String propertyName,
Object propertyValue)
Sets a property.
|
protected void |
setupDemo(org.opentrafficsim.simulationengine.AbstractWrappableAnimation animation,
org.opentrafficsim.core.network.OTSNetwork net)
Method that is called when the animation has been created, to add components for a demo.
|
protected abstract org.opentrafficsim.core.network.OTSNetwork |
setupSimulation(org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface sim)
Sets up the simulation based on provided properties.
|
void |
start()
Starts the simulation.
|
public final void setProperty(String propertyName, Object propertyValue)
propertyName
- String; property namepropertyValue
- Object; property valuepublic final String getProperty(String propertyName)
propertyName
- String; property namepublic final double getDoubleProperty(String propertyName)
propertyName
- String; property namepublic final boolean getBooleanProperty(String propertyName)
propertyName
- String; property namepublic final int getIntegerProperty(String propertyName)
propertyName
- String; property namepublic final org.djunits.value.vdouble.scalar.Duration getDurationProperty(String propertyName)
propertyName
- String; property namepublic final org.djunits.value.vdouble.scalar.Time getTimeProperty(String propertyName)
propertyName
- String; property namepublic final void setGtuColorer(org.opentrafficsim.core.gtu.animation.GTUColorer colorer)
colorer
- GTUColorer; GTU colorerpublic final org.opentrafficsim.core.gtu.animation.GTUColorer getGtuColorer()
public final void start()
public final void notify(nl.tudelft.simulation.event.EventInterface event) throws RemoteException
notify
in interface nl.tudelft.simulation.event.EventListenerInterface
RemoteException
public final org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface getSimulator()
public final org.opentrafficsim.core.network.OTSNetwork getNetwork()
protected void animateNetwork(org.opentrafficsim.core.network.OTSNetwork net)
net
- OTSNetwork; networkprotected void addAnimationToggles(org.opentrafficsim.simulationengine.AbstractWrappableAnimation animation)
animation
- AbstractWrappableAnimation; animation to set the toggle onprotected void addTabs(org.opentrafficsim.simulationengine.SimpleSimulatorInterface sim)
sim
- SimpleSimulatorInterface; simulatorprotected void setDefaultProperties()
setProperty()
. Default implementation does nothing.protected void onSimulationEnd()
protected void setupDemo(org.opentrafficsim.simulationengine.AbstractWrappableAnimation animation, org.opentrafficsim.core.network.OTSNetwork net)
animation
- AbstractWrappableAnimation; animationnet
- OTSNetwork; networkprotected abstract org.opentrafficsim.core.network.OTSNetwork setupSimulation(org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface sim) throws Exception
getProperty()
. Setting up a
simulation should at least create a network and some demand. Additionally this may setup traffic control, sampling, etc.sim
- OTSDEVSSimulatorInterface; simulatorException
- on any exceptionCopyright © 2014–2018 Delft University of Technology. All rights reserved.