You can use these Device Variables (

) in the equations of the same device model or any device model that inherits from it. Right-click a
Device Model or
Device Model Feature node and choose
Device Variables from the
Devices submenu.
Fill in the table columns and rows with the variables needed. Enter a Name and specify an
Expression for a variable. This directly defines an equation for the variable. The
Expression column, when nonempty, represents the right-hand side in an equation with the variable’s name as the left-hand side The main difference compared to adding an equivalent
Device Equations node is that any expression entered in the
Device Variables node may be modified by a device model that inherits from the device model that this node is in. This is not possible or allowed if you only add a device equation.
When added under a Port Model node, this section is called
Port Variables, and a
Flow variable column is available. Select the checkbox in the
Flow variable column for a variable to indicate that the variable is treated as a flow in connections between ports.
Click the Edit Variable button (

) underneath the table to edit these settings and others for the selected variable. In the
Edit Variable window, under
State options, the
Rule for selecting variable as a state list sets a priority rule for eliminating variables in the final device system. The options are
Always use as state,
Prefer as state,
Use as state if appropriate (the default),
Avoid using as state, and
Never use as state. Those variables that are not eliminated become states. All variables declared by the
Device States and
Discrete Device States nodes always become states. Enter an initial guess for a state in the
Initial guess (leave empty to skip) field. For all eliminated variables there is no need for an initial guess, and the expression will be ignored. Leave the field empty to skip defining any initial guess. The device system analysis will then choose an initial guess, which will be zero in most cases. Select the
Collect states to checkbox and then enter the name of an
ODE States Collection node to ensure that any states generated by this variable will be sorted into that collection. This is an alternative to using the pattern entered in the
Include states pattern (regular expression) field in that collection. The collection entered in the
Collect states to field will have precedence over any collection matched by the name pattern in the
ODE States Collection node.