add battery node in the salimax alarm and warning
This commit is contained in:
parent
3ab2570084
commit
183f8cfc2a
|
@ -334,6 +334,76 @@ internal static class Program
|
|||
|
||||
var alarmList = new List<AlarmOrWarning>();
|
||||
var warningList = new List<AlarmOrWarning>();
|
||||
var bAlarmList = new List<String>();
|
||||
var bWarningList = new List<String>();
|
||||
|
||||
|
||||
|
||||
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();
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -370,68 +440,6 @@ internal static class Program
|
|||
});
|
||||
}
|
||||
|
||||
if (record.Battery != null)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
foreach (var battery in record.Battery.Devices)
|
||||
{
|
||||
if (battery.LimpBitMap == 0)
|
||||
{
|
||||
// "All String are Active".WriteLine();
|
||||
}
|
||||
else if (IsPowerOfTwo(battery.LimpBitMap))
|
||||
{
|
||||
"1 String is disabled".WriteLine();
|
||||
warningList.Add(new AlarmOrWarning
|
||||
{
|
||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
|
||||
Description = "1 String is disabled"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
"2 or more string are disabled".WriteLine();
|
||||
|
||||
alarmList.Add(new AlarmOrWarning
|
||||
{
|
||||
Date = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Time = DateTime.Now.ToString("HH:mm:ss"),
|
||||
CreatedBy = "Battery node" + record.Config.Devices.BatteryNodes[i],
|
||||
Description = "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" + record.Config.Devices.BatteryNodes[i],
|
||||
Description = 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" + record.Config.Devices.BatteryNodes[i],
|
||||
Description = alarm
|
||||
});
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach (var warning in record.AcDc.Warnings)
|
||||
{
|
||||
warningList.Add(new AlarmOrWarning
|
||||
|
@ -464,8 +472,8 @@ internal static class Program
|
|||
|
||||
int.TryParse(s3Bucket?.Split("-")[0], out var installationId);
|
||||
|
||||
record.Log.SalimaxAlarms = alarmList;
|
||||
record.Log.SalimaxWarnings = warningList;
|
||||
//record.Log.SalimaxAlarms = bAlarmList;
|
||||
//record.Log.SalimaxWarnings = bWarningList;
|
||||
|
||||
var returnedStatus = new StatusMessage
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue