-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[blockly] Riemann sum persistence extension and js tern definitions #2893
base: main
Are you sure you want to change the base?
Conversation
#2597 Bundle Size — 10.9MiB (+0.02%).bf47ebf(current) vs bd9c6f0 main#2593(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
|
Current #2597 |
Baseline #2593 |
|
---|---|---|
Initial JS | 1.9MiB |
1.9MiB |
Initial CSS | 577.39KiB |
577.39KiB |
Cache Invalidation | 18.09% |
18.15% |
Chunks | 226 |
226 |
Assets | 249 |
249 |
Modules | 2947 |
2947 |
Duplicate Modules | 154 |
154 |
Duplicate Code | 1.8% |
1.8% |
Packages | 96 |
96 |
Duplicate Packages | 2 |
2 |
Bundle size by type 1 change
1 regression
Current #2597 |
Baseline #2593 |
|
---|---|---|
JS | 9.11MiB (+0.02% ) |
9.11MiB |
CSS | 866.47KiB |
866.47KiB |
Fonts | 526.1KiB |
526.1KiB |
Media | 295.6KiB |
295.6KiB |
IMG | 140.74KiB |
140.74KiB |
HTML | 1.38KiB |
1.38KiB |
Other | 871B |
871B |
Bundle analysis report Branch mherwege:riemann_sum Project dashboard
Generated by RelativeCI Documentation Report issue
@stefan-hoehn FYI, not to be merged yet, as waiting for the core and javascript enhancements. |
Can you add what the extension is about. We should avoid overloading blocks with too many things (not saying you do so 😉) |
I have added some description in the first post. This is about keeping the persistence blocks in line with the (still proposed) core and js scripting extensions. |
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
bfb2134
to
bf47ebf
Compare
Depends on openhab/openhab-js#401
Depends on openhab/openhab-core#4461
This will also require a new js scripting library release.
This PR extends the Blockly block getting a statistical value from persistence to be aligned with core and js scripting extensions.
The added statistical function is Riemann sum. This is an approximation of the integral value and can e.g. be used to calculate an approximation for energy consumption (in kWh) when the instantanous power (in W) is persisted.
The existing sum method calculates a naive sum, ignoring the time dimension and is not applicable for this. It could be used only if the persistence interval is constant by using the sum and multiplying with the interval duration.
There are multiple types of Riemann sum calculations depending on which value is used as an approximation in each bucket. The ones implemented in core (and js scripting) are: left, right, trapezoidal and midpoint. If the Riemann sum statistical method block is selected in the block, a parameter for this will also be shown, defaulting to left.
As average, variance and deviation statistical methods are based on Riemann sum calculations (the current average calculation assumes Riemann sums of type left), these methods now also have this extra type input parameter (defaulting to left).
Note that in most cases, the trapezoidal (or midpoint) methods would result in better accuracy. However, for backward compatibility reasons, the default has been kept on left.