<< Click to Display Table of Contents >> Navigation: »No topics above this level« Appendix C - Calculated Channels Examples |
The Calculated Channels functionality allows the user to create channels based on existing channels.
A number of functions are made available for use in the calculation. Some examples are provided here.
Basic arithmetic
C1 + 273.15 |
Boolean logic
returns 0.0 if false, 1.0 if true
C1 > 10 |
Booleans can also be used like a value
(C1 > 10) * 100.0 |
Trigonometric functions
Sqr(C1 * C1) |
Sin(C1) |
Cos(C1) |
Tan(C1) |
ATan2(C1, C2) |
Rounding function
Round([value], [decimal places)
Round(C1, 2) |
If/Else function
If ([Condition], [IfTrue], [IfFalse])
If(C1 == null, C2, C1) |
If(C1 < 0, 0, C1) |
If(C1 > C2, C1 - C2, C2 - C1) |
Min/Max/Avg functions
Takes an arbitrary number of parameters and returns the highest/lowest of them
Min(C1, C2, C3, 4.0) |
Max(C1, C2, C3, 4.0) |
Avg(C1, C2, C3, 4.0) |
Aggregations
C1.Max - C1.Min |
If(C1.Count > 0, C1.Latest, -9999.0) |
Get the 75th percentile value
C1.NthPercentile[75] |
Get the number of exceedences over 400
C1.Exceedences[400] |
Standard Deviation
C1.StdDev |
Unit Conversion
Convert(C1, "ppb", "ppm") |
ConvertMolecular(C1, "ppb", "µg/m³", "CO2") |
ConvertMolecularTemp(C1, "ppb", "µg/m³", "CO2", 25.0) |
Solar functions
SolarElevation(now, -37.8982076, 145.2455205) |
SolarAzimuth(now, -37.8982076, 145.2455205) |
SolarRad(now, -37.8982076, 145.2455205) / 1.1 |
Timer functions
Alternate between 0 and 1 on 5 second interval
(Now % 10) < 5 |
Get current hour of the day
Floor(LocalTime(Now) / 3600) |
Get current minute of the hour
Floor((LocalTime(Now) % 3600) / 60) |
Get current second of the minute
Now % 60 |