Fix control constants, we assign the Dc bus Voltage info depends on the mode
This commit is contained in:
parent
f8b13a9814
commit
b39b512a12
|
@ -205,21 +205,26 @@ internal static class Program
|
||||||
|
|
||||||
private static void ControlConstants(this StatusRecord r)
|
private static void ControlConstants(this StatusRecord r)
|
||||||
{
|
{
|
||||||
var inverters = r.AcDc.Devices;
|
var inverters = r.AcDc.Devices;
|
||||||
var dcDevices = r.DcDc.Devices;
|
var dcDevices = r.DcDc.Devices;
|
||||||
|
var configFile = r.Config;
|
||||||
|
|
||||||
|
var gridTie = r.AcDc.Devices.All(d => d.Control.Ac.GridType == GridType.GridTied400V50Hz); // TODO if any of the grid tie mode
|
||||||
|
|
||||||
|
inverters.ForEach(d => d.Control.Dc.MaxVoltage = gridTie ? configFile.GridTie.AcDc.MaxDcLinkVoltage : configFile.IslandMode.AcDc.MaxDcLinkVoltage);
|
||||||
|
inverters.ForEach(d => d.Control.Dc.MinVoltage = gridTie ? configFile.GridTie.AcDc.MinDcLinkVoltage : configFile.IslandMode.AcDc.MinDcLinkVoltage);
|
||||||
|
inverters.ForEach(d => d.Control.Dc.ReferenceVoltage = gridTie ? configFile.GridTie.AcDc.ReferenceDcLinkVoltage : configFile.IslandMode.AcDc.ReferenceDcLinkVoltage);
|
||||||
|
|
||||||
inverters.ForEach(d => d.Control.Dc.MaxVoltage = r.Config.MaxDcLinkVoltageFromAcDc);
|
inverters.ForEach(d => d.Control.Dc.PrechargeConfig = DcPrechargeConfig.PrechargeDcWithInternal);
|
||||||
inverters.ForEach(d => d.Control.Dc.MinVoltage = r.Config.MinDcLinkVoltageFromAcDc);
|
|
||||||
inverters.ForEach(d => d.Control.Dc.ReferenceVoltage = r.Config.ReferenceDcLinkVoltageFromAcDc);
|
dcDevices.ForEach(d => d.Control.DroopControl.UpperVoltage = gridTie ? configFile.GridTie.DcDc.UpperDcLinkVoltage : configFile.IslandMode.DcDc.UpperDcLinkVoltage);
|
||||||
inverters.ForEach(d => d.Control.Dc.PrechargeConfig = DcPrechargeConfig.PrechargeDcWithInternal);
|
dcDevices.ForEach(d => d.Control.DroopControl.LowerVoltage = gridTie ? configFile.GridTie.DcDc.LowerDcLinkVoltage : configFile.IslandMode.DcDc.LowerDcLinkVoltage);
|
||||||
|
dcDevices.ForEach(d => d.Control.DroopControl.ReferenceVoltage = gridTie ? configFile.GridTie.DcDc.ReferenceDcLinkVoltage : configFile.IslandMode.DcDc.ReferenceDcLinkVoltage);
|
||||||
|
|
||||||
dcDevices.ForEach(d => d.Control.DroopControl.UpperVoltage = r.Config.UpperDcLinkVoltageFromDc);
|
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryChargingCurrent = configFile.MaxBatteryChargingCurrent);
|
||||||
dcDevices.ForEach(d => d.Control.DroopControl.LowerVoltage = r.Config.LowerDcLinkVoltageFromDc);
|
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryDischargingCurrent = configFile.MaxBatteryDischargingCurrent);
|
||||||
dcDevices.ForEach(d => d.Control.DroopControl.ReferenceVoltage = r.Config.ReferenceDcLinkVoltageFromDc);
|
dcDevices.ForEach(d => d.Control.VoltageLimits.MaxBatteryVoltage = configFile.MaxChargeBatteryVoltage);
|
||||||
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryChargingCurrent = r.Config.MaxBatteryChargingCurrent);
|
dcDevices.ForEach(d => d.Control.VoltageLimits.MinBatteryVoltage = configFile.MinDischargeBatteryVoltage);
|
||||||
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryDischargingCurrent = r.Config.MaxBatteryDischargingCurrent);
|
|
||||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MaxBatteryVoltage = r.Config.MaxChargeBatteryVoltage);
|
|
||||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MinBatteryVoltage = r.Config.MinDischargeBatteryVoltage);
|
|
||||||
dcDevices.ForEach(d => d.Control.ControlMode = DcControlMode.VoltageDroop);
|
dcDevices.ForEach(d => d.Control.ControlMode = DcControlMode.VoltageDroop);
|
||||||
|
|
||||||
r.DcDc.ResetAlarms();
|
r.DcDc.ResetAlarms();
|
||||||
|
|
Loading…
Reference in New Issue