Automated Current limit

I am best to say a beginner compared to the knowledgeable people on this site.

Thankfully for this site i have read and fought through the beginning of the learning curve and found my self knowing enough about NR and its function to really want to know more .

I attempting to make a flow that will automatically reduce the input current limit of Battery chargers when AC loads external to the system go up. so that the generator is not over loaded.

I have made quite a bit of progress, but i am bit stuck trying to set up a divide function, to divide external loads ( Galley and 50hz ) it is watts by the system voltage, to then have Amps of the external loads, i would then like the result subtracted from the existing current limit. then written back to the system as you will see in the flow,

[{"id":"63aaa3e4.c45fec","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"5ecb14e4.29a8ec","type":"mqtt in","z":"63aaa3e4.c45fec","name":"Galley","topic":"shellies/shellyem-05EC0B/emeter/1/power","qos":"2","datatype":"auto","broker":"89c0f82.5aa2708","x":90,"y":20,"wires":[["aaf9f7d7.f96b18"]]},{"id":"aaf9f7d7.f96b18","type":"json","z":"63aaa3e4.c45fec","name":"","property":"payload","action":"","pretty":false,"x":210,"y":20,"wires":[["ae0a9070.6e2b7"]]},{"id":"74b9d194.34fe","type":"mqtt in","z":"63aaa3e4.c45fec","name":"50hz","topic":"shellies/shellyem-05EC0B/emeter/0/power","qos":"2","datatype":"auto","broker":"89c0f82.5aa2708","x":90,"y":100,"wires":[["a08aedcc.cb5b6"]]},{"id":"a08aedcc.cb5b6","type":"json","z":"63aaa3e4.c45fec","name":"","property":"payload","action":"","pretty":false,"x":210,"y":100,"wires":[["5e5bf59a.9bda2c"]]},{"id":"ae0a9070.6e2b7","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":40,"wires":[["42508796.522828"]]},{"id":"42508796.522828","type":"change","z":"63aaa3e4.c45fec","name":"sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var1')+$flowContext('var2')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":80,"wires":[["d0f62079.878d2","974e82e0.ab801"]]},{"id":"d0f62079.878d2","type":"debug","z":"63aaa3e4.c45fec","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":770,"y":20,"wires":[]},{"id":"5e5bf59a.9bda2c","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":100,"wires":[["42508796.522828"]]},{"id":"fc5c0b25.539d78","type":"mqtt in","z":"63aaa3e4.c45fec","name":"Voltage","topic":"shellies/shellyem-05EC0B/emeter/0/voltage","qos":"2","datatype":"auto","broker":"89c0f82.5aa2708","x":90,"y":220,"wires":[["1af4982c.0e8a58"]]},{"id":"c3ab30d9.c2fdc","type":"debug","z":"63aaa3e4.c45fec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":470,"y":280,"wires":[]},{"id":"1af4982c.0e8a58","type":"json","z":"63aaa3e4.c45fec","name":"","property":"payload","action":"","pretty":false,"x":220,"y":220,"wires":[["4484e922.707898"]]},{"id":"974e82e0.ab801","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":80,"wires":[["7f27a8ef.0d0008"]]},{"id":"4484e922.707898","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var4","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":220,"wires":[["7f27a8ef.0d0008","fbe56ff2.7512c"]]},{"id":"7f27a8ef.0d0008","type":"change","z":"63aaa3e4.c45fec","name":"Divide ( =amps )","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var3')/$flowContext('var4')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":200,"wires":[["607f058f.80a91c","4b184003.9dcb9"]]},{"id":"607f058f.80a91c","type":"debug","z":"63aaa3e4.c45fec","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":900,"y":180,"wires":[]},{"id":"50b66d1e.8965b4","type":"mqtt in","z":"63aaa3e4.c45fec","name":"Current Limit","topic":"N/+/vebus/+/Ac/ActiveIn/CurrentLimit","qos":"0","datatype":"auto","broker":"fbe52f52.20bd7","x":110,"y":320,"wires":[["47f189e4.d7cf38"]]},{"id":"47f189e4.d7cf38","type":"json","z":"63aaa3e4.c45fec","name":"","property":"payload","action":"","pretty":false,"x":270,"y":320,"wires":[["6c7262f6.fea90c","c3ab30d9.c2fdc"]]},{"id":"6c7262f6.fea90c","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":420,"wires":[["cbab0ce2.4ea9"]]},{"id":"9c7f2d70.5d281","type":"mqtt out","z":"63aaa3e4.c45fec","name":"CCGX MQTT","topic":"W/506583dbfda4/vebus/257/Ac/ActiveIn/CurrentLimit","qos":"","retain":"","broker":"fbe52f52.20bd7","x":1120,"y":340,"wires":[]},{"id":"f549620a.9362","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"value\": msg.payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":360,"wires":[["9c7f2d70.5d281","226f6e2d.107f82"]]},{"id":"226f6e2d.107f82","type":"debug","z":"63aaa3e4.c45fec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":910,"y":460,"wires":[]},{"id":"2d09686e.ed3978","type":"change","z":"63aaa3e4.c45fec","name":"(CL) - (Galley / 50hz)","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var5')-$flowContext('var6')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":380,"wires":[["f549620a.9362"]]},{"id":"cbab0ce2.4ea9","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var5","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":360,"wires":[["2d09686e.ed3978"]]},{"id":"4b184003.9dcb9","type":"change","z":"63aaa3e4.c45fec","name":"","rules":[{"t":"set","p":"var6","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":280,"wires":[["2d09686e.ed3978"]]},{"id":"fbe56ff2.7512c","type":"debug","z":"63aaa3e4.c45fec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":510,"y":140,"wires":[]},{"id":"89c0f82.5aa2708","type":"mqtt-broker","z":"","name":"RAS MQTT server","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"fbe52f52.20bd7","type":"mqtt-broker","z":"","name":"ccgx","broker":"192.168.150.71","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]


here is the corresponding screen shot, i have removed the wire to the MQTT out put as something does not seam quite right. ( still leaning the disable tab feature )

@Londine Please see this post about how to share flows or code in the forum.

Presently, other users are unable to import your flows, and therefore unable to assist you.

It would be great if after reading the link, you could edit your posts above (use the pencil icon below each post), and then hopefully you will get some responses from other users.

Thank you.

I was able to import the flow. When it comes to significant mathematical coding, I tend to use function nodes, and just do the nasty in the function node. Yes, this hides some of the details of the design, but it is just easier at times to revert to ancient coding methods.

Please note the flow attached does now have a dividing solution ... not sure if it the best way to go , or if so many Function nodes are needed..

I have had the realisation that this flow may in real life practice create a loop , as the Current limit written would then become the current limit value on the " current limit " mqtt in node.

If i could have some feed back on everyones thoughts on my 1 st attempt and how i may stream line the flow.

Many thanks

Hello, I have continued to test the above flow with mainly success, i have identified a few improvements that could be made but im a bit unsure how to implement.

-It would be best if i could limit the value to 1 decimal place before it goes to the CCGX (MQTT output node )

  • how can i make sure the output of ( Gal/ 50hz )/ ( volts) node is always negative ? at times is seams the system gets bogged down and a positive number appears. this ends up being a catastrophic when the poor old generator squeeze ever last drop of potential to keep up.

As always many many thanks for any and all assistance !! being a beginner is not always easy : )

Do you want to force 'value' always negative? Use JavaScript function and Math functions to force it to negative, like Math.Abs(thevalue) * -1 or something like that?

Hello,

thank you for the tip. yes i was wanting to force as a positive value would overload the generator,

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