opened 04:55PM - 04 Nov 24 UTC
enhancement
## Requirement
I want to calculate the energy consumption of a sensor that on…ly provides me with power data at irregular intervals. This could be, for example, the output of a heat pump, a heat output meter or other time-discrete values. For this, we need to implement an integral function.
## Suggestion
Provide a Riemann sum implementation with different alignments (left, right, mid, trapezoidal). Center/mid alignment is the best compromise between accuracy and implementation complexity.
[Riemann Sums](https://www.statisticshowto.com/calculus-problem-solving/riemann-sums/)
## Implementation
I provided a Riemann sum mid implementation in this discussion:
[Arithmetic mean vs average linear/step interpolation](https://community.openhab.org/t/arithmetic-mean-vs-average-linear-step-interpolation/159892/15)
## Your Environment
```
runtimeInfo:
version: 4.3.0
buildString: "Build #4362"
locale: en-AT
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 17.0.12
javaVendor: Ubuntu
osName: Linux
osVersion: 6.8.0-1013-raspi
osArchitecture: aarch64
availableProcessors: 4
freeMemory: 83704192
totalMemory: 605028352
uptime: 29022
startLevel: 100
addons:
- automation-jsscripting
- binding-enigma2
- binding-http
- binding-mielecloud
- binding-modbus
- binding-mqtt
- binding-netatmo
- binding-tado
- misc-openhabcloud
- persistence-influxdb
- persistence-mapdb
- transformation-jsonpath
- transformation-regex
- ui-basic
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: false
macos: false
windows: false
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
pixelRatio: 1
prefersColorScheme: dark
isSecureContext: false
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 12
language: en-AT
languages:
- en-AT
- en-GB
- en-US
- en
- de
onLine: true
platform: Linux x86_64
screen:
width: 3440
height: 1440
colorDepth: 24
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: dark
filled: true
pageTransitionAnimation: default
bars: light
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
blocklyRenderer: geras
userAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/130.0.0.0 Safari/537.36
timestamp: 2024-11-04T16:52:32.492Z
```