Add monomore high voltage as new condition for reducing the charging current
This commit is contained in:
parent
7d3eedeab2
commit
ac08b6cf9c
|
|
@ -319,33 +319,33 @@ internal static class Program
|
||||||
private static StatusMessage GetSalimaxStateAlarm(StatusRecord record)
|
private static StatusMessage GetSalimaxStateAlarm(StatusRecord record)
|
||||||
{
|
{
|
||||||
var alarmCondition = record.DetectAlarmStates(); // this need to be emailed to support or customer
|
var alarmCondition = record.DetectAlarmStates(); // this need to be emailed to support or customer
|
||||||
var s3Bucket = Config.Load().S3?.Bucket;
|
var s3Bucket = Config.Load().S3?.Bucket;
|
||||||
|
|
||||||
var alarmList = new List<AlarmOrWarning>();
|
var alarmList = new List<AlarmOrWarning>();
|
||||||
var warningList = new List<AlarmOrWarning>();
|
var warningList = new List<AlarmOrWarning>();
|
||||||
var bAlarmList = new List<String>();
|
var bAlarmList = new List<String>();
|
||||||
var bWarningList = new List<String>();
|
var bWarningList = new List<String>();
|
||||||
|
|
||||||
if (record.Battery != null)
|
if (record.Battery != null)
|
||||||
{
|
{
|
||||||
_oneTimeFlag.WriteLine(" onetime flag");
|
_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;
|
_oneTimeFlag = true;
|
||||||
warningList.Add(new AlarmOrWarning
|
warningList.Add(new AlarmOrWarning
|
||||||
{
|
{
|
||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||||
CreatedBy = "Charging Battery System",
|
CreatedBy = "Charging Battery System",
|
||||||
Description = "dynCCL Active: Max Battery Charging is 10 * N"
|
Description = "dynCCL Active: Max Battery Charging is 10 * N"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_oneTimeFlag = false;
|
_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;
|
_oneTimeFlag = true;
|
||||||
warningList.Add(new AlarmOrWarning
|
warningList.Add(new AlarmOrWarning
|
||||||
|
|
@ -359,78 +359,78 @@ internal static class Program
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_oneTimeFlag = false;
|
_oneTimeFlag = false;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (record.Battery != null)
|
||||||
|
{
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
foreach (var battery in record.Battery.Devices)
|
||||||
|
{
|
||||||
|
var devicesBatteryNode = record.Config.Devices.BatteryNodes[i];
|
||||||
|
|
||||||
|
if (battery.LimpBitMap == 0)
|
||||||
|
{
|
||||||
|
// "All String are Active".WriteLine();
|
||||||
|
}
|
||||||
|
else if (IsPowerOfTwo(battery.LimpBitMap))
|
||||||
|
{
|
||||||
|
"1 String is disabled".WriteLine();
|
||||||
|
Console.WriteLine(" ****************** ");
|
||||||
|
|
||||||
|
warningList.Add(new AlarmOrWarning
|
||||||
|
{
|
||||||
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||||
|
CreatedBy = "Battery node" + devicesBatteryNode,
|
||||||
|
Description = "1 String is disabled"
|
||||||
|
});
|
||||||
|
|
||||||
|
bWarningList.Add("/"+i+1 + "/1 String is disabled"); // battery id instead ( i +1 ) of node id: requested from the frontend
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
"2 or more string are disabled".WriteLine();
|
||||||
|
Console.WriteLine(" ****************** ");
|
||||||
|
|
||||||
|
alarmList.Add(new AlarmOrWarning
|
||||||
|
{
|
||||||
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||||
|
CreatedBy = "Battery node" + devicesBatteryNode,
|
||||||
|
Description = "2 or more string are disabled"
|
||||||
|
});
|
||||||
|
bAlarmList.Add(i +";2 or more string are disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var warning in record.Battery.Warnings)
|
||||||
|
{
|
||||||
|
warningList.Add(new AlarmOrWarning
|
||||||
|
{
|
||||||
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||||
|
CreatedBy = "Battery node" + devicesBatteryNode,
|
||||||
|
Description = warning
|
||||||
|
});
|
||||||
|
bWarningList.Add(i +";" + warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var alarm in battery.Alarms)
|
||||||
|
{
|
||||||
|
alarmList.Add(new AlarmOrWarning
|
||||||
|
{
|
||||||
|
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||||
|
CreatedBy = "Battery node" + devicesBatteryNode,
|
||||||
|
Description = alarm
|
||||||
|
});
|
||||||
|
bWarningList.Add(i +";" + alarm);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
/*
|
|
||||||
if (record.Battery != null)
|
|
||||||
{
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
foreach (var battery in record.Battery.Devices)
|
|
||||||
{
|
|
||||||
var devicesBatteryNode = record.Config.Devices.BatteryNodes[i];
|
|
||||||
|
|
||||||
if (battery.LimpBitMap == 0)
|
|
||||||
{
|
|
||||||
// "All String are Active".WriteLine();
|
|
||||||
}
|
|
||||||
else if (IsPowerOfTwo(battery.LimpBitMap))
|
|
||||||
{
|
|
||||||
"1 String is disabled".WriteLine();
|
|
||||||
Console.WriteLine(" ****************** ");
|
|
||||||
|
|
||||||
warningList.Add(new AlarmOrWarning
|
|
||||||
{
|
|
||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
|
||||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
|
||||||
CreatedBy = "Battery node" + devicesBatteryNode,
|
|
||||||
Description = "1 String is disabled"
|
|
||||||
});
|
|
||||||
|
|
||||||
bWarningList.Add("/"+i+1 + "/1 String is disabled"); // battery id instead ( i +1 ) of node id: requested from the frontend
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
"2 or more string are disabled".WriteLine();
|
|
||||||
Console.WriteLine(" ****************** ");
|
|
||||||
|
|
||||||
alarmList.Add(new AlarmOrWarning
|
|
||||||
{
|
|
||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
|
||||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
|
||||||
CreatedBy = "Battery node" + devicesBatteryNode,
|
|
||||||
Description = "2 or more string are disabled"
|
|
||||||
});
|
|
||||||
bAlarmList.Add(i +";2 or more string are disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var warning in record.Battery.Warnings)
|
|
||||||
{
|
|
||||||
warningList.Add(new AlarmOrWarning
|
|
||||||
{
|
|
||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
|
||||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
|
||||||
CreatedBy = "Battery node" + devicesBatteryNode,
|
|
||||||
Description = warning
|
|
||||||
});
|
|
||||||
bWarningList.Add(i +";" + warning);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var alarm in battery.Alarms)
|
|
||||||
{
|
|
||||||
alarmList.Add(new AlarmOrWarning
|
|
||||||
{
|
|
||||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
|
||||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
|
||||||
CreatedBy = "Battery node" + devicesBatteryNode,
|
|
||||||
Description = alarm
|
|
||||||
});
|
|
||||||
bWarningList.Add(i +";" + alarm);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (alarmCondition is not null)
|
if (alarmCondition is not null)
|
||||||
{
|
{
|
||||||
alarmCondition.WriteLine();
|
alarmCondition.WriteLine();
|
||||||
|
|
@ -488,10 +488,7 @@ internal static class Program
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Console.WriteLine("WARNING LIST IS" + warningList[0].Description);
|
_salimaxAlarmState = warningList.Any()
|
||||||
|
|
||||||
|
|
||||||
_salimaxAlarmState = warningList.Any()
|
|
||||||
? SalimaxAlarmState.Orange
|
? SalimaxAlarmState.Orange
|
||||||
: SalimaxAlarmState.Green; // this will be replaced by LedState
|
: SalimaxAlarmState.Green; // this will be replaced by LedState
|
||||||
|
|
||||||
|
|
@ -534,43 +531,18 @@ internal static class Program
|
||||||
|
|
||||||
r.Battery?.HighestCellVoltage.WriteLine(" HighestCellVoltage");
|
r.Battery?.HighestCellVoltage.WriteLine(" HighestCellVoltage");
|
||||||
r.Battery?.LowestCellVoltage.WriteLine(" LowestCellVoltage");
|
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
|
// 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
|
// 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 = (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);
|
maxBatteryChargingCurrentLive.WriteLine("dynCCL Active: Max Battery Charging is "+ maxBatteryChargingCurrentLive);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -589,7 +561,7 @@ internal static class Program
|
||||||
// }
|
// }
|
||||||
|
|
||||||
maxBatteryChargingCurrentLive.WriteLine(" maxBatteryChargingCurrentLive by DcDC");
|
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.MaxVoltage = devicesConfig.AcDc.MaxDcLinkVoltage);
|
||||||
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);
|
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue