Add one time flag for sending warnings about deligreen once its occured
This commit is contained in:
parent
01caa6864e
commit
7059a1f83d
|
|
@ -63,10 +63,10 @@ internal static class Program
|
|||
private static Boolean _subscribeToQueueForTheFirstTime = false;
|
||||
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
||||
private const UInt16 NbrOfFileToConcatenate = 30;
|
||||
private static UInt16 _counterOfFile = 0;
|
||||
private static UInt16 _fileCounter = 0;
|
||||
private static SalimaxAlarmState _salimaxAlarmState = SalimaxAlarmState.Green;
|
||||
private const String Port = "/dev/ttyUSB0";
|
||||
|
||||
private static Boolean _oneTimeFlag = false;
|
||||
|
||||
static Program()
|
||||
{
|
||||
|
|
@ -324,6 +324,41 @@ internal static class Program
|
|||
var bAlarmList = new List<String>();
|
||||
var bWarningList = new List<String>();
|
||||
|
||||
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
|
||||
{
|
||||
_oneTimeFlag = true;
|
||||
warningList.Add(new AlarmOrWarning
|
||||
{
|
||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||
CreatedBy = "Charging Battery System",
|
||||
Description = "dynCCL Active: Max Battery Charging is 10 * N"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_oneTimeFlag = false;
|
||||
}
|
||||
|
||||
if (record.Battery?.Voltage != null && (record.Battery?.LowestCellVoltage ?? 10) < 2.0 && !_oneTimeFlag) //this should be checked the number 10
|
||||
{
|
||||
_oneTimeFlag = true;
|
||||
warningList.Add(new AlarmOrWarning
|
||||
{
|
||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||
CreatedBy = "Battery System",
|
||||
Description = "dynDCL Active: Max Battery Discharging is 10 * N"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_oneTimeFlag = false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (record.Battery != null)
|
||||
{
|
||||
|
|
@ -491,8 +526,10 @@ internal static class Program
|
|||
|
||||
Double maxBatteryChargingCurrentLive ; //used with deligreenBattery for limiting charging
|
||||
Double maxBatteryDischargingCurrentLive; //used with deligreenBattery for limiting discharging
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
|
@ -525,9 +562,9 @@ internal static class Program
|
|||
// TODO The discharging current is well calculated but not communicated to live. But Written in S3
|
||||
|
||||
// Deligreen upper current limitation dynCCL
|
||||
if (r.Battery?.Voltage != null && (r.Battery?.Voltage ?? 0) > 61.0 )
|
||||
if (r.Battery?.Voltage != null && (r.Battery?.HighestCellVoltage ?? 0) > 3.80 )
|
||||
{
|
||||
maxBatteryChargingCurrentLive = r.Battery.Devices.Count * 10; // 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);
|
||||
}
|
||||
else
|
||||
|
|
@ -536,15 +573,18 @@ internal static class Program
|
|||
}
|
||||
|
||||
// Deligreen lower current limitation dynDCL
|
||||
if (r.Battery?.Soc != null && (r.Battery?.Soc ?? 100) < r.Config.MinSoc )
|
||||
{
|
||||
maxBatteryDischargingCurrentLive = 0; // Max charging current is 10 A * Number of batteries
|
||||
maxBatteryDischargingCurrentLive.WriteLine("dynDCL Active: Max Battery disCharging is "+ maxBatteryDischargingCurrentLive);
|
||||
}
|
||||
else
|
||||
{
|
||||
maxBatteryDischargingCurrentLive = devicesConfig.DcDc.MaxBatteryDischargingCurrent;
|
||||
}
|
||||
// if (r.Battery?.Voltage != null && (r.Battery?.LowestCellVoltage ?? 10) < 2.0 ) // this 10 comparison need to be checked
|
||||
// {
|
||||
// maxBatteryDischargingCurrentLive =(r.Battery.Devices.Count * 10)/ r.DcDc.Devices.Count ; // Max discharging current is 10 A * Number of batteries
|
||||
// maxBatteryDischargingCurrentLive.WriteLine("dynDCL Active: Max Battery disCharging is "+ maxBatteryDischargingCurrentLive);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// maxBatteryDischargingCurrentLive = devicesConfig.DcDc.MaxBatteryDischargingCurrent;
|
||||
// }
|
||||
|
||||
maxBatteryChargingCurrentLive.WriteLine(" maxBatteryChargingCurrentLive by DcDC");
|
||||
maxBatteryDischargingCurrentLive.WriteLine(" maxBatteryDischargingCurrentLive by DcD");
|
||||
|
||||
inverters.ForEach(d => d.Control.Dc.MaxVoltage = devicesConfig.AcDc.MaxDcLinkVoltage);
|
||||
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);
|
||||
|
|
@ -874,9 +914,9 @@ internal static class Program
|
|||
|
||||
private static async Task<Boolean> ConcatinatingAndCompressingFiles(DateTime timeStamp, S3Config s3Config)
|
||||
{
|
||||
if (_counterOfFile >= NbrOfFileToConcatenate)
|
||||
if (_fileCounter >= NbrOfFileToConcatenate)
|
||||
{
|
||||
_counterOfFile = 0;
|
||||
_fileCounter = 0;
|
||||
|
||||
var logFileConcatenator = new LogFileConcatenator();
|
||||
|
||||
|
|
@ -912,7 +952,7 @@ internal static class Program
|
|||
|
||||
Heartbit(timeStamp);
|
||||
}
|
||||
_counterOfFile++;
|
||||
_fileCounter++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue