Calculate
The Calculate element can arithmetically manipulate Variables, whereby the I/O remains unmodified.
Usage
This Flow Control element can apply standard arithmetic (+,-,*,/) onto a Variable. Furthermore, the modulo (%) and exponentiation (^) methods are implemented in Lua 5.1.
To edit the formula fill in the Formula field in the Properties. Please note that Variables are called with cow.VariableName.
Computation with a constant
cow.VariableName = cow.VariableName + ( any standard arithmetic symbol ) constant
Computation with a other Cow Variable
cow.VariableName = cow.VariableName + ( any standard arithmetic symbol ) cow.VariableName
Recall that a calculation of a Variable of type decimal and a Variable of type integer returns a Variable of type decimal.
Example
Properties Window
The Variable factor is passed to the logic BoxManipulation. Factor is used as the coarse factor for the selected processor Coarse. | ||
Here the Variable called factor is of type integer with default value two. To see how to set up and use a Variable follow the link. | ||
After clicking into the grey part of the element Group the properties window displays the current value of the Variable factor. | ||
The Calculate element displays the computation. Here the sum of the Variable factor and one is written back to the Variable factor. |
Parameters and I/O
Input | Description |
---|---|
FirstInput | Input is passed along and triggers Calculate |
Output | Description |
---|---|
FirstOutput | Output which is unmodified |