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 Boolean _subscribeToQueueForTheFirstTime = false;
|
||||||
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
private static SalimaxAlarmState _prevSalimaxState = SalimaxAlarmState.Green;
|
||||||
private const UInt16 NbrOfFileToConcatenate = 30;
|
private const UInt16 NbrOfFileToConcatenate = 30;
|
||||||
private static UInt16 _counterOfFile = 0;
|
private static UInt16 _fileCounter = 0;
|
||||||
private static SalimaxAlarmState _salimaxAlarmState = SalimaxAlarmState.Green;
|
private static SalimaxAlarmState _salimaxAlarmState = SalimaxAlarmState.Green;
|
||||||
private const String Port = "/dev/ttyUSB0";
|
private const String Port = "/dev/ttyUSB0";
|
||||||
|
private static Boolean _oneTimeFlag = false;
|
||||||
|
|
||||||
static Program()
|
static Program()
|
||||||
{
|
{
|
||||||
|
|
@ -324,6 +324,41 @@ internal static class Program
|
||||||
var bAlarmList = new List<String>();
|
var bAlarmList = new List<String>();
|
||||||
var bWarningList = 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)
|
if (record.Battery != null)
|
||||||
{
|
{
|
||||||
|
|
@ -492,6 +527,8 @@ internal static class Program
|
||||||
Double maxBatteryChargingCurrentLive ; //used with deligreenBattery for limiting charging
|
Double maxBatteryChargingCurrentLive ; //used with deligreenBattery for limiting charging
|
||||||
Double maxBatteryDischargingCurrentLive; //used with deligreenBattery for limiting discharging
|
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
|
//var maxBatteryDischargingCurrentLive = 0.0; //never used with deligreenBattery
|
||||||
/*
|
/*
|
||||||
|
|
@ -525,9 +562,9 @@ internal static class Program
|
||||||
// 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
|
||||||
|
|
||||||
// Deligreen upper current limitation dynCCL
|
// 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);
|
maxBatteryChargingCurrentLive.WriteLine("dynCCL Active: Max Battery Charging is "+ maxBatteryChargingCurrentLive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -536,15 +573,18 @@ internal static class Program
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deligreen lower current limitation dynDCL
|
// Deligreen lower current limitation dynDCL
|
||||||
if (r.Battery?.Soc != null && (r.Battery?.Soc ?? 100) < r.Config.MinSoc )
|
// if (r.Battery?.Voltage != null && (r.Battery?.LowestCellVoltage ?? 10) < 2.0 ) // this 10 comparison need to be checked
|
||||||
{
|
// {
|
||||||
maxBatteryDischargingCurrentLive = 0; // Max charging current is 10 A * Number of batteries
|
// 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);
|
// maxBatteryDischargingCurrentLive.WriteLine("dynDCL Active: Max Battery disCharging is "+ maxBatteryDischargingCurrentLive);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
maxBatteryDischargingCurrentLive = devicesConfig.DcDc.MaxBatteryDischargingCurrent;
|
// 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.MaxVoltage = devicesConfig.AcDc.MaxDcLinkVoltage);
|
||||||
inverters.ForEach(d => d.Control.Dc.MinVoltage = devicesConfig.AcDc.MinDcLinkVoltage);
|
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)
|
private static async Task<Boolean> ConcatinatingAndCompressingFiles(DateTime timeStamp, S3Config s3Config)
|
||||||
{
|
{
|
||||||
if (_counterOfFile >= NbrOfFileToConcatenate)
|
if (_fileCounter >= NbrOfFileToConcatenate)
|
||||||
{
|
{
|
||||||
_counterOfFile = 0;
|
_fileCounter = 0;
|
||||||
|
|
||||||
var logFileConcatenator = new LogFileConcatenator();
|
var logFileConcatenator = new LogFileConcatenator();
|
||||||
|
|
||||||
|
|
@ -912,7 +952,7 @@ internal static class Program
|
||||||
|
|
||||||
Heartbit(timeStamp);
|
Heartbit(timeStamp);
|
||||||
}
|
}
|
||||||
_counterOfFile++;
|
_fileCounter++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue