-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Energy management/calculations #3478
Comments
As other tools as Grafana are way better in visualizing data, i have seen many users do something like this (including myself):
But that is just historical. What would the future calculations need to do? Assist with deciding the provider to use? or automated decission to start or delay a power consuming task? Prognoses based on your historicall usage only is not enough, you would need a lot more parameters to train a model. /me: subscribed to this topic :-) |
See the dishwasher rule example I've provided. I simply program the dishwasher to be finished 7:00 in the morning. The rule will then detect that this has been scheduled and will then calculate the optimal period considering how much power it uses during the program and the future prices. For example, my most used program will use the most power approximately 1:30 into the program and then for the next hour after that. Therefore, for best results, the program needs to be mapped. Assuming linear power consumption for the duration of the program will give very different results.
Or something simpler. For example, for the washing machine we use a few more different programs than for the dishwasher, so in this case I haven't mapped any programs yet. However, I have persisted all parameters including the program types and energy consumption. So in theory I could select the last 60 °C cottons program, and the mapping of the program could be done automatically. I could then move this into the future, and the price could be calculated from a period, or the period could be calculated from the lowest price. |
Feeding tasks with details (e.g start/end boundaries, task duration, energy usage profile) to this ‘energy management service’ is one thing(demand). The other can be a bit more complex. The prices from external providers like you said can be obtained. But what about your own energy generators? Solar panels? That may need some weather prognoses etc? Home batteries? May need some expected battery drain. Prices here (Netherlands) are sort of fixed, and you only pay for the annual nett (from and to the grid substracted) result of power usage. Because of this method, scheduling is not yet important, but it will as these rules have changed per 2025. What constraints would the internal scheduler have? |
This issue has been mentioned on openHAB Community. There might be relevant details there: |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/entsoe-e-binding-for-nordpool-spot-prices/143833/4 |
This might be of interest to the readers of this thread: And this: Cheers, |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/dishwasher-price-calculation-automation/139207/1 |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/dishwasher-price-calculation-automation/139207/4 |
@jlaur , here are the calculations that I'm currently using with this solution: I have just recently improved my own solution since we (finally) got our electric vehicle. The content below is therefore is fresh from the oven and more advanced than what I have published in the link above. 1. Fetching the spot price and persisting it as a future-timestamped time series 2. Finding the cheapest consecutive N-hour window within a given time range
I originally used this so that I was searching the cheapest hours from midnight to midnight, but since the electric vehicle came to the picture, I'm now searching the cheapest window between 21 and 06 so that the car will always be ready in the morning.
3. Populating the rest of the day with "OFF" control points Anyway, the fact that I search for the cheapest car charging window between 21-06 means that I don't have control points from 07:00 onwards. This method allows me to populate 0 value ("off") control points from 07:00 onwards.
4. Finding the individual cheapest hours from a given range, cheap hours do not need to be consecutive.
5. Finding the individual expensive hours from a given range, hours do not need to be consecutive.
6. Finding the individual cheapest hours for heating, balancing the heating throughout the day. First of all, I calculate the needed amount of heating hours based on the weather forecast. The weather forecast has been persisted to a measurement 'fmi_forecast_temperature' with future timestamps. (Side note: In my own implementation I actually consider both temperature and wind speed of the weather forecast because the house cools down more when it's windy. I use the so called wind chill factor, the "feels like" temperature you can see in weather forecasts, see https://en.wikipedia.org/wiki/Wind_chill#North_American_and_United_Kingdom_wind_chill_index) I have searched empirically the house-specific formula that is basically "when tomorrow's average temperature is X, I need to allow Y heating hours for the heat pump". When the number of needed heating hours (Y above) is known / has been calculated, I can use the method below for finding the hours when I will allow the heat pump compressor to be on. Most of the time during this winter I have only heated the house during the night hours (number of slices has been 1) but on very cold days I have split the day to three 8 hour slices and searched the cheapest hours from each slice.
Cheers, p.s. I have previously published the code with the following license in the community post linked in the beginning of this comment. It's still my copyright so if parts of this code would end up in openhab, it can be licensed with the license that is used with openhab.
|
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/tibber-binding-get-best-price-items-like-awattar-binding/144223/9 |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/tibber-binding-get-best-price-items-like-awattar-binding/144223/17 |
Hey guys, I'm now jumping on this train as well, so count me in! I tried to read most of your ideas/discussion here, but as it is quite a lot, I certainly will have missed some aspects. Let me nonetheless try to summarize what I understood what we would ideally need:
Adding PV systems to the solution increases the complexity by another level, since we would additionally need
Did I miss anything crucial? Sounds already like quite some endeavor... 😲 |
Don't want to oversimpify, but for on a high level, i think such a system should consistent of three modules;
Edit: |
This simple demand modelling might work for EVs and heatpumps, but not so well for dishwashers, washing machines and tumble dryers - to schedule them well, you must probably consider the load more fine-grained than as a fixed power value (that's at least what I understand from @jlaur's solution). |
Yes, this would come in very handy for these use-cases. I guess we could reboot #844 and the implementation proposal #3000.
Correct, a poor man's solution for not having any PV systems, EV's or heat pumps to play with is to optimize scheduling of the dishwasher during the night. 😄 I also just added another small calculation example for some tumble dryer price feedback: https://community.openhab.org/t/dishwasher-price-calculation-automation/139207/5 - taking advantage of calculations currently implemented in openhab/openhab-addons#14376 - specifically https://github.com/openhab/openhab-addons/blob/e6fbfcf04aaf2fd130601534218a8e1d15825225/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/PriceCalculator.java My initial thought was to have such calculations consolidated in some central place so they could be reused for all bindings providing electricity price information. This could be done by providing an interface that such bindings could implement to deliver the needed data. You are right this is more fine-grained, but perhaps the calculations would actually be quite similar, if not the same, for EV/heat pump use-cases. One difference might be only having a need for running "full hours", but this seems like a simplification, i.e. rounding. At least I would appreciate to have the fined-grained use-cases included in the design we come up with. This is of course only a small part in the big puzzle. |
It's complex because there's different types of load. Many you can determine (like a dish washing will always take 1.5kWh), some you cannot in neither amount (like a car that constantly charges at say 11 kW but how to do the math if you don't have access to the SoC?) or power requirements (like an inverter heat pump that's consumption will vary a lot). BTW I'm happy to share what I implemented when it's for a good purpose like here. On live data from inverters, it's needed yes but don't put it in the mix here that might kill this issue's scope. |
To be considered just as a side note: Regarding prices I'll just add that openhab/openhab-addons#14529 has been introduced to avoid redundant VAT calculations. This is probably one of the first "finance" contributions. The next thing that comes to mind could be modelling currencies - currently |
I only tried to model the basics, offcourse the powerprofile can be very detailed. Maybe even a minute by minute power usage table for the device. This model won't prevent those details. In my mind, the model has enough room for something like a home battery or heat pump to get rid of the excess power. Just schedule a 'device' with constraint that it is not allowed to cost more then 0 money and uses x kw/h. But i also see room for priority as a constraint. There should be even more constraints, i didn't meant it as a limited list, just as a model. The main question is how such feature would fit in OH. Or do you guys think of some whole new concept? |
Yes, I was also planning to look a bit closer into that and what it would mean for future prices.
Interesting idea, but I would leave it out of scope for the start - this sounds like another complex feature on its own.
Thanks for the offer, I'll try to have a look. For our controller, I guess we might end up implementing it in Java directly then, but Rule DSLs are then pretty close already.
Yes, I agree that we should start slowly and cover the basics first - in a way that can be extended later on for more complex cases.
Difficult to say. I don't think we will be able to squeeze everything into the existing concepts, so yes, some new kind of construct might be necessary. |
@kaikreuzer wrote:
Thanks, I appreciate your acknowledgement! @kaikreuzer wrote
@lsiepel wrote:
How I see this is as follows: 1. We need a to have a capability to store future price and forecast data The common nominator for both the prices and the different forecasts is that they are future-timestamped time-series data, however the forecasted value of timestamp X may change over time as we get closer to it, but for energy optimization calculations the expected result is pretty much always that the fresh value for the same timestamp overwrites the older value for the same time. I would like to highlight that it's not just a question of electricity prices and temperature forecasts. There are many other forecasts that can be used as an input for energy management optimizations. Solar power production forecast, cloud coverage forecast, wind power production forecast, are the first ones that come to my mind. But as said, these are nothing more than future-timestamped time-series. 2. The price of electricity is a topic of its own I recently changed our network transfer contract so that it is no longer a fixed price / kWh like it used to be. Our deal is now that
Summa summarum: The electricity price topic has a couple of aspects:
3. Calculating the operating mode schedules for different kinds of energy consumers I'm intentionally using the word "operating mode" here instead of "ON/OFF schedules" here because @mstormi has a very valid point that the world has shades of gray between the binary ON and OFF. Most ground source heat pumps have a support for SG Ready modes (there are four of them). Some simpler devices like water boilers have just two modes, ON and OFF. I can easily see that EV charges can have other operating modes than just ON and OFF, they could for example provide an interface to allow changing the current (e.g. 8A, 10A, 13A, 16A, 32A). Anyway, we would ideally find a concept here which is simple for users but flexible enough for different kinds of use cases. @mstormi approached this slightly differently in his solution than I did in mine, see the discussion in the link above. But anyway, to not go into the solution yet, I'll try to write a couple of use cases in a user story format. a) As an owner of an electric vehicle, I want to find the best time to charge the vehicle between 21 this evening and 06 tomorrow so that it will be ready in the morning. I know that I need to charge the car for X1 hours. I do not want to interrupt the charging. In other words, the X1 hours must be consecutive. b) As an owner of a water boiler, I want to to find the best time to heat the domestic hot water tomorrow. I know that I need to heat the water for X2 hours. I do not want to interrupt the heating because stopping and re-starting it would mix the water layers. In other words, the X2 hours must be consecutive. c) As an owner of an air-to-air heat pump, I want to optimize the heating of the house by changing between two operating modes depending on the price of electricity. Based on the weather forecast, I know that I need to have mode A enabled for X3 hours of the day and I want these to be the cheapest hours of the day. The rest of the day (all other hours) I can use mode B. d) As an owner of a ground source heat pump that supports SG Ready modes, I want to toggle mode 4 when the price of the electricity is below a configured threshold. (there are of course more user stories than these, but this should be a good start) All this would fall into the "engine" category that @lsiepel was suggesting above. |
Some more input on levels. I also integrated EVCC Electric Vehicle Charge Controller in my EM system.
FWIW, EV charging is pretty similar in terms of black-white-gray coloring @masipila mentioned. These EVCC modes I felt match SGr modes quite well and since I had an existing SGr implementation for heat pumps in my EMS, I just did the mapping for EVs, too. |
From a user perspective i can understand all the cases. With those cases you demonstrated that it can get really complex and without proper design this will turn into spaghetti. As allways, but specifically in this case proper seperation of concern is very important here. As every The same for The scheduling engine can be very lean as all the hard parts have allready been done. I would really not suggest to make the engine responsible for determining the prices of the energy provider as that will need an extended and ever changing interface between the energyprovider and the engine. Anyway, the above is just a suggestion, and there is one step before this and that is how all this will be tied into the openHAB achitecture.
|
@lsiepel can you please elaborate your thinking of the PowerProfile? For what purpose do we need it? Not challenging, just trying to follow your thought process. |
Regarding the considerations of EnergyUser and the existing openHAB concepts. In my eyes all these EnergyUser devices are Things. There are Bindings to most of these already and eventually Items will abstract the state changes from one mode another (like ON / OFF or from SG Ready mode 1 to 4). The only thing that comes to my mind is that some use cases might need to know how much power the device will consume (and from which phase or all of them) if there would be some sort of a load balancing use case where you can't toggle all the devices on at the same time. Is this what you mean with the powerProfile and can you provide an example use case or user story to demonstrate the intended usage that you have in your mind? |
Yes, i meant the PowerProfile as a way of describing the required load usage over time. And +1 for the support of not only on/off but also different levels. Every level should have its own PowerProfile i guess. |
Thanks @J-N-K. My first impuls is that it should be fitted into UoM, but I haven't thought through the consequences (mainly wrt dynamic exchange rates).
That's true, but are there really any countries in the world where there are dynamic tariffs for water? I think adding such a feature would heavily increase complexity as the search for optima would have to be done for different dimensions simultaneously - I'd rather prefer to stay away from this (for now). |
I had a quick look and I think we have to extend I'm not aware of any country that does it. I would not implement that in the first step, just if it's possible to keep it extendable then we should do it. We might see gas tariffs in the future that at least have daily or monthly changes (especially thinking of hydrogen replacing fossil gas). |
Just to be clear, in lack of a better word, with (price) "elements" I mean the components that make up the total price you have to pay per kWh. In my case this is spot price, net tariff, system tariff, electricity tax and transmission net tariff. On top of that the fee to my electricity company, which is luckily fixed (no binding for that 🙂).
👍
So, as an example - two of my price components (let's try that word now) are dynamic: Spot price and net tariff. Currently both are provided by Energi Data Service, but let's say I wanted to use another binding (or a rule, script calling the REST API, karaf command etc.) for getting the spot price. I would now have at least two different price components (items) from different sources that should be taken into consideration when performing calculations, as the cheapest period has to be calculated from the sum. Maybe you already had this in mind, so just to be sure and fully aligned. The user should be able to configure which items to include in the calculations. |
@jlaur that's clear to me. For me, I can't get the grid tariff and the spot price from the same datasource, but that should not be an issue. I could have two separate Bindings, on which fetches the spot prices from Entso-E and another that calculates the grid tariffs and electricity tax. According to this [1], if the user places the different items in the same group and persists the group, then the sum of all items in that group will be persisted and we have the total price. But doing the summing should not be difficult even if it didn't happen automagically by persisting the group. If @kaikreuzer 's proposed class diagram is OK for everyone, should we break this thing into separate issues and establish a backlog of them?
Does this sound like a plan? [1] https://community.openhab.org/t/energy-rules-sum-of-group-to-item-help/10264/5 |
With persisting, do you mean storing it in some database? As i don't see that as a requirement, the Anyway, i see some kind of gap between the proposed I would have hoped that the framework could take care direct communcation in the background between the |
@jlaur Yes, agreed.
@masipila Yes, sounds good to me.
@lsiepel Yes, this would be exactly my plan as well - there can only be specific |
This issue has been mentioned on openHAB Community. There might be relevant details there: |
Hey guys, I just want to say that I am still alive and haven't forgotten about this topic. I'll probably not be able to make big advancements before the OH4 release end of June, but it is definitely my absolutely top priority right after that. |
This issue has been mentioned on openHAB Community. There might be relevant details there: |
It would also be nice if the solution would be a bit more generic. For instance you might also want to have something for redistributing rain water, money, heat, cold etc. one day. 🙂 I.e. resource management. |
hi, i went through the whole issue here. one thing i would like to add here: i will checkout the main branch and see if i could find some work done on this. sounds like fun!!! |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/energi-data-service-binding-4-0-0-0-4-1-0-0/144370/38 |
I think somebody is already working on a UoM for converting money amounts i.e USD per Euro (say). And (part of) your discussion is very similar to that -- namely kWh per Euro (say) which you might convert via UoM to Joule per DKr (say). Both these would be extensions of UoM where the conversion factors are variable rather than fixed in code. The variable rates are a time series where past rates are historical actual values, and future rates are forecasts. The source of these rates might be e.g. Bank of Denmark (say) or EON (say), or in my latter example (with double UoM conversion) both sources (say). The intervals between two fixed rate UoM conversion data points could be subject to various interpolation algorithms (e.g. linear, or keep last value, ..) |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/best-approach-for-energy-consumption-usage-queries/151393/21 |
Now with OH4(.1) out and Number:Currency and Number:EnergyPrice implemented, shouldn't we be picking this up again ? I just applied for a grid discount according to German §14a EnWG and my provider responded the industry is currently thinking to implement EEBus as a control protocol to power-dim or shutoff large consumers. It's still under evaluation, just spreading the word. They've also sent me a spec from the VDE if someone is interested (but that's fairly useless). Either way, I believe openHAB would benefit from an EEBus implementation. |
There is a community developed EEBus binding: https://github.com/csowada/openhab-ebus-binding. |
@florian-h05 Binding you refer to is ebus, while Markus talks about eebus (https://www.eebus.org/). I know, its quite confusing, but later is more recent and (in theory) spans across more areas than just heating/ventilation. |
Oh thanks for the hint, seems like it also confused me ;-) |
For what's it worth, EVCC has a working EEBus implementation in Go and is now working on v2. On forecasting, what about finalizing openhab/openhab-addons#13308 for 4.2. |
The current status can be seen in the PR - last comment. |
I would like to make some comments about EEBUS:
Integration would still be a big task, as the service on top of CEMd would have to be written in Go and an interface would have to be defined. Once that is done, support for germans §14a technically could also be implemented. Feel free to get in touch, my contact details are available at https://enbility.net |
I guess a different option would be to write a JNI wrapper for your EEBus implementation. I have googled a bit, and I also found the Java EEBus implementation from openMUC, which is created by a team of the Fraunhofer ISE in Freiburg, Germany: https://www.openmuc.org/eebus/ |
@florian-h05 sadly it is not open source and I haven’t seen it working with a device yet. But maybe they would be interested anyway helping you to have a show case |
I guess I have to face the truth of my situation that I won't be able to find the time to work on that topic the way I intended. Since I spent some time and proposed a potential architecture for tackling the problem, exactly one year has passed without any progress on my end - I'm feeling very sorry about that. 😢 So please do not wait for me here - if anybody is interested to pick up this topic, please speak up and drive it forward! In any case, I would split the discussion about general energy management (this issue) and EEBus. Imho, if we are able to create a modular architecture like the one suggested above, EEBus could possibly be one implementation behind the interfaces, but it would leave the room for many other (simpler) approaches as well. |
I'm creating this issue to start brainstorming ideas which may or may not grow into something. For starters, I will share some unstructured thoughts, which could grow into something structured and potentially into something that could be designed and implemented.
Let me start out by sharing some links which can shed some light into where I'm coming from with this:
My initial need is integration to services providing future energy prices. After that, having these prices, I would like to be able to perform calculations. These calculations should be implemented once with a common interface, no matter from which service the prices were obtained. I wonder, from an architectural point of view, if this already means something is needed within openhab-core, since addons cannot depend on other addons? For example, core could provide some interfaces and calculations, while addons could integrate various API's implementing such interface.
Now really brainstorming/dreaming. For the dishwasher example, I logged energy consumption during our most frequently used program and manually mapped that into a timetable in a rule. Considering being able to select the last run specific program on some device (having an energy consumption channel which can be persisted) and map that into another timeslot to calculate the price of that, or having the ideal timeslot calculated automatically within some boundaries. I guess this is just a use-case for the price integrations and calculations and an application which should be built outside of openHAB itself, but just wanted to mention this, so that the parts needed for this could emerge.
I now also have almost real-time logging of the power consumption in my house (see third link above) provided a current power (W) as well as accumulated energy consumed (kWh). The accumulated value is updated once per hour, and current power is updated every 10 seconds. With this data I would like to be able to create a graph like this (screenshot from AMS reader):
For this some post-processing is needed, since I receive the kWh data like this:
i.e. as totals, not hourly contributions. So (14610.24-14609.85) kWh = 0.39 kWh from this log example, which is shown as last bar on the graph above. I'm not sure what is the best approach for doing this, but again it would be nice with something consistent and reusable.
I will update this issue with additional thoughts and knowledge from all of you.
I'm currently considering providing a small binding fetching data from EnergiDataService which is a Danish service providing prices. Yesterday I was also able to receive the same prices from ENTSO-E, but in EUR. So this could reach a broader audience, but would additionally require integration to online currency exchange rates to have conversion to local currencies. Currency question: Do we have any kind of currency handling in openHAB?
The text was updated successfully, but these errors were encountered: