add doepke to the main function
This commit is contained in:
parent
d02fc6fdc8
commit
5e00714313
|
|
@ -27,10 +27,12 @@ using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
|
||||||
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc.Control;
|
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc.Control;
|
||||||
|
using InnovEnergy.Lib.Devices.Doepke;
|
||||||
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
using InnovEnergy.Lib.Protocols.Modbus.Channels;
|
||||||
using InnovEnergy.Lib.Units;
|
using InnovEnergy.Lib.Units;
|
||||||
using InnovEnergy.Lib.Utils;
|
using InnovEnergy.Lib.Utils;
|
||||||
using InnovEnergy.App.SodiStoreMax.DataTypes;
|
using InnovEnergy.App.SodiStoreMax.DataTypes;
|
||||||
|
using InnovEnergy.Lib.Devices.Doepke;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static InnovEnergy.App.SodiStoreMax.AggregationService.Aggregator;
|
using static InnovEnergy.App.SodiStoreMax.AggregationService.Aggregator;
|
||||||
using static InnovEnergy.App.SodiStoreMax.MiddlewareClasses.MiddlewareAgent;
|
using static InnovEnergy.App.SodiStoreMax.MiddlewareClasses.MiddlewareAgent;
|
||||||
|
|
@ -59,6 +61,8 @@ internal static class Program
|
||||||
private static readonly Channel PvOnAcIsland;
|
private static readonly Channel PvOnAcIsland;
|
||||||
private static readonly Channel RelaysChannel;
|
private static readonly Channel RelaysChannel;
|
||||||
private static readonly Channel BatteriesChannel;
|
private static readonly Channel BatteriesChannel;
|
||||||
|
private static readonly Channel DoepkeChannel;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
private static Boolean _curtailFlag = false;
|
private static Boolean _curtailFlag = false;
|
||||||
|
|
@ -91,6 +95,7 @@ internal static class Program
|
||||||
PvOnAcIsland = CreateChannel(d.PvOnAcIsland);
|
PvOnAcIsland = CreateChannel(d.PvOnAcIsland);
|
||||||
RelaysChannel = CreateChannel(d.RelaysIp);
|
RelaysChannel = CreateChannel(d.RelaysIp);
|
||||||
BatteriesChannel = CreateChannel(d.BatteryIp);
|
BatteriesChannel = CreateChannel(d.BatteryIp);
|
||||||
|
DoepkeChannel = CreateChannel(d.DoepkeIp);
|
||||||
|
|
||||||
BatteryNodes = config
|
BatteryNodes = config
|
||||||
.Devices
|
.Devices
|
||||||
|
|
@ -143,6 +148,8 @@ internal static class Program
|
||||||
var pvOnDcDevice = new AmptDevices(PvOnDc);
|
var pvOnDcDevice = new AmptDevices(PvOnDc);
|
||||||
var pvOnAcGridDevice = new AmptDevices(PvOnAcGrid);
|
var pvOnAcGridDevice = new AmptDevices(PvOnAcGrid);
|
||||||
var pvOnAcIslandDevice = new AmptDevices(PvOnAcIsland);
|
var pvOnAcIslandDevice = new AmptDevices(PvOnAcIsland);
|
||||||
|
var doepkeDevice = new DoepkeDevice(DoepkeChannel);
|
||||||
|
|
||||||
|
|
||||||
#if Amax
|
#if Amax
|
||||||
var saliMaxRelaysDevice = new RelaysDeviceAmax(RelaysChannel);
|
var saliMaxRelaysDevice = new RelaysDeviceAmax(RelaysChannel);
|
||||||
|
|
@ -164,6 +171,7 @@ internal static class Program
|
||||||
var battery = batteryDevices.Read();
|
var battery = batteryDevices.Read();
|
||||||
var pvOnAcGrid = pvOnAcGridDevice.Read();
|
var pvOnAcGrid = pvOnAcGridDevice.Read();
|
||||||
var pvOnAcIsland = pvOnAcIslandDevice.Read();
|
var pvOnAcIsland = pvOnAcIslandDevice.Read();
|
||||||
|
var doepek = doepkeDevice.Read();
|
||||||
|
|
||||||
var gridBusToIslandBus = Topology.CalculateGridBusToIslandBusPower(pvOnAcIsland, loadOnAcIsland, acDc);
|
var gridBusToIslandBus = Topology.CalculateGridBusToIslandBusPower(pvOnAcIsland, loadOnAcIsland, acDc);
|
||||||
|
|
||||||
|
|
@ -195,6 +203,7 @@ internal static class Program
|
||||||
LoadOnAcGrid = gridBusLoad,
|
LoadOnAcGrid = gridBusLoad,
|
||||||
LoadOnAcIsland = loadOnAcIsland,
|
LoadOnAcIsland = loadOnAcIsland,
|
||||||
LoadOnDc = dcLoad,
|
LoadOnDc = dcLoad,
|
||||||
|
Doepke = doepek,
|
||||||
StateMachine = StateMachine.Default,
|
StateMachine = StateMachine.Default,
|
||||||
EssControl = EssControl.Default,
|
EssControl = EssControl.Default,
|
||||||
Log = new SystemLog { SalimaxAlarmState = SalimaxAlarmState.Green, Message = null, SalimaxAlarms = null, SalimaxWarnings = null}, //TODO: Put real stuff
|
Log = new SystemLog { SalimaxAlarmState = SalimaxAlarmState.Green, Message = null, SalimaxAlarms = null, SalimaxWarnings = null}, //TODO: Put real stuff
|
||||||
|
|
@ -236,7 +245,6 @@ internal static class Program
|
||||||
Watchdog.NotifyAlive();
|
Watchdog.NotifyAlive();
|
||||||
|
|
||||||
var record = ReadStatus();
|
var record = ReadStatus();
|
||||||
|
|
||||||
SendSalimaxStateAlarm(GetSalimaxStateAlarm(record), record); // to improve
|
SendSalimaxStateAlarm(GetSalimaxStateAlarm(record), record); // to improve
|
||||||
|
|
||||||
record.ControlConstants();
|
record.ControlConstants();
|
||||||
|
|
@ -245,11 +253,13 @@ internal static class Program
|
||||||
record.AcDc.SystemControl.ApplyAcDcDefaultSettings();
|
record.AcDc.SystemControl.ApplyAcDcDefaultSettings();
|
||||||
record.DcDc.SystemControl.ApplyDcDcDefaultSettings();
|
record.DcDc.SystemControl.ApplyDcDcDefaultSettings();
|
||||||
|
|
||||||
/* Console.WriteLine(" Fails Counter = " + _failsCounter);
|
Console.WriteLine(" Fails Counter = " + _failsCounter);
|
||||||
|
|
||||||
// Retries Control
|
// Retries Control
|
||||||
if (record.StateMachine.State is not (28 or 23) )
|
/* if (record.StateMachine.State is not (28 or 23) )
|
||||||
{
|
{
|
||||||
|
// add a case 1 > RCD fail
|
||||||
|
// add a case 2 > overload
|
||||||
if (_failsCounter > 60) // 2 min
|
if (_failsCounter > 60) // 2 min
|
||||||
{
|
{
|
||||||
Console.WriteLine(" Fails retries reached threshold");
|
Console.WriteLine(" Fails retries reached threshold");
|
||||||
|
|
@ -261,9 +271,9 @@ internal static class Program
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_failsCounter = 0;
|
_failsCounter = 0;
|
||||||
}*/
|
}
|
||||||
//record.ControlPvPower(record.Config.CurtailP, record.Config.PvInstalledPower);
|
//record.ControlPvPower(record.Config.CurtailP, record.Config.PvInstalledPower);
|
||||||
|
*/
|
||||||
var essControl = record.ControlEss().WriteLine();
|
var essControl = record.ControlEss().WriteLine();
|
||||||
|
|
||||||
record.EssControl = essControl;
|
record.EssControl = essControl;
|
||||||
|
|
@ -443,9 +453,6 @@ internal static class Program
|
||||||
|
|
||||||
if (r.Battery != null)
|
if (r.Battery != null)
|
||||||
{
|
{
|
||||||
r.Battery.HighestCellVoltage.WriteLine(" HighestCellVoltage");
|
|
||||||
r.Battery.LowestCellVoltage.WriteLine(" LowestCellVoltage");
|
|
||||||
|
|
||||||
// Deligreen upper current limitation dynCCL
|
// Deligreen upper current limitation dynCCL
|
||||||
if ( dcCount != 0 && r.Battery.MonomerHighVoltageAlarm )
|
if ( dcCount != 0 && r.Battery.MonomerHighVoltageAlarm )
|
||||||
{
|
{
|
||||||
|
|
@ -458,7 +465,7 @@ internal static class Program
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deligreen lower current limitation dynDCL
|
// Deligreen lower current limitation dynDCL
|
||||||
if ( dcCount != 0 && r.Battery.MonomerLowVoltageAlarm ) // this 10 comparison need to be checked
|
if ( dcCount != 0 && r.Battery.MonomerLowVoltageAlarm )
|
||||||
{
|
{
|
||||||
maxBatteryDischargingCurrentLivebyDcDc = 10.0 / dcCount ; // Max discharging current is 10 A * Number of batteries
|
maxBatteryDischargingCurrentLivebyDcDc = 10.0 / dcCount ; // Max discharging current is 10 A * Number of batteries
|
||||||
Console.WriteLine("dynDCL Active: Max disCharging current for one Battery is "+ maxBatteryDischargingCurrentLivebyDcDc * dcCount); // multiply by dcCount for display purpose
|
Console.WriteLine("dynDCL Active: Max disCharging current for one Battery is "+ maxBatteryDischargingCurrentLivebyDcDc * dcCount); // multiply by dcCount for display purpose
|
||||||
|
|
@ -468,12 +475,15 @@ internal static class Program
|
||||||
maxBatteryDischargingCurrentLivebyDcDc = devicesConfig.DcDc.MaxBatteryDischargingCurrent/r.Battery.Devices.Count;
|
maxBatteryDischargingCurrentLivebyDcDc = devicesConfig.DcDc.MaxBatteryDischargingCurrent/r.Battery.Devices.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxBatteryChargingCurrentLiveByDcDc *= r.Battery.AvailableChBatteries; // Adapt the current to the number of available battery
|
maxBatteryChargingCurrentLiveByDcDc = 5 + (maxBatteryChargingCurrentLiveByDcDc * r.Battery.AvailableChBatteries); // Adapt the current to the number of available battery
|
||||||
maxBatteryDischargingCurrentLivebyDcDc *= r.Battery.AvailableDischBatteries; // Adapt the current to the number of available battery
|
maxBatteryDischargingCurrentLivebyDcDc = 5 + (maxBatteryDischargingCurrentLivebyDcDc * r.Battery.AvailableDischBatteries); // Adapt the current to the number of available battery
|
||||||
|
|
||||||
(r.Battery?.AvailableChBatteries)?.WriteLine(" Available Charging Batteries");
|
(r.Battery?.AvailableChBatteries)?.WriteLine(" Available Charging Batteries");
|
||||||
(r.Battery?.AvailableDischBatteries)?.WriteLine(" Available Discharging Batteries");
|
(r.Battery?.AvailableDischBatteries)?.WriteLine(" Available Discharging Batteries");
|
||||||
|
|
||||||
|
(r.Battery?.ChargeModeBatteries)?.WriteLine(" Batteries on charge mode");
|
||||||
|
(r.Battery?.DischargeModeBatteries)?.WriteLine(" Batteries on discharge mode");
|
||||||
|
|
||||||
maxBatteryChargingCurrentLiveByDcDc.WriteLine(" maxBatteryChargingCurrentLive by DcDC");
|
maxBatteryChargingCurrentLiveByDcDc.WriteLine(" maxBatteryChargingCurrentLive by DcDC");
|
||||||
maxBatteryDischargingCurrentLivebyDcDc.WriteLine(" maxBatteryDischargingCurrentLive by DcDc");
|
maxBatteryDischargingCurrentLivebyDcDc.WriteLine(" maxBatteryDischargingCurrentLive by DcDc");
|
||||||
|
|
||||||
|
|
@ -601,7 +611,7 @@ internal static class Program
|
||||||
Console.WriteLine(" ****************** ");
|
Console.WriteLine(" ****************** ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// why this is not in Controller?
|
// why is not in Controller?
|
||||||
private static void DistributePower(StatusRecord record, EssControl essControl)
|
private static void DistributePower(StatusRecord record, EssControl essControl)
|
||||||
{
|
{
|
||||||
var nInverters = record.AcDc.Devices.Count;
|
var nInverters = record.AcDc.Devices.Count;
|
||||||
|
|
@ -938,5 +948,13 @@ internal static class Program
|
||||||
{
|
{
|
||||||
status.Config.DayAndTimeForAdditionalCalibration = config.CalibrationChargeDate;
|
status.Config.DayAndTimeForAdditionalCalibration = config.CalibrationChargeDate;
|
||||||
}
|
}
|
||||||
|
if (config.CalibrationDischargeState == CalibrationDischargeType.RepetitivelyEvery)
|
||||||
|
{
|
||||||
|
status.Config.DownDayAndTimeForRepetitiveCalibration = config.CalibrationDischargeDate;
|
||||||
|
}
|
||||||
|
else if (config.CalibrationDischargeState == CalibrationDischargeType.AdditionallyOnce)
|
||||||
|
{
|
||||||
|
status.Config.DownDayAndTimeForAdditionalCalibration = config.CalibrationDischargeDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue