Variables overview
CIF features different kinds of variables, that have different functionality. Each is better suited for a particular purpose. The following table gives an overview:
Kind of variable | Can be assigned | Can change as time progresses |
---|---|---|
yes |
no |
|
no |
yes |
|
yes |
yes |
|
no |
yes |
|
depends |
depends |
Discrete variables can only change value when given an explicit new value by means of an assignment. They don’t change automatically as time progresses.
Algebraic variables can’t be assigned. Instead, their values depend on their declarations or equation(s). If the computations that result in their values depend on a variable that can change value as time progresses, then so can the values of the algebraic variables. Algebraic variables are used as named shorthand notations for computations, for readability, reuse, consistency, and abstraction.
Continuous variables automatically change value as time progresses, as specified by their derivatives. They can also be assigned new values, from which they then automatically change again, based on the current values of their derivatives.
The derivatives of the continuous variables can be seen as variables themselves. Their values depend on their declaration or equation(s). If the computations that result in their values depend on a variable that can change value as time progresses, then so can the values of the derivatives.
Input variables are introduced in a later lesson. Different tools may use different approaches to connect input variables to the environment of the specification, which impacts how values are provided for the input variables. Whether input variables can change value by assignment or can change as time progresses therefore also depends on how tools work with them. The CIF language allows assigning them via SVG input mappings with updates, which are explained in a later lesson.