Page: Setup -> Data
Math controllers allow one or more Inputs to have math applied to produce a new value that may be used within Mycodo.
!!! note "Last" means the controller will only acquire the last (latest) measurement in the database for performing math with. "Past" means the controller will acquire all measurements from the present until the "Max Age (seconds)" set by the user (e.g. if measurements are acquired every 10 seconds, and a Max Age is set to 60 seconds, there will on average be 6 measurements returned to have math performed).
Types of math controllers.
Type | Description |
---|---|
Average (Last, Multiple Channels) | Stores the statistical mean of the last measurement of multiple selected measurement channels. |
Average (Past, Single Channel) | Stores the statistical mean of one selected measurement channel over a duration of time determined by the Max Age (seconds) option. |
Sum (Last, Multiple Channels) | Stores the sum of multiple selected measurement channels. |
Sum (Past, Single Channel) | Stores the sum of one selected measurement channel over a duration of time determined by the Max Age(seconds) option. |
Difference | Stores the mathematical difference (value_1 - value_2). |
Equation | Stores the calculated value of an equation. |
Redundancy | Select multiple Inputs and if one input isn't available, the next measurement will be used. For example, this is useful if an Input stops but you don't want a PID controller to stop working if there is another measurement that can be used. More than one Input can be and the preferred Order of Use can be defined. |
Verification | Ensures the greatest difference between any selected Inputs is less than Max Difference, and if so, stores the average of the selected measurements. |
Statistics | Calculates mean, median, minimum, maximum, standard deviation (SD), SD upper, and SD lower for a set of measurements. |
Humidity (Wet/Dry-Bulb) | Calculates and stores the percent relative humidity from the dry-bulb and wet-bulb temperatures, and optional pressure. |
Math controller options.
Setting | Description |
---|---|
Input | Select the Inputs to use with the particular Math controller |
Period (seconds) | The duration of time between calculating and storing a new value |
Max Age (seconds) | The maximum allowed age of the Input measurements. If an Input measurement is older than this period, the calculation is cancelled and the new value is not stored in the database. Consequently, if another controller has a Max Age set and cannot retrieve a current Math value, it will cease functioning. A PID controller, for instance, may stop regulating if there is no new Math value created, preventing the PID controller from continuing to run when it should not. |
Start Offset (seconds) | Wait this duration before attempting the first calculation/measurement. |
Measurement | This is the condition being measured. For instance, if all of the selected measurements are temperature, this should also be temperature. A list of the pre-defined measurements that may be used is below. |
Units | This is the units to display along with the measurement, on Graphs. If a pre-defined measurement is used, this field will default to the units associated with that measurement. |
Reverse Equation | For Difference calculations, this will reverse the equation order, from value_1 - value_2 to value_2 - value_1 . |
Absolute Value | For Difference calculations, this will yield an absolute value (positive number). |
Max Difference | If the difference between any selected Input is greater than this value, no new value will be stored in the database. |
Dry-Bulb Temperature | The measurement that will serve as the dry-bulb temperature (this is the warmer of the two temperature measurements) |
Wet-Bulb Temperature | The measurement that will serve as the wet-bulb temperature (this is the colder of the two temperature measurements) |
Pressure | This is an optional pressure measurement that can be used to calculate the percent relative humidity. If disabled, a default 101325 Pa will be used in the calculation. |
Equation | An equation that will be solved with Python's eval() function. Let "x" represent the input value. Valid equation symbols include: + - * / ^ |
Order of Use | This is the order in which the selected Inputs will be used. This must be a comma separated list of Input IDs (integers, not UUIDs). |