Skip to content

Commit

Permalink
Add new register interface (#17)
Browse files Browse the repository at this point in the history
Thanks to @Kali-
  • Loading branch information
Giulio Cervera authored Sep 27, 2022
1 parent 574aa33 commit d9578e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ The following registers are provided by the Sun2000's Modbus interface and can b
| ForcibleDischargePower | Number | 100 | kW | |
| TimeOfUseChargingAndDischargingPeriods | Bytestring | | | |
| ExcessPVEnergyUseInTOU | Number | 1 | | |
| ActivePowerControlMode | Number | 1 | | |
| MaximumFeedGridPowerInKW | Number | 1000 | kW | |
| MaximumFeedGridPowerInPercentage | Number | 10 | % | |
| MaximumChargeFromGridPower | Number | 100 | kW | |
| SwitchToOffGrid | Number | 1 | | |
| VoltageInIndependentOperation | Number | 1 | | |
Expand Down
8 changes: 8 additions & 0 deletions sun2000_modbus/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@
1: 'The selected model is the same as the actual model of the connected meter',
2: 'The selected model is different from the actual model of the connected meter'
}

ActivePowerControlMode = {
0: 'Unlimited',
1: 'DI active scheduling',
5: 'Zero power grid connection',
6: 'Powerlimited grid connection (kW)',
7: 'Powerlimited grid connection (%)'
}
3 changes: 3 additions & 0 deletions sun2000_modbus/registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ class BatteryEquipmentRegister(Enum):
ForcibleDischargePower = Register(47249, 2, datatypes.DataType.INT32_BE, 100, "kW", AccessType.RW, None)
TimeOfUseChargingAndDischargingPeriods = Register(47255, 43, datatypes.DataType.MULTIDATA, None, None, AccessType.RW, None)
ExcessPVEnergyUseInTOU = Register(47299, 1, datatypes.DataType.UINT16_BE, 1, None, AccessType.RW, mappings.ExcessPVEnergyUseInTOU)
ActivePowerControlMode = Register(47415, 1, datatypes.DataType.UINT16_BE, 1, None, AccessType.RW, mappings.ActivePowerControlMode)
MaximumFeedGridPowerInKW = Register(47416, 2, datatypes.DataType.INT32_BE, 1000, "kW", AccessType.RW, None)
MaximumFeedGridPowerInPercentage = Register(47418, 1, datatypes.DataType.INT16_BE, 10, "%", AccessType.RW, None)
MaximumChargeFromGridPower = Register(47590, 2, datatypes.DataType.INT32_BE, 100, "kW", AccessType.RW, None)
SwitchToOffGrid = Register(47604, 1, datatypes.DataType.UINT16_BE, 1, None, AccessType.RW, mappings.SwitchToOffGrid)
VoltageInIndependentOperation = Register(47605, 1, datatypes.DataType.UINT16_BE, 1, None, AccessType.RW, mappings.VoltageIndependentOperation)
Expand Down

0 comments on commit d9578e1

Please sign in to comment.