diff --git a/csharp/Lib/Devices/AMPT/AmptDevices.cs b/csharp/Lib/Devices/AMPT/AmptDevices.cs index 1750d0029..4e8b47256 100644 --- a/csharp/Lib/Devices/AMPT/AmptDevices.cs +++ b/csharp/Lib/Devices/AMPT/AmptDevices.cs @@ -36,7 +36,7 @@ public class AmptDevices } catch (Exception e) { - Console.WriteLine(e); + Console.WriteLine( "Failed to read Ampt data \n"+ e.Message ); // TODO: log } diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlDevices.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlDevices.cs index 19b636678..866d4a49d 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlDevices.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlDevices.cs @@ -18,13 +18,11 @@ public class Battery48TlDevices return new Battery48TlRecords(records); } - catch + catch (Exception e) { - //Console.WriteLine(e); + Console.WriteLine( "Failed to read Battery data \n"+ e.Message ); // TODO: log - "Failed to read Battery data".WriteLine(); - return Battery48TlRecords.Null; } diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs index 5d5db55d2..6db267887 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs @@ -9,12 +9,13 @@ public class Battery48TlRecords { var empty = records.Count == 0; - Devices = records; - Eoc = !empty && records.All(r => r.Eoc); - Warnings = records.SelectMany(r => r.Warnings).Distinct().ToList(); - Alarms = records.SelectMany(r => r.Alarms).Distinct().ToList(); - Soc = empty ? 0 : records.Min(r => r.Soc.Value); - Temperature = records.Any() ? records.Average(b => b.Temperatures.Cells.Average.Value) : 0; + Devices = records; + Eoc = !empty && records.All(r => r.Eoc); + Warnings = records.SelectMany(r => r.Warnings).Distinct().ToList(); + Alarms = records.SelectMany(r => r.Alarms).Distinct().ToList(); + Soc = empty ? 0 : records.Min(r => r.Soc.Value); + Temperature = records.Any() ? records.Average(b => b.Temperatures.Cells.Average.Value) : 0; + HeatingCurrent = records.Any() ? records.Sum(b => b.HeatingCurrent) : 0; Dc = empty ? DcBus.FromVoltageCurrent(0, 0) @@ -25,12 +26,13 @@ public class Battery48TlRecords ); } - public DcBus Dc { get; init; } - public Boolean Eoc { get; init; } - public IReadOnlyList Warnings { get; init; } - public IReadOnlyList Alarms { get; init; } - public Percent Soc { get; init; } - public Temperature Temperature { get; init; } + public DcBus Dc { get; init; } + public Boolean Eoc { get; init; } + public IReadOnlyList Warnings { get; init; } + public IReadOnlyList Alarms { get; init; } + public Percent Soc { get; init; } + public Temperature Temperature { get; init; } + public Current HeatingCurrent { get; init; } public IReadOnlyList Devices { get; init; }