public abstract class AbstractSimulationScript extends Object implements nl.tudelft.simulation.event.EventListenerInterface, org.djutils.cli.Checkable
@Options and similar annotations. Default values of the properties in this abstract class can be overwritten by the
sub-class using CliUtil.changeDefaultValue().
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSimulationScript(String name,
String description)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTabs(OTSSimulatorInterface sim,
OTSSimulationApplication<?> animation)
Adds tabs to the animation.
|
protected void |
animateNetwork(OTSNetwork net)
Creates animations for nodes, links and lanes.
|
void |
check() |
GTUColorer |
getGtuColorer()
Returns the GTU colorer.
|
OTSRoadNetwork |
getNetwork()
Returns the network.
|
long |
getSeed()
Returns the seed.
|
Duration |
getSimulationTime()
Returns the simulation time.
|
OTSSimulatorInterface |
getSimulator()
Returns the simulator.
|
Time |
getStartTime()
Returns the start time.
|
Duration |
getWarmupTime()
Returns the warm-up time.
|
boolean |
isAutorun()
Returns whether to autorun.
|
void |
notify(nl.tudelft.simulation.event.EventInterface event) |
protected void |
onSimulationEnd()
Method that is called when the simulation has ended.
|
protected void |
setAnimationToggles(OTSAnimationPanel animation)
Sets the animation toggles.
|
void |
setGtuColorer(GTUColorer colorer)
Set GTU colorer.
|
protected void |
setupDemo(OTSAnimationPanel animationPanel,
OTSRoadNetwork net)
Method that is called when the animation has been created, to add components for a demo.
|
protected abstract OTSRoadNetwork |
setupSimulation(OTSSimulatorInterface sim)
Sets up the simulation based on provided properties.
|
void |
start()
Starts the simulation.
|
public long getSeed()
public Time getStartTime()
public Duration getWarmupTime()
public Duration getSimulationTime()
public boolean isAutorun()
public final void setGtuColorer(GTUColorer colorer)
colorer - GTUColorer; GTU colorerpublic final GTUColorer getGtuColorer()
public void check()
throws Exception
check in interface org.djutils.cli.CheckableExceptionpublic final void start()
throws Exception
Exception - on any exceptionpublic void notify(nl.tudelft.simulation.event.EventInterface event)
throws RemoteException
notify in interface nl.tudelft.simulation.event.EventListenerInterfaceRemoteExceptionpublic final OTSSimulatorInterface getSimulator()
public final OTSRoadNetwork getNetwork()
protected void animateNetwork(OTSNetwork net)
net - OTSNetwork; networkprotected void addTabs(OTSSimulatorInterface sim, OTSSimulationApplication<?> animation)
sim - OTSSimulatorInterface; simulatoranimation - OTSSimulationApplication<?>; animation to add tabs toprotected void onSimulationEnd()
protected void setupDemo(OTSAnimationPanel animationPanel, OTSRoadNetwork net)
animationPanel - OTSAnimationPanel; animation panelnet - OTSNetwork; networkprotected void setAnimationToggles(OTSAnimationPanel animation)
animation - OTSAnimationPanel; animation to set the toggle onprotected abstract OTSRoadNetwork setupSimulation(OTSSimulatorInterface 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 - OTSSimulatorInterface; simulatorException - on any exceptionCopyright © 2014–2019 Delft University of Technology. All rights reserved.