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 public static class Controller
{ {
private static readonly UnixTimeSpan MaxTimeWithoutEoc = UnixTimeSpan.FromDays(7); // TODO: move to config 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) 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 // 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.ClampMax(-correction), LimitedBy = EssLimit.ChargeLimitedByMaxDcBusVoltage }
: control with { PowerCorrection = clampedPowerDelta.ClampMin(correction), LimitedBy = EssLimit.DischargeLimitedByMinDcBusVoltage }; : control with { PowerCorrection = clampedPowerDelta.ClampMin(correction), LimitedBy = EssLimit.DischargeLimitedByMinDcBusVoltage };
} }
@ -122,7 +123,7 @@ public static class Controller
private static Double ComputePowerDelta(this StatusRecord s, EssMode mode) private static Double ComputePowerDelta(this StatusRecord s, EssMode mode)
{ {
var chargePower = s.AcDc.Devices.Sum(d => d.Status.Nominal.Power.Value); var chargePower = s.AcDc.Devices.Sum(d => d.Status.Nominal.Power.Value);
return mode switch return mode switch
{ {
EssMode.HeatBatteries => s.ControlInverterPower(chargePower), EssMode.HeatBatteries => s.ControlInverterPower(chargePower),
@ -153,7 +154,19 @@ public static class Controller
private static Double MaxBatteryChargePower(this StatusRecord s) 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) private static Double CurrentPowerSetPoint(this StatusRecord s)