Values changing

Hello experts,

I have a question about MQTT value changes.

My photovoltaik (PV) system is displayes in green, the load from house in red.

At Time 14:29 the load decrease, then the PV power also. If the load increase, the PV power also increase.

In the end let me say if both values increase within 10 seconds, and this "feature" is more than 3 times within 30 minutes, I will start a trigger. I cannot say how much the increases or decreses are. It is depending on battery SOC, PV power, load,... And I have no idea how Nodered can handle it. But I´m sure somebody have a solution.

Here detailed with 2 values increase and decrease:

Thank you in advance and best regards

Node red can handle it if you can come up with a precise requirement for what you want to do.
Remember that any measurement is likely to have some random fluctuation, so using words like 'increase' is meaningless unless you can say exactly what you mean by that.

Hello. OK will I try to define it better. Both values are variables from 0 to 10000 and change every 5 seconds.
If the red value increase (from exist value) more than 300 and within 20 seconds the green value increase more than 200 then send start a trigger for 1 minute.

So I have 12 green values and 12 red values in 1 minute. Per day I have approx. this diagram for better understanding:

Do you mean that when one sample is more than 300 greater than the previous?

Do you mean that the value at the start of the window must be captured and the total of 200 increase must be within 20 seconds, or do you mean that there must be a sample to sample increase of 200 within the 20 seconds?

What happens if the red line keeps increasing for several samples? Does the 20 second keep restarting or is it just extended?

What happens if the red line increases by the threshold, so the 20 seconds starts, then the red line dips for 15 seconds and then goes back up again. What happens to the window then?

I don't understand what you mean by that. Do you mean send a start message, then a minute later send a stop message? If so then again there are questions about what happens when things keep increasing (or start increasing again) during that minute, what happens then? It is necessary to try and think of all these eventualities before you build it.

Is it always the load which increases first, or could it be PV power first then load?

I know that this feature is not so easy to understand... Let my try it little different to explain:
The red "peaks" are something like a load in the house - electrical heater. This electrical heater is active for example 5 minutes. So you can see the normally load from house is 500W. If the electrical heater is on via thermostate and the green PV power increase for the same time (with some seconds delay) I can see my PV battery can´t catch the complete PV power and increase. In this case I will activate an additional heater for warm water (via relay).

I hope it is more clear

Yes, load increases at first, then the pv power.
I explained it in previous text. If there is more load, then it could be created more PV power. This is the reason why the green pv power increase also.

This flow uses a node-red-contrib-simple-gate.
If either Load or PV increases or decreases by more than a certain amount, the gate is opened for 20 seconds, so a corresponding change in the other measurement will be passed through to the debug output.
It only notices change between a measurement and the immediately previous one.
There are sure to be many edge cases where this fails.

``````[{"id":"0859c4d4a89178b4","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"8fa0819c1f7857c4","type":"group","z":"0859c4d4a89178b4","name":"Detect change between successive Load values","style":{"label":true},"nodes":["ea52375c298fbab8","74ef51bb373691d1","72192ae517ae1ccc","a06b371e17dc272b"],"x":34,"y":39,"w":412,"h":162},{"id":"7ef96c7797edf93a","type":"group","z":"0859c4d4a89178b4","name":"Detect change between successive PV values","style":{"label":true},"nodes":["05d79d29b29f49ff","f612edb98416ed33","f5622a948e6c4875","d37d2ee94a231fa9"],"x":34,"y":319,"w":412,"h":162},{"id":"b52aed442d733c38","type":"group","z":"0859c4d4a89178b4","name":"Open Gate for 20s","style":{"label":true},"nodes":["6662e25bbd0b02e7","769839ee8c2fb5b4"],"x":34,"y":219,"w":412,"h":82},{"id":"ea52375c298fbab8","type":"inject","z":"0859c4d4a89178b4","g":"8fa0819c1f7857c4","name":"Load 1500","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Load","payload":"1500","payloadType":"num","x":140,"y":160,"wires":[["72192ae517ae1ccc"]]},{"id":"3570ef32b448bc4d","type":"gate","z":"0859c4d4a89178b4","name":"","controlTopic":"control","defaultState":"closed","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":590,"y":260,"wires":[["6333688fa5432796"]]},{"id":"6662e25bbd0b02e7","type":"trigger","z":"0859c4d4a89178b4","g":"b52aed442d733c38","name":"","op1":"open","op2":"close","op1type":"str","op2type":"str","duration":"20","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":130,"y":260,"wires":[["769839ee8c2fb5b4"]]},{"id":"05d79d29b29f49ff","type":"inject","z":"0859c4d4a89178b4","g":"7ef96c7797edf93a","name":"PV 750","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"PV","payload":"750","payloadType":"num","x":130,"y":440,"wires":[["f612edb98416ed33"]]},{"id":"6333688fa5432796","type":"debug","z":"0859c4d4a89178b4","name":"Do something ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":260,"wires":[]},{"id":"74ef51bb373691d1","type":"inject","z":"0859c4d4a89178b4","g":"8fa0819c1f7857c4","name":"Load 1100","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Load","payload":"1100","payloadType":"num","x":140,"y":80,"wires":[["72192ae517ae1ccc"]]},{"id":"72192ae517ae1ccc","type":"rbe","z":"0859c4d4a89178b4","g":"8fa0819c1f7857c4","name":"Changed by 300?","func":"deadbandEq","gap":"300","start":"","inout":"in","septopics":false,"property":"payload","topi":"topic","x":330,"y":120,"wires":[["6662e25bbd0b02e7","3570ef32b448bc4d"]]},{"id":"769839ee8c2fb5b4","type":"change","z":"0859c4d4a89178b4","g":"b52aed442d733c38","name":"msg.topic = control","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":260,"wires":[["3570ef32b448bc4d"]]},{"id":"f612edb98416ed33","type":"rbe","z":"0859c4d4a89178b4","g":"7ef96c7797edf93a","name":"Changed by 200?","func":"deadbandEq","gap":"200","start":"","inout":"in","septopics":false,"property":"payload","topi":"topic","x":330,"y":400,"wires":[["3570ef32b448bc4d","6662e25bbd0b02e7"]]},{"id":"a06b371e17dc272b","type":"inject","z":"0859c4d4a89178b4","g":"8fa0819c1f7857c4","name":"Load 1250","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Load","payload":"1250","payloadType":"num","x":140,"y":120,"wires":[["72192ae517ae1ccc"]]},{"id":"f5622a948e6c4875","type":"inject","z":"0859c4d4a89178b4","g":"7ef96c7797edf93a","name":"PV 600","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"PV","payload":"600","payloadType":"num","x":130,"y":400,"wires":[["f612edb98416ed33"]]},{"id":"d37d2ee94a231fa9","type":"inject","z":"0859c4d4a89178b4","g":"7ef96c7797edf93a","name":"PV 450","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"PV","payload":"350","payloadType":"num","x":130,"y":360,"wires":[["f612edb98416ed33"]]}]
``````

We don't need to understand the bigger picture. We need a complete definition of the logic required with all possibilities covered.

Thanks. Let me try it out. It looks good. Tomorrow first test.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.