Class SimulationTimeService

  • All Implemented Interfaces:
    TimeService

    public class SimulationTimeService
    extends Object
    implements TimeService
    Simulation time model. Can be used by configuring in the yamcs.instance.yaml:
     timeService:
         class: org.yamcs.time.SimulationTimeService
         args:
             time0: 2020-10-02T18:10:00.000Z
             speed: 1.0
     
    By default the time0 is initialised with the time at the instance startup and the speed is 1.

    The service mantains a simulated time which is running based on the computer clock according to speed (e.g. speed = 2 means it runs two times realtime speed). If the speed is 0, the simulated time never advances and it has to be advanced from other place (see below).

    The simulation time service (as well as the speed) can be updated by various means:

    • Using the http time API; see https://docs.yamcs.org/yamcs-http-api/time/ for details.
    • Setting the option updateSimulationTime: true on a TM Data Link (this is implemented in AbstractTmDataLink) and will cause the simulation time to be updated with the packet generation time each time a packet is received on the corresponding link.
    • By a custom service.

    Note: using a time0 configured with a fixed value will cause the Yamcs to start always with the same simulation time and that might cause undesired effects such as packets overwriting eachother in the archive.

    Such an option is better to be used in a template which can then be used to create always new Yamcs instances (corresponding to test sessions) such that the data is separated. See the instance and templates API .

    • Constructor Detail

      • SimulationTimeService

        public SimulationTimeService​(String yamcsInstance,
                                     YConfiguration config)
      • SimulationTimeService

        public SimulationTimeService​(String yamcsInstance)
    • Method Detail

      • setSimElapsedTime

        public void setSimElapsedTime​(long simElapsedTime)
      • setTime0

        public void setTime0​(long time0)
        Set the time0
        Parameters:
        time0 -
      • setSimSpeed

        public void setSimSpeed​(double simSpeed)
        Set the simulation speed. If greater than 0, the time passes even without the update of the simElapsedTime.
        Parameters:
        simSpeed -