Variables

Variables are calculated values that represent model states. Variables are modified by the solver as it searches for a solution. Each additional variable adds a degree of freedom to the problem.

Variables are declared in the Variables ... End Variables section of the model file. The variables may be defined in one section or in multiple declarations throughout the model. Variable initialization is performed sequentially, from top to bottom. If a variable does not have an initial value given, a default value of 1.0 is assigned. Variables may also be a function of other parameters or variable initial conditions. These initial conditions are processed once as the first step after the model parsing.

Scope

All variables have global scope. This facilitates the exchange of information between models but can also lead to name conflicts. Object variables have the object name pre-pended. In order to use an object's variable in an equation, a connection must be made to a user-defined variable.

Global Name

Variables are identified by the simulation mode, file name, model or object name, and variable name. These names are separated by a period to form a global name. These global names are used in configuration files to identify the variable.

Example

 ! Example variable declarations in test.apm
 Model example
   Variables
     v0                 ! no initial value provided - default = 1
     v1 = 1.5           ! initializes to 1.5
     v2 = 2 * p1        ! initializes to 3.0
     v3 = exp(p2) * p1  ! initializes to exp(3.0) * 1.5
     my_variable = 1   ! initializes to 1.0
   End Variables
 End Model

Global variable name for variable v0 in model example and file test.apm solved in a steady-state ss simulation.

  ss.test.example.v0