Add monomore high voltage as new condition for reducing the charging current

This commit is contained in:
atef 2025-04-24 11:35:16 +02:00
parent 7d3eedeab2
commit ac08b6cf9c
1 changed files with 104 additions and 132 deletions

View File

@ -329,7 +329,7 @@ internal static class Program
if (record.Battery != null)
{
_oneTimeFlag.WriteLine(" onetime flag");
if (record.Battery?.Voltage != null && (record.Battery?.HighestCellVoltage ?? 0) > 3.80 && !_oneTimeFlag) //this shoudld be checked the number 0
if (record.Battery?.MonomerHighVoltageAlarm == true && !_oneTimeFlag) //this should be checked: the number 0
{
_oneTimeFlag = true;
warningList.Add(new AlarmOrWarning
@ -345,7 +345,7 @@ internal static class Program
_oneTimeFlag = false;
}
if (record.Battery?.Voltage != null && (record.Battery?.LowestCellVoltage ?? 10) < 2.0 && !_oneTimeFlag) //this should be checked the number 10
/* if (record.Battery?.MonomerLowVoltageAlarm == true && !_oneTimeFlag) //this should be checked: the number 10
{
_oneTimeFlag = true;
warningList.Add(new AlarmOrWarning
@ -359,7 +359,7 @@ internal static class Program
else
{
_oneTimeFlag = false;
}
}*/
}
/*
if (record.Battery != null)
@ -488,9 +488,6 @@ internal static class Program
});
}
//Console.WriteLine("WARNING LIST IS" + warningList[0].Description);
_salimaxAlarmState = warningList.Any()
? SalimaxAlarmState.Orange
: SalimaxAlarmState.Green; // this will be replaced by LedState
@ -535,42 +532,17 @@ internal static class Program
r.Battery?.HighestCellVoltage.WriteLine(" HighestCellVoltage");
r.Battery?.LowestCellVoltage.WriteLine(" LowestCellVoltage");
//var maxBatteryDischargingCurrentLive = 0.0; //never used with deligreenBattery
/*
// This adapting the max discharging current to the current Active Strings
if (r.Battery != null)
{
const Int32 stringsByBattery = 5;
var numberOfBatteriesConfigured = r.Config.Devices.BatteryNodes.Length;
var numberOfTotalStrings = stringsByBattery * numberOfBatteriesConfigured;
var dischargingCurrentByString = devicesConfig.DcDc.MaxBatteryDischargingCurrent / numberOfTotalStrings;
var boolList = new List<Boolean>();
foreach (var stringActive in r.Battery.Devices.Select(b => b.BatteryStrings).ToList())
{
boolList.Add(stringActive.String1Active);
boolList.Add(stringActive.String2Active);
boolList.Add(stringActive.String3Active);
boolList.Add(stringActive.String4Active);
boolList.Add(stringActive.String5Active);
}
var numberOfBatteriesStringActive = boolList.Count(b => b);
if (numberOfTotalStrings != 0)
{
maxBatteryDischargingCurrentLive = dischargingCurrentByString * numberOfBatteriesStringActive;
}
}
*/
// TODO The discharging current is well calculated but not communicated to live. But Written in S3
//r.Battery?.MonomerHighVoltageAlarm.WriteLine(" Monomer High Voltage ");
//r.Battery?.MonomerHighVoltageAlarm.WriteLine(" Monomer High Voltage ");
// Deligreen upper current limitation dynCCL
if (r.Battery?.Voltage != null && (r.Battery?.HighestCellVoltage ?? 0) > 3.80 )
if (r.DcDc.Devices.Count != 0 && r.Battery?.MonomerHighVoltageAlarm == true )
{
maxBatteryChargingCurrentLive = (r.Battery.Devices.Count * 10)/ r.DcDc.Devices.Count ; // Max charging current is 10 A * Number of batteries
maxBatteryChargingCurrentLive.WriteLine("dynCCL Active: Max Battery Charging is "+ maxBatteryChargingCurrentLive);
}
else
{
@ -589,7 +561,7 @@ internal static class Program
// }
maxBatteryChargingCurrentLive.WriteLine(" maxBatteryChargingCurrentLive by DcDC");
maxBatteryDischargingCurrentLive.WriteLine(" maxBatteryDischargingCurrentLive by DcD");
maxBatteryDischargingCurrentLive.WriteLine(" maxBatteryDischargingCurrentLive by DcDc");
inverters.ForEach(d => d.Control.Dc.MaxVoltage = devicesConfig.AcDc.MaxDcLinkVoltage);
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);