Introduce constant (battery heating power = 200)

This commit is contained in:
atef 2023-08-02 11:05:26 +02:00
parent e6f1263e4b
commit f9193f4624
1 changed files with 16 additions and 3 deletions

View File

@ -9,6 +9,7 @@ namespace InnovEnergy.App.SaliMax.Ess;
public static class Controller
{
private static readonly UnixTimeSpan MaxTimeWithoutEoc = UnixTimeSpan.FromDays(7); // TODO: move to config
private static readonly Double BatteryHeatingPower = 200.0; // TODO: move to config
public static EssMode SelectControlMode(this StatusRecord s)
{
@ -85,7 +86,7 @@ public static class Controller
// find out if we reach the lower or upper Dc limit by comparing the current Dc voltage to the reference voltage
return s.AcDc.Dc.Voltage > s.Config.ReferenceDcBusVoltage
return s.AcDc.Dc.Voltage > s.Config.ReferenceDcLinkVoltageFromAcDc
? control with { PowerCorrection = clampedPowerDelta.ClampMax(-correction), LimitedBy = EssLimit.ChargeLimitedByMaxDcBusVoltage }
: control with { PowerCorrection = clampedPowerDelta.ClampMin(correction), LimitedBy = EssLimit.DischargeLimitedByMinDcBusVoltage };
}
@ -153,7 +154,19 @@ public static class Controller
private static Double MaxBatteryChargePower(this StatusRecord s)
{
return s.Battery.Devices.Sum(b => b.MaxChargePower);
// This introduce a limit when we don't have communication with batteries
// Otherwise the limit will be 0 and the batteries will be not heated
var maxChargePower = s.Config.Devices.BatteryNodes.Length * BatteryHeatingPower;
if (s.Battery.Devices.Count != 0)
{
maxChargePower = s.Battery.Devices.Sum(b => b.MaxChargePower);
}
maxChargePower.WriteLine(" Max Charge Power");
return maxChargePower;
}
private static Double CurrentPowerSetPoint(this StatusRecord s)