init
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
/// <summary>
|
||||
/// defines the interface tag aware classes must implement
|
||||
/// </summary>
|
||||
public interface ITagAware
|
||||
{
|
||||
}
|
||||
public abstract class TagAwareBase : DbTimeStampBase
|
||||
{
|
||||
public byte[] TagsBlobBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = new byte[TagIDs.Length * sizeof(int)];
|
||||
Buffer.BlockCopy(TagIDs, 0, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.Length < sizeof(int)) return;
|
||||
var tagsBlob = new int[value.Length / sizeof(int)];
|
||||
try
|
||||
{
|
||||
Buffer.BlockCopy(value, 0, tagsBlob, 0, value.Length);
|
||||
TagIDs = tagsBlob;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private int[] _tagIDs = new int[0];
|
||||
public int[] TagIDs
|
||||
{
|
||||
get => _tagIDs;
|
||||
set => _tagIDs = value ?? new int[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,669 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
|
||||
namespace DatabaseImport
|
||||
{
|
||||
public class SensorData : SensorBase, IComparable<SensorData>, ISensorData
|
||||
{
|
||||
/// <summary>
|
||||
/// 11260 Implement DiagnosticsMode in DataPRO
|
||||
/// DiagnosticsMode means the bridge in analog is short circuited to the outside world and only internal resistors are used
|
||||
/// </summary>
|
||||
public bool DiagnosticsMode { get; set; } = false;
|
||||
public const string TEST_SPECIFIC_DOUT = "TSD_";
|
||||
public static bool IsTestSpecificDigitalOutSN(string sn)
|
||||
{
|
||||
if (!sn.StartsWith(TEST_SPECIFIC_DOUT)) return false;
|
||||
var s = sn.Substring(4);
|
||||
return Guid.TryParse(s, out var notUsed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// At one time all the different DelayMS were using one underlying property for storage, _delayMS.
|
||||
/// Now, the individual SquibFireDelayMS, etc. are defined because we don't want controls that are sharing to limit each other.
|
||||
/// </summary>
|
||||
public double DelayMS
|
||||
{
|
||||
get => _delayMS;
|
||||
set => _delayMS = value;
|
||||
}
|
||||
|
||||
public const double MINIMUM_DIGITALOUTPUT_DELAY_MS = 0D;
|
||||
public const double MAXIMUM_DIGITALOUTPUT_DELAY_MS = 99000D;
|
||||
|
||||
private double _digitalOutputDelayMS;
|
||||
public double DigitalOutputDelayMS
|
||||
{
|
||||
get => _digitalOutputDelayMS;
|
||||
set
|
||||
{
|
||||
var d = value;
|
||||
if (d < MINIMUM_DIGITALOUTPUT_DELAY_MS)
|
||||
{
|
||||
d = MINIMUM_DIGITALOUTPUT_DELAY_MS;
|
||||
}
|
||||
else if (d > MAXIMUM_DIGITALOUTPUT_DELAY_MS)
|
||||
{
|
||||
d = MAXIMUM_DIGITALOUTPUT_DELAY_MS;
|
||||
}
|
||||
SetProperty(ref _digitalOutputDelayMS, d, "DigitalOutputDelayMS");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// At one time all the different DurationMS were using one underlying property for storage, _durationMS.
|
||||
/// Now, the individual SquibFireDurationMS, etc. are defined because we don't want controls that are sharing to limit each other.
|
||||
/// </summary>
|
||||
public double DurationMS
|
||||
{
|
||||
get => _durationMS;
|
||||
set => SetProperty(ref _durationMS, value, "DurationMS");
|
||||
}
|
||||
|
||||
private double _digitalOutputDurationMS = 10D;
|
||||
public double DigitalOutputDurationMS
|
||||
{
|
||||
get => _digitalOutputDurationMS;
|
||||
set => SetProperty(ref _digitalOutputDurationMS, value, "DigitalOutputDurationMS");
|
||||
}
|
||||
private DigitalOutputModes _digitalOutputMode = DigitalOutputModes.FVLH;
|
||||
|
||||
public DigitalOutputModes DigitalOutputMode
|
||||
{
|
||||
get => _digitalOutputMode;
|
||||
set => SetProperty(ref _digitalOutputMode, value, "DigitalOutputMode");
|
||||
}
|
||||
|
||||
public bool DigitalOutputLimitDuration
|
||||
{
|
||||
get => _limitDuration;
|
||||
set => SetProperty(ref _limitDuration, value, "LimitDuration");
|
||||
}
|
||||
|
||||
private double _delayMS;
|
||||
|
||||
public double SquibFireDelayMS
|
||||
{
|
||||
get => _delayMS;
|
||||
set => SetProperty(ref _delayMS, value, "SquibFireDelayMS");
|
||||
}
|
||||
|
||||
private double _durationMS = 10D;
|
||||
public double SquibFireDurationMS
|
||||
{
|
||||
get => _durationMS;
|
||||
set => SetProperty(ref _durationMS, value, "SquibFireDurationMS");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// right now all the Limit Duration mechanisms using the same underlying property for storage (_limitDuration), however
|
||||
/// the public access methods (LimitSquibDuration, etc) exist in case we separate them out in the future
|
||||
/// </summary>
|
||||
public bool LimitDuration
|
||||
{
|
||||
get => _limitDuration;
|
||||
set => SetProperty(ref _limitDuration, value, "LimitDuration");
|
||||
}
|
||||
|
||||
private bool _limitDuration = true;
|
||||
public bool LimitSquibFireDuration
|
||||
{
|
||||
get => _limitDuration;
|
||||
set => SetProperty(ref _limitDuration, value, "LimitSquibFireDuration");
|
||||
}
|
||||
|
||||
private double _squibToleranceLow = 1D;
|
||||
|
||||
public double SquibToleranceLow
|
||||
{
|
||||
get => _squibToleranceLow;
|
||||
set => SetProperty(ref _squibToleranceLow, value, "SquibToleranceLow");
|
||||
}
|
||||
|
||||
private double _squibToleranceHigh = 8D;
|
||||
public double SquibToleranceHigh
|
||||
{
|
||||
get => _squibToleranceHigh;
|
||||
set => SetProperty(ref _squibToleranceHigh, value, "SquibToleranceHigh");
|
||||
}
|
||||
|
||||
private SquibMeasurementType _squibMeasurementType = SquibMeasurementType.VOLTAGE;
|
||||
public SquibMeasurementType SquibMeasurementType
|
||||
{
|
||||
get => _squibMeasurementType;
|
||||
set => SetProperty(ref _squibMeasurementType, value, "SquibMeasurementType");
|
||||
}
|
||||
|
||||
private double _squibOutputCurrent = 1.5D;
|
||||
public double SquibOutputCurrent
|
||||
{
|
||||
get => _squibOutputCurrent;
|
||||
set => SetProperty(ref _squibOutputCurrent, value, "SquibOutputCurrent");
|
||||
}
|
||||
|
||||
public override string DisplayUnit
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsSquib())
|
||||
{
|
||||
switch (SquibMeasurementType)
|
||||
{
|
||||
case SquibMeasurementType.CURRENT:
|
||||
return "A";
|
||||
default:
|
||||
return "V";
|
||||
}
|
||||
}
|
||||
if (null == Calibration || 0 == Calibration.Records.Records.Length) { return ""; }
|
||||
return Calibration.Records.Records[0].EngineeringUnits; //6194 disable display units for the short term
|
||||
}
|
||||
//6194 disable display units for the short term
|
||||
set { }
|
||||
}
|
||||
private SquibFireMode _squibFireMode = SquibFireMode.NONE;
|
||||
public SquibFireMode SquibFireMode
|
||||
{
|
||||
get => _squibFireMode;
|
||||
set => SetProperty(ref _squibFireMode, value, "SquibFireMode");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the input mode for this setting
|
||||
/// </summary>
|
||||
protected DigitalInputModes _inputMode = DigitalInputModes.CCNO;
|
||||
/// <summary>
|
||||
/// the scaler is a bit different than an ordinary scaler, so the name here is inaccurate, however the idea is
|
||||
/// that we allow the user to transform collected data, primarly by allowing them to define the 0,1 value of the digital output
|
||||
/// </summary>
|
||||
protected DigitalInputScaleMultiplier _digitalInputScaleMultiplier = new DigitalInputScaleMultiplier();
|
||||
|
||||
/// <summary>
|
||||
/// the setting name allows us to refer to different settings and allow it to be more easily included in test setups and channel setups
|
||||
/// </summary>
|
||||
public string SettingName
|
||||
{
|
||||
get => SerialNumber;
|
||||
set
|
||||
{
|
||||
SerialNumber = value;
|
||||
OnPropertyChanged("SettingName");
|
||||
}
|
||||
}
|
||||
|
||||
public DigitalInputModes InputMode
|
||||
{
|
||||
get => _inputMode;
|
||||
set => SetProperty(ref _inputMode, value, "InputMode");
|
||||
}
|
||||
|
||||
public DigitalInputScaleMultiplier ScaleMultiplier
|
||||
{
|
||||
get => _digitalInputScaleMultiplier;
|
||||
set => SetProperty(ref _digitalInputScaleMultiplier, value, "ScaleMultiplier");
|
||||
}
|
||||
|
||||
public SensorData(SensorData copy)
|
||||
{
|
||||
if (null == copy) { copy = new SensorData(); }
|
||||
DbTimeStamp = copy.DbTimeStamp;
|
||||
_digitalOutputMode = copy._digitalOutputMode;
|
||||
_inputMode = copy._inputMode;
|
||||
SquibMeasurementType = copy.SquibMeasurementType;
|
||||
_digitalInputScaleMultiplier = new DigitalInputScaleMultiplier(copy._digitalInputScaleMultiplier);
|
||||
_delayMS = copy._delayMS;
|
||||
_digitalOutputDelayMS = copy._digitalOutputDelayMS;
|
||||
_durationMS = copy._durationMS;
|
||||
_digitalOutputDurationMS = copy._digitalOutputDurationMS;
|
||||
_limitDuration = copy._limitDuration;
|
||||
_squibToleranceHigh = copy._squibToleranceHigh;
|
||||
_squibToleranceLow = copy._squibToleranceLow;
|
||||
_squibFireMode = copy._squibFireMode;
|
||||
_squibOutputCurrent = copy._squibOutputCurrent;
|
||||
TagsBlobBytes = copy.TagsBlobBytes;
|
||||
DoNotUse = copy.DoNotUse;
|
||||
Broken = copy.Broken;
|
||||
DbTimeStamp = copy.DbTimeStamp;
|
||||
if (null != copy.Calibration)
|
||||
{
|
||||
Calibration = new SensorCalibration(copy.Calibration);
|
||||
}
|
||||
try
|
||||
{
|
||||
AxisNumber = copy.AxisNumber;
|
||||
BridgeLegMode = copy.BridgeLegMode;
|
||||
BridgeResistance = copy.BridgeResistance;
|
||||
Bridge = copy.Bridge;
|
||||
ByPassFilter = copy.ByPassFilter;
|
||||
CheckCalibrationSignal = copy.CheckCalibrationSignal;
|
||||
CalInterval = copy.CalInterval;
|
||||
Capacity = copy.Capacity;
|
||||
CheckOffset = copy.CheckOffset;
|
||||
Comment = copy.Comment;
|
||||
CouplingMode = copy.CouplingMode;
|
||||
Created = copy.Created;
|
||||
ExternalShuntResistance = copy.ExternalShuntResistance;
|
||||
Filter = copy.Filter;
|
||||
Id = copy.Id;
|
||||
InternalShuntResistance = copy.InternalShuntResistance;
|
||||
Invert = copy.Invert;
|
||||
ISOCode = copy.ISOCode;
|
||||
LastModified = copy.LastModified;
|
||||
_localOnly = copy.LocalOnly;
|
||||
Manufacturer = copy.Manufacturer;
|
||||
DisplayUnit = copy.DisplayUnit;
|
||||
Model = copy.Model;
|
||||
LastUpdatedBy = copy.LastUpdatedBy;
|
||||
NumberOfAxes = copy.NumberOfAxes;
|
||||
OffsetToleranceHigh = copy.OffsetToleranceHigh;
|
||||
OffsetToleranceLow = copy.OffsetToleranceLow;
|
||||
RangeMedium = copy.RangeMedium;
|
||||
RangeHigh = copy.RangeHigh;
|
||||
RangeLow = copy.RangeLow;
|
||||
SensorCategory = copy.SensorCategory;
|
||||
SerialNumber = copy.SerialNumber;
|
||||
Shunt = copy.Shunt;
|
||||
Status = copy.Status;
|
||||
TimesUsed = copy.TimesUsed;
|
||||
UniPolar = copy.UniPolar;
|
||||
UserSerialNumber = copy.UserSerialNumber;
|
||||
UserValue1 = copy.UserValue1;
|
||||
UserValue2 = copy.UserValue2;
|
||||
UserValue3 = copy.UserValue3;
|
||||
DiagnosticsMode = copy.DiagnosticsMode;
|
||||
Version = copy.Version;
|
||||
SetSupportedExcitationFromString(copy.GetSerializedSupportedExcitation());
|
||||
TagsBlobBytes = copy.TagsBlobBytes;
|
||||
DoNotUse = copy.DoNotUse;
|
||||
Broken = copy.Broken;
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log(ex);
|
||||
}
|
||||
|
||||
FilterClassIso = copy.FilterClassIso;
|
||||
MeasureExcitation = copy.MeasureExcitation;
|
||||
MeasureNoise = copy.MeasureNoise;
|
||||
}
|
||||
private static Test.Module.Channel.Sensor.BridgeType ConvertToBridge(int bridge)
|
||||
{
|
||||
switch (bridge)
|
||||
{
|
||||
case 0: return Test.Module.Channel.Sensor.BridgeType.IEPE;
|
||||
case 4: return Test.Module.Channel.Sensor.BridgeType.HalfBridge_SigPlus;
|
||||
case 3: return Test.Module.Channel.Sensor.BridgeType.FullBridge;
|
||||
case 2: return Test.Module.Channel.Sensor.BridgeType.HalfBridge;
|
||||
case 1: return Test.Module.Channel.Sensor.BridgeType.QuarterBridge;
|
||||
default: return Test.Module.Channel.Sensor.BridgeType.FullBridge;
|
||||
}
|
||||
}
|
||||
|
||||
//added an option parameter to prevent querying cals one by one by passing in a dictionary
|
||||
//17991 calspan speed ups for opening a test setup
|
||||
public SensorData(IDataRecord reader, IReadOnlyDictionary<string, SensorCalibration> calLookup = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
AxisNumber = Convert.ToInt16(reader[DbOperations.SensorDB.SensorDataFields.AxisNumber.ToString()]);
|
||||
BridgeLegMode = (BridgeLeg)Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.BridgeLegMode.ToString()]);
|
||||
BridgeResistance = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.BridgeResistance.ToString()]);
|
||||
Bridge = ConvertToBridge(Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.BridgeType.ToString()]));
|
||||
ByPassFilter = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.BypassFilter.ToString()]);
|
||||
CheckCalibrationSignal = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.CalibrationSignal.ToString()]);
|
||||
CalInterval = Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.CalInterval.ToString()]);
|
||||
Capacity = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.Capacity.ToString()]);
|
||||
CheckOffset = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.CheckOffset.ToString()]);
|
||||
Comment = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.Comment.ToString()]);
|
||||
CouplingMode = (CouplingModes)Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.CouplingMode.ToString()]);
|
||||
Created = (DateTime)reader[DbOperations.SensorDB.SensorDataFields.Created.ToString()];
|
||||
ExternalShuntResistance = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.ExternalShuntResistance.ToString()]);
|
||||
Filter = new FilterClass(Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.FilterClass.ToString()]));
|
||||
Id = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.eId.ToString()]);
|
||||
InternalShuntResistance = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.InternalShuntResistance.ToString()]);
|
||||
Invert = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.Invert.ToString()]);
|
||||
ISOCode = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.IsoCode.ToString()]);
|
||||
LastModified = (DateTime)reader[DbOperations.SensorDB.SensorDataFields.LastModified.ToString()];
|
||||
_localOnly = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.LocalOnly.ToString()]);
|
||||
Manufacturer = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.Manufacturer.ToString()]);
|
||||
DisplayUnit = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.MeasurementUnit.ToString()]);
|
||||
Model = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.Model.ToString()]);
|
||||
LastUpdatedBy = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.ModifiedBy.ToString()]);
|
||||
NumberOfAxes = Convert.ToInt16(reader[DbOperations.SensorDB.SensorDataFields.NumberOfAxes.ToString()]);
|
||||
OffsetToleranceHigh = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.OffsetToleranceHigh.ToString()]);
|
||||
OffsetToleranceLow = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.OffsetToleranceLow.ToString()]);
|
||||
RangeMedium = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.RangeAve.ToString()]);
|
||||
RangeHigh = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.RangeHigh.ToString()]);
|
||||
RangeLow = Convert.ToDouble(reader[DbOperations.SensorDB.SensorDataFields.RangeLow.ToString()]);
|
||||
SensorCategory = Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.SensorCategory.ToString()]);
|
||||
SerialNumber = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.SerialNumber.ToString()]);
|
||||
Shunt = (ShuntMode)Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.Shunt.ToString()]);
|
||||
var oStatus = reader[DbOperations.SensorDB.SensorDataFields.Status.ToString()];
|
||||
if (oStatus is string s)
|
||||
{
|
||||
if (Enum.TryParse(s, out SensorStatus newStatus))
|
||||
{
|
||||
Status = newStatus;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = (SensorStatus)Convert.ToInt32(oStatus);
|
||||
}
|
||||
TimesUsed = Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.TimesUsed.ToString()]);
|
||||
UniPolar = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.UniPolar.ToString()]);
|
||||
UserSerialNumber = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.UserSerialNumber.ToString()]);
|
||||
DiagnosticsMode = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.DiagnosticsMode.ToString()]);
|
||||
UserValue1 = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.UserValue1.ToString()]);
|
||||
UserValue2 = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.UserValue2.ToString()]);
|
||||
UserValue3 = Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.UserValue3.ToString()]);
|
||||
Version = Convert.ToInt32(reader[DbOperations.SensorDB.SensorDataFields.Version.ToString()]);
|
||||
SetSupportedExcitationFromString(Convert.ToString(reader[DbOperations.SensorDB.SensorDataFields.SupportedExcitation.ToString()]));
|
||||
TagsBlobBytes = (byte[])reader[DbOperations.SensorDB.SensorDataFields.UserTags.ToString()];
|
||||
DoNotUse = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.DoNotUse.ToString()]);
|
||||
Broken = Convert.ToBoolean(reader[DbOperations.SensorDB.SensorDataFields.Broken.ToString()]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//APILogger.Log("Failed to process: ", ex);
|
||||
}
|
||||
}
|
||||
private string _serialNumber = "";
|
||||
public string SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set => SetProperty(ref _serialNumber, value, "SerialNumber");
|
||||
}
|
||||
private string _userSerialNumber = "";
|
||||
public string UserSerialNumber
|
||||
{
|
||||
get => _userSerialNumber;
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
SetProperty(ref _userSerialNumber, value, "UserSerialNumber");
|
||||
}
|
||||
}
|
||||
|
||||
private SensorStatus _status = SensorStatus.Available;
|
||||
public SensorStatus Status
|
||||
{
|
||||
get => _status;
|
||||
set => _status = value;
|
||||
}
|
||||
|
||||
|
||||
private string _id = "";
|
||||
public string Id
|
||||
{
|
||||
get => _id;
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
SetProperty(ref _id, value, "Id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _comment = "";
|
||||
public string Comment
|
||||
{
|
||||
get => _comment;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) { value = ""; }
|
||||
SetProperty(ref _comment, value, "Comment");
|
||||
}
|
||||
}
|
||||
private double _internalShuntResistance;
|
||||
public double InternalShuntResistance
|
||||
{
|
||||
get => _internalShuntResistance;
|
||||
set => SetProperty(ref _internalShuntResistance, value, "InternalShuntResistance");
|
||||
}
|
||||
|
||||
private double _externalShuntResistance;
|
||||
public double ExternalShuntResistance
|
||||
{
|
||||
get => _externalShuntResistance;
|
||||
set => SetProperty(ref _externalShuntResistance, value, "ExternalShuntResistance");
|
||||
}
|
||||
|
||||
private BridgeLeg _bridgeLegMode = BridgeLeg.First;
|
||||
public BridgeLeg BridgeLegMode
|
||||
{
|
||||
get => _bridgeLegMode;
|
||||
set => SetProperty(ref _bridgeLegMode, value, "BridgeLegMode");
|
||||
}
|
||||
|
||||
|
||||
private string _userValue1 = "";
|
||||
public string UserValue1
|
||||
{
|
||||
get => _userValue1;
|
||||
set { if (value == null) { value = ""; } SetProperty(ref _userValue1, value, "UserValue1"); }
|
||||
}
|
||||
|
||||
private string _userValue2 = "";
|
||||
public string UserValue2
|
||||
{
|
||||
get => _userValue2;
|
||||
set { if (value == null) { value = ""; } SetProperty(ref _userValue2, value, "UserValue2"); }
|
||||
}
|
||||
|
||||
private string _userValue3 = "";
|
||||
public string UserValue3
|
||||
{
|
||||
get => _userValue3;
|
||||
set { if (value == null) { value = ""; } SetProperty(ref _userValue3, value, "UserValue3"); }
|
||||
}
|
||||
|
||||
|
||||
public string GetSerializedSupportedExcitation()
|
||||
{
|
||||
return string.Join(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator, SupportedExcitation.Select(sp => sp.ToString()).ToArray());
|
||||
}
|
||||
public void SetSupportedExcitationFromString(string s)
|
||||
{
|
||||
var excitations = new List<ExcitationVoltageOptions.ExcitationVoltageOption>();
|
||||
|
||||
var tokens = s.Split(new[] { System.Globalization.CultureInfo.InvariantCulture.TextInfo.ListSeparator }, StringSplitOptions.None);
|
||||
foreach (var token in tokens)
|
||||
{
|
||||
if (Enum.TryParse(token, out ExcitationVoltageOptions.ExcitationVoltageOption option)) { excitations.Add(option); }
|
||||
}
|
||||
SupportedExcitation = excitations.ToArray();
|
||||
}
|
||||
|
||||
private DateTime _created = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;
|
||||
public DateTime Created
|
||||
{
|
||||
get => _created;
|
||||
set => SetProperty(ref _created, value, "Created");
|
||||
}
|
||||
|
||||
private int _timesUsed;
|
||||
public int TimesUsed
|
||||
{
|
||||
get => _timesUsed;
|
||||
set => SetProperty(ref _timesUsed, value, "TimesUsed");
|
||||
}
|
||||
|
||||
private int _sensorCategory;
|
||||
public int SensorCategory
|
||||
{
|
||||
get => _sensorCategory;
|
||||
set => SetProperty(ref _sensorCategory, value, "SensorCategory");
|
||||
}
|
||||
|
||||
private bool _bypassFilter;
|
||||
public bool ByPassFilter
|
||||
{
|
||||
get => _bypassFilter;
|
||||
set => SetProperty(ref _bypassFilter, value, "BypassFilter");
|
||||
}
|
||||
|
||||
private bool _checkCalibrationSignal;
|
||||
public bool CheckCalibrationSignal
|
||||
{
|
||||
get => _checkCalibrationSignal;
|
||||
set => SetProperty(ref _checkCalibrationSignal, value, "CheckCalibrationSignal");
|
||||
}
|
||||
|
||||
|
||||
public string TestObject
|
||||
{
|
||||
get => new IsoCode(ISOCode).TestObject;
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode) { TestObject = value };
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("TestObject");
|
||||
}
|
||||
}
|
||||
|
||||
public string OriginalPosition { get; set; }
|
||||
|
||||
public string Position
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.Position = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("Position");
|
||||
}
|
||||
}
|
||||
public string MainLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.MainLocation;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.MainLocation = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("MainLocation");
|
||||
}
|
||||
}
|
||||
public string FineLocation1
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.FineLocation1;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.FineLocation1 = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("FineLocation1");
|
||||
}
|
||||
}
|
||||
public string FineLocation2
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.FineLocation2;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.FineLocation2 = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("FineLocation2");
|
||||
}
|
||||
}
|
||||
public string FineLocation3
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.FineLocation3;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.FineLocation3 = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
OnPropertyChanged("FineLocation3");
|
||||
}
|
||||
}
|
||||
public string FilterClassIso
|
||||
{
|
||||
get
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
return ic.FilterClass;
|
||||
}
|
||||
set
|
||||
{
|
||||
var ic = new IsoCode(ISOCode);
|
||||
ic.FilterClass = value;
|
||||
ISOCode = ic.StringRepresentation;
|
||||
switch (value)
|
||||
{
|
||||
case "A":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.CFC1000);
|
||||
break;
|
||||
case "B":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.CFC600);
|
||||
break;
|
||||
case "C":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.CFC180);
|
||||
break;
|
||||
case "D":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.CFC60);
|
||||
break;
|
||||
case "P":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.None);
|
||||
break;
|
||||
case "S":
|
||||
Filter = new FilterClass(FilterClass.FilterClassType.AdHoc);
|
||||
break;
|
||||
}
|
||||
OnPropertyChanged("FilterClassIso");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SensorData()
|
||||
{
|
||||
ISOCode = BuildIsoCodeFromFilter(null, Filter.FClass);
|
||||
}
|
||||
|
||||
public int CompareTo(SensorData other)
|
||||
{
|
||||
return string.Compare(SerialNumber, other.SerialNumber, StringComparison.Ordinal);
|
||||
}
|
||||
public bool IncompatibleSensorAssignment(string sensorDimension, string channelDimension)
|
||||
{
|
||||
return sensorDimension != channelDimension &&
|
||||
sensorDimension != "00" &&
|
||||
sensorDimension != "SE" &&
|
||||
!sensorDimension.Contains("?") &&
|
||||
channelDimension != "00" &&
|
||||
channelDimension != "SE" &&
|
||||
!channelDimension.Contains("?");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user