From 6abb0497ae5d4af3eaa0d321a2ba8753e1bc0696 Mon Sep 17 00:00:00 2001 From: atef Date: Fri, 25 Apr 2025 09:25:02 +0200 Subject: [PATCH] Add new Alarms on the deligreen library --- .../BatteryDeligreenRecords.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/csharp/Lib/Devices/BatteryDeligreen/BatteryDeligreenRecords.cs b/csharp/Lib/Devices/BatteryDeligreen/BatteryDeligreenRecords.cs index f48c3bdba..48ed9d77a 100644 --- a/csharp/Lib/Devices/BatteryDeligreen/BatteryDeligreenRecords.cs +++ b/csharp/Lib/Devices/BatteryDeligreen/BatteryDeligreenRecords.cs @@ -14,6 +14,15 @@ public class BatteryDeligreenRecords public required Double Power { get; init; } public required Voltage LowestCellVoltage { get; init; } public required Voltage HighestCellVoltage { get; init; } + public required Boolean MonomerHighVoltageAlarm { get; init; } + public required Boolean MonomerLowVoltageAlarm { get; init; } + public required Boolean ChargeSwitchState { get; init; } + public required Boolean DischargeSwitchState { get; init; } + public required Int32 AvailableDischBatteries { get; init; } + public required Int32 AvailableChBatteries { get; init; } + public required Boolean Eoc { get; init; } // End of Charge + public required Boolean Eod { get; init; } // End of Discharge + // public required Temperature TemperatureCell2 { get; init; } @@ -42,7 +51,15 @@ public class BatteryDeligreenRecords Voltage = records.Average(r =>r.BatteryDeligreenDataRecord.BusVoltage), Power = records.Sum(r => r.BatteryDeligreenDataRecord.Power), LowestCellVoltage = records.Min(r => r.BatteryDeligreenDataRecord.CellVoltage.Min()), - HighestCellVoltage = records.Max(r => r.BatteryDeligreenDataRecord.CellVoltage.Max()) + HighestCellVoltage = records.Max(r => r.BatteryDeligreenDataRecord.CellVoltage.Max()), + MonomerHighVoltageAlarm = records.Any(r => r.BatteryDeligreenAlarmRecord.AlarmEvent2.MonomerHighVoltageAlarm), + MonomerLowVoltageAlarm = records.Any(r => r.BatteryDeligreenAlarmRecord.AlarmEvent2.MonomerLowVoltageAlarm), + ChargeSwitchState = records.All(r => r.BatteryDeligreenAlarmRecord.OnOffState.ChargeSwitchState), + DischargeSwitchState = records.All(r => r.BatteryDeligreenAlarmRecord.OnOffState.DischargeSwitchState), + AvailableDischBatteries = records.Select(r => r.BatteryDeligreenAlarmRecord.OnOffState.DischargeSwitchState ? 1 : 0).Sum(), + AvailableChBatteries = records.Select(r => r.BatteryDeligreenAlarmRecord.OnOffState.ChargeSwitchState ? 1 : 0).Sum(), + Eoc = records.All(r => r.BatteryDeligreenAlarmRecord.AlarmEvent2.MonomerOvervoltageProtection), + Eod = records.All(r => r.BatteryDeligreenAlarmRecord.AlarmEvent2.MonomerUnderVoltageProtection), }; } } \ No newline at end of file