Files
DP44/DataPRO/SLICECommands/CalibrationCommands.cs
2026-04-17 14:55:32 -04:00

2499 lines
90 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using DTS.Common.Enums.DASFactory;
using DTS.Common.ICommunication;
using DTS.Common.Utilities;
namespace DTS.DASLib.Command.SLICE
{
public abstract class DiagnosticsCommands : CommandBase
{
protected enum Commands
{
Reserved = 0x00,
QueryDiagnosticMeasurementChannel = 0x01,
QueryChannelShuntResults = 0x02,
QueryChannelOffset = 0x03,
QueryBridgeResistance = 0x04,
QueryChannelNoiseStatistic = 0x05,
// Doesn't exist -- what should it do?
QueryRecorderHealth = 0x06,
SetChannelOffset = 0x07,
DiagnosShuntDACs = 0x08,
QueryChannelCalSignalResults = 0x09,
//Commands_CalibrateCalSignalDAC = 0x0A // Not implemented
CalibrateCALSignalDAC = 0x0A,
QueryVoltageInsertaionResult_SLICE2 = 0x0B,
SetChannelDiagnosticVoltageInsertion_SLICE2 = 0x0C,
QueryStackChannelDiagnosticVoltageInsert_SLICE2 = 0x0D,
SetStackChannelExcitationLevel_SLICE2 = 0x0E,
QueryStackChannelExcitationLevel_SLICE2 = 0x0F,
// being default to 0 when prepareForDiagnostic is called.
SetAutoArmStackChannelDiagnosticLevel_SLICE2 = 0x10, // protocol 137.
QueryAutoArmStackChannelDiagnosticLevel_SLICE2 = 0x11, // protocol 137.
SetRearmStackChannelDiagnosticLevel_SLICE2 = 0x12, // protocol 137.
QueryRearmStackChannelDiagnosticLevel_SLICE2 = 0x13, // protocol 137.
SetSliceDefaultMIF_SLICE2 = 0x14, // protocol 140
RunAutoArmDiagnostics = 0x15, // protocol ??
RunAutoReArmDiagnostics = 0x16,
SetPostEventChannelDiagnosticLevel = 0x17, // protocol 143.
QueryPostEventChannelDiagnosticLevel = 0x18, // protocol 143.
QuerySquibChannelConfiguration = 0x19, // for TOM CMDCAL_QUERY_SQUIB_CHANNEL_CONFIGURATION
SetSquibChannelConfiguraion = 0x1A, // for TOM CMDCAL_SET_SQUIB_CHANNEL_CONFIGURATION
QueryDigitalChannelConfiguration = 0x1B, // for TOM digital output. CMDCAL_QUERY_DIGITAL_CHANNEL_CONFIGURATION
SetDigitalChannelConfiguration = 0x1C, // for TOM digital output. CMDCAL_SET_DIGITAL_CHANNEL_CONFIGURATION
QuerySquibResistance = 0x1D, // protocol ?? CMDCAL_QUERY_SQUIB_RESISTANCE
QueryInternalChannelOffset = 0x1E, // protocol 148 CMDCAL_QUERY_INTERNAL_CHANNEL_OFFSET
QueryAllDiagnosticMeasurementChannel = 0x1F, //for Power Pro query all diagnostic measurement
};
protected abstract Commands _Command { get; }
protected DiagnosticsCommands(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Type = CommandPacket.CommandType.Diagnostics;
command.SetCommand((byte)_Command, _Command.ToString());
}
protected DiagnosticsCommands(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Type = CommandPacket.CommandType.Diagnostics;
command.SetCommand((byte)_Command, _Command.ToString());
}
}
public class MeasureS6DBDiagnosticChannel : MeasureDiagnosticChannel
{
public MeasureS6DBDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureS6DBDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the BASE
/// </summary>
public S6DBDiagnosticChannelList Channel
{
get => (S6DBDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"Channel: {Channel}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {Channel}, Measurement: {Measurement}"
});
}
}
public class MeasureSPDBDiagnosticChannel : MeasureDiagnosticChannel
{
public enum BaseDiagnosticChannelList
{
InputVoltage = 0x00,
BackupVoltage = 0x01,
TemperatureC = 0x02,
//These are the rest of the DB diag channels
DIAGNOSTICS_CHANNEL__BATTERY1_C = 100, // 0
DIAGNOSTICS_CHANNEL__BATTERY1_V = 101, // 1
DIAGNOSTICS_CHANNEL__BATTERY2_C = 102, // 2
DIAGNOSTICS_CHANNEL__BATTERY2_V = 103, // 3
DIAGNOSTICS_CHANNEL__OUTPUT1_C = 104, // 4
DIAGNOSTICS_CHANNEL__OUTPUT1_V = 105, // 5
DIAGNOSTICS_CHANNEL__OUTPUT2_C = 106, // 6
DIAGNOSTICS_CHANNEL__OUTPUT2_V = 107, // 7
DIAGNOSTICS_CHANNEL__OUTPUT3_C = 108, // 8
DIAGNOSTICS_CHANNEL__OUTPUT3_V = 109, // 9
DIAGNOSTICS_CHANNEL__OUTPUT4_C = 110, // 10
DIAGNOSTICS_CHANNEL__OUTPUT4_V = 111, // 11
DIAGNOSTICS_CHANNEL__OUTPUT5_C = 112, // 12
DIAGNOSTICS_CHANNEL__OUTPUT5_V = 113, // 13
DIAGNOSTICS_CHANNEL__OUTPUT6_C = 114, // 14
DIAGNOSTICS_CHANNEL__OUTPUT6_V = 115, // 15
DIAGNOSTICS_CHANNEL__OUTPUT7_C = 116, // 16
DIAGNOSTICS_CHANNEL__OUTPUT7_V = 117, // 17
DIAGNOSTICS_CHANNEL__OUTPUT8_C = 118, // 18
DIAGNOSTICS_CHANNEL__OUTPUT8_V = 119, // 19
DIAGNOSTICS_CHANNEL__OUTPUT_B1_C = 120, // 20
DIAGNOSTICS_CHANNEL__OUTPUT_B1_V = 121, // 21
DIAGNOSTICS_CHANNEL__OUTPUT_B2_C = 122, // 22
DIAGNOSTICS_CHANNEL__OUTPUT_B2_V = 123, // 23
DIAGNOSTICS_CHANNEL__INPUT_C = 124, // 24
DIAGNOSTICS_CHANNEL__INPUT_V = 125, // 25
DIAGNOSTICS_CHANNEL__FAN_V = 126, // 26
DIAGNOSTICS_CHANNEL__SBUS_V = 127, // 27
DIAGNOSTICS_CHANNEL__SCAP_V = 128, // 28
DIAGNOSTICS_CHANNEL__TEMPERATURE1 = 129,
DIAGNOSTICS_CHANNEL__TEMPERATURE2 = 130,
DIAGNOSTICS_CHANNEL__TEMPERATURE3 = 131,
};
public MeasureSPDBDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureSPDBDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the BASE
/// </summary>
public BaseDiagnosticChannelList Channel
{
get => (BaseDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"Channel: {Channel}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {Channel}, Measurement: {Measurement}"
});
}
}
public class MeasureBaseDiagnosticChannel : MeasureDiagnosticChannel
{
public enum BaseDiagnosticChannelList
{
InputVoltage = 0x00,
BackupVoltage = 0x01,
TemperatureC = 0x02,
};
public MeasureBaseDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureBaseDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the BASE
/// </summary>
public BaseDiagnosticChannelList Channel
{
get => (BaseDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"Channel: {Channel.ToString()}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {Channel}, Measurement: {Measurement}"
});
}
}
public class MeasurePowerProDiagnosticChannel : MeasureDiagnosticChannel
{
public enum PowerProDiagnosticChannelList
{
InputVoltage_A = 0x00,
InputCurrent_A = 0x01,
InputVoltage_L = 0x02,
InputCurrent_L = 0x03,
InputVoltage_C = 0x04,
InputCurrent_C = 0x05,
InputCurrent_TOTAL = 0x06,
OutputVoltage_A = 0x07,
OutputCurrent_A = 0x08,
OutputVoltage_L = 0x09,
OutputCurrent_L = 0x0A,
OutputVoltage_W = 0x0B,
OutputCurrent_W = 0x0C,
OutputVoltage_B = 0x0D,
OutputCurrent_B = 0x0E,
BatterySOC = 0x0F,
BatteryVoltage = 0x10,
BatteryCurrent = 0x11,
TemperatureC = 0x12,
};
public MeasurePowerProDiagnosticChannel(Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasurePowerProDiagnosticChannel(Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the BASE
/// </summary>
public PowerProDiagnosticChannelList Channel
{
get => (PowerProDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { string.Format("Channel: {0}", Channel.ToString()) });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
string.Format("Channel: {0}, Measurement: {1}", Channel, Measurement)
});
}
}
public class MeasureTomBaseDiagnosticChannel : MeasureDiagnosticChannel
{
public enum TomBaseDiagnosticChannelList
{
RawInputVoltage = 0x00, // legacy value in SLICE PRO
BackupVoltage = 0x01, // legacy value in SLICE PRO
TomTemperatureC = 0x02, // legacy value in SLICE PRO
BackupCapacity = 0x03,
Power17V = 0x04,
Power5V = 0x05,
Power3p3V = 0x06,
PowerMinus5V = 0x07
};
public MeasureTomBaseDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureTomBaseDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the BASE
/// </summary>
public TomBaseDiagnosticChannelList Channel
{
get => (TomBaseDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"Channel: {Channel.ToString()}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {Channel}, Measurement: {Measurement}"
});
}
}
public class MeasureBridgeDiagnosticChannel : MeasureDiagnosticChannel
{
public enum BridgeDiagnosticChannelList
{
ExcitationA = 0x0B,
ThreeVoltFilter = 0x0A,
FiveVoltAnalog = 0x09,
SupplyMon = 0x08,
TwoPointFiveVoltReference = 0x07,
// Channel 0x06 is actually hooked up to a digital and isn't a valid measurement
ExcitationB = 0x05,
ExcitationC = 0x04,
VeREFPlus = 0x03,
VeREFMinus = 0x02,
Temperature = 0x01,
VccMinusVssOverTwo = 0x00
};
public MeasureBridgeDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureBridgeDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the given BRIDGE (specified by the DeviceID property)
/// </summary>
public BridgeDiagnosticChannelList Channel
{
get => (BridgeDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
lines.Add(new List<string>() { $"Address: {DeviceID}, Channel: {Channel}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {Channel}, Measurement: {Measurement}"
});
}
}
public class MeasureIEPEDiagnosticChannel : MeasureDiagnosticChannel
{
public enum IEPEDiagnosticChannelList
{
// Digital Channels are not valid measurements
// IM_ExcitationA = 0x0B, // A0 -- DIGITAL
// IM_ThreeVoltFilter = 0x0A, // A1 -- DIGITAL
// IM_FiveVoltAnalog = 0x09, // A2 -- DIGITAL
IM_SupplyMon = 0x08, // A3
IM_TwoPointFiveVoltReference = 0x07, // A4
// DIGITAL 0x06 // A5 -- DIGITAL
IM_24VPowerSupply = 0x05, // A6
// IM_ExcitationC = 0x04, // A7 -- DIGITAL
IM_VeREFPlus = 0x03,
IM_VeREFMinus = 0x02,
IM_Temperature = 0x01,
IM_VccMinusVssOverTwo = 0x00
}
public MeasureIEPEDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureIEPEDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
/// <summary>
/// The measurement channel within the given BRIDGE (specified by the DeviceID property)
/// </summary>
public IEPEDiagnosticChannelList DiagnosticField
{
get => (IEPEDiagnosticChannelList)_channel;
set { _channel = (byte)value; command.SetParameter(0, _channel); }
}
public override void CommandToString(ref List<List<string>> lines)
{
lines.Add(new List<string>() { $"Address: {DeviceID}, DiagnosticField: {DiagnosticField}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"DiagnosticField: {DiagnosticField}, Measurement: {Measurement}"
});
}
}
public abstract class MeasureDiagnosticChannel : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryDiagnosticMeasurementChannel;
protected byte _channel;
protected float _value;
public float Measurement => _value;
protected MeasureDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Parameter = new byte[1];
}
protected MeasureDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Parameter = new byte[1];
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
if (response.Parameter.Length > 1)
{
response.GetParameter(1, out _value);
}
else
{
_value = float.NaN;
}
}
return CommandReceiveAction.StopReceiving;
}
}
//
// output digital channel format
//
public class SetDigitalChannelConfiguration : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetDigitalChannelConfiguration;
public SetDigitalChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Parameter = new byte[10];
}
public SetDigitalChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Parameter = new byte[10];
}
/// <summary>
/// channel ID
/// </summary>
public byte GetDigitalChannel { get; private set; }
public void SetDigitalChannelID(byte value)
{
GetDigitalChannel = value;
command.SetParameter(0, GetDigitalChannel);
}
/// <summary>
/// return output mode
/// </summary>
public byte GetDigitalOutputMode { get; private set; }
public void SetDigitalOutputMode(byte value)
{
GetDigitalOutputMode = value;
command.SetParameter(1, GetDigitalOutputMode);
}
/// <summary>
/// Delay in msec.
/// </summary>
public float GetDigitalDelayMs { get; private set; }
public void SetDigitalDelayMs(float value)
{
GetDigitalDelayMs = value;
command.SetParameter(2, GetDigitalDelayMs);
}
/// <summary>
/// output duraiton in msec.
/// </summary>
public float GetDigitalDurationMs { get; private set; }
public void SetDigitalDurationMs(float value)
{
GetDigitalDurationMs = value;
command.SetParameter(6, GetDigitalDurationMs);
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status != DFConstantsAndEnums.CommandStatus.StatusNoError)
{
throw new Exception(MakeLogString("Can't set digital channel configuration"));
}
return CommandReceiveAction.StopReceiving;
}
}
public class QueryDigitalChannelConfiguration : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryDigitalChannelConfiguration;
public QueryDigitalChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Parameter = new byte[] { 0x01 };
}
public QueryDigitalChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Parameter = new byte[] { 0x01 };
}
private byte _outputMode;
private float _outputDelayMs;
private float _outputDurationMs;
/// <summary>
/// channel ID
/// </summary>
public byte DigitalChannelGet { get; private set; }
public void SetDigitalChannelID(byte value)
{
DigitalChannelGet = value;
command.SetParameter(0, DigitalChannelGet);
}
/// <summary>
/// return output mode
/// </summary>
public byte DigitalOutputMode { get { return _outputMode; } }
/// <summary>
/// Delay in msec.
/// </summary>
public float DigitalDelayMs { get { return _outputDelayMs; } }
/// <summary>
/// output duraiton in msec.
/// </summary>
public float DigitalDurationMs { get { return _outputDurationMs; } }
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
response.GetParameter(1, out _outputMode);
response.GetParameter(2, out _outputDelayMs);
response.GetParameter(6, out _outputDurationMs);
}
return CommandReceiveAction.StopReceiving;
}
}
// 0 Squib Channel ID uint8_t 1 Channel ID from 0-3.
// 1 Output Mode uint8_t 1 Fire Mode
// 0 = Disable.
// 1 = Cap Discharge.
// 2 = Constant Current.
// 3 = Cap Discharge to dummy load.
// 4 = Constant Current to dummy load.
// 2 Measurement Type uint8_t 1 Signal type for recording.
// 1 = Squib Voltage.
// 2 = Initiation Signal
// 3-6 Output Delay float32_t 4 Output delay in msec. Ranges 0.0-msec to 167,700.0-msec with 0.1msec resolution.
// 7-10 Output Duration float32_t 4 Output active duration ranges from 0.0-msec to 2,600.00msec with 0.1msec resolution.
// Value 0 will keep the output active as long as trigger active (for entire post-event duration).
// 11-14 Resistance Low float32_t 4 SQUIB resistance LOW threshold 0.0 to 10.0 Ohm.
// 15-18 Resistance High float32_t 4 SQUIB resistance HIGH threshold 0.0 to 10.0 Ohm.
// 19-22 Output Current float32_t 4 SQUIB output current 0.0 to 4.0 Amp
public class SetSquibChannelConfiguraion : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetSquibChannelConfiguraion;
public SetSquibChannelConfiguraion(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Parameter = new byte[23];
}
public SetSquibChannelConfiguraion(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Parameter = new byte[23];
}
private const int CHANNELID_PARM_OFFSET = 0;
private const int FIREMODE_PARM_OFFSET = 1;
private const int MEASURETYPE_PARM_OFFSET = 2;
private const int OUTPUT_DELAY_PARM_OFFSET = 3;
private const int OUTPUT_DUR_PARAM_OFFSET = 7;
private const int RES_LOW_PARM_OFFSET = 11;
private const int RES_HI_PARM_OFFSET = 15;
private const int OUTPUT_I_PARM_OFFSET = 19;
/// <summary>
/// channel ID
/// </summary>
public byte GetSquibChannel { get; private set; }
public void SetSquibChannelID(byte value)
{
GetSquibChannel = value;
command.SetParameter(CHANNELID_PARM_OFFSET, GetSquibChannel);
}
/// <summary>
/// return output mode
/// </summary>
public byte GetSquibOutputMode { get; private set; }
public void SetSquibOutputMode(byte value)
{
GetSquibOutputMode = value;
command.SetParameter(FIREMODE_PARM_OFFSET, GetSquibOutputMode);
}
/// <summary>
/// return record mode.
/// </summary>
public byte GetSquibRecordMode { get; private set; }
public void SetSquibRecordMode(byte value)
{
GetSquibRecordMode = value;
command.SetParameter(MEASURETYPE_PARM_OFFSET, GetSquibRecordMode);
}
/// <summary>
/// Delay in msec.
/// </summary>
public float GetSquibDelayMs { get; private set; }
public void SetSquibDelayMs(float value)
{
GetSquibDelayMs = value;
command.SetParameter(OUTPUT_DELAY_PARM_OFFSET, GetSquibDelayMs);
}
/// <summary>
/// output duraiton in msec.
/// </summary>
public float GetSquibDurationMs { get; private set; }
public void SetSquibDurationMs(float value)
{
GetSquibDurationMs = value;
command.SetParameter(OUTPUT_DUR_PARAM_OFFSET, GetSquibDurationMs);
}
/// <summary>
/// resistance low limit.
/// </summary>
public float GetSquibResMin { get; private set; }
public void SetSquibResMin(float value)
{
GetSquibResMin = value;
command.SetParameter(RES_LOW_PARM_OFFSET, GetSquibResMin);
}
/// <summary>
/// resistance high limit.
/// </summary>
public float GetSquibResMax { get; private set; }
public void SetSquibResMax(float value)
{
GetSquibResMax = value;
command.SetParameter(RES_HI_PARM_OFFSET, GetSquibResMax);
}
/// <summary>
/// output current value
/// </summary>
public float GetSquibOutputCurrentAmp { get; private set; }
public void SetSquibOutputCurrentAmp(float value)
{
GetSquibOutputCurrentAmp = value;
command.SetParameter(OUTPUT_I_PARM_OFFSET, GetSquibOutputCurrentAmp);
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
}
else
{
throw new Exception(MakeLogString($"Can't set squib: {response.Status}"));
}
return CommandReceiveAction.StopReceiving;
}
/*
* private const int CHANNELID_PARM_OFFSET = 0;
private const int FIREMODE_PARM_OFFSET = 1;
private const int MEASURETYPE_PARM_OFFSET = 2;
private const int OUTPUT_DELAY_PARM_OFFSET = 3;
private const int OUTPUT_DUR_PARAM_OFFSET = 7;
private const int RES_LOW_PARM_OFFSET = 11;
private const int RES_HI_PARM_OFFSET = 15;
private const int OUTPUT_I_PARM_OFFSET = 19;
*/
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {GetSquibChannel}, Firemode: {GetSquibOutputMode}, MeasurementType: {GetSquibRecordMode}, Delay: {GetSquibDelayMs}, Duration: {GetSquibDurationMs}, OutputCurrent: {GetSquibOutputCurrentAmp}, ResistanceLow: {GetSquibResMin}, ResistanceHigh: {GetSquibResMax}"
});
}
}
public class QuerySquibChannelConfiguration : DiagnosticsCommands
{
public QuerySquibChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
command.Parameter = new byte[] { 0x01 };
}
public QuerySquibChannelConfiguration(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
command.Parameter = new byte[] { 0x01 };
}
protected override Commands _Command => Commands.QuerySquibChannelConfiguration;
private byte _outputMode;
private byte _recordType;
private float _outputDelayMs;
private float _outputDurationMs;
private float _squibResLowLimit;
private float _squibResHiLimit;
private float _squibOutputCurrent;
/// <summary>
/// channel ID
/// </summary>
public byte SquibChannelGet { get; private set; }
public void SetSquibChannelID(byte value)
{
SquibChannelGet = value;
command.SetParameter(0, SquibChannelGet);
}
/// <summary>
/// return output mode
/// </summary>
public byte SquibOutputMode => _outputMode;
/// <summary>
/// return record mode.
/// </summary>
public byte SquibRecordMode => _recordType;
/// <summary>
/// Delay in msec.
/// </summary>
public float SquibDelayMs => _outputDelayMs;
/// <summary>
/// output duraiton in msec.
/// </summary>
public float SquibDurationMs => _outputDurationMs;
/// <summary>
/// resistance low limit.
/// </summary>
public float SquibResMin => _squibResLowLimit;
/// <summary>
/// resistance high limit.
/// </summary>
public float SquibResMax => _squibResHiLimit;
/// <summary>
/// output current value
/// </summary>
public float SquibOutputCurrentAmp => _squibOutputCurrent;
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
response.GetParameter(1, out _outputMode);
response.GetParameter(2, out _recordType);
response.GetParameter(3, out _outputDelayMs);
response.GetParameter(7, out _outputDurationMs);
response.GetParameter(11, out _squibResLowLimit);
response.GetParameter(15, out _squibResHiLimit);
response.GetParameter(19, out _squibOutputCurrent);
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {SquibChannelGet}"
});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Channel: {SquibChannelGet}, Firemode: {SquibOutputMode}, MeasurementType: {SquibRecordMode}, Delay: {SquibDelayMs}, Duration: {SquibDurationMs}, OutputCurrent {SquibOutputCurrentAmp}"
});
}
}
public class QueryChannelShuntResults : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryChannelShuntResults;
private byte[] _channelList;
/// <summary>
/// Wipes out the ChannelList, TargetDeflectionMV and ActualDeflectionMV
/// arrays and sets the number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
ActualDeflectionMV = new float[NumberOfStackChannels];
TargetDeflectionMV = new float[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
/// <summary>
/// The millivolt value that the channel targeted.
/// </summary>
public float[] TargetDeflectionMV { get; private set; }
/// <summary>
/// The millivolt value that the channel deflected to with the target deflection applied.
/// </summary>
public float[] ActualDeflectionMV { get; private set; }
public QueryChannelShuntResults(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public QueryChannelShuntResults(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
TargetDeflectionMV = new float[NumberOfStackChannels];
ActualDeflectionMV = new float[NumberOfStackChannels];
for (int i = 0; i < NumberOfStackChannels; i++)
{
response.GetParameter(8 * i, out TargetDeflectionMV[i]);
response.GetParameter(8 * i + 4, out ActualDeflectionMV[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}"
});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Target Deflection (mv): {ArrayToString.ArrayObjectToString(TargetDeflectionMV)}, Actual Deflection (mv): {ArrayToString.ArrayObjectToString(ActualDeflectionMV)}"
});
}
}
public class QueryChannelCalSignalResults : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryChannelCalSignalResults;
private byte[] _channelList;
/// <summary>
/// Wipes out the ChannelList, TargetDeflectionMV and ActualDeflectionMV
/// arrays and sets the number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
ActualMV = new float[NumberOfStackChannels];
TargetMV = new float[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
/// <summary>
/// The millivolt value that the channel targeted.
/// </summary>
public float[] TargetMV { get; private set; }
/// <summary>
/// The millivolt value that the channel deflected to with the target deflection applied.
/// </summary>
public float[] ActualMV { get; private set; }
public QueryChannelCalSignalResults(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public QueryChannelCalSignalResults(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
TargetMV = new float[NumberOfStackChannels];
ActualMV = new float[NumberOfStackChannels];
for (int i = 0; i < NumberOfStackChannels; i++)
{
response.GetParameter(8 * i, out TargetMV[i]);
response.GetParameter(8 * i + 4, out ActualMV[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}"
});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Target (mv): {ArrayToString.ArrayObjectToString(TargetMV)}, Actual (mv): {ArrayToString.ArrayObjectToString(ActualMV)}"
});
}
}
public class OffsetChannel : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetChannelOffset;
private byte[] _channelList;
private short[] _zeroTarget;
private ushort[] _targetTolerance;
/// <summary>
/// Wipes out the ChannelList, ZeroTarget and TargetTolerance arrays and sets the
/// number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[5 * NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
_zeroTarget = new short[NumberOfStackChannels];
_targetTolerance = new ushort[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
/// <summary>
/// The list of zero targets (as signed 16-bit a/d counts) for the stack channels being offset. Each channel will try to adjust
/// its output to match the corresponding value in this array.
/// </summary>
public short[] ZeroTarget
{
get => _zeroTarget;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via ZeroTarget");
}
_zeroTarget = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(NumberOfStackChannels + 2 * i, _zeroTarget[i]);
}
}
}
/// <summary>
/// The list of tolerances (as unsigned 16-bit a/d counts) for each stack channel. The channels will
/// stop trying to zero themselves when they get within +/- this value of the corresponding ZeroTarget.
/// </summary>
public ushort[] TargetTolerance
{
get => _targetTolerance;
set
{
if (0 == NumberOfStackChannels)
{
NumberOfStackChannels = value.Length;
//throw new ApplicationException("NumberOfChannels must be set before ChannelList, ZeroTarget, or TargetTolerance");
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via TargetTolerance");
}
_targetTolerance = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(3 * NumberOfStackChannels + 2 * i, _targetTolerance[i]);
}
}
}
/// <summary>
/// The value (in signed 16-bit a/d counts) that the channel zeroed to.
/// </summary>
public short[] FinalZero { get; private set; }
/// <summary>
/// The difference (in signed 16-bit a/d counts) between the FinalZero and the ZeroTarget. A positive
/// value indicates that the channel settled above the ZeroTarget, a negative value indicates that it
/// settled below.
/// </summary>
public short[] FinalZeroError { get; private set; }
public OffsetChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public OffsetChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
FinalZero = new short[NumberOfStackChannels];
FinalZeroError = new short[NumberOfStackChannels];
for (int i = 0; i < NumberOfStackChannels; i++)
{
response.GetParameter(2 * i, out FinalZero[i]);
FinalZeroError[i] = (short)(FinalZero[i] - _zeroTarget[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>(){string.Format("StackChannels: {0}, ZeroTargets: {1}, TargetTolerances: {2}",
ArrayToString.ArrayObjectToString(StackChannelList),
ArrayToString.ArrayObjectToString(ZeroTarget),
ArrayToString.ArrayObjectToString(TargetTolerance))});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>() { $"FinalZero: {ArrayToString.ArrayObjectToString(FinalZero)}, ZeroError: {ArrayToString.ArrayObjectToString(FinalZeroError)}" });
}
}
public class MeasureStackChannelOffset : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryChannelOffset;
private byte _numChannels;
private byte[] _channelList;
public byte NumberOfChannels
{
get => _numChannels;
set
{
_numChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[_numChannels];
_channelList = new byte[_numChannels];
}
}
public byte[] ChannelList
{
get => _channelList;
set
{
_channelList = value;
if (_numChannels != _channelList.Length)
{
_numChannels = (byte)_channelList.Length;
command.Parameter = new byte[_numChannels];
}
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
public float[] MeasuredOffset { get; private set; }
public MeasureStackChannelOffset(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureStackChannelOffset(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
MeasuredOffset = new float[_numChannels];
for (int i = 0; i < _numChannels; i++)
{
response.GetParameter(_numChannels + 4 * i, out MeasuredOffset[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"StackChannels: {ArrayToString.ArrayObjectToString(ChannelList)}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Measured Offset (mv): {ArrayToString.ArrayObjectToString (MeasuredOffset)}"
});
}
}
public class MeasureStackInternalChannelOffset : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryInternalChannelOffset;
private byte _numChannels;
private byte[] _channelList;
public byte NumberOfChannels
{
get => _numChannels;
set
{
_numChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[_numChannels];
_channelList = new byte[_numChannels];
}
}
public byte[] ChannelList
{
get => _channelList;
set
{
_channelList = value;
if (_numChannels != _channelList.Length)
{
_numChannels = (byte)_channelList.Length;
command.Parameter = new byte[_numChannels];
}
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
public float[] MeasuredInternalOffset { get; private set; }
public MeasureStackInternalChannelOffset(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureStackInternalChannelOffset(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
MeasuredInternalOffset = new float[_numChannels];
for (int i = 0; i < _numChannels; i++)
{
response.GetParameter(_numChannels + 4 * i, out MeasuredInternalOffset[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"StackChannels: {ArrayToString.ArrayObjectToString(ChannelList)}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Measured Internal Offset (mv): {ArrayToString.ArrayObjectToString (MeasuredInternalOffset)}"
});
}
}
public class MeasureSquibChannelResistances : DiagnosticsCommands
{
protected override Commands _Command => Commands.QuerySquibResistance;
public MeasureSquibChannelResistances(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock)
{
command.Parameter = new byte[4] { 0, 1, 2, 3 };
for (int i = 0; i < 4; i++) { MeasuredResistanceOhms[i] = float.NaN; }
}
public MeasureSquibChannelResistances(DTS.Common.Interface.DASFactory.ICommunication sock, int timeoutMS) : base(sock, timeoutMS)
{
command.Parameter = new byte[4] { 0, 1, 2, 3 };
for (int i = 0; i < 4; i++) { MeasuredResistanceOhms[i] = float.NaN; }
}
public float[] MeasuredResistanceOhms { get; } = new float[4];
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
for (int i = 0; i < 4; i++)
{
response.GetParameter(i * 4, out float f);
MeasuredResistanceOhms[i] = f;
}
}
return CommandReceiveAction.StopReceiving;
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Measured Resistance (ohms): {ArrayToString.ArrayObjectToString (MeasuredResistanceOhms)}"
});
}
}
public class MeasureStackChannelBridgeResistance : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryBridgeResistance;
private byte _numChannels;
private byte[] _channelList;
public byte NumberOfChannels
{
get => _numChannels;
set
{
_numChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[_numChannels];
_channelList = new byte[_numChannels];
}
}
public byte[] StackChannelList
{
get => _channelList;
set
{
_channelList = value;
if (_numChannels != _channelList.Length)
{
_numChannels = (byte)_channelList.Length;
command.Parameter = new byte[_numChannels];
}
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
public float[] MeasuredBridgeResistanceOhms { get; private set; }
public MeasureStackChannelBridgeResistance(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureStackChannelBridgeResistance(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
MeasuredBridgeResistanceOhms = new float[_numChannels];
for (int i = 0; i < _numChannels; i++)
{
// Firmware returns bridge resistance as u16s, we want it as floats
response.GetParameter(2 * i, out ushort ohms);
MeasuredBridgeResistanceOhms[i] = ohms;
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Measured Resistance (ohms): {ArrayToString.ArrayObjectToString (MeasuredBridgeResistanceOhms)}"
});
}
}
// QuerySquibResistance
public class QuerySquibResistance : DiagnosticsCommands
{
protected override DiagnosticsCommands.Commands _Command
{
get { return Commands.QuerySquibResistance; }
}
private byte _numChannels;
private byte[] _channelList;
private float[] _measuredSquibResistanceOhms;
public byte NumberOfChannels
{
get => _numChannels;
set
{
_numChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[_numChannels];
_channelList = new byte[_numChannels];
}
}
public byte[] StackChannelList
{
get => _channelList;
set
{
_channelList = value;
if (_numChannels != _channelList.Length)
{
_numChannels = (byte)_channelList.Length;
command.Parameter = new byte[_numChannels];
}
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
public float[] MeasuredSquibResistanceOhms { get { return _measuredSquibResistanceOhms; } }
public QuerySquibResistance(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public QuerySquibResistance(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
_measuredSquibResistanceOhms = new float[_numChannels];
for (int i = 0; i < _numChannels; i++)
{
// Firmware returns bridge resistance as u16s, we want it as floats
float ohms;
response.GetParameter(4 * i, out ohms);
_measuredSquibResistanceOhms[i] = ohms;
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>(){string.Format("StackChannels: {0}",
ArrayToString.ArrayObjectToString (StackChannelList))});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
string.Format("Measured Resistance (ohms): {0}",
ArrayToString.ArrayObjectToString (MeasuredSquibResistanceOhms))
});
}
}
public class MeasureChannelNoiseStatistic : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryChannelNoiseStatistic;
private byte _numChannels;
private byte[] _channelList;
private bool[] _usegainofone;
public byte[] ChannelList
{
get => _channelList;
set
{
if (value.Length != _numChannels)
{
_channelList = new byte[value.Length];
_usegainofone = new bool[value.Length];
_numChannels = (byte)value.Length;
command.Parameter = new byte[2 * _numChannels];
}
_channelList = value;
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(i, value[i]);
}
}
}
public bool[] UseGainOfOne
{
get => _usegainofone;
set
{
if (value.Length != _numChannels)
{
_channelList = new byte[value.Length];
_usegainofone = new bool[value.Length];
_numChannels = (byte)value.Length;
command.Parameter = new byte[2 * _numChannels];
}
_usegainofone = value;
for (int i = 0; i < _numChannels; i++)
{
command.SetParameter(_numChannels + i, value[i]);
}
}
}
public float[] StandardDeviation { get; private set; }
public MeasureChannelNoiseStatistic(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public MeasureChannelNoiseStatistic(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
protected override CommandReceiveAction WholePackage()
{
StandardDeviation = new float[_numChannels];
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
if (response.ParameterLength != sizeof(ushort) * _numChannels + _numChannels)
{
throw new ApplicationException("MeasureChannelNoiseStatistic: Error getting standard deviation values for all channels requested: length is " + response.ParameterLength.ToString());
}
var _ustddev = new ushort[_numChannels];
for (int i = 0; i < _numChannels; i++)
{
response.GetParameter(_numChannels + i * sizeof(ushort), out _ustddev[i]);
StandardDeviation[i] = _ustddev[i];
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"Stack channels: {ArrayToString.ArrayObjectToString(ChannelList)}, Use G=1: {ArrayToString.ArrayObjectToString(UseGainOfOne)}" });
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
string.Format("Stack channels: {0}, Use G=1: {1}, Standard deviation: {2}",
ArrayToString.ArrayObjectToString(ChannelList),
ArrayToString.ArrayObjectToString(UseGainOfOne),
ArrayToString.ArrayObjectToString(StandardDeviation))
});
}
}
public class DiagnosShuntDACs : DiagnosticsCommands
{
protected override Commands _Command => Commands.DiagnosShuntDACs;
private byte[] _channelList;
/// <summary>
/// Wipes out the ChannelList, TargetDeflectionMV and ActualDeflectionMV
/// arrays and sets the number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
public DiagnosShuntDACs(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.DiangosShuntDAC);
}
public DiagnosShuntDACs(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.DiangosShuntDAC);
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>() { $"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}" });
}
}
public class QueryVoltageInsertaionResult_SLICE2 : DiagnosticsCommands
{
protected override Commands _Command => Commands.QueryVoltageInsertaionResult_SLICE2;
private byte[] _channelList;
/// <summary>
/// Wipes out the ChannelList, TargetDeflectionMV and ActualDeflectionMV
/// arrays and sets the number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
ActualGain = new float[NumberOfStackChannels];
ExpectedGain = new float[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
/// <summary>
/// The millivolt value that the channel targeted.
/// </summary>
public float[] ExpectedGain { get; private set; }
/// <summary>
/// The millivolt value that the channel deflected to with the target deflection applied.
/// </summary>
public float[] ActualGain { get; private set; }
public QueryVoltageInsertaionResult_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.VoltageInsertion);
}
public QueryVoltageInsertaionResult_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.VoltageInsertion);
}
protected override CommandReceiveAction WholePackage()
{
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
{
ExpectedGain = new float[NumberOfStackChannels];
ActualGain = new float[NumberOfStackChannels];
for (int i = 0; i < NumberOfStackChannels; i++)
{
response.GetParameter(8 * i, out ExpectedGain[i]);
response.GetParameter(8 * i + 4, out ActualGain[i]);
}
}
return CommandReceiveAction.StopReceiving;
}
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}"
});
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
lines.Add(new List<string>()
{
$"Expected Gain: {ArrayToString.ArrayObjectToString(ExpectedGain)}, Actual Gain: {ArrayToString.ArrayObjectToString(ActualGain)}"
});
}
}
public class SetChannelDiagnosticVoltageInsertion_SLICE2 : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetChannelDiagnosticVoltageInsertion_SLICE2;
private byte[] _channelList;
/// <summary>
/// Wipes out the ChannelList, TargetDeflectionMV and ActualDeflectionMV
/// arrays and sets the number of stack channels to value.
/// </summary>
/// <param name="value"></param>
private void SetNumberOfStackChannels(int value)
{
NumberOfStackChannels = value;
// Wipe out the existing parameters ...
command.Parameter = new byte[NumberOfStackChannels];
_channelList = new byte[NumberOfStackChannels];
ActualGain = new float[NumberOfStackChannels];
ExpectedGain = new float[NumberOfStackChannels];
}
/// <summary>
/// Read-only property to retrieve the number of stack channels being offset.
/// </summary>
public int NumberOfStackChannels { get; private set; } = 0;
/// <summary>
/// The list of stack channels to offset.
/// </summary>
public byte[] StackChannelList
{
get => _channelList;
set
{
if (0 == NumberOfStackChannels)
{
SetNumberOfStackChannels(value.Length);
}
else if (value.Length != NumberOfStackChannels)
{
throw new ApplicationException("Inconsistent channel count set via StackChannelList");
}
_channelList = value;
for (int i = 0; i < NumberOfStackChannels; i++)
{
command.SetParameter(i, _channelList[i]);
}
}
}
/// <summary>
/// The millivolt value that the channel targeted.
/// </summary>
public float[] ExpectedGain { get; private set; }
/// <summary>
/// The millivolt value that the channel deflected to with the target deflection applied.
/// </summary>
public float[] ActualGain { get; private set; }
public SetChannelDiagnosticVoltageInsertion_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
//per CPB, tie this to diagnostics mode, not voltage insertion for this call
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.DiagnosticsMode);
}
public SetChannelDiagnosticVoltageInsertion_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
//per CPB tie this to diagnostics mode, not voltage insertion for this call
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.DiagnosticsMode);
}
protected override CommandReceiveAction WholePackage() => CommandReceiveAction.StopReceiving;
public override void CommandToString(ref List<List<string>> lines)
{
base.CommandToString(ref lines);
lines.Add(new List<string>()
{
$"StackChannels: {ArrayToString.ArrayObjectToString(StackChannelList)}"
});
}
public override void ResponseToString(ref List<List<string>> lines) => base.ResponseToString(ref lines);
}
public class SetSliceDefaultMIF_SLICE2 : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetSliceDefaultMIF_SLICE2;
public SetSliceDefaultMIF_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
MinimumProtocolVersion = 129; // sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.SetDefaultMIF);
}
public SetSliceDefaultMIF_SLICE2(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.SetDefaultMIF);
}
}
public class SetSliceDefaultMIF_SLICE6 : DiagnosticsCommands
{
protected override Commands _Command => Commands.SetSliceDefaultMIF_SLICE2;
public SetSliceDefaultMIF_SLICE6(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
MinimumProtocolVersion = 0; // sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.SetDefaultMIF);
}
public SetSliceDefaultMIF_SLICE6(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.SetDefaultMIF);
}
}
public class RunAutoArmDiagnostics : DiagnosticsCommands
{
protected override Commands _Command => Commands.RunAutoArmDiagnostics;
public RunAutoArmDiagnostics(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public RunAutoArmDiagnostics(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
}
public class RunAutoReArmDiagnostics : DiagnosticsCommands
{
protected override Commands _Command => Commands.RunAutoReArmDiagnostics;
public RunAutoReArmDiagnostics(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
}
public RunAutoReArmDiagnostics(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
}
}
public class MeasurePowerProAllDiagnosticChannel : DiagnosticsCommands
{
private byte _numberOfchannel;
public float[] Value { get; } = new float[32];
public System.Collections.BitArray ChannelFlags
{
get
{
return new System.Collections.BitArray(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus]));
}
}
public class ChannelStatus
{
public ChannelStatus(byte statusByte)
{
var flags = new System.Collections.BitArray(statusByte);
Fault = flags[(int)StatusList.FaultStatus];
Protection = flags[(int)StatusList.ProtectionStatus];
CurrentOutOfRange = flags[(int)StatusList.CurrentOutOfRange];
VoltageOutOfRange = flags[(int)StatusList.VoltageOutOfRange];
}
public bool Fault { get; set; }
public bool Protection { get; set; }
public bool CurrentOutOfRange { get; set; }
public bool VoltageOutOfRange { get; set; }
}
public ChannelStatus InputAmphenolChannelStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.InputAmphenol]);
}
}
public ChannelStatus InputLemoChannelStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.InputLemo]);
}
}
public ChannelStatus InputLemoWETCHARGERStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.InputWETCHARGER]);
}
}
public ChannelStatus OutputAmphenolStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.OutputAmphenol]);
}
}
public ChannelStatus OutputLemoStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.OutputLemo]);
}
}
public ChannelStatus OutputWETStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.OutputWET]);
}
}
public ChannelStatus OutputBatteryStatus
{
get
{
return new ChannelStatus(BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus])[(int)ChannelsList.OutputBattery]);
}
}
public bool TemperatureOutOfOperationRangeStaus
{
get
{
return ChannelFlags[(int)ChannelStatusList.TemperatureOutOfOperationRange];
}
}
public bool DtsStatusInput
{
get
{
return ChannelFlags[(int)ChannelStatusList.DtsStatus];
}
}
public bool DtsStartInput
{
get
{
return ChannelFlags[(int)ChannelStatusList.DtsStart];
}
}
public bool DtsEventInput
{
get
{
return ChannelFlags[(int)ChannelStatusList.DtsEvent];
}
}
public enum ChannelsList
{
InputAmphenol,
InputLemo,
InputWETCHARGER,
OutputAmphenol,
OutputLemo,
OutputWET,
OutputBattery,
}
public enum StatusList
{
FaultStatus,
ProtectionStatus,
CurrentOutOfRange,
VoltageOutOfRange,
}
public enum ChannelStatusList
{
InputAmphenolfault,
InputAmphenolprotection,
InputAmphenolcurrentoutofrange,
InputAmphenolvoltageoutofrange,
InputLemofault,
InputLemoprotection,
InputLemoCurrentOutOfRange,
InputLemoVoltageOutOfRange,
InputWETCHARGERfault,
InputWETCHARGERProtection,
InputWETCHARGERcurrentOutOfRange,
InputWETCHARGERVoltageOutOfRange,
OutputAmphenolFault,
OutputAmphenolProtection,
OutputAmphenolCurrentOutOfRange,
OutputAmphenolVoltageOutOfRange,
OutputLemoFault,
OutputLemoProtection,
OutputLemoCurrentOutOfRange,
OutputLemoVoltageOutOfRange,
OutputWETFault,
OutputWETProtection,
OutputWETCurrentOutOfRange,
OutputWETVoltageOutOfRange,
OutputBatteryFault,
OutputBatteryProtection,
OutputBatteryCurrentOutOfRange,
OutputBatteryVoltageOutOfRange,
TemperatureOutOfOperationRange,
DtsStatus,
DtsStart,
DtsEvent,
}
public float InputAmphenolVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputVoltage_A];
}
}
public float InputAmphenolCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputCurrent_A];
}
}
public float InputLemoVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputVoltage_L];
}
}
public float InputLemoCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputCurrent_L];
}
}
public float InputChargerVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputVoltage_C];
}
}
public float InputChargerCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputCurrent_C];
}
}
public float InputCurrentTotal
{
get
{
return Value[(int)PowerProDiagnosticChannelList.InputCurrent_TOTAL];
}
}
public float OutputAmphenolVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputVoltage_A];
}
}
public float OutputAmphenolCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputCurrent_A];
}
}
public float OutputLemoVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputVoltage_L];
}
}
public float OutputLemoCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputCurrent_L];
}
}
public float OutputWETVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputVoltage_W];
}
}
public float OutputWETCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputCurrent_W];
}
}
public float OutputBatteryVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputVoltage_B];
}
}
public float OutputBatteryCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.OutputCurrent_B];
}
}
public float BatterySOC
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatterySOC];
}
}
public float BatteryVoltage
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatteryVoltage];
}
}
public float BatteryCurrent
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatteryCurrent];
}
}
public float TemperatureC
{
get
{
return Value[(int)PowerProDiagnosticChannelList.TemperatureC];
}
}
public float BatteryChipTemperatureC
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatteryChipTemperatureC];
}
}
public float BatteryThermistor1TemperatureC
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatteryThermistor1TemperatureC];
}
}
public float BatteryThermistor2TemperatureC
{
get
{
return Value[(int)PowerProDiagnosticChannelList.BatteryThermistor2TemperatureC];
}
}
public float ChargerPowerW
{
get
{
return Value[(int)PowerProDiagnosticChannelList.ChargerPowerW];
}
}
public float ChargerInputCurrentA
{
get
{
return Value[(int)PowerProDiagnosticChannelList.ChargerInputCurrentA];
}
}
public float DischargeCurrentA
{
get
{
return Value[(int)PowerProDiagnosticChannelList.DischargeCurrentA];
}
}
public float CalculateTotalOUT_CURRENT_A
{
get
{
return Value[(int)PowerProDiagnosticChannelList.CalculateTotalOUT_CURRENT_A];
}
}
public enum PowerProDiagnosticChannelList
{
InputVoltage_A = 0x00,
InputCurrent_A = 0x01,
InputVoltage_L = 0x02,
InputCurrent_L = 0x03,
InputVoltage_C = 0x04,
InputCurrent_C = 0x05,
InputCurrent_TOTAL = 0x06,
OutputVoltage_A = 0x07,
OutputCurrent_A = 0x08,
OutputVoltage_L = 0x09,
OutputCurrent_L = 0x0A,
OutputVoltage_W = 0x0B,
OutputCurrent_W = 0x0C,
OutputVoltage_B = 0x0D,
OutputCurrent_B = 0x0E,
BatterySOC = 0x0F,
BatteryVoltage = 0x10,
BatteryCurrent = 0x11,
TemperatureC = 0x12,
BatteryChipTemperatureC = 0x13, // 19
BatteryThermistor1TemperatureC = 0x14, // 20
BatteryThermistor2TemperatureC = 0x15, // 21
ChargerPowerW = 0x16, // 22
ChargerInputCurrentA = 0x17, // 23
DischargeCurrentA = 0x18, // 24
CalculateTotalOUT_CURRENT_A = 0x19, // 25
ChannelStatus = 0x1A, // 26
};
protected override DiagnosticsCommands.Commands _Command
{
get { return Commands.QueryAllDiagnosticMeasurementChannel; }
}
public MeasurePowerProAllDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock)
: base(sock)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.MeasurePowerProAllDiagnosticChannel);
}
public MeasurePowerProAllDiagnosticChannel(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec)
: base(sock, TimeoutMillisec)
{
MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.MeasurePowerProAllDiagnosticChannel);
}
protected override CommandReceiveAction WholePackage()
{
int offset = 1;
// we have a whole package
if (response.Status != DFConstantsAndEnums.CommandStatus.StatusNoError) return CommandReceiveAction.StopReceiving;
response.GetParameter(0, out _numberOfchannel);
for (int i = 0; i < _numberOfchannel; i++)
{
response.GetParameter(offset, out Value[i]);
offset += 4;
}
return CommandReceiveAction.StopReceiving;
}
public override void ResponseToString(ref List<List<string>> lines)
{
base.ResponseToString(ref lines);
var sb = new System.Text.StringBuilder();
BitConverter.GetBytes(Value[(int)PowerProDiagnosticChannelList.ChannelStatus]).ToList().ForEach(x => sb.Append($"{x.ToString("X")} "));
lines.Add(new List<string>()
{
$"StatusBytes: {sb.ToString()}, InputCurrentTotal: {InputCurrentTotal}, ",
$"InputAmphenolVoltage: {InputAmphenolVoltage}, InputAmphenolCurrent: {InputLemoCurrent}, ",
$"InputLemoVoltage: {InputLemoVoltage}, InputLemoCurrent: {InputLemoCurrent}, ",
$"InputChargerVoltage: {InputChargerVoltage}, InputChargerCurrent: {InputChargerCurrent}, ",
$"OutputAmphenolVoltage: {OutputAmphenolVoltage}, OutputAmphenolCurrent: {OutputLemoCurrent}, ",
$"OutputLemoVoltage: {OutputLemoVoltage}, OutputLemoCurrent: {OutputLemoCurrent}, ",
$"OutputWETVoltage: {OutputWETVoltage}, OutputWETCurrent: {OutputWETCurrent}, ",
$"OutputBatteryVoltage: {OutputBatteryVoltage}, OutputBatteryCurrent: {OutputBatteryCurrent}, ",
$"BatterySOC: {BatterySOC}, BatteryVoltage: {BatteryVoltage}, BatteryCurrent: {BatteryCurrent}, ",
$"TemperatureC: {TemperatureC}, BatteryChipTemperatureC: {BatteryChipTemperatureC}, ",
$"BatteryThermistor1TemperatureC: {BatteryThermistor1TemperatureC}, BatteryThermistor2TemperatureC: {BatteryThermistor2TemperatureC}, ",
$"ChargerPowerW: {ChargerPowerW}, ChargerInputCurrentA: {ChargerInputCurrentA}, ",
$"DischargeCurrentA: {DischargeCurrentA}, CalculateTotalOUT_CURRENT_A : {CalculateTotalOUT_CURRENT_A}",
});
}
}
}