ottopaulsen / node-red-contrib-power-saver

A Node-RED node to saver money by turning off when the power is most expensive
Other
71 stars 17 forks source link

Schedule seems incorrect #31

Closed martin-swe closed 2 years ago

martin-swe commented 2 years ago

The schedule looks weird to me. See below:

config: object maxHoursToSaveInSequence: "20" minHoursOnAfterMaxSequenceSaved: "1" minSaving: 0.01 sendCurrentValueWhenRescheduling: true outputIfNoSchedule: true sentOnCommand: false time: "2022-01-17T09:52:04.580+01:00" version: "3.3.0" current: true

priceData: array[24] [0 … 9] 0: object value: 0.224 start: "2022-01-17T00:00:00.000+01:00" 1: object value: 0.2064 start: "2022-01-17T01:00:00.000+01:00" 2: object value: 0.1863 start: "2022-01-17T02:00:00.000+01:00" 3: object value: 0.1613 start: "2022-01-17T03:00:00.000+01:00" 4: object value: 0.1966 start: "2022-01-17T04:00:00.000+01:00" 5: object value: 0.252 start: "2022-01-17T05:00:00.000+01:00" 6: object value: 0.2605 start: "2022-01-17T06:00:00.000+01:00" 7: object value: 0.9028 start: "2022-01-17T07:00:00.000+01:00" 8: object value: 0.9402 start: "2022-01-17T08:00:00.000+01:00" 9: object value: 0.9618 start: "2022-01-17T09:00:00.000+01:00" [10 … 19] 10: object value: 1.0221 start: "2022-01-17T10:00:00.000+01:00" 11: object value: 1.0175 start: "2022-01-17T11:00:00.000+01:00" 12: object value: 0.9539 start: "2022-01-17T12:00:00.000+01:00" 13: object value: 1.1774 start: "2022-01-17T13:00:00.000+01:00" 14: object value: 1.3361 start: "2022-01-17T14:00:00.000+01:00" 15: object value: 1.7284 start: "2022-01-17T15:00:00.000+01:00" 16: object value: 1.8997 start: "2022-01-17T16:00:00.000+01:00" 17: object value: 1.9739 start: "2022-01-17T17:00:00.000+01:00" 18: object value: 1.9654 start: "2022-01-17T18:00:00.000+01:00" 19: object value: 1.8983 start: "2022-01-17T19:00:00.000+01:00" [20 … 23] 20: object value: 1.883 start: "2022-01-17T20:00:00.000+01:00" 21: object value: 1.8162 start: "2022-01-17T21:00:00.000+01:00" 22: object value: 1.7857 start: "2022-01-17T22:00:00.000+01:00" 23: object value: 1.0639 start: "2022-01-17T23:00:00.000+01:00" source: "Tibber"

schedule: array[6] 0: object time: "2022-01-17T00:00:00.000+01:00" value: false 1: object time: "2022-01-17T03:00:00.000+01:00" value: true 2: object time: "2022-01-17T10:00:00.000+01:00" value: false 3: object time: "2022-01-17T12:00:00.000+01:00" value: true 4: object time: "2022-01-17T13:00:00.000+01:00" value: false 5: object time: "2022-01-17T23:00:00.000+01:00" value: true

ottopaulsen commented 2 years ago

What is weird? What did you expect?

martin-swe commented 2 years ago

Schedule is true from 3am and turns to false at 10am for a total of 7 hours true. At 7am the price goes from 0.26 to 0.90. I would have expected the schedule change to false at 7am.

At 12 am the schedule turns to true again and then back to false at 1pm. I would have expected for the schedule to remain false.

ottopaulsen commented 2 years ago

Hi, I am sorry for the late response. I need you to provide data in a different way.

In the debug-window, when you point to the payload, you get a copy-button visible to the right. Please use that to copy the data coming from output 3 to a debug-node.

martin-swe commented 2 years ago

This was the output yesterday. How can I access this today?

Today's schedule makes sense.

ottopaulsen commented 2 years ago

Hmm. Not so easy, or maybe not even possible.

I suggest you come back if it happens again.

martin-swe commented 2 years ago

Here is another one that looks weird to me. Schedule is true from 1am to 7am. Price goes from 0.23 to 0.67 at 5am and to 1.55 at 6am. Saving null at 5am and 6am. doesn't make sense to me with a schedule I have for this node.

{"schedule":[{"time":"2022-01-21T01:00:00.000+01:00","value":true},{"time":"2022-01-21T07:00:00.000+01:00","value":false},{"time":"2022-01-21T23:00:00.000+01:00","value":true}],"hours":[{"price":0.2271,"onOff":false,"start":"2022-01-21T00:00:00.000+01:00","saving":0.0013},{"price":0.2258,"onOff":true,"start":"2022-01-21T01:00:00.000+01:00","saving":null},{"price":0.2259,"onOff":true,"start":"2022-01-21T02:00:00.000+01:00","saving":null},{"price":0.2274,"onOff":true,"start":"2022-01-21T03:00:00.000+01:00","saving":null},{"price":0.2314,"onOff":true,"start":"2022-01-21T04:00:00.000+01:00","saving":null},{"price":0.6778,"onOff":true,"start":"2022-01-21T05:00:00.000+01:00","saving":null},{"price":1.5553,"onOff":true,"start":"2022-01-21T06:00:00.000+01:00","saving":null},{"price":1.8809,"onOff":false,"start":"2022-01-21T07:00:00.000+01:00","saving":0.2963},{"price":1.9014,"onOff":false,"start":"2022-01-21T08:00:00.000+01:00","saving":0.3168},{"price":1.8987,"onOff":false,"start":"2022-01-21T09:00:00.000+01:00","saving":0.3141},{"price":1.897,"onOff":false,"start":"2022-01-21T10:00:00.000+01:00","saving":0.3124},{"price":1.878,"onOff":false,"start":"2022-01-21T11:00:00.000+01:00","saving":0.2934},{"price":1.8609,"onOff":false,"start":"2022-01-21T12:00:00.000+01:00","saving":0.2763},{"price":1.9012,"onOff":false,"start":"2022-01-21T13:00:00.000+01:00","saving":0.3166},{"price":1.8785,"onOff":false,"start":"2022-01-21T14:00:00.000+01:00","saving":0.2939},{"price":1.892,"onOff":false,"start":"2022-01-21T15:00:00.000+01:00","saving":0.3074},{"price":1.917,"onOff":false,"start":"2022-01-21T16:00:00.000+01:00","saving":0.3324},{"price":2.0649,"onOff":false,"start":"2022-01-21T17:00:00.000+01:00","saving":0.4803},{"price":2.0313,"onOff":false,"start":"2022-01-21T18:00:00.000+01:00","saving":0.4467},{"price":1.8732,"onOff":false,"start":"2022-01-21T19:00:00.000+01:00","saving":0.2886},{"price":1.8016,"onOff":false,"start":"2022-01-21T20:00:00.000+01:00","saving":0.217},{"price":1.743,"onOff":false,"start":"2022-01-21T21:00:00.000+01:00","saving":0.1584},{"price":1.7604,"onOff":false,"start":"2022-01-21T22:00:00.000+01:00","saving":0.1758},{"price":1.5846,"onOff":true,"start":"2022-01-21T23:00:00.000+01:00","saving":null}],"source":"Tibber","config":{"maxHoursToSaveInSequence":"20","minHoursOnAfterMaxSequenceSaved":"1","minSaving":0.001,"sendCurrentValueWhenRescheduling":true,"outputIfNoSchedule":false},"sentOnCommand":false,"time":"2022-01-21T08:44:56.322+01:00","version":"3.3.0","current":false}

ottopaulsen commented 2 years ago

The price when you turn on, at 23:00, is 1.58. That is more than the price at 04:00 (0.23) and 05:00 (0.68), so it would not make sense to save those two.

You can see it easier in the viewer.

By the way, what are you using this for? Since you accept so many hours off, you could consider using the LowestPrice node.

martin-swe commented 2 years ago

Understand that is the way the Best Save works at the moment. For me it doesn't make sense that and optimisation algorithm turns on more hours than required by the input parameters in the first true period (1am to 7am) just because a second true period (23pm) many hours later has a very high price. If that is the way you want it to work I'll use some other nodes.

ottopaulsen commented 2 years ago

The Best Save node works under the assumption that the power you are not using during an off-period will be used immediately after, in the next on-period. This is for example as would be the case with a water heater. Since the hours at 04:00 and 05:00 are in fact cheaper than the hour at 23:00, it is better to keep them on, than using the power in the more expensive period later.

If this is not what you want, you should use another node.