Class AbstractRealTimeMatcherProbe
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractProbe
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.probes.AbstractRealTimeMatcherProbe
-
- All Implemented Interfaces:
IProbe
public abstract class AbstractRealTimeMatcherProbe extends AbstractProbe
This probe slows down the simulation so that its execution speed matches real time (in the simulation), or a specific factor F times quicker than real time.- Author:
- Yoann Kubera, Gildas Morvan
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
MILLISECONDS_IN_SECONDS
The number of milliseconds in a second.protected static int
NANOSECONDS_IN_SECONDS
The number of nanoseconds in a second.
-
Constructor Summary
Constructors Constructor Description AbstractRealTimeMatcherProbe()
Builds a probe slowing down the simulation so that its execution speed matches real time.AbstractRealTimeMatcherProbe(double accelerationFactor)
Builds a probe slowing down the simulation so that its execution speed matches a specific factoraccelerationFactor
times quicker than real time.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract double
getTimeElapsedBetween(SimulationTimeStamp time1, SimulationTimeStamp time2)
Gets the time elapsed between two simulation time stamps, in seconds.void
observeAtInitialTimes(SimulationTimeStamp initialTime, ISimulationEngine engine)
Observes the state of the simulation when the initial time stamp is reached.void
observeAtPartialConsistentTime(SimulationTimeStamp halfConsistentTime, ISimulationEngine engine)
Observes the state of the simulation when at least one level is in a consistent state.-
Methods inherited from class fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractProbe
endObservation, observeAtFinalTime, prepareObservation, reactToAbortion, reactToError
-
-
-
-
Constructor Detail
-
AbstractRealTimeMatcherProbe
public AbstractRealTimeMatcherProbe(double accelerationFactor)
Builds a probe slowing down the simulation so that its execution speed matches a specific factoraccelerationFactor
times quicker than real time.- Parameters:
accelerationFactor
- The acceleration factor of the simulation. 1 means that the time of the simulation has to match real time. A higher value means that the simulation has to go faster than real time. A lower value means that the simulation has to go slower than real time. This value has to be strictly positive.
-
AbstractRealTimeMatcherProbe
public AbstractRealTimeMatcherProbe()
Builds a probe slowing down the simulation so that its execution speed matches real time.
-
-
Method Detail
-
observeAtInitialTimes
public void observeAtInitialTimes(SimulationTimeStamp initialTime, ISimulationEngine engine)
Observes the state of the simulation when the initial time stamp is reached.- Specified by:
observeAtInitialTimes
in interfaceIProbe
- Overrides:
observeAtInitialTimes
in classAbstractProbe
- Parameters:
initialTime
- The initial time stamp of the simulation.engine
- The simulation engine embedding the currently running simulation and the current dynamic state of the various levels of the simulation.
-
observeAtPartialConsistentTime
public void observeAtPartialConsistentTime(SimulationTimeStamp halfConsistentTime, ISimulationEngine engine)
Observes the state of the simulation when at least one level is in a consistent state.- Specified by:
observeAtPartialConsistentTime
in interfaceIProbe
- Overrides:
observeAtPartialConsistentTime
in classAbstractProbe
- Parameters:
halfConsistentTime
- The time stamp for which at least one level of the simulation is a consistent state.engine
- The simulation engine embedding the currently running simulation and the current dynamic state of the various levels of the simulation.
-
getTimeElapsedBetween
protected abstract double getTimeElapsedBetween(SimulationTimeStamp time1, SimulationTimeStamp time2)
Gets the time elapsed between two simulation time stamps, in seconds.- Parameters:
time1
- The first time stamp of the comparison.time2
- The second time stamp of the comparison. We necessarily have time2 superior or equal to time1.- Returns:
- The time elapsed between two simulation time stamps, in seconds.
-
-