Add time to TOC request

This commit is contained in:
atef 2023-08-31 15:16:20 +02:00
parent c955b97c2b
commit 6c2360f0ad
4 changed files with 28 additions and 19 deletions

View File

@ -174,6 +174,11 @@ internal static class Program
var t = UnixTime.Now;
var record = ReadStatus();
var batteryTimeToToc = (3600 - record.Battery.TimeToToc / 60 );
record.Battery.TimeToToc.WriteLine(" : Value of register 54");
batteryTimeToToc .WriteLine(" : Remaining time before next top of charge");
record.ControlConstants();
record.ControlSystemState();

View File

@ -25,6 +25,8 @@ public partial class Battery48TlRecord
public Percent Soc => _Soc;
public UInt16 TimeToTOC => (UInt16)_TimeToTOC;
public Current BusCurrent => _BusCurrent;
public Current HeatingCurrent => _BusCurrent - _CellsCurrent;

View File

@ -23,22 +23,22 @@ public partial class Battery48TlRecord
[InputRegister(1062, Scale = 0.01, Offset = -10000)] private Double _BusCurrent;
[InputRegister(1053, Scale = 0.1)] private Double _Soc;
[InputRegister(1052)] private Double _TimeToTOC;
[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(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 Double _FwVersion;
[InputRegister(1055)] private Double _SerialNum1;
[InputRegister(1056)] private Double _SerialNum2;
[InputRegister(1057)] private Double _SerialNum3;
[InputRegister(1058)] private Double _SerialNum4;
[InputRegister(1059)] private Double _LimpBitMap;
[InputRegister(1060)] private Double _BatteryState1;
[InputRegister(1061)] private Double _BatteryState2;
[InputRegister(1054)] private Double _FwVersion;
[InputRegister(1055)] private Double _SerialNum1;
[InputRegister(1056)] private Double _SerialNum2;
[InputRegister(1057)] private Double _SerialNum3;
[InputRegister(1058)] private Double _SerialNum4;
[InputRegister(1059)] private Double _LimpBitMap;
[InputRegister(1060)] private Double _BatteryState1;
[InputRegister(1061)] private Double _BatteryState2;
private LedState ParseLed(LedColor led) => (LedState)((_LedStates >> (Int32)led) & 3);

View File

@ -14,6 +14,7 @@ public class Battery48TlRecords
public required Percent CurrentMinSoc { get; init; }
public required Temperature Temperature { get; init; }
public required DcPower HeatingPower { get; init; }
public required UInt16 TimeToToc { get; init; }
public required IReadOnlyList<Battery48TlRecord> Devices { get; init; }
@ -32,6 +33,7 @@ public class Battery48TlRecords
CurrentMinSoc = records.Min(r => r.Soc.Value),
Temperature = records.Average(b => b.Temperatures.Cells.Average.Value),
HeatingPower = records.Sum(b => b.HeatingPower),
TimeToToc = records.Min(r => r.TimeToTOC),
Dc = DcBus.FromVoltageCurrent
(