Add heating power to the average battery.

This commit is contained in:
atef 2023-08-30 13:38:50 +02:00
parent db6fe5ecbf
commit 57c5faf1e6
2 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Units.Power;
using InnovEnergy.Lib.Utils;
using static InnovEnergy.Lib.Devices.Battery48TL.DataTypes.LedState;
namespace InnovEnergy.Lib.Devices.Battery48TL;
@ -28,6 +29,8 @@ public partial class Battery48TlRecord
public Current HeatingCurrent => _BusCurrent - _CellsCurrent;
public DcPower HeatingPower => HeatingCurrent * Dc.Voltage;
public readonly struct Leds_
{
public LedState Blue => Self.ParseLed(LedColor.Blue);

View File

@ -1,5 +1,7 @@
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Units.Composite;
using InnovEnergy.Lib.Units.Power;
using InnovEnergy.Lib.Utils;
namespace InnovEnergy.Lib.Devices.Battery48TL;
@ -16,7 +18,7 @@ public class Battery48TlRecords
Soc = empty ? 0 : records.Average(r => r.Soc.Value);
CurrentMinSoc = 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;
HeatingPower = records.Any() ? records.Sum(b => b.HeatingPower) : 0;
Dc = empty
? DcBus.Null
@ -35,6 +37,7 @@ public class Battery48TlRecords
public Percent CurrentMinSoc { get; init; }
public Temperature Temperature { get; init; }
public Current HeatingCurrent { get; init; }
public DcPower HeatingPower { get; init; }
public IReadOnlyList<Battery48TlRecord> Devices { get; init; }