Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which Parameter is which #81

Open
PanterSoft opened this issue Jul 2, 2023 · 9 comments
Open

Which Parameter is which #81

PanterSoft opened this issue Jul 2, 2023 · 9 comments

Comments

@PanterSoft
Copy link

Hello,

First of all great project. it works like it should. but I got one small Issue.

How can I differentiate between home power usage, Net power and Producting Power. I want to separate the power used for home and the power I am sending to the grid but I can't figure out how to get these values.

is there a good documentation which parameter is what physical value ?

I figured out that the Net power is described by the Meter Param [power]. but where do I get the parameter for Home usage ? or The current production Power.

@tornadomaus
Copy link

tornadomaus commented Jul 3, 2023

He PanterSoft,

Same problem. I'm not sure, i will test it the next days.

power_ac = producting power
meter.power = When minus consume power, when plus export power to grid.

So you can calculate it. Take care, there some scale. power_ac_scale and power_scale

inverter_power = power_ac * (10 ** power_ac_scale)
meter_power = power * (10 ** power_scale)

Now,

When meter_power is plus, you export power.
meter_power = export power to grid.

Self consumption and home power usage is
inverter_power - meter_power

When meter_power is minus.
meter_power = import from grid

home power usage is (minus and minus are plus)
inverter_power - meter_power

Self consumption is
inverter_power

I hope this helps and that I am correct.

@tornadomaus
Copy link

tornadomaus commented Jul 3, 2023

Sorry, I'm not a pro.
this is my first version.

inverter_power = power_ac * (10 ** power_ac_scale)
meter_power = power * (10 ** power_scale)

if meter_power > 0:
      import_power = 0
      export_power= meter_power
      self_use_power = inverter_power - meter_power
      home_use_power = self_use_power
elif meter_power < 0:
      import_power = meter_power
      export_power = 0
      self_use_power = inverter_power
      home_use_power = inverter_power - meter_power
elif meter_power == 0:
      print("Waring: Blackout")

@PanterSoft
Copy link
Author

Hi @tornadomaus,

I found out that

Power to Net = meter_values["power"]

corresponds directly to the values in the Solaredge app which means Net power is working fine.

Power to Home = power_dc

Battery Charging Power =

Power_ac is 0W for me but I am producing over 4Kw but I am using the full power by charging the battery and directly consuming it. so I cannot use this as production power.

I still have to tinker around a bit to really interpret the values correctly.

here is a Screenshot how my current dashboard looks. Ignore the Net,Home,Production Power they are only working if the battery is full. that's the current problem xD

Solaredge_gathered_data

@tornadomaus
Copy link

Hi @PanterSoft

I have no battery, so i can't test that.

There are different systems, but can it be that the battery is charged direct with DC power?
So when the battery isn't full, all DC power go directly to the battery and from the battery to home use,
and power_ac will >0 when the battery is full?

Cause power_dc is not my "power to home". On my side, power_dc is the DC power direct from the photovoltaic.

@PanterSoft
Copy link
Author

Hi,

Yes that could be. Unfortunately I have no time the next days but I will eventually find out how it plays together and then I am posting my findings here.

@AnneWielis
Copy link

AnneWielis commented Nov 7, 2023

Does anyone have a clue how to get the actual solar production?

Currently i'm calculating ac_power + meter_power + battery_charge. That does work, but i'd prefer to have the actual value at hand.

@LotadaC
Copy link

LotadaC commented Nov 7, 2023

May you explain?
How is your hardware (connected)?

Mine should be:

stringed module optimizers
   ↓
   ↓ ◄--► BAT-05K48
   ↓
SE8/10K
   ↓
home consumption
   ↑
   ↓
MTR-240-3PC1-D-A-MW
   ↑
   ↓
grid

I think (I guess!!) that "I_DC_Power" is the raw output of the optimizer string, pure actual photovoltaic production.
Charging the battery consumes some of this power...
The sum of "I_DC_Power" and "Battery_1_Instantaneous_Power" (negative means charging, positive means discharging) should be the input of the inverter.
"I_AC_Power" should be the output of the inverter
"M_AC_Power" ist the power through the meter.

@AnneWielis
Copy link

I have no idea how the hardware is connected physically, tbh. But yes, looks similar on my end.

So, there are only three meters:
ac_power, meter_power, battery_charge

The rest has to be calculated, right?

@LotadaC
Copy link

LotadaC commented Nov 8, 2023

Only three meters?

the official description of the SunSpec implementation is here.
The Registers are listed from page 15ff.
Common Registers -> 40000..40068
Inverter Registers -> 40069..40108
Meter 1 -> 40121..40294
Meter 2 -> 40295..40468
Meter 3 -> 40469..40644

extendet Inverter Registers (Multi-MPPT) -> 40121..40190
(value of 40121=160 -> extendet Inverter, value of 40121=0x0001 -> Meter 1)

The description of the battery registers is here (Page 19ff)
Battery 1 -> 57600..57785 (0xE100..0xE1B9)
Battery 2 -> 57856..58041 (0xE200..0xE2B9)

It looks like there are some "undocumented" registers concerning the Home Backup Interface (#71 )

The Registers supported by nmakel's library are defined here:

class Inverter(SolarEdge):
def __init__(self, *args, **kwargs):
self.model = "Inverter"
self.wordorder = Endian.Big
super().__init__(*args, **kwargs)
self.registers = {
# name, address, length, register, type, target type, description, unit, batch
"c_id": (0x9c40, 2, registerType.HOLDING, registerDataType.STRING, str, "SunSpec ID", "", 1),
"c_did": (0x9c42, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec DID", "", 1),
"c_length": (0x9c42, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec Length", "16Bit Words", 1),
"c_manufacturer": (0x9c44, 16, registerType.HOLDING, registerDataType.STRING, str, "Manufacturer", "", 1),
"c_model": (0x9c54, 16, registerType.HOLDING, registerDataType.STRING, str, "Model", "", 1),
"c_version": (0x9c6c, 8, registerType.HOLDING, registerDataType.STRING, str, "Version", "", 1),
"c_serialnumber": (0x9c74, 16, registerType.HOLDING, registerDataType.STRING, str, "Serial", "", 1),
"c_deviceaddress": (0x9c84, 1, registerType.HOLDING, registerDataType.UINT16, int, "Modbus ID", "", 1),
"c_sunspec_did": (0x9c85, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec DID", C_SUNSPEC_DID_MAP, 2),
"c_sunspec_length": (0x9c86, 1, registerType.HOLDING, registerDataType.UINT16, int, "Length", "16Bit Words", 2),
"current": (0x9c87, 1, registerType.HOLDING, registerDataType.UINT16, int, "Current", "A", 2),
"l1_current": (0x9c88, 1, registerType.HOLDING, registerDataType.UINT16, int, "L1 Current", "A", 2),
"l2_current": (0x9c89, 1, registerType.HOLDING, registerDataType.UINT16, int, "L2 Current", "A", 2),
"l3_current": (0x9c8a, 1, registerType.HOLDING, registerDataType.UINT16, int, "L3 Current", "A", 2),
"current_scale": (0x9c8b, 1, registerType.HOLDING, registerDataType.SCALE, int, "Current Scale Factor", "", 2),
"l1_voltage": (0x9c8c, 1, registerType.HOLDING, registerDataType.UINT16, int, "L1 Voltage", "V", 2),
"l2_voltage": (0x9c8d, 1, registerType.HOLDING, registerDataType.UINT16, int, "L2 Voltage", "V", 2),
"l3_voltage": (0x9c8e, 1, registerType.HOLDING, registerDataType.UINT16, int, "L3 Voltage", "V", 2),
"l1n_voltage": (0x9c8f, 1, registerType.HOLDING, registerDataType.UINT16, int, "L1-N Voltage", "V", 2),
"l2n_voltage": (0x9c90, 1, registerType.HOLDING, registerDataType.UINT16, int, "L2-N Voltage", "V", 2),
"l3n_voltage": (0x9c91, 1, registerType.HOLDING, registerDataType.UINT16, int, "L3-N Voltage", "V", 2),
"voltage_scale": (0x9c92, 1, registerType.HOLDING, registerDataType.SCALE, int, "Voltage Scale Factor", "", 2),
"power_ac": (0x9c93, 1, registerType.HOLDING, registerDataType.INT16, int, "Power", "W", 2),
"power_ac_scale": (0x9c94, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power Scale Factor", "", 2),
"frequency": (0x9c95, 1, registerType.HOLDING, registerDataType.UINT16, int, "Frequency", "Hz", 2),
"frequency_scale": (0x9c96, 1, registerType.HOLDING, registerDataType.SCALE, int, "Frequency Scale Factor", "", 2),
"power_apparent": (0x9c97, 1, registerType.HOLDING, registerDataType.INT16, int, "Power (Apparent)", "VA", 2),
"power_apparent_scale": (0x9c98, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power (Apparent) Scale Factor", "", 2),
"power_reactive": (0x9c99, 1, registerType.HOLDING, registerDataType.INT16, int, "Power (Reactive)", "VAr", 2),
"power_reactive_scale": (0x9c9a, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power (Reactive) Scale Factor", "", 2),
"power_factor": (0x9c9b, 1, registerType.HOLDING, registerDataType.INT16, int, "Power Factor", "%", 2),
"power_factor_scale": (0x9c9c, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power Factor Scale Factor", "", 2),
"energy_total": (0x9c9d, 2, registerType.HOLDING, registerDataType.ACC32, int, "Total Energy", "Wh", 2),
"energy_total_scale": (0x9c9f, 1, registerType.HOLDING, registerDataType.SCALE, int, "Total Energy Scale Factor", "", 2),
"current_dc": (0x9ca0, 1, registerType.HOLDING, registerDataType.UINT16, int, "DC Current", "A", 2),
"current_dc_scale": (0x9ca1, 1, registerType.HOLDING, registerDataType.SCALE, int, "DC Current Scale Factor", "", 2),
"voltage_dc": (0x9ca2, 1, registerType.HOLDING, registerDataType.UINT16, int, "DC Voltage", "V", 2),
"voltage_dc_scale": (0x9ca3, 1, registerType.HOLDING, registerDataType.SCALE, int, "DC Voltage Scale Factor", "", 2),
"power_dc": (0x9ca4, 1, registerType.HOLDING, registerDataType.INT16, int, "DC Power", "W", 2),
"power_dc_scale": (0x9ca5, 1, registerType.HOLDING, registerDataType.SCALE, int, "DC Power Scale Factor", "", 2),
"temperature": (0x9ca7, 1, registerType.HOLDING, registerDataType.INT16, int, "Temperature", "°C", 2),
"temperature_scale": (0x9caa, 1, registerType.HOLDING, registerDataType.SCALE, int, "Temperature Scale Factor", "", 2),
"status": (0x9cab, 1, registerType.HOLDING, registerDataType.UINT16, int, "Status", INVERTER_STATUS_MAP, 2),
"vendor_status": (0x9cac, 1, registerType.HOLDING, registerDataType.UINT16, int, "Vendor Status", "", 2),
"rrcr_state": (0xf000, 1, registerType.HOLDING, registerDataType.UINT16, int, "RRCR State", "", 3),
"active_power_limit": (0xf001, 1, registerType.HOLDING, registerDataType.UINT16, int, "Active Power Limit", "%", 3),
"cosphi": (0xf002, 2, registerType.HOLDING, registerDataType.FLOAT32, int, "CosPhi", "", 3),
"commit_power_control_settings": (0xf100, 1, registerType.HOLDING, registerDataType.INT16, int, "Commit Power Control Settings", "", 4),
"restore_power_control_default_settings": (0xf101, 1, registerType.HOLDING, registerDataType.INT16, int, "Restore Power Control Default Settings", "", 4),
"reactive_power_config": (0xf103, 2, registerType.HOLDING, registerDataType.INT32, int, "Reactive Power Config", REACTIVE_POWER_CONFIG_MAP, 4),
"reactive_power_response_time": (0xf105, 2, registerType.HOLDING, registerDataType.UINT32, int, "Reactive Power Response Time", "ms", 4),
"advanced_power_control_enable": (0xf142, 2, registerType.HOLDING, registerDataType.UINT16, int, "Advanced Power Control Enable", "", 4),
"export_control_mode": (0xf700, 1, registerType.HOLDING, registerDataType.UINT16, int, "Export Control Mode", "", 5),
"export_control_limit_mode": (0xf701, 1, registerType.HOLDING, registerDataType.UINT16, int, "Export Control Limit Mode", EXPORT_CONTROL_LIMIT_MAP, 5),
"export_control_site_limit": (0xf702, 2, registerType.HOLDING, registerDataType.FLOAT32, int, "Export Control Site Limit", "W", 5)
}
self.meter_dids = [
(0x9cfc, 1, registerType.HOLDING, registerDataType.UINT16, int, "", "", 1),
(0x9daa, 1, registerType.HOLDING, registerDataType.UINT16, int, "", "", 1),
(0x9e59, 1, registerType.HOLDING, registerDataType.UINT16, int, "", "", 1)
]
self.battery_dids = [
(0xe140, 1, registerType.HOLDING, registerDataType.UINT16, int, "", "", 1),
(0xe240, 1, registerType.HOLDING, registerDataType.UINT16, int, "", "", 1)
]
def meters(self):
meters = [self._read(v) for v in self.meter_dids]
return {f"Meter{idx + 1}": Meter(offset=idx, parent=self) for idx, v in enumerate(meters) if v}
def batteries(self):
batteries = [self._read(v) for v in self.battery_dids]
return {f"Battery{idx + 1}": Battery(offset=idx, parent=self) for idx, v in enumerate(batteries) if v != 255}
class Meter(SolarEdge):
def __init__(self, offset=False, *args, **kwargs):
self.model = f"Meter{offset + 1}"
self.wordorder = Endian.Big
super().__init__(*args, **kwargs)
self.offset = METER_REGISTER_OFFSETS[offset]
self.registers = {
"c_manufacturer": (0x9cbb + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Manufacturer", "", 1),
"c_model": (0x9ccb + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Model", "", 1),
"c_option": (0x9cdb + self.offset, 8, registerType.HOLDING, registerDataType.STRING, str, "Mode", "", 1),
"c_version": (0x9ce3 + self.offset, 8, registerType.HOLDING, registerDataType.STRING, str, "Version", "", 1),
"c_serialnumber": (0x9ceb + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Serial", "", 1),
"c_deviceaddress": (0x9cfb + self.offset, 1, registerType.HOLDING, registerDataType.UINT16, int, "Modbus ID", "", 1),
"c_sunspec_did": (0x9cfc + self.offset, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec DID", C_SUNSPEC_DID_MAP, 2),
"c_sunspec_length": (0x9cfd + self.offset, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec Length", "16Bit Words", 2),
"current": (0x9cfe + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Current", "A", 2),
"l1_current": (0x9cff + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1 Current", "A", 2),
"l2_current": (0x9d00 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2 Current", "A", 2),
"l3_current": (0x9d01 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3 Current", "A", 2),
"current_scale": (0x9d02 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Current Scale Factor", "", 2),
"voltage_ln": (0x9d03 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L-N Voltage", "V", 2),
"l1n_voltage": (0x9d04 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1-N Voltage", "V", 2),
"l2n_voltage": (0x9d05 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2-N Voltage", "V", 2),
"l3n_voltage": (0x9d06 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3-N Voltage", "V", 2),
"voltage_ll": (0x9d07 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L-L Voltage", "V", 2),
"l12_voltage": (0x9d08 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1-l2 Voltage", "V", 2),
"l23_voltage": (0x9d09 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2-l3 Voltage", "V", 2),
"l31_voltage": (0x9d0a + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3-l1 Voltage", "V", 2),
"voltage_scale": (0x9d0b + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Voltage Scale Factor", "", 2),
"frequency": (0x9d0c + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Frequency", "Hz", 2),
"frequency_scale": (0x9d0d + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Frequency Scale Factor", "", 2),
"power": (0x9d0e + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Power", "W", 2),
"l1_power": (0x9d0f + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1 Power", "W", 2),
"l2_power": (0x9d10 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2 Power", "W", 2),
"l3_power": (0x9d11 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3 Power", "W", 2),
"power_scale": (0x9d12 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power Scale Factor", "", 2),
"power_apparent": (0x9d13 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Power (Apparent)", "VA", 2),
"l1_power_apparent": (0x9d14 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1 Power (Apparent)", "VA", 2),
"l2_power_apparent": (0x9d15 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2 Power (Apparent)", "VA", 2),
"l3_power_apparent": (0x9d16 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3 Power (Apparent)", "VA", 2),
"power_apparent_scale": (0x9d17 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power (Apparent) Scale Factor", "", 2),
"power_reactive": (0x9d18 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Power (Reactive)", "VAr", 2),
"l1_power_reactive": (0x9d19 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1 Power (Reactive)", "VAr", 2),
"l2_power_reactive": (0x9d1a + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2 Power (Reactive)", "VAr", 2),
"l3_power_reactive": (0x9d1b + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3 Power (Reactive)", "VAr", 2),
"power_reactive_scale": (0x9d1c + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power (Reactive) Scale Factor", "", 2),
"power_factor": (0x9d1d + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "Power Factor", "", 2),
"l1_power_factor": (0x9d1e + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L1 Power Factor", "", 2),
"l2_power_factor": (0x9d1f + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L2 Power Factor", "", 2),
"l3_power_factor": (0x9d20 + self.offset, 1, registerType.HOLDING, registerDataType.INT16, int, "L3 Power Factor", "", 2),
"power_factor_scale": (0x9d21 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Power Factor Scale Factor", "", 2),
"export_energy_active": (0x9d22 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Exported Energy (Active)", "Wh", 2),
"l1_export_energy_active": (0x9d24 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Exported Energy (Active)", "Wh", 2),
"l2_export_energy_active": (0x9d26 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Exported Energy (Active)", "Wh", 2),
"l3_export_energy_active": (0x9d28 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Exported Energy (Active)", "Wh", 2),
"import_energy_active": (0x9d2a + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Imported Energy (Active)", "Wh", 2),
"l1_import_energy_active": (0x9d2c + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Imported Energy (Active)", "Wh", 2),
"l2_import_energy_active": (0x9d2e + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Imported Energy (Active)", "Wh", 2),
"l3_import_energy_active": (0x9d30 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Imported Energy (Active)", "Wh", 2),
"energy_active_scale": (0x9d32 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Energy (Active) Scale Factor", "", 2),
"export_energy_apparent": (0x9d33 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Exported Energy (Apparent)", "VAh", 3),
"l1_export_energy_apparent": (0x9d35 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Exported Energy (Apparent)", "VAh", 3),
"l2_export_energy_apparent": (0x9d37 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Exported Energy (Apparent)", "VAh", 3),
"l3_export_energy_apparent": (0x9d39 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Exported Energy (Apparent)", "VAh", 3),
"import_energy_apparent": (0x9d3b + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Imported Energy (Apparent)", "VAh", 3),
"l1_import_energy_apparent": (0x9d3d + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Imported Energy (Apparent)", "VAh", 3),
"l2_import_energy_apparent": (0x9d3f + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Imported Energy (Apparent)", "VAh", 3),
"l3_import_energy_apparent": (0x9d41 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Imported Energy (Apparent)", "VAh", 3),
"energy_apparent_scale": (0x9d43 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Energy (Apparent) Scale Factor", "", 3),
"import_energy_reactive_q1": (0x9d44 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Imported Energy (Reactive) Quadrant 1", "VArh", 3),
"l1_import_energy_reactive_q1": (0x9d46 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Imported Energy (Reactive) Quadrant 1", "VArh", 3),
"l2_import_energy_reactive_q1": (0x9d48 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Imported Energy (Reactive) Quadrant 1", "VArh", 3),
"l3_import_energy_reactive_q1": (0x9d4a + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Imported Energy (Reactive) Quadrant 1", "VArh", 3),
"import_energy_reactive_q2": (0x9d4c + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Imported Energy (Reactive) Quadrant 2", "VArh", 3),
"l1_import_energy_reactive_q2": (0x9d4e + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Imported Energy (Reactive) Quadrant 2", "VArh", 3),
"l2_import_energy_reactive_q2": (0x9d50 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Imported Energy (Reactive) Quadrant 2", "VArh", 3),
"l3_import_energy_reactive_q2": (0x9d52 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Imported Energy (Reactive) Quadrant 2", "VArh", 3),
"export_energy_reactive_q3": (0x9d54 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Exported Energy (Reactive) Quadrant 3", "VArh", 3),
"l1_export_energy_reactive_q3": (0x9d56 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Exported Energy (Reactive) Quadrant 3", "VArh", 3),
"l2_export_energy_reactive_q3": (0x9d58 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Exported Energy (Reactive) Quadrant 3", "VArh", 3),
"l3_export_energy_reactive_q3": (0x9d5a + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Exported Energy (Reactive) Quadrant 3", "VArh", 3),
"export_energy_reactive_q4": (0x9d5c + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Total Exported Energy (Reactive) Quadrant 4", "VArh", 3),
"l1_export_energy_reactive_q4": (0x9d5e + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L1 Exported Energy (Reactive) Quadrant 4", "VArh", 3),
"l2_export_energy_reactive_q4": (0x9d60 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L2 Exported Energy (Reactive) Quadrant 4", "VArh", 3),
"l3_export_energy_reactive_q4": (0x9d62 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "L3 Exported Energy (Reactive) Quadrant 4", "VArh", 3),
"energy_reactive_scale": (0x9d64 + self.offset, 1, registerType.HOLDING, registerDataType.SCALE, int, "Energy (Reactive) Scale Factor", "", 3)
}
class Battery(SolarEdge):
def __init__(self, offset=False, *args, **kwargs):
self.model = f"Battery{offset + 1}"
self.wordorder = Endian.Little
super().__init__(*args, **kwargs)
self.offset = BATTERY_REGISTER_OFFSETS[offset]
self.registers = {
"c_manufacturer": (0xe100 + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Manufacturer", "", 1),
"c_model": (0xe110 + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Model", "", 1),
"c_version": (0xe120 + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Version", "", 1),
"c_serialnumber": (0xe130 + self.offset, 16, registerType.HOLDING, registerDataType.STRING, str, "Serial", "", 1),
"c_deviceaddress": (0xe140 + self.offset, 1, registerType.HOLDING, registerDataType.UINT16, int, "Modbus ID", "", 1),
"c_sunspec_did": (0xe141 + self.offset, 1, registerType.HOLDING, registerDataType.UINT16, int, "SunSpec DID", "", 1),
"rated_energy": (0xe142 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Rated Energy", "Wh", 2),
"maximum_charge_continuous_power": (0xe144 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Charge Continuous Power", "W", 2),
"maximum_discharge_continuous_power": (0xe146 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Discharge Continuous Power", "W", 2),
"maximum_charge_peak_power": (0xe148 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Charge Peak Power", "W", 2),
"maximum_discharge_peak_power": (0xe14a + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Discharge Peak Power", "W", 2),
"average_temperature": (0xe16c + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Average Temperature", "°C", 2),
"maximum_temperature": (0xe16e + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Temperature", "°C", 2),
"instantaneous_voltage": (0xe170 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Instantaneous Voltage", "V", 2),
"instantaneous_current": (0xe172 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Instantaneous Current", "A", 2),
"instantaneous_power": (0xe174 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Instantaneous Power", "W", 2),
"lifetime_export_energy_counter": (0xe176 + self.offset, 4, registerType.HOLDING, registerDataType.UINT64, int, "Total Exported Energy", "Wh", 2),
"lifetime_import_energy_counter": (0xe17A + self.offset, 4, registerType.HOLDING, registerDataType.UINT64, int, "Total Imported Energy", "Wh", 2),
"maximum_energy": (0xe17e + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Maximum Energy", "Wh", 2),
"available_energy": (0xe180 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "Available Energy", "Wh", 2),
"soh": (0xe182 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "State of Health (SOH)", "%", 2),
"soe": (0xe184 + self.offset, 2, registerType.HOLDING, registerDataType.SEFLOAT, float, "State of Energy (SOE)", "%", 2),
"status": (0xe186 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Status", BATTERY_STATUS_MAP, 2),
"status_internal": (0xe188 + self.offset, 2, registerType.HOLDING, registerDataType.UINT32, int, "Internal Status", BATTERY_STATUS_MAP, 2),
"event_log": (0xe18a + self.offset, 2, registerType.HOLDING, registerDataType.UINT16, int, "Event Log", "", 2),
"event_log_internal": (0xe192 + self.offset, 2, registerType.HOLDING, registerDataType.UINT16, int, "Internal Event Log", "", 2),
}

40100 = 0x9CA4 is I_DC_Power (DC Power value)
40101 = 0x9CA5 is I_DC_Power_SF (Scale factor)
is here:

"power_dc": (0x9ca4, 1, registerType.HOLDING, registerDataType.INT16, int, "DC Power", "W", 2),
"power_dc_scale": (0x9ca5, 1, registerType.HOLDING, registerDataType.SCALE, int, "DC Power Scale Factor", "", 2),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants