question

chrisu avatar image
chrisu asked

Little help with Node Red: total grid power

Hello,

sorry for this noob question.
I want to make a routine based on the current total grid power. But I can only access the single values for L1/L2/L3.
Am I stupid? How can I add those numers to a total?

1665133008116.png

Node-RED
1665133008116.png (17.0 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

11 Answers
Phil Gavin avatar image
Phil Gavin answered ·

I am also a complete Node-RED noob. I don't use it for much, but total power was one of the things.

Drawing a line from an input to a dashboard output is about my lot. Manipulating the data en route is beyond my ken.

I would also like to know this very answer.

Specifically, because there used to be a Venus total power value tag available for import and export.

With a recent Venus update, these total power tags have disappeared.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

deonkorb avatar image
deonkorb answered ·

I suggest you use the Join node in manual mode. This will combine all three phase power reading into 1 message, that you can add using an expression or script.

Create a single message from separate streams of messages : Node-RED (nodered.org)

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

nickdb avatar image nickdb ♦♦ commented ·

Ok, went back to relook at it and found the solution (in my case I am calculating total PV kWh from multiple mppts).

You need to set the msg.topic on each message and then join on that.

screenshot-2022-10-07-at-151217.png


1 Like 1 ·
nickdb avatar image nickdb ♦♦ commented ·
The problem with this is that messages aren't always sent in the correct order. The join will just take the first 3 messages, it does not check what is sending it. Some nodes can be delayed and when joined you end up with inaccurate numbers.

I haven't found a way to reliably sequence inputs from different nodes.

0 Likes 0 ·
chrisu avatar image
chrisu answered ·

I installed the "aggregator" node and now I become the mean value of the last 30 Minutes. All tree nodes are pointing to it and the result seems correct.

behind there is a shelly 1pm switch which controls a water heat pump. When there is a lot of sun, I increase the target temperature of it.

1665148384760.png


1665148384760.png (43.1 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

modian avatar image modian commented ·
Hi Chris,


I'm quite new in Nodered and i#m looking for your solution. Can you provide your Nodered flow to import?


Thx
Dirk

0 Likes 0 ·
silverfox avatar image
silverfox answered ·

I installed a small node called "Calculator" to the palette - very useful node for many things: https://flows.nodered.org/node/node-red-contrib-calc

Setting the 'Calculator' node to "Sum" it adds all the numbers in an array.

To create the array, I used the 'Join' node already in the palette.

Attached is a picture of the flow and a picture of the 'Join' node settings that worked for me. I'd send you the .json file but when you use a 'System' node, it puts all the options into the .json file, which makes it huge!

totalgridpower.jpg

joinsetuptocreatearray.jpgI think from looking at the pictures you'll get it. To see total power, feed the output of the 'Sum' node into a 'Debug' node and click Deploy.

Since my system is for 120/240 volt split phase, I only have L1 and L2, so you'll need to modify for 3 phase.

I'm also a noob to Venus OS Large Node Red, so maybe this is not the best way to add my two phases? I'd love to hear if anyone has a criticism or suggestion about my method!


1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Phil Gavin avatar image Phil Gavin commented ·
This works for me in 3 phase, I just changed the message parts to "3".
0 Likes 0 ·
spazpeker avatar image
spazpeker answered ·

I do something similar with my MPPT adding them together and sending them to another pi via mqtt


Attached the flow

1676980145795.png

flows.zip


1676980145795.png (184.9 KiB)
flows.zip (3.9 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Dirk-Jan Faber (Victron Energy) avatar image
Dirk-Jan Faber (Victron Energy) answered ·

I used your question to create an example flow for just this. It will become available as an importable example when 1.4.30 has been added to Venus. Meanwhile you could also grab it from https://raw.githubusercontent.com/victronenergy/node-red-contrib-victron/master/examples/Sum%20power%20inputs.json

The example creates a subflow that sums all inputs and outputs (by default) every 5 seconds. It can also be set to output less often or only when the total changes.

1677276618662.png1677276674731.png


1677276618662.png (82.7 KiB)
1677276674731.png (63.7 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

regan avatar image regan commented ·

Hi, I've added your subflow to my project and have only one minor issue I'm not sure how to solve in the best way.


Anytime I re-deploy, the first input value is passed through directly. I am charting the total PV power of a couple mppts, and this causes a dip in the chart as it shows the first inputs value by itself before the subsequent mppt input messages populate the stored values.

I'm not sure what the best fix is, but one thing I can think of would be to add another env var for the number of expected input flows before it sends out a value or maybe when it's writing the msg.topic to the stored array if that topic wasn't set previously skip outputting and return after saving the initialized value.


Another feature would maybe be to set the value of the output topic, it seems it relies on the rate limiter to snub duplicates for each input and uses the first input topic as it's output topic. Easily fixed with a change function, but I think it'd make a nice rounded off subflow that way.

0 Likes 0 ·
Dirk-Jan Faber (Victron Energy) avatar image Dirk-Jan Faber (Victron Energy) ♦ regan commented ·

Nice ideas. Thanks! I've added them to the subflow, which is available on the url above and will be added to the next release in the examples.
As suggested I've implemented it by adding two env vars:
1682705520939.pngWhen the expected inputs is set to zero, it behaves as before.

0 Likes 0 ·
1682705520939.png (22.6 KiB)
ektus avatar image
ektus answered ·

As of this moring, I'm running the "large" image on my Cerbo (Release channel, build date 20240226113741). Where do I find this sublflow?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

nickdb avatar image nickdb ♦♦ commented ·

You actually don't need to use it anymore. The new nodes (might be beta only still), export to a global variable so you can just add it all together in a function.

https://www.victronenergy.com/blog/2024/02/23/node-red-update-for-victron-users/

Clicking on the link in the post further up gives you the code which can just be imported to get the subflow.

0 Likes 0 ·
hominidae avatar image
hominidae answered ·

maybe a dump question, but with a grid meter installled, the sum of all phases should be there already, or am I wrong?

I don't use the victron supplied contrib nodes, only mqtt but still it should be on dbus somewhere

1710074886656.png


A simple alternative, maybe: I like are these nodes: node-red-contrib-boolean-logic-ultimate ...there is a math node in that library, which will also SUM all messages, based on the number of different topics passing through it.


1710074886656.png (42.5 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

nickdb avatar image nickdb ♦♦ commented ·

The nodes directly do not support all the dbus registers.

You can see what is supported here: https://github.com/victronenergy/node-red-contrib-victron/wiki/Available-nodes

But, using the custom input node, you can call any path.

screenshot-2024-03-10-at-151755.png

1 Like 1 ·
hominidae avatar image
hominidae answered ·

...so, according to that: https://github.com/victronenergy/node-red-contrib-victron/wiki/Available-nodes#grid-meter ...with a grid meter installed, there should be total power available for Grid (which was asked initially, but you need to define that rule - compared to an AC-meter or PV-Meter - in the structure of the GX).

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

ektus avatar image
ektus answered ·

What's not available is total AC Power, though (the one shown in the VRM dashboard). Grid meter does provide a total, but is useless once ESS is running. I want to program something to optimize grid export when the battery threatens to get full (so, during most of summer).

System configuration: 3~ with 9,5kWp of AC-Solar (10 year old system which may export), 8x Pylontech US5000 and 5,7kWp of DC-coupled solar (Victron MPPTs) which may not export. Once the battery is full, the DC chargers become idle. So I want to export more during the day and charge from DC only, but use the AC system to supplement bigger loads (e.g. car charging).

Something like "If SOC greater than 70% and AC loads smaller than 50% of DC solar, then export all of AC production".

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dadeppa avatar image
dadeppa answered ·

Hey @ektus , I had the same problem and used the solution provided earlier by silverfox


2024-03-24-10-37-12-clipboard.png

Nevertheless I got another question:
Is there a possibility to get the Total Generated AC Power (sum of L1/L2/L3 Power (W) of AC-IN, AC-OUT1, AC-OUT2)?


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.