Simulation builtins

The simulation builtins return values that are either specified in the simulation Run Specs dialog box, or that are related to the current simulation run.

This section describes the following builtins:

DT

DT is the time increment for calculations in a model simulation. You select the DT for the model in the Run Specs dialog box. For more information about DT, see Understanding DT (Delta Time).

STARTTIME

The STARTTIME builtin returns the value that you've specified in the From box in the Run Specs dialog box for the model.

STOPTIME

The STOPTIME builtin returns the value that you've specified in the To box in the Run Specs dialog box for the model.

TIME

The TIME builtin returns the current time within a model simulation. TIME is often used as an argument to logical functions, trigonometric functions, and graphical functions.

Examples:

10*SIN(2*PI*TIME/12) generates a sinusoidal fluctuation with an amplitude of 10 and a period of 12.

My_Bonus = IF(TIME=5) OR (Sales>5000) THEN Bonus ELSE 0

This statement sets My Bonus to the value of Bonus at simulated time 5, or whenever the value of Sales is greater than 5000. When neither condition is met, the statement gives the value 0. Sales and Bonus are defined elsewhere in the model.

As the following graph shows, TIME can also be used as the independent variable in a graphical function which defines a set of historical data.

Because of the internal calculations associated with the Runge-Kutta methods, the TIME function won't return values equal to simulation time when you use the 2nd- or 4th-order Runge-Kutta computation methods. When your model constructs rely on the TIME function being exactly equal to simulation time, be sure to use Euler's method.

Concept Link IconSee Also