Add hte IO states as boolean variables

This commit is contained in:
atef 2024-02-06 11:47:39 +01:00
parent 01fcb60f24
commit 37bdd4a338
1 changed files with 12 additions and 5 deletions

View File

@ -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_
{