From b8b908e7f8a916651acb40c3886be63ce7912eff Mon Sep 17 00:00:00 2001 From: atef Date: Thu, 22 Jun 2023 09:55:57 +0200 Subject: [PATCH] Clean up controller --- csharp/App/SaliMax/src/Ess/Controller.cs | 50 +----------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/csharp/App/SaliMax/src/Ess/Controller.cs b/csharp/App/SaliMax/src/Ess/Controller.cs index 55007e035..063e80b10 100644 --- a/csharp/App/SaliMax/src/Ess/Controller.cs +++ b/csharp/App/SaliMax/src/Ess/Controller.cs @@ -43,12 +43,7 @@ public static class Controller var currentPowerSetPoint = s.CurrentPowerSetPoint(); - var essControl = limitedControl with { PowerSetpoint = currentPowerSetPoint + limitedControl.PowerCorrection }; - - essControl.WriteLine(); - s.Battery.Soc.WriteLine("Soc"); - - return essControl; + return limitedControl with { PowerSetpoint = currentPowerSetPoint + limitedControl.PowerCorrection }; } private static EssControl LimitInverterPower(this EssControl control, StatusRecord s) @@ -89,48 +84,7 @@ public static class Controller : control with { PowerCorrection = clampedPowerDelta.ClampMin(correction), LimitedBy = EssLimit.DischargeLimitedByMinDcBusVoltage }; } - // private static Double AdjustMaxChargePower(StatusRecord s, Double powerDelta) - // { - // var acDcs = s.AcDc.Devices; - // - // var nInverters = acDcs.Count; - // - // if (nInverters == 0) - // return 0; // no inverters present: we cannot charge at all - // - // var nominalPower = acDcs.Sum(d => d.Status.Nominal.Power); - // - // if (nInverters == 1) - // return powerDelta; // single inverter: current loop cannot happen - // - // acDcs.ForEach(d => d.Status.PowerLimitedBy.WriteLine()); - // - // var dcLimited = acDcs.Any(d => d.Status.PowerLimitedBy == PowerLimit.DcLink); - // - // if (expr) - // { - // - // } - // - // - // var maxPowerDifference = nominalPower / 25; - // - // var maxPower = acDcs.Max(d => d.Status.Ac.Power.Active.Value).WriteLine("Max"); - // var minPower = acDcs.Min(d => d.Status.Ac.Power.Active.Value).WriteLine("Min"); - // - // var sum = acDcs.Sum(d => d.Status.Ac.Power.Active.Value); - // - // var powerDifference = maxPower - minPower; - // - // if (powerDifference > maxPowerDifference) - // ChargePower = sum - powerDifference / 4; - // else - // ChargePower += maxPowerDifference / 2; - // - // $"HACK : ChargePower {ChargePower} Difference: {powerDifference}".WriteLine(); - // } - - + private static EssControl LimitChargePower(this EssControl control, StatusRecord s) {