java.lang.Object | |
↳ | uk.ac.imperial.presage2.core.simulator.RunnableSimulation |
Implements the Presage2 simulation loop. Loads a simulation either from command-line invocation or database id.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
finishTime | Maximum number of simulation timesteps. | ||||||||||
threads | The number of threads to use for schedule execution. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a module to the simulation specification.
| |||||||||||
Adds a class to the simulation which is automatically instantiated via
the Injector.
| |||||||||||
Initialise scenario elements. | |||||||||||
Run a single simulation from commandline arguments. | |||||||||||
Runs a full simulation from the specification provided by the overriding
class implementation and provided parameters.
| |||||||||||
Run a simulation from a parameter set stored in a database, and
identified by a
simID . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Runnable
|
Maximum number of simulation timesteps. This field is used by the
finishTimeCondition(int)
to prevent unbounded simulation
execution. Additional conditions can preempt simulation completion.
Default constructor. Does not initialise object until run()
is
called.
Add a module to the simulation specification. May only be done during the
initialisation phase of the simulation, usually in an
initialiseScenario(Scenario)
implementation.
module | AbstractModule to add. |
---|
RuntimeException | if called after the Injector has been created, and so this module can no longer be used for the simulation. |
---|
Adds a class to the simulation which is automatically instantiated via the Injector. These objects are automatically added the the scenario objects. If called before simulation initialisation objects are created at initialisation time, otherwise it is done immediately.
Initialise scenario elements.
Elements can be added in three ways:
Scenario
.addModule(AbstractModule)
.addObjectClass(Class)
which will
be instantiated automatically by the simulatorRun a single simulation from commandline arguments. Takes the following parameters:
simulation_class_name simulation_parameter=parameter_value...
Where simulation_class_name
is the fully qualified name of a
class which implements RunnableSimulation
and is visible to this
class (i.e. public), and
simulation_parameter=parameter_value
are key/value pairs for
simulation parameters. This pairs should correspond to Parameter
annotations on fields or methods within the RunnableSimulation
we
are running. The key is the name assigned to each Parameter
inside the annotations. These fields and methods must be public in order
for use to insert the provided values in.
ClassNotFoundException | |
NoSuchMethodException | |
InvocationTargetException | |
InstantiationException | |
IllegalAccessException | |
UndefinedParameterException | |
IllegalArgumentException | |
IllegalAccessException | |
UndefinedParameterException | |
ClassNotFoundException | |
NoSuchMethodException | |
InvocationTargetException | |
InstantiationException |
Runs a full simulation from the specification provided by the overriding class implementation and provided parameters.
Run a simulation from a parameter set stored in a database, and
identified by a simID
.
simID | long identifier of the parameter set in the database. |
---|---|
threads | int number of threads to use in the simulator |
Exception |
---|
IllegalArgumentException | |
---|---|
IllegalAccessException | |
UndefinedParameterException |