The fundamental difference between variables and calculations is that
variables can have optimizations associated with them, and
calculations can be defined by muParser compatible equations; these are the orthogonal traits. See also the Optimization and Statistical Analysis section of the Device Tag.
Variables can be used to define the arguments of a primitive device, or which file is used in a Touchstone based device. For example, the geometry of a microstrip circuit may be based on several calculations of variables to make sure the circuit can be realized (see single_wilkinson.dsn in the examples folder). There is only one variable block. Variables can use units.
Calculations can be used on the variables, and the results can be values in the devices. There are multiple calculation blocks. Calculations use the muParser engine.
A common technique using variables and calculations is to ensure a monotonically increasing impedance. For example:
Variables can be used to define the arguments of a primitive device, or which file is used in a Touchstone based device. For example, the geometry of a microstrip circuit may be based on several calculations of variables to make sure the circuit can be realized (see single_wilkinson.dsn in the examples folder). There is only one variable block. Variables can use units.
<variables>
<theta_1 value="30“></theta_1> (variables may not use equations)
<z1 value="100">
<opt min="50" max="100" />
</z1>
<z2 value="100">
<opt min="50" max="100" step="5"/>
<stat min="50" max="100" />
</z2>
</variables>
<TL node_list="3 5"> (This is a device)
<z0 value = "100" />
<theta value = "theta_1" />
<f0 value = "150e6" />
</TL>
Calculations can be used on the variables, and the results can be values in the devices. There are multiple calculation blocks. Calculations use the muParser engine.
<calculation equation="theta_2 = 2*theta_1">
(calculations cannot have opt or stat tags)
</calculation>
A common technique using variables and calculations is to ensure a monotonically increasing impedance. For example:
<variables>
<z0 value = "50" />
<m1 value = "1">
<opt min="1" max="1.2" />
</m1>
<m2 value = "1">
<opt min="1" max="1.2" />
</m2>
</variables>
<calculation equation="z1 = m1 * z0" />
<calculation equation="z2 = m2 * z1" />