Seite 2 von 2

Re: 48V-Akku zur Grundlastabdeckung - Einbindung/Hardware?

Verfasst: Fr Jan 06, 2023 10:18 am
von Stevie_AN
Scheinbar ist es doch nicht so einfach. Ich hab das im Node Red jetzt mal folgender Maßen gebastelt:
2023-01-06_11h10_29.png
Und in der Funktion dann immer den Wert "m" mit addiert.
2023-01-06_11h10_59.png
2023-01-06_11h10_59.png (9.38 KiB) 1296 mal betrachtet
Ich kann dem einspeisenden WR jedoch immer nur 0 - 300W vorgeben. Und aktuell schickt er ja immer viel mehr (also x+m) raus.
2023-01-06_11h10_09.png
2023-01-06_11h10_09.png (9.62 KiB) 1296 mal betrachtet
Doch komplizierter, als ich dachte.

Hier mal der Flow, wie es aktuell aussieht. Der Send an den HM-300 stimmt noch nicht, der ist noch nicht da.

Code: Alles auswählen

[{"id":"82119491.05bc9","type":"tab","label":"Shelly Ladepunkt","disabled":false,"info":""},{"id":"ea537576.f6855","type":"mqtt in","z":"82119491.05bc9","name":"Bezug EVU","topic":"openWB/evu/W","qos":"2","datatype":"json","broker":"c4cb83c8.1bd0c","nl":false,"rap":true,"rh":0,"x":330,"y":280,"wires":[["411eecd0.951cdc","c46b2a4f.08f8d","ada02d11.0493a"]]},{"id":"411eecd0.951cdc","type":"ui_gauge","z":"82119491.05bc9","name":"","group":"910cd9b8.54f308","order":0,"width":0,"height":0,"gtype":"gage","title":"Einspeisung | Netzbezug","label":"Watt","format":"{{value}}","min":"-10000","max":"+10000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"0","seg2":"300","diff":true,"className":"","x":750,"y":280,"wires":[]},{"id":"c46b2a4f.08f8d","type":"function","z":"82119491.05bc9","name":"if-Filter","func":"m = msg.payload;\nif (m > 300)\n{\nmsg.payload=(300 + m);\n}\nif (m > 800)\n{\nmsg.payload=(0 + m);\n}\nif (m <= 0)\n{\nmsg.payload=(0 + m);\n}\nelse if (m < 300)\n{\nmsg.payload=(m + m);\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":380,"wires":[["dbc25041.070998"]]},{"id":"bfee6647.327bd8","type":"ui_text","z":"82119491.05bc9","group":"910cd9b8.54f308","order":1,"width":"0","height":"0","name":"","label":"Vorgabe Einspeisung: ","format":"{{msg.payload}} W","layout":"row-center","className":"","x":740,"y":320,"wires":[]},{"id":"2363eec9.805eba","type":"mqtt out","z":"82119491.05bc9","name":"HM-300 Ahoy-DTU","topic":"/ctrl/limit_persistent_absolute/","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"c4cb83c8.1bd0c","x":930,"y":580,"wires":[]},{"id":"37734c32.6c474c","type":"debug","z":"82119491.05bc9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":640,"wires":[]},{"id":"dbc25041.070998","type":"delay","z":"82119491.05bc9","name":"","pauseType":"rate","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"60","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":500,"wires":[["2363eec9.805eba","37734c32.6c474c","f10aab1e.f21d3"]]},{"id":"ada02d11.0493a","type":"function","z":"82119491.05bc9","name":"","func":"m = msg.payload;\nif (m > 300)\n{\nmsg.payload=(300);\n}\nif (m > 800)\n{\nmsg.payload=(0);\n}\nif (m <= 0)\n{\nmsg.payload=(0);\n}\nelse if (m < 300)\n{\nmsg.payload=(m);\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":320,"wires":[["bfee6647.327bd8"]]},{"id":"f10aab1e.f21d3","type":"ui_text","z":"82119491.05bc9","group":"910cd9b8.54f308","order":2,"width":0,"height":0,"name":"","label":"Send an WR: ","format":"{{msg.payload}}","layout":"row-center","className":"","x":720,"y":360,"wires":[]},{"id":"c4cb83c8.1bd0c","type":"mqtt-broker","name":"OpenWB","broker":"192.168.178.61","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"30","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"910cd9b8.54f308","type":"ui_group","name":"EVU","tab":"d55078b2.26bcd8","order":1,"disp":true,"width":"9","collapse":false},{"id":"d55078b2.26bcd8","type":"ui_tab","name":"OPENWB","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

Re: 48V-Akku zur Grundlastabdeckung - Einbindung/Hardware?

Verfasst: Fr Jan 06, 2023 2:52 pm
von Gero
nodeRED hat die Eigenart, dass man sich Werte aus dem letzten Durchlauf des Flows nicht in den einzelnen Nodes des Flows merken kann. Dafür muss man in Variablen schreiben, die für den ganzen Flow oder gar ganz global gelten.

Die beiden oberen Inject-Nodes setzen eine Variable, die in dem unteren Flow abgefragt wird.

flow.jpg

Code: Alles auswählen

[{"id":"4408cde48aff4005","type":"change","z":"7ecc73778fed7cbb","name":"","rules":[{"t":"set","p":"flow_variable","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":220,"wires":[["c105f22fbc6e9ccb"]]},{"id":"6a0b259e701ce963","type":"inject","z":"7ecc73778fed7cbb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":180,"y":220,"wires":[["4408cde48aff4005"]]},{"id":"c105f22fbc6e9ccb","type":"debug","z":"7ecc73778fed7cbb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":220,"wires":[]},{"id":"2c351c650ef55ece","type":"debug","z":"7ecc73778fed7cbb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":300,"wires":[]},{"id":"6e82cf562812cbfe","type":"inject","z":"7ecc73778fed7cbb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":300,"wires":[["b013199d0f7e0e7d"]]},{"id":"b013199d0f7e0e7d","type":"change","z":"7ecc73778fed7cbb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"flow_variable","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":300,"wires":[["2c351c650ef55ece"]]},{"id":"8772e53b6be1a18e","type":"inject","z":"7ecc73778fed7cbb","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":190,"y":140,"wires":[["4408cde48aff4005"]]}]

Re: 48V-Akku zur Grundlastabdeckung - Einbindung/Hardware?

Verfasst: Fr Jan 06, 2023 3:59 pm
von Gero
Ich hab' das mal unter Auslassung des Dashboards fertig gestellt. Vielleicht passt's ja so.

Die drei unteren Inject-Nodes inititialisieren flow-globale Variablen: Einmal die 300, die 800 und die letzte WR-Einspeiseleistung. Darüber für's debuggen die Abfrage dieses Werts und ganz am Anfang Deine Logik, ein wenig angepasst.


Code: Alles auswählen

[{"id":"c46b2a4f.08f8d","type":"function","z":"82119491.05bc9","name":"if-Filter","func":"var w = flow.get(\"max_w\");\nvar g = flow.get(\"grenze\");\n\nvar l = flow.get(\"letzter\"); // letzte RW-Vorgabe\n\nm = msg.payload + l;\n\n// Einspeisung\nif ( m < 0 ){\n    msg.payload = 0;\n}\n\n// überschreitung max. WR-Leistung\nif (m > w){\n    msg.payload = w; \n}\n\n\n// Überlast ohne WR\n\nif ( m > g ){\n    msg.payload = 0;\n}\nflow.set(\"letzter\", msg.payload); \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":340,"wires":[["dbc25041.070998"]]},{"id":"37734c32.6c474c","type":"debug","z":"82119491.05bc9","name":"an_WR","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":340,"wires":[]},{"id":"dbc25041.070998","type":"delay","z":"82119491.05bc9","name":"","pauseType":"rate","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"60","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":730,"y":340,"wires":[["37734c32.6c474c"]]},{"id":"ada02d11.0493a","type":"function","z":"82119491.05bc9","name":"","func":"m = msg.payload;\nvar w = flow.get(\"max_w\");\nvar g = flow.get(\"grenze\");\n\nif (m > w){\n    msg.payload = w;\n}\nelse{\n    msg.payload = m;\n}\nif ((m > g) || (m < 0)){\n    msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":160,"wires":[["ec9f70b38fb4f6f2"]]},{"id":"b6c1ea50c81e25eb","type":"debug","z":"82119491.05bc9","name":"EVU","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":240,"wires":[]},{"id":"ec9f70b38fb4f6f2","type":"debug","z":"82119491.05bc9","name":"Einspeisung","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":160,"wires":[]},{"id":"581d063bb4a047c8","type":"change","z":"82119491.05bc9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":240,"wires":[["b6c1ea50c81e25eb","ada02d11.0493a","c46b2a4f.08f8d"]]},{"id":"3e7c0df831dc0adc","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"110","payloadType":"num","x":90,"y":240,"wires":[["581d063bb4a047c8"]]},{"id":"9f5fc50c2772e954","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"350","payloadType":"num","x":90,"y":160,"wires":[["581d063bb4a047c8"]]},{"id":"58514faaf10890b7","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-80","payloadType":"num","x":90,"y":320,"wires":[["581d063bb4a047c8"]]},{"id":"dd96b6272ff2622f","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"850","payloadType":"num","x":90,"y":80,"wires":[["581d063bb4a047c8"]]},{"id":"5773237007cacee3","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"300","payloadType":"num","x":110,"y":540,"wires":[["757c367ba212f169"]]},{"id":"757c367ba212f169","type":"change","z":"82119491.05bc9","name":"","rules":[{"t":"set","p":"max_w","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":540,"wires":[[]]},{"id":"75132375f9ca3d34","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":440,"wires":[["73e66b03710dabcf"]]},{"id":"78d195d74e57a14b","type":"debug","z":"82119491.05bc9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":440,"wires":[]},{"id":"73e66b03710dabcf","type":"function","z":"82119491.05bc9","name":"","func":"msg.payload = flow.get(\"letzter\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":440,"wires":[["78d195d74e57a14b"]]},{"id":"3f70473546677c25","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"800","payloadType":"num","x":110,"y":580,"wires":[["47e7a9489d46447a"]]},{"id":"47e7a9489d46447a","type":"change","z":"82119491.05bc9","name":"","rules":[{"t":"set","p":"grenze","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":580,"wires":[[]]},{"id":"0cd290f2d1be3eff","type":"inject","z":"82119491.05bc9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":110,"y":500,"wires":[["9fa8b7c0e588d5c0"]]},{"id":"9fa8b7c0e588d5c0","type":"change","z":"82119491.05bc9","name":"","rules":[{"t":"set","p":"letzter","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":500,"wires":[[]]}]

Re: 48V-Akku zur Grundlastabdeckung - Einbindung/Hardware?

Verfasst: So Jan 08, 2023 12:37 pm
von Stevie_AN
Wow...! DANKE :)

Das sieht extrem vielversprechend aus und hätte ich definitiv nicht hinbekommen.

Nun muss nur noch der Microinverter und die Hardware für die OpenDTU ankommen und dann geht es an die nächste Hürde: Den Wert per MQTT oder Modbus an die OpenDTU schicken, so dass der Hoymiles HM-300 die Drosselung auch entsprechend ausführt.

Bin extrem gespannt. Hoffentlich klappt das alles so, wie ich mir das vorstelle.

Danke, Gero!

Grüße und einen schönen Sonntag noch...