<< Click to Display Table of Contents >> Navigation: MODELS > Resident variables |
1. Resident time variables
A number of variables are permanently defined and are available for use in a model. Their value can be used directly in any variable expression of a model, and cannot be modified in assignment statements in the model. Their names are visible in any model, and can be used directly without being declared in a VAR declaration.
The following resident variables provide access to the time characteristics of the simulation of a model.
Variable |
Description |
A separate set of values of these variables exists locally for each use of each model. The timestep can be declared locally in the header of each model TIMESTEP min:recip(SampleFreq) |
|
t |
the present value of the simulation time in the model; |
prevtime |
the previous value of the simulation time in the model; |
timestep |
the present value of the simulation interval in the model (=t-prevtime); |
endtime |
the external simulation time to which the model is to be updated; |
fullstep |
the total time interval over which the model is to be updated (= endtime - previous endtime); |
maxstep |
the calculated present maximum allowed value of the time step in the model; |
minstep |
the calculated present minimum allowed value of the time step in the model; |
Other resident variables are defined globally for a simulation: |
|
starttime |
the value of time at the start of the simulation; |
stoptime |
the value of time at which the simulation will end; |
startstep |
the value of the outermost time step at the start of the simulation. |
In addition to representing the present value of the simulation time in a model, the variable t can also be used as a regular reference to the value of time in expressions describing history functions in a model (see HISTORY).
2. Resident constants
A number of numerical and logical constants are permanently defined and are available for use in model descriptions. Their value can be used directly in any expression of a model. Their names are visible in any model, and can be used directly without being declared in a CONST declaration.
The following resident constants are defined:
Constant |
Value |
Resident numerical constants: |
|
pi |
= 3.14159... |
inf |
= very large number fitting the computer in use |
undefined |
= 88888.88888 (value held by any element before it is assigned a first value) |
Resident logical constants: |
|
false |
= 0 |
true |
= 1 |
no |
= 0 |
yes |
= 1 |
open |
= 0 |
closed |
= 1 |
off |
= 0 |
on |
= 1 |