Add the SOCAh to the battery data

This commit is contained in:
atef 2024-01-19 12:33:21 +01:00
parent 80f9186319
commit 1fb9be93e9
3 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ public partial class Battery48TlRecord
public Strings Alarms => ParseAlarms() .OrderBy(w => w).ToList();
public Percent Soc => _Soc;
public Double SOCAh => _SOCAh;
public Current BusCurrent => _BusCurrent;
public UInt16 BusCurrentHex => _BusCurrentHex;
@ -40,7 +41,7 @@ public partial class Battery48TlRecord
// When The battery is full charged (reached EOC) the Time Since TOC is set to 0
public TimeSpan TimeSinceTOC => TimeSpan.FromMinutes(_TimeSinceToc);
public Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(14);
public Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(13); // Each 14 days , we do calibration. But there is wait time for all batteries to request and for next day calibration rule we put this 13 days
public readonly struct Leds_
{

View File

@ -21,6 +21,7 @@ public partial class Battery48TlRecord
[InputRegister(1001, Scale = 0.01)] private Double _BusVoltage;
[InputRegister(1000, Scale = 0.01, Offset = -10000)] private Double _CellsCurrent;
[InputRegister(1000)] private UInt16 _CellsCurrentHex;
[InputRegister(1002, Scale = 0.1, Offset = -10000)] private Double _SOCAh;
[InputRegister(1062, Scale = 0.01, Offset = -10000)] private Double _BusCurrent;

View File

@ -11,6 +11,7 @@ public class Battery48TlRecords
public required IReadOnlyList<String> Warnings { get; init; }
public required IReadOnlyList<String> Alarms { get; init; }
public required Percent Soc { get; init; }
public required Double SocAh { get; init; }
public required Percent CurrentMinSoc { get; init; }
public required Temperature Temperature { get; init; }
public required DcPower HeatingPower { get; init; }
@ -31,6 +32,7 @@ public class Battery48TlRecords
Warnings = records.SelectMany(r => r.Warnings).Distinct().ToList(),
Alarms = records.SelectMany(r => r.Alarms).Distinct().ToList(),
Soc = records.Average(r => r.Soc.Value),
SocAh = records.Average(r => r.SOCAh),
CurrentMinSoc = records.Min(r => r.Soc.Value),
Temperature = records.Average(b => b.Temperatures.Cells.Average.Value),
HeatingPower = records.Sum(b => b.HeatingPower),