Update The parse Alarm for testing
This commit is contained in:
parent
95489c1409
commit
a9f0acaf78
|
@ -21,30 +21,31 @@ public partial class Battery48TlRecord
|
||||||
|
|
||||||
public Boolean Eoc => Leds is { Green: On, Amber: Off, Blue : Off };
|
public Boolean Eoc => Leds is { Green: On, Amber: Off, Blue : Off };
|
||||||
|
|
||||||
public UInt16 IoStates => _IoStates;
|
public UInt16 IoStates => _IoStates;
|
||||||
|
public UInt16 LimpBitMap => _LimpBitMap;
|
||||||
|
|
||||||
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 String FwVersion => _FwVersion.ToString("X4");
|
||||||
|
|
||||||
public Strings Warnings => ParseWarnings().OrderBy(w => w).ToList();
|
public Strings Warnings => ParseWarnings().OrderBy(w => w).ToList();
|
||||||
public Strings Alarms => ParseAlarms() .OrderBy(w => w).ToList();
|
public Strings Alarms => ParseAlarms() .OrderBy(w => w).ToList();
|
||||||
|
|
||||||
public Percent Soc => _Soc;
|
public Percent Soc => _Soc;
|
||||||
public Double SOCAh => _SOCAh;
|
public Double SOCAh => _SOCAh;
|
||||||
|
|
||||||
public Current BusCurrent => _BusCurrent;
|
public Current BusCurrent => _BusCurrent;
|
||||||
//public UInt16 BusCurrentHex => _BusCurrentHex;
|
|
||||||
|
|
||||||
public Current CellsCurrent => _CellsCurrent;
|
public Current CellsCurrent => _CellsCurrent;
|
||||||
|
|
||||||
public Current HeatingCurrent => _BusCurrent - _CellsCurrent;
|
public Current HeatingCurrent => _BusCurrent - _CellsCurrent;
|
||||||
public DcPower HeatingPower => HeatingCurrent * Dc.Voltage;
|
public DcPower HeatingPower => HeatingCurrent * Dc.Voltage;
|
||||||
|
|
||||||
// Time since TOC is a counter from the last moment when the battery reached EOC
|
// Time since TOC is a counter from the last moment when the battery reached EOC
|
||||||
// When The battery is full charged (reached EOC) the Time Since TOC is set to 0
|
// When The battery is full charged (reached EOC) the Time Since TOC is set to 0
|
||||||
public TimeSpan TimeSinceTOC => TimeSpan.FromMinutes(_TimeSinceToc);
|
public TimeSpan TimeSinceTOC => TimeSpan.FromMinutes(_TimeSinceToc);
|
||||||
|
|
||||||
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 Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(7); // From AF0A (Fw Version) 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_
|
public readonly struct Leds_
|
||||||
{
|
{
|
||||||
|
@ -123,36 +124,42 @@ public partial class Battery48TlRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
||||||
private IEnumerable<String> ParseAlarms()
|
private Strings ParseAlarms()
|
||||||
{
|
{
|
||||||
Boolean HasBit(Int16 bit) => (_AlarmFlags & 1uL << bit) > 0;
|
var x = new List<String>
|
||||||
|
{
|
||||||
if (HasBit(0) ) yield return "Tam : BMS temperature too low";
|
"Tam : BMS temperature too low",
|
||||||
if (HasBit(2) ) yield return "TaM2 : BMS temperature too high";
|
};
|
||||||
if (HasBit(3) ) yield return "Tbm : Battery temperature too low";
|
return x;
|
||||||
if (HasBit(5) ) yield return "TbM2 : Battery temperature too high";
|
|
||||||
if (HasBit(7) ) yield return "VBm2 : Bus voltage too low";
|
// UInt64 x = 0b100;
|
||||||
if (HasBit(9) ) yield return "VBM2 : Bus voltage too high";
|
// Boolean HasBit(Int16 bit) => (x & 1uL << bit) > 0;//(_AlarmFlags & 1uL << bit) > 0;
|
||||||
if (HasBit(11)) yield return "IDM2 : Discharge current too high";
|
// if (HasBit(0) ) yield return "Tam : BMS temperature too low";
|
||||||
if (HasBit(12)) yield return "ISOB : Electrical insulation failure";
|
// if (HasBit(2) ) yield return "TaM2 : BMS temperature too high";
|
||||||
if (HasBit(13)) yield return "MSWE : Main switch failure";
|
// if (HasBit(3) ) yield return "Tbm : Battery temperature too low";
|
||||||
if (HasBit(14)) yield return "FUSE : Main fuse blown";
|
// if (HasBit(5) ) yield return "TbM2 : Battery temperature too high";
|
||||||
if (HasBit(15)) yield return "HTRE : Battery failed to warm up";
|
// if (HasBit(7) ) yield return "VBm2 : Bus voltage too low";
|
||||||
if (HasBit(16)) yield return "TCPE : Temperature sensor failure";
|
// if (HasBit(9) ) yield return "VBM2 : Bus voltage too high";
|
||||||
if (HasBit(17)) yield return "STRE : Voltage measurement circuit fails";
|
// if (HasBit(11)) yield return "IDM2 : Discharge current too high";
|
||||||
if (HasBit(18)) yield return "CME : Current sensor failure";
|
// if (HasBit(12)) yield return "ISOB : Electrical insulation failure";
|
||||||
if (HasBit(19)) yield return "HWFL : BMS hardware failure";
|
// if (HasBit(13)) yield return "MSWE : Main switch failure";
|
||||||
if (HasBit(20)) yield return "HWEM : Hardware protection tripped";
|
// if (HasBit(14)) yield return "FUSE : Main fuse blown";
|
||||||
if (HasBit(21)) yield return "ThM : Heatsink temperature too high";
|
// if (HasBit(15)) yield return "HTRE : Battery failed to warm up";
|
||||||
if (HasBit(23)) yield return "vsm2 : Low string voltage failure";
|
// if (HasBit(16)) yield return "TCPE : Temperature sensor failure";
|
||||||
if (HasBit(25)) yield return "vsM2 : String voltage too high";
|
// if (HasBit(17)) yield return "STRE : Voltage measurement circuit fails";
|
||||||
if (HasBit(27)) yield return "iCM2 : Charge current too high";
|
// if (HasBit(18)) yield return "CME : Current sensor failure";
|
||||||
if (HasBit(29)) yield return "iDM2 : Discharge current too high";
|
// if (HasBit(19)) yield return "HWFL : BMS hardware failure";
|
||||||
if (HasBit(31)) yield return "MID2 : String voltage unbalance too high";
|
// if (HasBit(20)) yield return "HWEM : Hardware protection tripped";
|
||||||
if (HasBit(42)) yield return "HTFS : Heater Fuse Blown";
|
// if (HasBit(21)) yield return "ThM : Heatsink temperature too high";
|
||||||
if (HasBit(43)) yield return "DATA : Parameters out of range";
|
// if (HasBit(23)) yield return "vsm2 : Low string voltage failure";
|
||||||
if (HasBit(45)) yield return "CELL2: Unbalance string voltages";
|
// if (HasBit(25)) yield return "vsM2 : String voltage too high";
|
||||||
if (HasBit(46)) yield return "HEBT : Loss of heartbeat";
|
// if (HasBit(27)) yield return "iCM2 : Charge current too high";
|
||||||
|
// if (HasBit(29)) yield return "iDM2 : Discharge current too high";
|
||||||
|
// if (HasBit(31)) yield return "MID2 : String voltage unbalance too high";
|
||||||
|
// if (HasBit(42)) yield return "HTFS : Heater Fuse Blown";
|
||||||
|
// if (HasBit(43)) yield return "DATA : Parameters out of range";
|
||||||
|
// if (HasBit(45)) yield return "CELL2: Unbalance string voltages";
|
||||||
|
// if (HasBit(46)) yield return "HEBT : Loss of heartbeat";
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
||||||
|
|
Loading…
Reference in New Issue