public abstract class Simulator extends Object implements ISimulator
Where the models describe the system and how its components should interact with each others, the simulators are the actual objects making the simulation. They manage the time locally (at which time a given model thinks it is) and globally (the time of the system is the maximum of all its local times).
Modifier and Type | Class and Description |
---|---|
static class |
Simulator.SimulatorFactory
The factory class of all simulators.
|
Modifier and Type | Field and Description |
---|---|
protected IDevs |
_model
Associated model.
|
protected String |
_name
A unique identifier for this simulator.
|
protected Double |
_tL
Last event occurrence date.
|
protected Double |
_tN
Next event occurrence date.
|
Constructor and Description |
---|
Simulator(IDevs model)
Specific constructor that sets the name to "SingleSimulator" and takes
a model to simulate.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(INamed in) |
void |
deltFunc(Double t)
Wrapper for model transition functions.
|
void |
deltFunc(Double t,
Message x)
Wrapper for model transition functions.
|
void |
initialize()
Initialize associated model, time and dates.
|
void |
initialize(Double currentTime)
Initialize associated model, time and dates.
|
IDevs |
model()
Getter on the simulated model.
|
String |
name()
The name of this simulator, that must be unique among all simulators at
the same level and under the same coordinator.
|
void |
simInject(Double e,
Message m)
Inject an event in the simulation.
|
void |
simulate(Integer itNb)
Run the simulation up to a specified iteration count.
|
void |
timeAdvance(Double t)
Advance current time to the specified date.
|
Double |
tL()
Getter on the last event occurrence date.
|
Double |
tN()
Getter on the next event occurrence date.
|
protected String _name
protected Double _tL
protected Double _tN
protected IDevs _model
public Simulator(IDevs model)
model
- The model to simulate.public Double tL()
tL
in interface ISimulator
public Double tN()
tN
in interface ISimulator
public IDevs model()
model
in interface ISimulator
public String name()
public void initialize()
initialize
in interface ISimulator
public void initialize(Double currentTime)
initialize
in interface ISimulator
currentTime
- Time to next (actually first) event of the
simulation.public void deltFunc(Double t, Message x)
deltFunc
in interface ISimulator
t
- Event happen date.x
- Message to be sent.public void deltFunc(Double t)
deltFunc
in interface ISimulator
t
- Event happen date.public void simulate(Integer itNb)
simulate
in interface ISimulator
itNb
- The maximum iteration count.public void simInject(Double e, Message m)
simInject
in interface ISimulator
e
- The event happen date.m
- The message to be sent.public void timeAdvance(Double t)
timeAdvance
in interface ISimulator
t
- Time advance.public int compareTo(INamed in)
compareTo
in interface Comparable<INamed>
Copyright © 2017–2019 UniversitĂ© CĂ´te d'Azur, CNRS, I3S. All rights reserved.