Dynamic Grid Set Point via Node-Red

I have Fronius 6kw PV connected to AC-In of 2 parallel Multiplus 48/3000/35 with a 15kwh LiFePO4 battery. There is also an ET112 Grid Meter providing data to Venus OS. All loads are on the AC-Out of the Multi’s.

Am running it as an ESS system however in the mornings, the system starts to draw from the grid despite having a Grid Set Point at -10w.

The grid draw increases as PV increases until PV exceeds loads plus maximum charge rate.

To overcome this, I experimented with manually decreasing Grid Set Point (GSP) as the grid draw increased - it worked to a degree but this became tiresome and there was always a time lag between an action and the system response.

My explanation/theory/supposition for why this happens is that for current to flow, there has to be a voltage difference. The Fronius is raising its voltage to send current to the grid & the Multi’s AC-In. The Multi’s are trying to charge the battery by setting a AC-In voltage such that the ET112 Grid Meter reads -10w (the GSP). However, the grid voltage is always changing hence the Fronius voltage is always changing and the Multi’s are trying to keep up with the changes, the delays in the ET112 reporting (estimated at 0.5 second) and the inertia in changing the charge current. The Multi’s then struggle to set a voltage that is always behind (time wise) the Fronius/Grid.

During the first month after switching on this system, the grid operator recorded 18kwh of usage, 10kwh was between sunrise & midday. The remaining 8kwh was mostly overnight as the Multi’s were still struggling to maintain a GSP of -10w.

It was the height of summer and there were no loads that could not be met by the battery via the Multis.

You might think 18kwh is not a lot but as I don’t like paying for electricity if I can avoid it, I created a Node-Red flow called Dynamic Grid Set Point (DGSP).

In the month after implementing DGSP, the grid operator recorded 4kwh of usage, 2.5kwh between sunrise & midday.

This a graph showing the impact of it working:

Every 5 seconds, the Node-Red flow gets the Median Grid Power during those 5 seconds. Median is used to minimise the effect of outliers.

If Grid Power is positive, subtract 2 x Grid Power from GSP to a minimum of -1000w. This is the penalty for Grid Power going positive.

If Grid Power is between 0w & -20w, do not change current GSP.

If Grid Power is between -20w and current GSP, increase the GSP by 1/6th of the Grid Power. For example, if current GSP is -500w and Median Grid Power is -180w, the new GSP will be -470w.

If Grid Power is less than current GSP, increase the GSP by 1/6th of the Grid Power. For example, if current GSP is -500w and Median Grid Power is -600w, the new GSP will be -400w.

These last two factors (1/6th) will result in it taking it about 30 seconds for the GSP to return to -10w.

You may want to change the second instance of these factors to get to the desired GSP (-10w) quicker. Using a factor of 1/3rd in the prior example of current GSP is -500w and Median Grid Power is -600w, the new GSP will be -300w.

If in any iteration, the new GSP is >-10w, set the new GSP to -10w.

This is the Flow:

And this is the JSON file for importing into Node-Red:
DGSP.zip (1.3 KB)