Add the GRid Power, Exported and imported power

This commit is contained in:
atef 2025-10-20 15:01:18 +02:00
parent 59652425cd
commit 334ee4e6c1
2 changed files with 38 additions and 15 deletions

View File

@ -13,6 +13,9 @@ public partial class WITGrowatRecord
{ {
// private List<BatteryRecord> Batteries { get; set; } = new(); // private List<BatteryRecord> Batteries { get; set; } = new();
//public BatteriesRecord? BatteriesRecords => BatteriesRecord.FromBatteries(Batteries); //public BatteriesRecord? BatteriesRecords => BatteriesRecord.FromBatteries(Batteries);
public ActivePower ConsumptionPower => MeterPower + InverterActivePower ;
public ActivePower InverterActivePower => _ActivePower; public ActivePower InverterActivePower => _ActivePower;
public ReactivePower InverterReactivePower => _ReactivePower; public ReactivePower InverterReactivePower => _ReactivePower;
public Frequency Frequency => _Frequency; public Frequency Frequency => _Frequency;
@ -24,13 +27,9 @@ public partial class WITGrowatRecord
public CurrentRms PhaseBCurrent => _PhaseBCurrent; public CurrentRms PhaseBCurrent => _PhaseBCurrent;
public CurrentRms PhaseCCurrent => _PhaseCCurrent; public CurrentRms PhaseCCurrent => _PhaseCCurrent;
public Int32 MeterPower => _MeterPower; public ActivePower MeterPower => _importedPowerFromGrid - _exportedPowerToGrid;
public ActivePower GridMeterPower => _GridPower; public ActivePower ExportedPowerToGridMeter => _exportedPowerToGrid;
public Int32 BatteryPower1 public ActivePower ImportedPowerFromGrid => _importedPowerFromGrid;
{
get => _BatteryPower1;
set => _BatteryPower1 = value;
}
public Temperature InverterTemperature => _InverterTemperature; public Temperature InverterTemperature => _InverterTemperature;
@ -52,15 +51,30 @@ public partial class WITGrowatRecord
public Current Pv1Current => _Pv1Current; public Current Pv1Current => _Pv1Current;
public Voltage Pv2Voltage => _Pv2Voltage; public Voltage Pv2Voltage => _Pv2Voltage;
public Current Pv2Current => _Pv2Current; public Current Pv2Current => _Pv2Current;
public Voltage Pv3Voltage => _Pv3Voltage;
public Current Pv3Current => _Pv3Current;
public Voltage Pv4Voltage => _Pv4Voltage;
public Current Pv4Current => _Pv4Current;
public Voltage Pv5Voltage => _Pv5Voltage;
public Current Pv5Current => _Pv5Current;
public Voltage Pv6Voltage => _Pv6Voltage;
public Current Pv6Current => _Pv6Current;
public DcPower Pv1InpuPower => _Pv1InpuPower; public DcPower Pv1InpuPower => _Pv1InpuPower;
public DcPower TotalPvPower => (Pv1Voltage * Pv1Current) + (Pv2Voltage * Pv2Current) +
(Pv3Voltage * Pv3Current) + (Pv4Voltage * Pv4Current) +
(Pv5Voltage * Pv5Current) + (Pv6Voltage * Pv6Current);
// ********************************** Holding Registers (Control) ************************************************************* // ********************************** Holding Registers (Control) *************************************************************
// public UInt16 DeviceModel => _DeviceModel; // public UInt16 DeviceModel => _DeviceModel;
public UInt32 RatedPower public UInt32 RatedPower
{ {
get => _RatedPower; get => _ratedPower;
} }
public UInt32 MaxActivePower public UInt32 MaxActivePower

View File

@ -10,8 +10,9 @@ public partial class WITGrowatRecord
{ {
/****************************** Input registers ****************************/ /****************************** Input registers ****************************/
[InputRegister<Int32>(35, Scale = 0.1)] private Int32 _GridPower; [InputRegister<Int32>(8081, Scale = 0.1)] private Int32 _importedPowerFromGrid;
[InputRegister<Int32>(8083, Scale = 0.1)] private Int32 _exportedPowerToGrid;
// 3100031009 — Operating Status Info // 3100031009 — Operating Status Info
[InputRegister(31000)] private UInt16 _SystemOperatingMode; [InputRegister(31000)] private UInt16 _SystemOperatingMode;
[InputRegister(31001)] private UInt16 _BatteryOperatingMode; [InputRegister(31001)] private UInt16 _BatteryOperatingMode;
@ -24,10 +25,18 @@ public partial class WITGrowatRecord
[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
[InputRegister(31010)] private Int16 _Pv1Voltage; [InputRegister(31010,Scale = 0.1)] private Int16 _Pv1Voltage;
[InputRegister(31011)] private Int16 _Pv1Current; [InputRegister(31011,Scale = 0.1)] private Int16 _Pv1Current;
[InputRegister(31012)] private Int16 _Pv2Voltage; [InputRegister(31012,Scale = 0.1)] private Int16 _Pv2Voltage;
[InputRegister(31013)] private Int16 _Pv2Current; [InputRegister(31013,Scale = 0.1)] private Int16 _Pv2Current;
[InputRegister(31014,Scale = 0.1)] private Int16 _Pv3Voltage;
[InputRegister(31015,Scale = 0.1)] private Int16 _Pv3Current;
[InputRegister(31016,Scale = 0.1)] private Int16 _Pv4Voltage;
[InputRegister(31017,Scale = 0.1)] private Int16 _Pv4Current;
[InputRegister(31018,Scale = 0.1)] private Int16 _Pv5Voltage;
[InputRegister(31019,Scale = 0.1)] private Int16 _Pv5Current;
[InputRegister(31020,Scale = 0.1)] private Int16 _Pv6Voltage;
[InputRegister(31021,Scale = 0.1)] private Int16 _Pv6Current;
[InputRegister(31058)] private Int16 _Pv1InpuPower; [InputRegister(31058)] private Int16 _Pv1InpuPower;
//— AC Side 31100 - 31199 //— AC Side 31100 - 31199
@ -129,7 +138,7 @@ public partial class WITGrowatRecord
/****************************** Holding registers ****************************/ /****************************** Holding registers ****************************/
// [HoldingRegister(30000)] private UInt16 _DeviceModel; // [HoldingRegister(30000)] private UInt16 _DeviceModel;
[HoldingRegister<UInt32>(30016, Scale = 0.1)] private UInt32 _RatedPower; [HoldingRegister<UInt32>(30016, Scale = 0.1)] private UInt32 _ratedPower;
[HoldingRegister<UInt32>(30018, Scale = 0.1)] private UInt32 _MaxActivePower; [HoldingRegister<UInt32>(30018, Scale = 0.1)] private UInt32 _MaxActivePower;
[HoldingRegister<UInt32>(30028, Scale = 0.1)] private UInt32 _PvInputMaxPower; [HoldingRegister<UInt32>(30028, Scale = 0.1)] private UInt32 _PvInputMaxPower;
[HoldingRegister(30030)] private UInt16 _BatteryType; [HoldingRegister(30030)] private UInt16 _BatteryType;