Clean up controller

This commit is contained in:
atef 2023-06-22 09:55:57 +02:00
parent 1c253bb603
commit b8b908e7f8
1 changed files with 2 additions and 48 deletions

View File

@ -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)
{