From 37bdd4a33807d438e8f359ed5d7a9528c649b98f Mon Sep 17 00:00:00 2001 From: atef Date: Tue, 6 Feb 2024 11:47:39 +0100 Subject: [PATCH] Add hte IO states as boolean variables --- .../Battery48TL/Battery48TlRecord.Api.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs index 0060f6816..616500969 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs @@ -17,11 +17,18 @@ public partial class Battery48TlRecord public Temperatures_ Temperatures => new Temperatures_(this); public StringActive_ BatteryStrings => new StringActive_(this); - public Boolean ConnectedToDcBus => (_IoStates & 1) == 0; + public Boolean ConnectedToDcBus => (_IoStates & 1) == 0; + public Boolean AlarmOutActive => (_IoStates & 2) == 0; + public Boolean InternalFanActive => (_IoStates & 4) == 1; + public Boolean VoltMeasurementAllowed => (_IoStates & 8) == 1; + public Boolean AuxRelayBus => (_IoStates & 16) == 0; + public Boolean RemoteStateActive => (_IoStates & 32) == 1; + public Boolean RiscActive => (_IoStates & 64) == 1; + public Boolean Eoc => Leds is { Green: On, Amber: Off, Blue : Off }; public UInt16 IoStates => _IoStates; - public String SerialNumber => $"{_SerialNum1:X4}{_SerialNum2:X4}{_SerialNum3:X4}{_SerialNum4:X4}".TrimEnd('0'); + public String SerialNumber => $"{_SerialNum1:X4}{_SerialNum2:X4}{_SerialNum3:X4}{_SerialNum4:X4}".TrimEnd('0'); public String FwVersion => _FwVersion.ToString("X4"); public Strings Warnings => ParseWarnings().OrderBy(w => w).ToList(); @@ -31,9 +38,9 @@ public partial class Battery48TlRecord public Double SOCAh => _SOCAh; public Current BusCurrent => _BusCurrent; - public UInt16 BusCurrentHex => _BusCurrentHex; + //public UInt16 BusCurrentHex => _BusCurrentHex; - public UInt16 CellsCurrentHex => _CellsCurrentHex; + public Current CellsCurrent => _CellsCurrent; public Current HeatingCurrent => _BusCurrent - _CellsCurrent; public DcPower HeatingPower => HeatingCurrent * Dc.Voltage; @@ -42,7 +49,7 @@ public partial class Battery48TlRecord // When The battery is full charged (reached EOC) the Time Since TOC is set to 0 public TimeSpan TimeSinceTOC => TimeSpan.FromMinutes(_TimeSinceToc); - public Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(13); // Each 14 days , we do calibration. But there is wait time for all batteries to request and for next day calibration rule we put this 13 days + public Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(7); // Each 14 days , we do calibration. But there is wait time for all batteries to request and for next day calibration rule we put this 13 days public readonly struct Leds_ {