Package xdevs.core.simulation
Class AbstractSimulator
- java.lang.Object
-
- xdevs.core.simulation.AbstractSimulator
-
- Direct Known Subclasses:
Coordinator
,Simulator
public abstract class AbstractSimulator extends Object
This class represents the abstraction of a parallel DEVS simulator, in xDEVS style. The simulator is responsible for the simulation of a DEVS model, and it is composed of a simulation clock and the model to simulate. The simulator is responsible for the initialization, execution and termination of the simulation.
-
-
Field Summary
Fields Modifier and Type Field Description protected SimulationClock
clock
The simulation clock of the simulator.protected double
tL
The time of the last event.protected double
tN
The time of the next event.
-
Constructor Summary
Constructors Constructor Description AbstractSimulator(SimulationClock clock)
Creates a new simulator with the given simulation clock.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
clear()
Empties the event list at the ports of the associated model.abstract void
deltfcn()
Executes one of the transition functions of the DEVS simulation, depending on the current state of the model and whether there are new events or not.abstract void
exit()
This is a special function, out of the DEVS formalism, that allows to realize some actions when the simulation ends.SimulationClock
getClock()
Gets the simulation clock of the simulator.abstract Component
getModel()
Gets the associated model of the simulator.double
getTL()
double
getTN()
Gets the time of the next event.abstract void
initialize()
Initializes the simulator and the associated model.abstract void
lambda()
Executes the output function of the DEVS simulation.void
setTL(double tL)
Sets the time of the last event.void
setTN(double tN)
Sets the time of the next event.abstract double
ta()
Executes the time advance mechanism of the DEVS simulation.
-
-
-
Field Detail
-
clock
protected SimulationClock clock
The simulation clock of the simulator.
-
tL
protected double tL
The time of the last event.
-
tN
protected double tN
The time of the next event.
-
-
Constructor Detail
-
AbstractSimulator
public AbstractSimulator(SimulationClock clock)
Creates a new simulator with the given simulation clock.- Parameters:
clock
- the simulation clock of the simulator.
-
-
Method Detail
-
initialize
public abstract void initialize()
Initializes the simulator and the associated model. This is not part of the DEVS formalism, but it is a necessary step to prepare the simulator for the simulation.
-
exit
public abstract void exit()
This is a special function, out of the DEVS formalism, that allows to realize some actions when the simulation ends.
-
ta
public abstract double ta()
Executes the time advance mechanism of the DEVS simulation.- Returns:
- the new DEVS sigma.
-
lambda
public abstract void lambda()
Executes the output function of the DEVS simulation.
-
deltfcn
public abstract void deltfcn()
Executes one of the transition functions of the DEVS simulation, depending on the current state of the model and whether there are new events or not.
-
clear
public abstract void clear()
Empties the event list at the ports of the associated model.
-
getModel
public abstract Component getModel()
Gets the associated model of the simulator.- Returns:
- the associated model of the simulator.
-
getTL
public double getTL()
-
setTL
public void setTL(double tL)
Sets the time of the last event.- Parameters:
tL
- the time of the last event.
-
getTN
public double getTN()
Gets the time of the next event.- Returns:
- the time of the next event.
-
setTN
public void setTN(double tN)
Sets the time of the next event.- Parameters:
tN
- the time of the next event.
-
getClock
public SimulationClock getClock()
Gets the simulation clock of the simulator.- Returns:
- the simulation clock of the simulator.
-
-