Coder Social home page Coder Social logo

Comments (6)

Apollon77 avatar Apollon77 commented on August 28, 2024 1

Data aggregation stuff is locate here: https://github.com/ioBroker/ioBroker.history/blob/master/lib/aggregate.js#L65 and "post pocessing" in https://github.com/ioBroker/ioBroker.history/blob/master/lib/aggregate.js#L117
For this all logic should be done as post-processing I think

from iobroker.history.

Apollon77 avatar Apollon77 commented on August 28, 2024

Basic implementation maybe using https://www.npmjs.com/package/math-tools

from iobroker.history.

AlCalzone avatar AlCalzone commented on August 28, 2024

When integrating, that module seems to expect a function which has to be defined for all x-values (or time points) in the interval to integrate. We don't have that because we only have single data points. But we basically only need this simple formula:

// at the start of the interval:
integral = 0
// for each data point
integral += 0.5 * (current_value + prev_value) * (current_timestamp - prev_timestamp)

And the sum doesn't have to be recalculated each time if we somehow store the aggregated value. Then we only need to add the last part whenever a new data point arrives.

from iobroker.history.

Apollon77 avatar Apollon77 commented on August 28, 2024

What Time.base we should use? h or min r sec or ms ? :-) Data-Timestamps has ms, so it would result in "Wms" :-)

from iobroker.history.

AlCalzone avatar AlCalzone commented on August 28, 2024

What Time.base we should use? h or min r sec or ms ? :-) Data-Timestamps has ms, so it would result in "Wms" :-)

As dumb as that sounds for energy consumption, I would use ms to have maximum flexibility. Maybe we can add a scaling factor, which would be 1/3600000 to turn Wms into Wh. Or make the time base configurable?

from iobroker.history.

Apollon77 avatar Apollon77 commented on August 28, 2024

Please check out 2.0.0 https://forum.iobroker.net/topic/54197/test-adapter-history-2-0-0

from iobroker.history.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.