Documentation‎ > ‎

Variable and Calculation Blocks

Difference Between the Blocks

The fundamental difference between the variable block and the calculation block is: variables cannot be defined by equations, and calculations cannot have optimization or statistical parameters defined.
Variable blocks may have multiple arguments of the format:

Variable Blocks

Simple Optimization and Variable Blocks

Name = value unit

Furthermore, variables may be optimized with the following format (please pay attention to the semicolon):
   Name = value ; <opt … /> <stat … />
Where the “…” is the standard Mason definitions, e.g.:
    min==”1” max==”2” step==”0.1” set="0"
In effect, everything past the semicolon is directly placed into Mason’s XML format.  If you use a colon instead of a semi-colon, the optimization tag will be visible.  If variables or calculations are added in the GUI, remember to change the parameter field to "Argument".

The "min" and "max" definitions provide the valid range for the variable.  The "step" is optional, and defines the increments the optimizer can take (so in the above example, the following are valid values: 1.0, 1.1, 1.2, 1.3, all the way to 2.0).  The "set" is part of an advanced optimization technique and is optional.

So, a valid argument in the variable block could be:
    length_qw = 0.1; <opt min="50" max="100" step="5"/>
When optimizing, the "min" and "max" are required to be defined.  The "step" and "set" are optional.

Variable Files

It is also possible to use a file which has variables, which is a useful way to pass a subsection of code (say from a Linux box back to a Windows box).  Use a variable name of "__filename" and the value is the filename, as in:

__filename = validation\validation28_var.txt;

The variable file is an XML file of the form:
<?xml version="1.0" encoding="utf-8" ?>
        <z0 value="69.7928 ">
            <opt min="25" max="200" step="0" set=" 1 " />
            <stat std_dev="10" />

Calculation Blocks 

YouTube Video

Calculations create new variables that are based on previously defined variables.  These can be either from the variable block, or from a previously defined calculation.
   theta_2 = 2*theta_1
If variables or calculations are added in the GUI, remember to change the parameter field to "Argument".  For a complete list of acceptable calculation criteria, please check out my math parser page.