add mapping of the error and warning growatt

This commit is contained in:
atef 2026-02-13 09:36:12 +01:00
parent 07ede85347
commit 4c94238188
5 changed files with 138 additions and 24 deletions

View File

@ -56,6 +56,4 @@ public static class RabbitMqManager
Console.WriteLine($"Producer sent message: {message}"); Console.WriteLine($"Producer sent message: {message}");
} }
} }

View File

@ -0,0 +1,58 @@
namespace InnovEnergy.Lib.Devices.WITGrowatt4_15K.DataType;
public enum GrowattErrorCode
{
NoAlarm = 0,
ExportLimitationFailSafe = 311,
DcBiasAbnormal = 400,
HighDcComponentOutputCurrent = 402,
BusVoltageSamplingAbnormal = 404,
RelayFault = 405,
OverTemperature = 408,
BusVoltageAbnormal = 409,
InternalCommunicationFailure = 411,
TemperatureSensorDisconnected = 412,
IgbtDriveFault = 413,
EepromError = 414,
AuxiliaryPowerAbnormal = 415,
DcAcOvercurrentProtection = 416,
CommunicationProtocolMismatch = 417,
DspComFirmwareMismatch = 418,
DspSoftwareHardwareMismatch = 419,
CpldAbnormal = 421,
RedundancySamplingInconsistent = 422,
PwmPassThroughSignalFailure = 423,
AfciSelfTestFailure = 425,
PvCurrentSamplingAbnormal = 426,
AcCurrentSamplingAbnormal = 427,
BusSoftbootFailure = 429,
EpoFault = 430,
MonitoringChipBootVerificationFailed = 431,
BmsCommunicationFailure = 500,
BmsChargeDischargeFailure = 501,
BatteryVoltageLow = 502,
BatteryVoltageHigh = 503,
BatteryTemperatureAbnormal = 504,
BatteryReversed = 505,
BatteryOpenCircuit = 506,
BatteryOverloadProtection = 507,
Bus2VoltageAbnormal = 508,
BatteryChargeOcp = 509,
BatteryDischargeOcp = 510,
BatterySoftStartFailed = 511,
EpsOutputShortCircuited = 600,
OffGridBusVoltageLow = 601,
OffGridTerminalVoltageAbnormal = 602,
SoftStartFailed = 603,
OffGridOutputVoltageAbnormal = 604,
BalancedCircuitSelfTestFailed = 605,
HighDcComponentOutputVoltage = 606,
OffGridOutputOverload = 607,
OffGridParallelSignalAbnormal = 608
}

View File

@ -0,0 +1,58 @@
namespace InnovEnergy.Lib.Devices.WITGrowatt4_15K.DataType;
public enum GrowattWarningCode : UInt16
{
NoAlarm =0,
StringFault = 200,
PvStringPidQuickConnectAbnormal = 201,
DcSpdFunctionAbnormal = 202,
PvShortCircuited = 203,
PvBoostDriverAbnormal = 204,
AcSpdFunctionAbnormal = 205,
DcFuseBlown = 208,
DcInputVoltageTooHigh = 209,
PvReversed = 210,
PidFunctionAbnormal = 219,
PvStringDisconnected = 220,
PvStringCurrentUnbalanced = 221,
NoUtilityGrid = 300,
GridVoltageOutOfRange = 301,
GridFrequencyOutOfRange = 302,
Overload = 303,
MeterDisconnected = 308,
MeterReverselyConnected = 309,
LinePeVoltageAbnormal = 310,
PhaseSequenceError = 311,
FanFailure = 400,
MeterAbnormal = 401,
OptimizerCommunicationAbnormal = 402,
OverTemperature = 407,
OverTemperatureAlarm = 408,
NtcTemperatureSensorBroken = 409,
SyncSignalAbnormal = 411,
GridStartupConditionsNotMet = 412,
BatteryCommunicationFailure = 500,
BatteryDisconnected = 501,
BatteryVoltageTooHigh = 502,
BatteryVoltageTooLow = 503,
BatteryReverseConnected = 504,
LeadAcidTempSensorDisconnected = 505,
BatteryTemperatureOutOfRange = 506,
BmsFault = 507,
LithiumBatteryOverload = 508,
BmsCommunicationAbnormal = 509,
BatterySpdAbnormal = 510,
OutputDcComponentBiasAbnormal = 600,
DcComponentOverHighOutputVoltage = 601,
OffGridOutputVoltageTooLow = 602,
OffGridOutputVoltageTooHigh = 603,
OffGridOutputOverCurrent = 604,
OffGridBusVoltageTooLow = 605,
OffGridOutputOverload = 606,
BalancedCircuitAbnormal = 609
}

View File

@ -42,10 +42,10 @@ public partial class WITGrowatRecord
public BatteryoperatinStatus BatteryOperatingMode => (BatteryoperatinStatus) _batteryOperatingMode; public BatteryoperatinStatus BatteryOperatingMode => (BatteryoperatinStatus) _batteryOperatingMode;
public OperatingPriority OperatingMode => (OperatingPriority)_operatingPriority; public OperatingPriority OperatingMode => (OperatingPriority)_operatingPriority;
public UInt16 FaultMainCode => _faultMainCode; // need to pre proceesed public GrowattErrorCode FaultMainCode => _faultMainCode; // need to pre proceesed
public UInt16 FaultSubCode => _faultSubCode; // need to pre proceesed public UInt16 FaultSubCode => _faultSubCode; // need to pre proceesed
public UInt16 WarningMainCode => _warningMainCode; // need to pre proceesed public GrowattWarningCode WarningMainCode => _warningMainCode; // need to pre proceesed
public UInt16 WarningSubCode => _warningSubCode; // need to pre proceesed public UInt16 WarningSubCode => _warningSubCode; // need to pre proceesed
public Voltage Pv1Voltage => _pv1Voltage; public Voltage Pv1Voltage => _pv1Voltage;
public Current Pv1Current => _pv1Current; public Current Pv1Current => _pv1Current;
@ -96,10 +96,10 @@ public partial class WITGrowatRecord
get => _VppProtocolVerNumber; get => _VppProtocolVerNumber;
} }
public Boolean ControlPermession public Boolean ControlPermission
{ {
get => _ControlPermession; get => _ControlPermission;
set => _ControlPermession = value; set => _ControlPermission = value;
} }
public Boolean EnableCommand public Boolean EnableCommand
@ -172,16 +172,16 @@ public partial class WITGrowatRecord
set => _BatteryMaxDischargePower = value; set => _BatteryMaxDischargePower = value;
} }
public Percent ChargeCutoffSocVoltage public Voltage ChargeCutoffSocVoltage
{ {
get => _BatteryChargeCutoffVoltage; get => _batteryChargeCutoffVoltage;
set => _BatteryChargeCutoffVoltage = (UInt16)value; set => _batteryChargeCutoffVoltage = (UInt16)value;
} }
public Percent DischargeCutoffVoltage public Voltage DischargeCutoffVoltage
{ {
get => _BatteryDischargeCutoffVoltage; get => _batteryDischargeCutoffVoltage;
set => _BatteryDischargeCutoffVoltage = (UInt16)value; set => _batteryDischargeCutoffVoltage = (UInt16)value;
} }
public Percent LoadPriorityDischargeCutoffSoc public Percent LoadPriorityDischargeCutoffSoc
@ -249,9 +249,8 @@ public partial class WITGrowatRecord
set => _batteryMaxDischargingCurrent = (UInt16) value; set => _batteryMaxDischargingCurrent = (UInt16) value;
} }
public Double Battery1MaxDischargingCurrent => _batteryMaxDischargingCurrent; public Double Battery1MaxDischargingCurrent => _batteryMaxDischargingCurrent;
public Double Battery1MaxChargingCurrent => _batteryMaxChargingCurrent;
public Double Battery1MaxChargingCurrent => _batteryMaxChargingCurrent;
public Percent Battery1Soc => _BatterySoc1; public Percent Battery1Soc => _BatterySoc1;
public Percent Battery1Soh => _BatterySoh1; public Percent Battery1Soh => _BatterySoh1;

View File

@ -1,3 +1,4 @@
using InnovEnergy.Lib.Devices.WITGrowatt4_15K.DataType;
using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes; using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes;
namespace InnovEnergy.Lib.Devices.WITGrowatt4_15K; namespace InnovEnergy.Lib.Devices.WITGrowatt4_15K;
@ -19,9 +20,9 @@ public partial class WITGrowatRecord
[InputRegister(31002)] private UInt16 _operatingPriority; [InputRegister(31002)] private UInt16 _operatingPriority;
[InputRegister(31003)] private UInt16 _reserved1; [InputRegister(31003)] private UInt16 _reserved1;
[InputRegister(31004)] private UInt16 _reserved2; [InputRegister(31004)] private UInt16 _reserved2;
[InputRegister(31005)] private UInt16 _faultMainCode;// Can we change this to warning? [InputRegister(31005)] private GrowattErrorCode _faultMainCode;// Can we change this to warning?
[InputRegister(31006)] private UInt16 _faultSubCode; // Can we change this to warning? [InputRegister(31006)] private UInt16 _faultSubCode; // Can we change this to warning?
[InputRegister(31007)] private UInt16 _warningMainCode; [InputRegister(31007)] private GrowattWarningCode _warningMainCode;
[InputRegister(31008)] private UInt16 _warningSubCode; [InputRegister(31008)] private UInt16 _warningSubCode;
[InputRegister(31009)] private UInt16 _reserved3; [InputRegister(31009)] private UInt16 _reserved3;
// 3101031099 — PV Parameters // 3101031099 — PV Parameters
@ -144,7 +145,7 @@ public partial class WITGrowatRecord
[HoldingRegister(30030)] private UInt16 _BatteryType; [HoldingRegister(30030)] private UInt16 _BatteryType;
[HoldingRegister(30099)] private UInt16 _VppProtocolVerNumber; [HoldingRegister(30099)] private UInt16 _VppProtocolVerNumber;
[HoldingRegister(30100, writable: true)] private Boolean _ControlPermession; // 0 Disabled, 1 enabled [HoldingRegister(30100, writable: true)] private Boolean _ControlPermission; // 0 Disabled, 1 enabled
[HoldingRegister(30101, writable: true)] private Boolean _EnableCommand; // 0: Off, 1: On; Defaut is 1; not stored, must enable this register to control inverter [HoldingRegister(30101, writable: true)] private Boolean _EnableCommand; // 0: Off, 1: On; Defaut is 1; not stored, must enable this register to control inverter
[HoldingRegister(30102)] private UInt16 _CountryRegionCode; [HoldingRegister(30102)] private UInt16 _CountryRegionCode;
[HoldingRegister(30103)] private UInt16 _Reserved8; [HoldingRegister(30103)] private UInt16 _Reserved8;
@ -166,7 +167,7 @@ public partial class WITGrowatRecord
[HoldingRegister(30162)] private UInt16 _PowerFactor; // [0, 2000] [18000, 20000]; Default: 20000; Actual PF = (Register Value - 10000) [HoldingRegister(30162)] private UInt16 _PowerFactor; // [0, 2000] [18000, 20000]; Default: 20000; Actual PF = (Register Value - 10000)
[HoldingRegister(30203, writable : true)] private UInt16 _EmsCommunicationFailureTime; // [1,300] TODO to 30 [HoldingRegister(30203, writable : true)] private UInt16 _EmsCommunicationFailureTime; // [1,300] TODO to 30
[HoldingRegister(30204, writable : true)] private Boolean _EnableEmsCommunicationFailureTime; // 0: disabled, 1 = enabled we should enable this TODO [HoldingRegister(30204, writable : true)] private Boolean _EnableEmsCommunicationFailureTime; // 0: disabled, 1 = enabled we should not enable this the naming is not correct
[HoldingRegister(30300)] private UInt16 _BatteryClusterIndex; // [0..3] [HoldingRegister(30300)] private UInt16 _BatteryClusterIndex; // [0..3]
[HoldingRegister<UInt32>(30400 , writable: true)] private UInt32 _BatteryMaxChargePower; // [HoldingRegister<UInt32>(30400 , writable: true)] private UInt32 _BatteryMaxChargePower; //
@ -182,8 +183,8 @@ public partial class WITGrowatRecord
[HoldingRegister(30474)] private UInt16 _ActualChargeDischargePowerControlValue; // [HoldingRegister(30474)] private UInt16 _ActualChargeDischargePowerControlValue; //
[HoldingRegister(30475)] private UInt16 _OffGridDischargeCutoffSoc; // [HoldingRegister(30475)] private UInt16 _OffGridDischargeCutoffSoc; //
[HoldingRegister(30496, writable: true, Scale = 0.1)] private UInt16 _BatteryChargeCutoffVoltage; // [HoldingRegister(30496, writable: true, Scale = 0.1)] private UInt16 _batteryChargeCutoffVoltage; //
[HoldingRegister(30497, writable: true, Scale = 0.1)] private UInt16 _BatteryDischargeCutoffVoltage; // [HoldingRegister(30497, writable: true, Scale = 0.1)] private UInt16 _batteryDischargeCutoffVoltage; //
[HoldingRegister(30498, writable: true, Scale = 0.1)] private UInt16 _batteryMaxChargingCurrent; // [HoldingRegister(30498, writable: true, Scale = 0.1)] private UInt16 _batteryMaxChargingCurrent; //
[HoldingRegister(30499, writable: true, Scale = 0.1)] private UInt16 _batteryMaxDischargingCurrent; //*/ [HoldingRegister(30499, writable: true, Scale = 0.1)] private UInt16 _batteryMaxDischargingCurrent; //*/
} }