Compare commits
No commits in common. "501a0584c58e8b240f76726ac093ae8992f21fb1" and "9ba33a6cf78c7c242c7cfc85074e71614b4620a1" have entirely different histories.
501a0584c5
...
9ba33a6cf7
|
@ -342,7 +342,7 @@ public static class Aggregator
|
|||
ChargingBatteryPower = batteryChargePower.Any() ? batteryChargePower.Average() : 0.0,
|
||||
GridExportPower = gridPowerExport.Any() ? gridPowerExport.Sum() : 0.0,
|
||||
GridImportPower = gridPowerImport.Any() ? gridPowerImport.Sum() : 0.0,
|
||||
PvPower = pvPower.Any() ? pvPower.Last() : 0.0,
|
||||
PvPower = pvPower.Any() ? pvPower.Max() : 0.0,
|
||||
HeatingPower = heatingPowerAvg.Any() ? heatingPowerAvg.Average() : 0.0,
|
||||
};
|
||||
|
||||
|
|
|
@ -229,11 +229,11 @@ internal static class Program
|
|||
|
||||
SendSalimaxStateAlarm(currentSalimaxState, record);
|
||||
|
||||
//record.ControlPvPower(record.Config.CurtailP);
|
||||
|
||||
record.ControlConstants();
|
||||
record.ControlSystemState();
|
||||
|
||||
record.ControlPvPower(record.Config.CurtailP);
|
||||
|
||||
var essControl = record.ControlEss().WriteLine();
|
||||
|
||||
record.EssControl = essControl;
|
||||
|
@ -477,7 +477,6 @@ internal static class Program
|
|||
var dcDevices = r.DcDc.Devices;
|
||||
var configFile = r.Config;
|
||||
var maxBatteryDischargingCurrentLive = 0.0;
|
||||
var devicesConfig = r.AcDc.Devices.All(d => d.Control.Ac.GridType == GridType.GridTied400V50Hz) ? configFile.GridTie : configFile.IslandMode; // TODO if any of the grid tie mode
|
||||
|
||||
// This adapting the max discharging current to the current Active Strings
|
||||
if (r.Battery != null)
|
||||
|
@ -485,7 +484,7 @@ internal static class Program
|
|||
const Int32 stringsByBattery = 5;
|
||||
var numberOfBatteriesConfigured = r.Config.Devices.BatteryNodes.Length;
|
||||
var numberOfTotalStrings = stringsByBattery * numberOfBatteriesConfigured;
|
||||
var dischargingCurrentByString = devicesConfig.DcDc.MaxBatteryDischargingCurrent / numberOfTotalStrings;
|
||||
var dischargingCurrentByString = configFile.MaxBatteryDischargingCurrent / numberOfTotalStrings;
|
||||
|
||||
var boolList = new List<Boolean>();
|
||||
|
||||
|
@ -508,6 +507,7 @@ internal static class Program
|
|||
|
||||
// TODO The discharging current is well calculated but not communicated to live. But Written in S3
|
||||
|
||||
var devicesConfig = r.AcDc.Devices.All(d => d.Control.Ac.GridType == GridType.GridTied400V50Hz) ? configFile.GridTie : configFile.IslandMode; // TODO if any of the grid tie mode
|
||||
|
||||
inverters.ForEach(d => d.Control.Dc.MaxVoltage = devicesConfig.AcDc.MaxDcLinkVoltage);
|
||||
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);
|
||||
|
@ -519,12 +519,12 @@ internal static class Program
|
|||
dcDevices.ForEach(d => d.Control.DroopControl.LowerVoltage = devicesConfig.DcDc.LowerDcLinkVoltage);
|
||||
dcDevices.ForEach(d => d.Control.DroopControl.ReferenceVoltage = devicesConfig.DcDc.ReferenceDcLinkVoltage);
|
||||
|
||||
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryChargingCurrent = devicesConfig.DcDc.MaxBatteryChargingCurrent);
|
||||
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryChargingCurrent = configFile.MaxBatteryChargingCurrent);
|
||||
dcDevices.ForEach(d => d.Control.CurrentControl.MaxBatteryDischargingCurrent = maxBatteryDischargingCurrentLive);
|
||||
dcDevices.ForEach(d => d.Control.MaxDcPower = devicesConfig.DcDc.MaxDcPower);
|
||||
dcDevices.ForEach(d => d.Control.MaxDcPower = configFile.MaxDcPower);
|
||||
|
||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MaxBatteryVoltage = devicesConfig.DcDc.MaxChargeBatteryVoltage);
|
||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MinBatteryVoltage = devicesConfig.DcDc.MinDischargeBatteryVoltage);
|
||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MaxBatteryVoltage = configFile.MaxChargeBatteryVoltage);
|
||||
dcDevices.ForEach(d => d.Control.VoltageLimits.MinBatteryVoltage = configFile.MinDischargeBatteryVoltage);
|
||||
dcDevices.ForEach(d => d.Control.ControlMode = DcControlMode.VoltageDroop);
|
||||
|
||||
r.DcDc.ResetAlarms();
|
||||
|
@ -532,12 +532,13 @@ internal static class Program
|
|||
}
|
||||
|
||||
// This will be used for provider throttling, this example is only for either 100% or 0 %
|
||||
private static void ControlPvPower(this StatusRecord r, UInt16 exportLimit = 100)
|
||||
private static void ControlPvPower(this StatusRecord r, Int16 exportLimit = 100)
|
||||
{
|
||||
const UInt16 stableFactor = 500;
|
||||
UInt16 stableFactor = 500;
|
||||
var inverters = r.AcDc.Devices;
|
||||
var dcDevices = r.DcDc.Devices;
|
||||
var configFile = r.Config;
|
||||
var systemProduction = inverters.Count * 25000; // this should be from to the PV
|
||||
var systemProduction = inverters.Count * 25000;
|
||||
var limitSystemProduction = systemProduction * exportLimit / 100;
|
||||
var devicesConfig = r.AcDc.Devices.All(d => d.Control.Ac.GridType == GridType.GridTied400V50Hz) ? configFile.GridTie : configFile.IslandMode; // TODO if any of the grid tie mode
|
||||
var targetReferenceVoltage = devicesConfig.AcDc.ReferenceDcLinkVoltage;
|
||||
|
@ -556,26 +557,45 @@ internal static class Program
|
|||
{
|
||||
"We are openning the window".WriteLine();
|
||||
|
||||
//r.Config.GridSetPoint = -limitSystemProduction + stableFactor;
|
||||
//r.Config.GridSetPoint.WriteLine(" Grid set point");
|
||||
r.Config.GridSetPoint = -limitSystemProduction + stableFactor;
|
||||
r.Config.GridSetPoint.WriteLine(" Grid set point");
|
||||
var maxDcLinkVoltage = (UInt16)(r.Config.GridTie.AcDc.MaxDcLinkVoltage + 10);
|
||||
var minDcLinkVoltage = (UInt16)(r.Config.GridTie.AcDc.MinDcLinkVoltage - 10);
|
||||
var maxDcDcLinkVoltage = (UInt16)(r.Config.GridTie.DcDc.UpperDcLinkVoltage + 10);
|
||||
var minDcDcLinkVoltage = (UInt16)(r.Config.GridTie.DcDc.LowerDcLinkVoltage + 10);
|
||||
|
||||
r.Config.GridTie.AcDc.MaxDcLinkVoltage = maxDcLinkVoltage;
|
||||
r.Config.GridTie.AcDc.MinDcLinkVoltage = minDcLinkVoltage;
|
||||
r.Config.GridTie.DcDc.UpperDcLinkVoltage = maxDcDcLinkVoltage;
|
||||
r.Config.GridTie.DcDc.LowerDcLinkVoltage = minDcDcLinkVoltage;
|
||||
|
||||
maxDcLinkVoltage.WriteLine("maxDcLinkVoltage");
|
||||
minDcLinkVoltage.WriteLine("minxDcLinkVoltage");
|
||||
maxDcDcLinkVoltage.WriteLine("maxDcDcLinkVoltage");
|
||||
minDcDcLinkVoltage.WriteLine("minDcDcLinkVoltage");
|
||||
|
||||
}
|
||||
else if (r.GridMeter.Ac.Power.Active > -limitSystemProduction + stableFactor * 4)
|
||||
else if (r.GridMeter.Ac.Power.Active > -limitSystemProduction + stableFactor * 2)
|
||||
{
|
||||
"We are closing the window".WriteLine();
|
||||
|
||||
//r.Config.GridSetPoint = -limitSystemProduction + stableFactor;
|
||||
//r.Config.GridSetPoint.WriteLine(" Grid set point");
|
||||
r.Config.GridSetPoint = -limitSystemProduction + stableFactor;
|
||||
r.Config.GridSetPoint.WriteLine(" Grid set point");
|
||||
|
||||
if ((r.Config.GridTie.AcDc.MaxDcLinkVoltage - r.Config.GridTie.AcDc.MinDcLinkVoltage) > 60)
|
||||
{
|
||||
var maxDcLinkVoltage = (UInt16)(r.Config.GridTie.AcDc.MaxDcLinkVoltage - 10);
|
||||
var minDcLinkVoltage = (UInt16)(r.Config.GridTie.AcDc.MinDcLinkVoltage + 10);
|
||||
var maxDcDcLinkVoltage = (UInt16)(r.Config.GridTie.DcDc.UpperDcLinkVoltage - 10);
|
||||
var minDcDcLinkVoltage = (UInt16)(r.Config.GridTie.DcDc.LowerDcLinkVoltage - 10);
|
||||
r.Config.GridTie.AcDc.MaxDcLinkVoltage = maxDcLinkVoltage;
|
||||
r.Config.GridTie.AcDc.MinDcLinkVoltage = minDcLinkVoltage;
|
||||
r.Config.GridTie.DcDc.UpperDcLinkVoltage = maxDcDcLinkVoltage;
|
||||
r.Config.GridTie.DcDc.LowerDcLinkVoltage = minDcDcLinkVoltage;
|
||||
maxDcLinkVoltage.WriteLine("maxDcLinkVoltage");
|
||||
minDcLinkVoltage.WriteLine("minxDcLinkVoltage");
|
||||
maxDcDcLinkVoltage.WriteLine("maxDcDcLinkVoltage");
|
||||
minDcDcLinkVoltage.WriteLine("minDcDcLinkVoltage");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -586,14 +606,16 @@ internal static class Program
|
|||
else
|
||||
{
|
||||
r.Config.GridTie.AcDc.MaxDcLinkVoltage.WriteLine("maxDcLinkVoltage");
|
||||
r.Config.GridTie.AcDc.MinDcLinkVoltage.WriteLine("minxDcLinkVoltage");
|
||||
r.Config.GridTie.DcDc.UpperDcLinkVoltage.WriteLine("maxDcDcLinkVoltage");
|
||||
r.Config.GridTie.DcDc.LowerDcLinkVoltage.WriteLine("minDcDcLinkVoltage");
|
||||
}
|
||||
}
|
||||
|
||||
//if (exportLimit == 100)
|
||||
//{
|
||||
// r.Config.GridSetPoint = 0;
|
||||
//}
|
||||
if (exportLimit == 100)
|
||||
{
|
||||
r.Config.GridSetPoint = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true };
|
||||
|
||||
public required Double MinSoc { get; set; }
|
||||
public required UInt16 CurtailP { get; set; }
|
||||
public required Int16 CurtailP { get; set; }
|
||||
public required CalibrationChargeType ForceCalibrationChargeState { get; set; }
|
||||
public required DateTime DayAndTimeForRepetitiveCalibration { get; set; }
|
||||
public required DateTime DayAndTimeForAdditionalCalibration { get; set; }
|
||||
|
@ -28,6 +28,13 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
public required DevicesConfig IslandMode { get; set; }
|
||||
public required DevicesConfig GridTie { get; set; }
|
||||
|
||||
public required Double MaxBatteryChargingCurrent { get; set; }
|
||||
public required Double MaxBatteryDischargingCurrent { get; set; }
|
||||
public required Double MaxDcPower { get; set; }
|
||||
|
||||
public required Double MaxChargeBatteryVoltage { get; set; }
|
||||
public required Double MinDischargeBatteryVoltage { get; set; }
|
||||
|
||||
public required DeviceConfig Devices { get; set; }
|
||||
public required S3Config? S3 { get; set; }
|
||||
|
||||
|
@ -59,13 +66,6 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
UpperDcLinkVoltage = 50,
|
||||
LowerDcLinkVoltage = 50,
|
||||
ReferenceDcLinkVoltage = 750,
|
||||
|
||||
MaxBatteryChargingCurrent = 210,
|
||||
MaxBatteryDischargingCurrent = 210,
|
||||
MaxDcPower = 10000,
|
||||
|
||||
MaxChargeBatteryVoltage = 57,
|
||||
MinDischargeBatteryVoltage = 0,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -83,13 +83,6 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
UpperDcLinkVoltage = 50,
|
||||
LowerDcLinkVoltage = 50,
|
||||
ReferenceDcLinkVoltage = 750,
|
||||
|
||||
MaxBatteryChargingCurrent = 210,
|
||||
MaxBatteryDischargingCurrent = 210,
|
||||
MaxDcPower = 10000,
|
||||
|
||||
MaxChargeBatteryVoltage = 57,
|
||||
MinDischargeBatteryVoltage = 0,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -153,13 +146,6 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
UpperDcLinkVoltage = 50,
|
||||
LowerDcLinkVoltage = 50,
|
||||
ReferenceDcLinkVoltage = 750,
|
||||
|
||||
MaxBatteryChargingCurrent = 210,
|
||||
MaxBatteryDischargingCurrent = 210,
|
||||
MaxDcPower = 10000,
|
||||
|
||||
MaxChargeBatteryVoltage = 57,
|
||||
MinDischargeBatteryVoltage = 0,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -177,6 +163,9 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
UpperDcLinkVoltage = 20,
|
||||
LowerDcLinkVoltage = 20,
|
||||
ReferenceDcLinkVoltage = 750,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
MaxBatteryChargingCurrent = 210,
|
||||
MaxBatteryDischargingCurrent = 210,
|
||||
|
@ -184,9 +173,6 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
|
||||
MaxChargeBatteryVoltage = 57,
|
||||
MinDischargeBatteryVoltage = 0,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
S3 = new()
|
||||
{
|
||||
|
|
|
@ -5,11 +5,4 @@ public class DcDcConfig
|
|||
public required Double LowerDcLinkVoltage { get; set; }
|
||||
public required Double ReferenceDcLinkVoltage { get; init; }
|
||||
public required Double UpperDcLinkVoltage { get; set; }
|
||||
|
||||
public required Double MaxBatteryChargingCurrent { get; set; }
|
||||
public required Double MaxBatteryDischargingCurrent { get; set; }
|
||||
public required Double MaxDcPower { get; set; }
|
||||
|
||||
public required Double MaxChargeBatteryVoltage { get; set; }
|
||||
public required Double MinDischargeBatteryVoltage { get; set; }
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using InnovEnergy.Lib.Units;
|
||||
|
||||
namespace InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.Status;
|
||||
|
||||
public class ActiveVoltages
|
||||
{
|
||||
public Voltage ActiveUpperVoltage => _Self.DcMaxVoltage;
|
||||
public Voltage ActiveLowerVoltage => _Self.DcMinVoltage;
|
||||
public Voltage ActiveRefVoltage => _Self.DcReferenceVoltage;
|
||||
|
||||
internal ActiveVoltages(AcDcRecord self) => _Self = self;
|
||||
private readonly AcDcRecord _Self;
|
||||
}
|
Loading…
Reference in New Issue