Class 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 Detail

      • MILLISECONDS_IN_SECONDS

        protected static final int MILLISECONDS_IN_SECONDS
        The number of milliseconds in a second.
      • NANOSECONDS_IN_SECONDS

        protected static final int NANOSECONDS_IN_SECONDS
        The number of nanoseconds in a second.
    • Constructor Detail

      • AbstractRealTimeMatcherProbe

        public AbstractRealTimeMatcherProbe​(double accelerationFactor)
        Builds a probe slowing down the simulation so that its execution speed matches a specific factor accelerationFactor 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 interface IProbe
        Overrides:
        observeAtInitialTimes in class AbstractProbe
        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 interface IProbe
        Overrides:
        observeAtPartialConsistentTime in class AbstractProbe
        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.