Add battery heating Current
This commit is contained in:
parent
bd24a725c6
commit
b37fd90098
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,13 @@ public class Battery48TlRecords
|
||||||
{
|
{
|
||||||
var empty = records.Count == 0;
|
var empty = records.Count == 0;
|
||||||
|
|
||||||
Devices = records;
|
Devices = records;
|
||||||
Eoc = !empty && records.All(r => r.Eoc);
|
Eoc = !empty && records.All(r => r.Eoc);
|
||||||
Warnings = records.SelectMany(r => r.Warnings).Distinct().ToList();
|
Warnings = records.SelectMany(r => r.Warnings).Distinct().ToList();
|
||||||
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)
|
||||||
|
@ -25,12 +26,13 @@ public class Battery48TlRecords
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DcBus Dc { get; init; }
|
public DcBus Dc { get; init; }
|
||||||
public Boolean Eoc { get; init; }
|
public Boolean Eoc { get; init; }
|
||||||
public IReadOnlyList<String> Warnings { get; init; }
|
public IReadOnlyList<String> Warnings { get; init; }
|
||||||
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; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue