Explains Riemann Integration methods (#30595)

* explain integration methods

* Update source/_integrations/integration.markdown

Co-authored-by: Christian Adamini <christian.adamini@invision.de>

* spelling

Co-authored-by: Danny Tsang <567982+dannytsang@users.noreply.github.com>

* grammar

Co-authored-by: Danny Tsang <567982+dannytsang@users.noreply.github.com>

---------

Co-authored-by: Christian Adamini <christian.adamini@invision.de>
Co-authored-by: Danny Tsang <567982+dannytsang@users.noreply.github.com>
This commit is contained in:
Diogo Gomes 2024-01-06 10:41:44 +00:00 committed by GitHub
parent afe07e1009
commit 39cf70c14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,24 @@ In case you expect that your source sensor will provide several subsequent value
The unit of `source` together with `unit_prefix` and `unit_time` is used to generate a unit for the integral product (e.g. a source in `W` with prefix `k` and time `h` would result in `kWh`). Note that `unit_prefix` and `unit_time` are _also_ relevant to the Riemann sum calculation. The unit of `source` together with `unit_prefix` and `unit_time` is used to generate a unit for the integral product (e.g. a source in `W` with prefix `k` and time `h` would result in `kWh`). Note that `unit_prefix` and `unit_time` are _also_ relevant to the Riemann sum calculation.
## Integration method
Riemann Sum is a approximation of an integral by a finite sum and is therefore intrinsically inaccurate, nonetheless, depending on the method used, values can be more or less accurate.
Regardless of the method used the integration will be more accurate if the source updates more often. If your source is not updated, neither will the Riemann Sum sensor, as all this integration does is calculate the next step in the event of a source update.
### Trapezoidal
The `trapezoidal` method follows the [Trapezoidal rule](https://en.wikipedia.org/wiki/Trapezoidal_rule). This method is the most accurate of the currently implemented methods, **if** the source updates often, since it better fits the curve of the intrinsic source.
### Left
The `left` method follows the [Left rule](https://en.wikipedia.org/wiki/Riemann_sum#Left_rule). The method **underestimates** the intrinsic source, but is extremely accurate at estimating rectangular functions which are very stable for long periods of time and change very rapidly (e.g. such as the power function of a resistive load can jump instantly to a given value and stay at the same value for hours). If your source keeps its state for long periods of time, this method is preferable to the `trapezoidal`.
### Right
The `right` method follows the [Right rule](https://en.wikipedia.org/wiki/Riemann_sum#Right_rule). The method is similar to the left method, but **overestimates** the intrinsic source. Again it is only appropriate to be used with rectangular functions.
## Energy ## Energy
An integration sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts). An integration sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts).