@GXMnow , would you mind giving more details about how you’re controlling charge and discharge on your XW? I’m presently installing one, and got node red and modbus working.
My goal is to have AC coupling working, charging batteries first before selling, while maintaining grid support, if at all possible. With Victron ESS, I could just set one single modbus register, and it would target a power level on the AC1.
I’ve toyed with the EPC registers, but not getting the expected behavior. Don’t mind using the battery current registers if they actually work—so if you have a proven config that gives you some amount of manual control via modbus of charging and discharging, it would probably save me more hours of trial and error, lol!
My system is a bit unique here in that I am doing my modbus control on a PLC, so my code won't directly translate to Node Red, but you should be able to do similar math in a flow. And many of my choices are also unique to my power limits and system arrangement. I thought I could write a quick explanation, but this is about as short as I could do it. I am happy to share my basic function code, but again, this s for a Triangle PLC with their own flavor of basic combined with ladder logic.
I also added two very cheap power meters. It turns out they don't understand direction of flow. So I was not able to use them to directly monitor the grid power. It would not know if power is coming from the grid or exporting to the grid. A Watt-Node would work better, but it is $600 vs just $40 for these two 1 phase meters. So I made an odd choice. These power meters are now measuring all of the loads in my main panel. I did this by passing each L1 wires through one of the CTs and all of the L2 wires through the other CT.
So now I have the data I need. I have the PLC read from the XW-Pro, the Amps, Volts, and Watts, from the output, battery, and AC1 input. And then it also reads the two power meters in the main panel. Then I have a few constants that I set in the PLC registers. This s a little harder to explain, but I will try. I had no idea how accurate the meters are, so I added span and offset values so allow me to calibrate the cheap meters. But they have proven to be within less than 20 watts of the utility meter and my Fluke clamp meter. Then I also added offset and span values to allow me to fudge my power output separately during charging or discharging. This allows me to add or subtract from the power calculation to force it to either allow some grid export, or force it to consume a bit from the grid. A simple add factor can slip it the same amount at any power level, and the spam (multiplier) can allow it to offset more as the power increases, like a percentage. I am currently only using the add offset. I will explain a bit more in the next section.
The first thing I needed to do was decide when to tell the XW-Pro to start charging. My goal was to use as little grid power as possible. The lowest charge rate in the XW-Pro is 5% of 140 amps, or 7 amps. At my maximum 58 volts, 7 amps is 406 watts. So my PLC takes all the data it received, and then looks at the watts going out the AC1 input to my main panel and subtracting the loads watts from the two cheap power meters. Once my Enphase grid tied solar is pushing 420 watts more than my house needs, then I know I can tell it the XW-Pro to charge, and I will still be exporting a few watts to the grid. On clear days, this works perfectly and each morning, once there is enough sun, charging starts.
Adjusting the charge current from there is fairly easy. If the watts going out to the AC1 exceeds the loads by more than 100 watts, I raise the charge current 1%. That is about an 80 watt step. If the power export falls below 20 watts, I lower the charge current by 1%. The average export power ended up floating very close to 60 watts while the sun is shining. Those threshold values can be moved if you want to export more, or keep it importing.
Stopping charging is a little different. I decided I didn't want it to stop every time a cloud passed over, so I only bother stopping the charge if the AC coupled Grid Tied solar falls to where the AC output of the XW-Pro starts consuming power. Heavy loads in the main panel will nd up taking grid power when it is cloudy. I did this mainly because I didn't want my Central A/C compressor discharging the battery while grid power was at the cheapest time of use. As long as the XW-Pro is still charging at just 5%, it can't pull battery power to feed loads.
At 3:50 PM, I have the XW-Pro set to charge block. At that point, the charge "Bulk" and rate% commands no longer do anything, and the XW defaults to powering loads, but it is still quite smart on it's own. As long as the incoming AC coupled solar is covering the loads, the XW sits idle.
It turns out the way I have my power meters measuring the loads made the discharging side much easier. I could just take the power from the 2 meters, add them together, divide it by the total AC1 L1 + L2 voltage, and tell the XW to grid sell that much current. In a perfect world, it would set it to zero grid power every time it ran the loop and updated. But I didn't like it making instant changes. I take the power it is exporting now, and the new setting, and only shift it 80% of that difference. This makes it take about 3 cycles of the loop to match any big current change up or down. And I also added a window about 80 watts wide where it won't change the sell current setting. That way any small load changes don't make it adjust. It also turns out that the XW-Pro sell amps function is not a true sell from battery command as I had originally expected. It just looks at the AC1 current and adjusts the inverter power to get the current you asked for. Why is this different? The BIG difference is due to the AC coupled solar. If my Enphase system is pushing 3,000 watts, and my house is only using 2,000 watts. And I have the XW set to export 500 watts for the loads in the main panel, then the XW still just sits idle because there is already more than enough power going back to the main panel. And if my main panel demands 1,500 watts, the XW will just export 1,000 watts to make up the difference with the 500 watts from the Enphase solar.
How I like to do up a program like this is to start with a flow chart. What are the questions? What data do you need to make the decisions? What does each answer make you do?
Things like my dead band windows and offsets were added when the decisions were not acting how I want it to act. Slowing responses is not needed, but it but I didn't like seeing it jumping around too quickly and certainly didn't like ever seeing it overshoot the desired current.