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)
{
Console.WriteLine(e);
Console.WriteLine( "Failed to read Ampt data \n"+ e.Message );
// TODO: log
}

View File

@ -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;
}

View File

@ -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<String> Warnings { get; init; }
public IReadOnlyList<String> 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<String> Warnings { get; init; }
public IReadOnlyList<String> Alarms { get; init; }
public Percent Soc { get; init; }
public Temperature Temperature { get; init; }
public Current HeatingCurrent { get; init; }
public IReadOnlyList<Battery48TlRecord> Devices { get; init; }