Innovenergy_trunk/csharp/Lib/Devices/Battery48TL/Battery48TlRegisters.cs

55 lines
2.3 KiB
C#

using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes;
using InnovEnergy.Lib.StatusApi.DeviceTypes;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Units.Composite;
namespace InnovEnergy.Lib.Devices.Battery48TL;
#pragma warning disable CS0169, CS0649
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[BigEndian] // alarm/warning flags
public record Battery48TlRegisters : IBattery
{
[InputRegister(1004)] internal UInt16 _LedStates;
[InputRegister<UInt64>(1005)] internal UInt64 _WarningFlags;
[InputRegister<UInt64>(1009)] internal UInt64 _AlarmFlags;
[InputRegister(1013)] internal UInt16 _IoStates;
[InputRegister(999, Scale = 0.01)] internal Double _Voltage ;
[InputRegister(1000, Scale = 0.01, Offset = -10000)] internal Double _Current ;
[InputRegister(1053, Scale = 0.1)] internal Double _Soc;
[InputRegister(1014, Scale = 0.1, Offset = -400)] internal Double _TemperatureBoard ;
[InputRegister(1015, Scale = 0.1, Offset = -400)] internal Double _TemperatureCellsCenter ;
[InputRegister(1016, Scale = 0.1, Offset = -400)] internal Double _TemperatureCellsLeft ;
[InputRegister(1017, Scale = 0.1, Offset = -400)] internal Double _TemperatureCellsRight ;
public DcBus Dc => DcBus.FromVoltageCurrent(_Voltage, _Current);
public Percent Soc => _Soc;
public Leds Leds => this.ParseLeds();
public Temperatures Temperature => this.ParseBatteryTemperatures();
public Boolean ConnectedToDcBus => this.ParseConnectedToDcBus();
public Boolean Heating => this.ParseHeating();
public Boolean Eoc => this.ParseEoc();
public IReadOnlyList<String> Warnings => this.ParseWarnings().ToList() ;
public IReadOnlyList<String> Alarms => this.ParseAlarms().ToList() ;
//
// public Decimal CellsVoltage { get; init; }
//
// public Decimal MaxChargingPower { get; init; }
// public Decimal MaxDischargingPower { get; init; }
}