Innovenergy_trunk/csharp/Lib/Devices/Battery250UP/Battery250UPRecord.Modbus.cs

102 lines
4.1 KiB
C#

using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Devices.Battery250Up.DataTypes;
using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes;
namespace InnovEnergy.Lib.Devices.Battery250Up;
#pragma warning disable CS0169, CS0649
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
[BigEndian]
public partial class Battery250UpRecord
{
[InputRegister(1004)] private UInt16 _LedStates;
[InputRegister<UInt64>(1005)] private UInt64 _WarningFlags;
//mine
[InputRegister<UInt64>(1006)] private UInt64 _WarningFlags16to31;
[InputRegister<UInt64>(1007)] private UInt64 _WarningFlags32to47;
[InputRegister<UInt64>(1008)] private UInt64 _WarningFlags48to63;
[InputRegister<UInt64>(1009)] private UInt64 _AlarmFlags;
//mine
[InputRegister<UInt64>(1010)] private UInt64 _AlarmFlags16to31;
[InputRegister<UInt64>(1011)] private UInt64 _AlarmFlags32to47;
[InputRegister<UInt64>(1012)] private UInt64 _AlarmFlags48to63;
[InputRegister(1013)] private UInt16 _IoStates;
[InputRegister(999, Scale = 0.01)] private Double _CellsVoltage;
[InputRegister(1001, Scale = 0.01)] private Double _BusVoltage;
[InputRegister(1000, Scale = 0.01, Offset = -10000)] private Double _CellsCurrent;
[InputRegister(1002, Scale = 0.1, Offset = -10000)] private Double _SOCAh;
[InputRegister(1062, Scale = 0.01, Offset = -10000)] private Double _BusCurrent;
[InputRegister(1053, Scale = 0.1)] private Double _Soc;
[InputRegister(1052)] private UInt16 _TimeSinceToc;
[InputRegister(1014, Scale = 0.1, Offset = -400)] private Double _TemperaturesBoard;
[InputRegister(1015, Scale = 0.1, Offset = -400)] private Double _TemperaturesCellsCenter;
[InputRegister(1016, Scale = 0.1, Offset = -400)] private Double _TemperaturesCellsLeft;
[InputRegister(1017, Scale = 0.1, Offset = -400)] private Double _TemperaturesCellsRight;
[InputRegister(1003, Scale = 0.1, Offset = -400)] private Double _TemperaturesCellsAverage;
[InputRegister(1054)] private UInt16 _FwVersion;
[InputRegister(1055)] private UInt16 _SerialNum1;
[InputRegister(1056)] private UInt16 _SerialNum2;
[InputRegister(1057)] private UInt16 _SerialNum3;
[InputRegister(1058)] private UInt16 _SerialNum4;
[InputRegister(1059)] private UInt16 _LimpBitMap;
[InputRegister(1060)] private UInt16 _BatteryState1;
[InputRegister(1061)] private UInt16 _BatteryState2;
//mine
[InputRegister(1018, Scale = 0.1)] private Double _RiscC_pwm;
[InputRegister(1019, Scale = 0.1)] private Double _RiscL_pwm;
[InputRegister(1050)] private UInt16 _RTCCounterLo;
[InputRegister(1051)] private UInt16 _RTCCounterHi;
[InputRegister(1052)] private UInt16 _TimeToTocRequest;
//[InputRegister(1063)] private UInt16 _TotalBatteryCycle;
private LedState ParseLed(LedColor led) => (LedState)((_LedStates >> (Int32)led) & 3);
// public Decimal CellsVoltage { get; init; }
//
// public Decimal MaxChargingPower { get; init; }
// public Decimal MaxDischargingPower { get; init; }
}