Add battery heating Current

This commit is contained in:
atef 2023-07-10 10:35:29 +02:00
parent bd24a725c6
commit b37fd90098
3 changed files with 17 additions and 17 deletions

View File

@ -36,7 +36,7 @@ public class AmptDevices
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e); Console.WriteLine( "Failed to read Ampt data \n"+ e.Message );
// TODO: log // TODO: log
} }

View File

@ -18,13 +18,11 @@ public class Battery48TlDevices
return new Battery48TlRecords(records); return new Battery48TlRecords(records);
} }
catch catch (Exception e)
{ {
//Console.WriteLine(e); Console.WriteLine( "Failed to read Battery data \n"+ e.Message );
// TODO: log // TODO: log
"Failed to read Battery data".WriteLine();
return Battery48TlRecords.Null; return Battery48TlRecords.Null;
} }

View File

@ -15,6 +15,7 @@ public class Battery48TlRecords
Alarms = records.SelectMany(r => r.Alarms).Distinct().ToList(); Alarms = records.SelectMany(r => r.Alarms).Distinct().ToList();
Soc = empty ? 0 : records.Min(r => r.Soc.Value); Soc = empty ? 0 : records.Min(r => r.Soc.Value);
Temperature = records.Any() ? records.Average(b => b.Temperatures.Cells.Average.Value) : 0; Temperature = records.Any() ? records.Average(b => b.Temperatures.Cells.Average.Value) : 0;
HeatingCurrent = records.Any() ? records.Sum(b => b.HeatingCurrent) : 0;
Dc = empty Dc = empty
? DcBus.FromVoltageCurrent(0, 0) ? DcBus.FromVoltageCurrent(0, 0)
@ -31,6 +32,7 @@ public class Battery48TlRecords
public IReadOnlyList<String> Alarms { get; init; } public IReadOnlyList<String> Alarms { get; init; }
public Percent Soc { get; init; } public Percent Soc { get; init; }
public Temperature Temperature { get; init; } public Temperature Temperature { get; init; }
public Current HeatingCurrent { get; init; }
public IReadOnlyList<Battery48TlRecord> Devices { get; init; } public IReadOnlyList<Battery48TlRecord> Devices { get; init; }