Afternoon all,
I have recently built my own battery storage system, I have solar pv on the roof and a home energy monitoring system (emontx). I am using s Victron Colour control GX running Venus OS to monitor and control my battery system.
I have added the modbus tcp to config ymal and I tested it by addressing some of the registers and all works well. I can tell it to stop invertering and charge and vice versa.
To gain absolute control over the battery system I will need to run whats called ‘external control’ This is where the user (me) implement his own control loop in the Energy Storage System app. Mode 3 is external control of your inverter/charger. I am looking to do this. The understanding is simple but im unsure how to write the code for this. Basically when I am generating solar from my pv say 1000W and my house load is 200w. This would mean I would be exporting 800W to grid. I would like to write a analog script/ control loop that mathmatically calculates how much to charge/discharge.
I have a CT on my incoming cable to my house that is all calibrated so I know exactly how much i am importing/exporting. and is updated every 10secs. I can you this as a input to drive the output adressess via modbus.
What would you say is the best code/ example to do this. Modbus register 37 is ESS power setpoint phase 1 and has a scaling factor of -32668 to 32668.
As the example above if I was exporting 800W the modbus my input would be -800 so I would need to write +800 to this address to tell it to charge. Victron use this formula below.
Power to/from AC-input = Power to/from battery + Power to/from AC-output
Any help would be much apprecicated.
Thanks
Gareth