Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page

Table of Contents
maxLevel4

Accessing the current simulation time

Simulation time is a timestamp that is retrieved from a simulation clock. You can use ALH API to get the simulation time of execution.

Code Block
languagetext
ALH.getCurrentTime()
ALH.getCurrentTime("timeUnit")

The following code fragment shows how to get the simulation time of execution through ALH API.

Code Block
languagetext
ALH.getCurrentTime();
ALH.getCurrentTime("ms");					//You can use either the name or abbreviation of the time unit.
Note

Supported time units are nanosecond(ns), microsecond(µs), millisecond(ms), second(s), minute(min), hour(h), day(d), week(w), month(mo), year(y).

Accessing a simulation time unit

The simulation time unit is defined in the tag "timeUnit" of an SimulationConfig stereotype. If you do not define the value of this tag, the default unit of time is the millisecond. You can use ALH API to get a simulation time unit of execution.

The following code fragment shows how to get the TimeUnit tag of a SimulationConfig through ALH API.

Code Block
languagetext
ALH.getTimeUnit();          // millisecond