4llonsy / sofar_solar

A project that logs data from sofar solar inverter and sends the data to blynk server using RS485 modbus interface.
MIT License
9 stars 5 forks source link

Grid export register #3

Open dibg opened 2 years ago

dibg commented 2 years ago

I have the same inverter and your code works just fine as it is. Im only missing the ct clamp reading and optionally the inverter temperature.

I noticed you differentiated from the register you provided to get the correct values. (for example: in your code: PV_Power = (unsigned int)node.getResponseBuffer(0x0A)*0.01; but in the datasheet: pv power 1 is 0x1C and not 0x0A. The one you put in the code is the correct one)

How you discover what is the correct registers ? And do you know what is the register for CT (current clamp) reading or feed in power or export power (all 3 is the same thing just a different way of naming them)

4llonsy commented 2 years ago

Yeah, I remember some registers were shifted by some constant (maybe because of a difference in model version or different datasheet for 3phase, 1phase inverter). If I remember correctly I had to manually find the correct ones. (I just found the frequency register, coz I knew it was going to be around 50, and then shifted the registers according to that amount).

Active_Power      = (int)node.getResponseBuffer(0x0C)*0.01;
Reactive_Power    = (unsigned int)node.getResponseBuffer(0x0D)*0.01;

Is this what you want? This is the export power. You can find the actual power by just a Pythagorean sum of these two quantities.

dibg commented 2 years ago

On reactive power i always get 0.00 so no help there. I found the right address to be 0x29. Is a 16bit register which overflows for negative consumption (power import). I fork and modified the code and open a pull request if you wish to merge it.