Limit DischargePower based on nb. of batteries that are actually connected to the DC bus, not nb. of batteries that communicate

This commit is contained in:
ig 2023-09-06 10:20:23 +02:00
parent 7f91d49374
commit 3b1a553be5
1 changed files with 3 additions and 19 deletions

View File

@ -1,6 +1,5 @@
using InnovEnergy.Lib.Devices.Battery48TL;
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc;
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Utils;
@ -104,8 +103,8 @@ public static class Controller
private static EssControl LimitDischargePower(this EssControl control, StatusRecord s)
{
var maxBatteryDischargeDelta = s.Battery?.Devices.Sum(b => b.MaxDischargePower) ?? 0;
var keepMinSocLimitDelta = s.ControlBatteryPower(s.HoldMinSocPower());
var maxBatteryDischargeDelta = s.Battery?.Devices.Where(b => b.ConnectedToDcBus).Sum(b => b.MaxDischargePower) ?? 0;
var keepMinSocLimitDelta = s.ControlBatteryPower(s.HoldMinSocPower());
return control
.LimitDischargePower(maxBatteryDischargeDelta , EssLimit.DischargeLimitedByBatteryPower)
@ -187,24 +186,9 @@ public static class Controller
return s.Battery?.Devices ?? Array.Empty<Battery48TlRecord>();
}
private static Boolean MustDoCalibrationCharge(this StatusRecord statusRecord)
{
// var config = statusRecord.Config;
//
// if (statusRecord.Battery.Eoc)
// {
// "Batteries have reached EOC".LogInfo();
// config.LastEoc = UnixTime.Now;
// return false;
// }
//
// return UnixTime.Now - statusRecord.Config.LastEoc > MaxTimeWithoutEoc;
// no need to return false in case of EOC reached
// because the BMS will set the Time Since TOC to 0 as soon a battery reach EOC
// then Calibration Charge flag will be set false by the software
return statusRecord.Battery?.CalibrationChargeRequested ?? false;
return statusRecord.Battery?.CalibrationChargeRequested ?? false;
}