... | ... | @@ -8,9 +8,9 @@ Transform Expressions are used for a number of purposes, including: |
|
|
|
|
|
Transform Expressions are entered on the Sensor editing screen. The screenshot below shows a Transform Expression that is to adjust the reading from a Light Sensor, correcting for light reducing paint that covers the sensor.
|
|
|
|
|
|
[[images/transform_ex1.png]]
|
|
|

|
|
|
|
|
|
In the `Transform or Calculated Field Function Name` box you can see the transform expression: `val*35.0 - 140.0`. The variable `val` is always available in a Transform Expression and it contains the raw sensor value that was posted. This transform multiplies that raw value by 35.0 and then subtracts 140.0. When creating these expressions, you have all the [[built-in functions|https://docs.python.org/2/library/functions.html]] (e.g. `abs()` for absolute value, ) from the Python programming language plus the functions available in the [[Python math module|https://docs.python.org/2/library/math.html]] (e.g. `sqrt()`, `sin()`, `log10()`). So, an expression such as `sqrt(val)/(val - 8.6)` is a valid transform expression.
|
|
|
In the `Transform or Calculated Field Function Name` box you can see the transform expression: `val*35.0 - 140.0`. The variable `val` is always available in a Transform Expression and it contains the raw sensor value that was posted. This transform multiplies that raw value by 35.0 and then subtracts 140.0. When creating these expressions, you have all the [built-in functions](https://docs.python.org/2/library/functions.html) (e.g. `abs()` for absolute value, ) from the Python programming language plus the functions available in the [Python math module](https://docs.python.org/2/library/math.html) (e.g. `sqrt()`, `sin()`, `log10()`). So, an expression such as `sqrt(val)/(val - 8.6)` is a valid transform expression.
|
|
|
|
|
|
In the above screenshot, note that the `Calculated Field` box is **not** checked. This is not a new calculated field, created from other sensor values or the gathered from the Internet. Instead, this is just a conversion of an incoming sensor value.
|
|
|
|
... | ... | @@ -20,7 +20,7 @@ Electric meters, gas meters, water meters, and fuel meters often produce pulses |
|
|
|
|
|
Special pulse counter Transform features were developed to address this situation. The recommended setting for a pulse counter is to have it continually accumulate pulse counts, only resetting to zero when a maximum rollover pulse count is reached. If your pulse counter is set up in this way, below is an example of how you can transform the total pulse count values into a usable rate value. In this example, a natural gas meter is being read, and a pulse occurs for each CCF of gas passing through the meter. Our objective is to convert the pulse count readings into a gas flow measured in Btu/hour.
|
|
|
|
|
|
[[images/transform_ex2.png]]
|
|
|

|
|
|
|
|
|
The BMON Transform feature has a special variable named `rate`. If a Transform expression uses this variable, BMON knows that a pulse count is being measured, and BMON automatically calculates the pulse rate per second indicated by the last pulse count reading received relative to the prior pulse count reading. This pulse rate is stored in the variable `rate`. As an example, assume that the last pulse count received was a total count of 10,435. The prior pulse count reading from the sensor was 9,623 and it was receive 605 seconds prior to the current reading. The pulse rate that occurred between the two readings was `(10435 - 9623) / 605 = 1.342 pulses/second`. This value of 1.342 is automatically stored in the `rate` variable.
|
|
|
|
... | ... | @@ -36,7 +36,7 @@ There are couple other optional but often important parameters that can be enter |
|
|
|
|
|
**`max_rate`** (default value = 5.0, expressed as pulses/second): Pulse count reporting errors (one common one described below) can sometimes lead to an erroneous high pulse rate calculation. BMON will not save any sensor values if the pulse rate is above this `max_rate` value. For the example above, a maximum pulse rate 1.5 pulses per second is set. This corresponds to a 5,454,000 Btu/hour rate. Reported sensor values will be rejected if they exceed this rate. Note that there is a default `max_rate` value of 5.0 pulses/second if you value is provided in the `Function Parameters` box.
|
|
|
|
|
|
**`rollover`** (default value = 65536, largest 16 bit value): Pulse counters usually have a maximum pulse count that they record before rolling over to zero. BMON will account for this rollover when calculating the pulse rate. Year 2014 and prior [[Monnit wireless pulse counters|http://www.monnit.com/ProductSearch?SortBy=Rank&Asc=False+&PageSize=12&ProductCategory=1&SensorType=32&SensorProfile=30]] roll over at a count of 65,536, the default value for this parameter. Newer Monnit pulse counters are 32 bit and roll over at 4,294,967,296. If you expect your pulse counter to eventually roll over, you need to ensure that BMON is using the correct `rollover` value.
|
|
|
**`rollover`** (default value = 65536, largest 16 bit value): Pulse counters usually have a maximum pulse count that they record before rolling over to zero. BMON will account for this rollover when calculating the pulse rate. Year 2014 and prior [Monnit wireless pulse counters](http://www.monnit.com/ProductSearch?SortBy=Rank&Asc=False+&PageSize=12&ProductCategory=1&SensorType=32&SensorProfile=30) roll over at a count of 65,536, the default value for this parameter. Newer Monnit pulse counters are 32 bit and roll over at 4,294,967,296. If you expect your pulse counter to eventually roll over, you need to ensure that BMON is using the correct `rollover` value.
|
|
|
|
|
|
**`ignore_zero`** (default value = `True`, the other valid value is `False`): Monnit Wireless pulse counters occasionally reset to a pulse count of zero if there are transmission problems or an accidental reset of the sensor. So, the pulse count value of zero is usually an erroneous value. By leaving this `ignore_zero` parameter at its default value of `True`, these zero pulse count readings will be ignored and no value will be stored until the next valid reading.
|
|
|
|
... | ... | @@ -50,7 +50,7 @@ If your pulse counter is setup to reset to zero after it reports its pulse count |
|
|
|
|
|
The screenshot below is example of configuring a counter that resets to zero after each sensor report.
|
|
|
|
|
|
[[images/transform_ex3.png]]
|
|
|

|
|
|
|
|
|
The text `count_rate` must be entered into the `Transform or Calculated Field Function Name` box. Then, additional parameters are entered into the `Function Parameters in YAML form` box. Each parameter has a default value, so they are not required to be entered, but you will likely need to override some of the default values.
|
|
|
|
... | ... | |