Model time is the virtual (simulated) time maintained by the AnyLogic simulation engine. Model time has nothing to do with the real time or the computer’s clock (although you can run the model to scale to real time).
In AnyLogic, the model time takes real numbers (double type values). The model clock is advanced in steps: when the engine is executing a discrete event model, the model time jumps from one event to another; when running a continuous time model, the time steps are typically smaller and of equal size.
To establish the correspondence between the model time and real-world time where the system being modeled lives, we need to define the time units. The type of time unit depends on the time scale of the activities you are modeling. For example, if you are modeling a call center where the call durations are measured in seconds or minutes, you may set the time units to seconds or minutes. If you are modeling a supply chain, where manufacturing and shipping times are measured in days, days would be the right choice.
AnyLogic supports all common time units: milliseconds, seconds, minutes, hours, days, weeks, months, years. You can change the model time units at any time, although we recommend that you select the model time units when you create the model.
To set the time units
- In the Project view located in the left sidebar, select the model (the topmost item).
- In the model’s Properties, select the required time units from the Model time units drop-down list.
You can set the stop time, the time at which you want the simulation run to be terminated.
To set start and stop times
- In the Project view located in the left sidebar, select the model (the topmost item).
- Locate the Model time section in the Properties.
- If you want the simulation to stop at a specific time, you can specify stop time as a calendar date or you can specify the simulation time horizon as a number of model time units.
- Otherwise, if you prefer to specify times as calendar dates, enter the start and stop dates using Start date and Stop date controls. By default, the start date is set to the date when the model was created.
AnyLogic can execute the simulation model in two modes, virtual time and real time on a given scale.
- In real time mode, the AnyLogic model time is mapped to real time, that is, you specify how many model time units one second takes. This is often needed when you want your presentation to look like real life. The engine tries to maintain a given scale, for example, 10 model time units (say, 10 simulated weeks) per 1 real second. Sometimes, however, the engine is unable to maintain a given time scale because the events are too frequent or too complex, or because the system of equations is too large and/or the time step is too small. Then the engine will work as fast as possible until it finds the next opportunity to maintain the real-time scale. Thus, the only thing the model can guarantee with respect to the real time is that the model execution will never go faster than requested.
- In virtual time mode, the simulation engine runs the model as fast as it can. The model runs at its maximum speed and there is no mapping between model time units and seconds of astronomical time. This time mode is useful when you need to simulate your model for a long period of time. The virtual time mode is used when simulation performance is important and animation of the model dynamics is not required.
In real time mode, you can increase or decrease the model simulation speed by changing the model simulation speed scale. The default 1x scale means that the model is simulated with the model simulation speed defined in the properties of the current AnyLogic experiment; 2x means that the model is run twice faster than the specified model speed, and so on. For instance, if the model speed is 6 model time units per second, 2x means that 12 model time units correspond to 1 second.
You can set the desired execution mode in the model’s Model time properties section. Later, you can use the controls in the model window to change the mode during runtime or do it programmatically.
To set the default time mode and simulation speed
- In the Project view located in the left sidebar, select the model (the topmost item).
- Locate the Model time section in the Properties.
- Set the time mode for the animation using the controls in the Animation runs in section.
- If you want to run your model in the virtual time mode, select the Virtual time mode option.
- Otherwise, if you want to set the mapping between model time and real time units, select Real time mode and set the scale value (number of model time units executed per one second) from the Animation time scale drop-down list below.
The easiest way to display model time while the model is running is to open the developer panel. The model time indicators are at the very top of it.
-
How can we improve this article?
-