2729 lines
134 KiB
Plaintext
2729 lines
134 KiB
Plaintext
/*
|
|
* DTS.Slice.Control.Event.Module.AnalogInputChannel.cs
|
|
*
|
|
* Copyright © 2009
|
|
* Diversified Technical Systems, Inc.
|
|
* All Rights Reserved
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using DTS.Common.DAS.Concepts;
|
|
using DTS.Common.Enums;
|
|
using DTS.Common.SerializationPlus;
|
|
using DTS.DASLib.Service;
|
|
using DTS.Common.Utilities;
|
|
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
|
using DTS.Common.Utilities.Logging;
|
|
using DTS.Common.Enums.Sensors;
|
|
using DTS.Common.Interface.DASFactory.Diagnostics;
|
|
using DTS.Common.DAS.Concepts.DAS.Channel;
|
|
using DTS.Common.Classes.Sensors;
|
|
|
|
namespace DTS.Slice.Control
|
|
{
|
|
// *** see DTS.Slice.Control.Event.cs ***
|
|
public partial class Event
|
|
{
|
|
// *** see DTS.Slice.Control.Event.Module.cs ***
|
|
public partial class Module
|
|
{
|
|
public partial class SquibEventChannel
|
|
: Channel,
|
|
IEngineeringUnitAware,
|
|
IIsoCodeAware
|
|
{
|
|
public string SerialNumber { get; set; } = "";
|
|
public SquibMeasurementType MeasurementType
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.SquibEventChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
protected SquibEventChannel(Module parentModule, int absoluteNumber)
|
|
: base(parentModule, absoluteNumber)
|
|
{ //
|
|
// Intended only for constructing implicit conversion instances, hence the
|
|
// restrictive access modifier.
|
|
} //
|
|
|
|
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.SquibEventChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="channel">
|
|
/// The <see cref="DASChannel"/> with which to initialize this object.
|
|
/// </param>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
public SquibEventChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's analog input-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
MvPerEu = 1.0;
|
|
ScaleFactorMv = 1.0;
|
|
SetPropertyValuesFrom(channel);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Get/set this object's engineering unit description <see cref="string"/>.
|
|
/// </summary>
|
|
public string EngineeringUnits
|
|
{
|
|
get
|
|
{
|
|
switch (MeasurementType)
|
|
{
|
|
case SquibMeasurementType.CURRENT:
|
|
return "A";
|
|
case SquibMeasurementType.INIT_SIGNAL:
|
|
return "V";
|
|
case SquibMeasurementType.VOLTAGE:
|
|
return "V";
|
|
case SquibMeasurementType.NONE:
|
|
return "";
|
|
default:
|
|
throw new NotSupportedException("SquibEventChannel::EngineeringUnits Unknown MeasurementType " + MeasurementType.ToString());
|
|
}
|
|
}
|
|
set { }
|
|
}
|
|
/// <summary>
|
|
/// Get/set this object's IsoCode <see cref="string"/>.
|
|
/// </summary>
|
|
public string IsoCode
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
/// <summary>
|
|
/// Convert this object to a DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <returns>
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> equivalent for this object.
|
|
/// </returns>
|
|
///
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module parentModule)
|
|
{
|
|
try
|
|
{
|
|
var that
|
|
= new Serialization.Test.Module.AnalogInputChannel(parentModule);
|
|
|
|
|
|
if (!IsConfigured)
|
|
throw new Exception("cannot serialize unconfigured analog input channel");
|
|
that.ChannelId = ChannelId;
|
|
that.Bridge = SensorConstants.BridgeType.SQUIB;
|
|
that.BridgeResistanceOhms = 0;
|
|
that.ZeroPoint = 0;
|
|
that.UserValue1 = UserValue1;
|
|
that.UserValue2 = UserValue2;
|
|
that.UserValue3 = UserValue3;
|
|
that.SetupEID = SetupEID;
|
|
that.DataCollectionEID = DataCollectionEID;
|
|
that.ChannelDescriptionString = ChannelDescriptionString;
|
|
that.OriginalChannelName = OriginalChannelName;
|
|
that.ChannelName2 = ChannelName2;
|
|
that.Description = ChannelDescriptionString;
|
|
that.Manufacturer = Manufacturer;
|
|
that.Model = Model;
|
|
that.HardwareChannelName = HardwareChannelName;
|
|
that.ChannelId = ChannelId;
|
|
that.ChannelGroupName = ChannelGroupName;
|
|
that.DesiredRange = 1;
|
|
that.EngineeringUnits = EngineeringUnits;
|
|
that.ExcitationVoltage = ExcitationVoltageOptions.ExcitationVoltageOption.Volt5;
|
|
that.InitialEu = 0;
|
|
that.IsInverted = false;
|
|
|
|
that.IsSubsampled = false;
|
|
if (IsLastCalibrationDateValid) { that.LastCalibrationDate = LastCalibrationDate; }
|
|
if (IsCalDueDateValid) { that.CalDueDate = CalDueDate; }
|
|
if (IsSensorIDValid) { that.SensorID = SensorID; }
|
|
if (IsOffsetToleranceLowMvValid) { that.OffsetToleranceLowMv = OffsetToleranceLowMv; }
|
|
if (IsOffsetToleranceHighMvValid) { that.OffsetToleranceHighMv = OffsetToleranceHighMv; }
|
|
if (IsIsoChannelNameValid) { that.IsoChannelName = IsoChannelName; }
|
|
if (IsUserCodeValid) { that.UserCode = UserCode; }
|
|
if (IsUserChannelNameValid) { that.UserChannelName = UserChannelName; }
|
|
|
|
that.IsoCode = IsoCode;
|
|
that.NoiseAsPercentageOfFullScale = NoiseAsPercentageOfFullScale;
|
|
that.Number = Number;
|
|
that.AbsoluteDisplayOrder = AbsoluteDisplayOrder;
|
|
that.PreTestZeroLevelAdc = PreTestZeroLevelAdc;
|
|
that.ZeroMvInADC = ZeroMvInADC;
|
|
that.WindowAverageADC = WindowAverageADC;
|
|
that.RemovedADC = RemovedADC;
|
|
that.ProportionalToExcitation = false;
|
|
that.RemoveOffset = false;
|
|
that.Sensitivity = 1D;
|
|
that.SerialNumber = "";
|
|
that.ShuntEnabled = false;
|
|
that.VoltageInsertionCheckEnabled = false;
|
|
that.CalSignalEnabled = false;
|
|
|
|
that.Start = Start;
|
|
that.PreTestZeroLevelAdc = PreTestZeroLevelAdc;
|
|
that.ZeroMvInADC = ZeroMvInADC;
|
|
that.WindowAverageADC = WindowAverageADC; //I'm not entirely sure why this is being set twice ... but why break with tradition!
|
|
that.RemovedADC = RemovedADC;
|
|
that.AbsoluteDisplayOrder = AbsoluteDisplayOrder;
|
|
that.ZeroAverageWindow = new Serialization.Test.IntervalSec(-1, 1);
|
|
that.ZeroMethod = ZeroMethodType.UsePreEventDiagnosticsZero;
|
|
that.RemoveOffset = true;
|
|
that.UnitConversion = 1.0;
|
|
that.AtCapacity = false;
|
|
that.CapacityOutputIsBasedOn = 1.000;
|
|
that.SensitivityUnits = SensorConstants.SensUnits.NONE;
|
|
try
|
|
{
|
|
if (TimeOfFirstSampleSecValid)
|
|
{
|
|
that.TimeOfFirstSampleSec = TimeOfFirstSampleSec;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
//ignore exception
|
|
}
|
|
|
|
that.SoftwareFilter = CurrentFilter.ToBaseString();
|
|
|
|
that.Data = new Serialization.Test.Module.Channel.DataArray<short>();
|
|
that.Data.MvPerEu = GetMvPerEu();
|
|
that.Data.ScaleFactorMv = GetScaleFactorMv();
|
|
that.Data.Multiplier = Multiplier;
|
|
that.Data.UnitConversion = UnitConversion;
|
|
that.AtCapacity = AtCapacity;
|
|
that.CapacityOutputIsBasedOn = CapacityOutputIsBasedOn;
|
|
that.SensitivityUnits = SensitivityUnits;
|
|
that.Data.UserOffsetEU = UserOffsetEU;
|
|
if (UnfilteredData is Serialization.SliceRaw.File.PersistentChannel persistentChannelInfo)
|
|
that.PersistentChannelInfo = persistentChannelInfo;
|
|
that.SerialNumber = SerialNumber;
|
|
return that;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem converting " + GetType().FullName + " to " + typeof(Serialization.Test.Module.AnalogInputChannel), ex);
|
|
}
|
|
}
|
|
public override string ToString()
|
|
{
|
|
try
|
|
{
|
|
return !string.IsNullOrEmpty(ChannelDescriptionString) ? ChannelDescriptionString : base.ToString();
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting string representation", ex);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Initialize this object from the specified DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <param name="that">
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> from which to initialize this object.
|
|
/// </param>
|
|
///
|
|
public override void FromDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module.Channel that)
|
|
{
|
|
throw new NotImplementedException("SquibEventChannel::FromDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataEu() { throw new NotImplementedException("SquibEventChannel::GetUnfilteredDataEu"); }
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
throw new NotImplementedException("SquibEventChannel::GetUnfilteredDataMV");
|
|
}
|
|
/// <summary>
|
|
/// Get <see cref="bool"/> value indicating whether or not the specified channel is configured.
|
|
/// </summary>
|
|
public override bool IsConfigured
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
/// <summary>
|
|
/// Get the actual available maximum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMaxRangeEu => throw new NotImplementedException("SquibEventChannel::ActualMaxRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the actual available minimum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMinRangeEu => throw new NotImplementedException("SquibEventChannel::ActualMinRangeEu");
|
|
|
|
public override double DesiredRangeEU => throw new NotImplementedException("SquibEventChannel::DesiredRangeEu");
|
|
|
|
public override double SensorCapacityEU => throw new NotImplementedException("SquibEventChannel::SensorCapacityEU");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data min in EU.
|
|
/// </summary>
|
|
public override double DataMinEu => throw new NotImplementedException("SquibEventChannel::DataMinEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data max in EU.
|
|
/// </summary>
|
|
public override double DataMaxEu => throw new NotImplementedException("SquibEventChannel::DataMaxEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range in EU.
|
|
/// </summary>
|
|
public override double DataRangeEu => throw new NotImplementedException("SquibEventChannel::DataRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range/2 in EU.
|
|
/// </summary>
|
|
public override double DataHalfRangeValueEu => throw new NotImplementedException("SquibEventChannel::DataHalfRangeValueEu");
|
|
|
|
public const string InitSignalString = " (Init Signal)";
|
|
public const string VoltageString = " (Voltage)";
|
|
public const string CurrentString = " (Current)";
|
|
/// <summary>
|
|
/// Get data zero level counts.
|
|
/// </summary>
|
|
public override short DataZeroLevelAdc => throw new NotImplementedException("SquibEventChannel::DataZeroLevelAdc");
|
|
|
|
/// <summary>
|
|
/// Set the appropriate properties in this class from the equivalent properties
|
|
/// of the specified object.
|
|
/// </summary>
|
|
///
|
|
///<param name="dasChannel">
|
|
/// The <see cref="DASChannel"/> object containing the
|
|
/// property values to be copied.
|
|
/// </param>
|
|
///
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
if (null == dasChannel)
|
|
throw new ArgumentNullException("could not initialize from null das channel reference");
|
|
if (!(dasChannel is OutputSquibChannel squib))
|
|
throw new ArgumentException("could not interpret " + dasChannel.GetType().FullName +
|
|
" initialization object as " +
|
|
typeof(OutputSquibChannel).FullName);
|
|
OffsetToleranceLowMv = double.NaN;
|
|
OffsetToleranceHighMv = double.NaN;
|
|
SensorID = squib.IDs[0].ID.ToString();
|
|
LastCalibrationDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;
|
|
CalDueDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;
|
|
ChannelDescriptionString = string.IsNullOrWhiteSpace(squib.UserValue1)
|
|
? squib.SquibDescription
|
|
: squib.UserValue1;
|
|
ChannelName2 = squib.ChannelName2;
|
|
switch (MeasurementType)
|
|
{
|
|
case SquibMeasurementType.CURRENT:
|
|
if (ChannelDescriptionString.EndsWith(".1"))
|
|
{
|
|
ChannelDescriptionString =
|
|
ChannelDescriptionString.Substring(0,
|
|
ChannelDescriptionString.Length - 2) + ".2";
|
|
}
|
|
ChannelDescriptionString += CurrentString;
|
|
if (ChannelName2 != null)
|
|
{
|
|
if (ChannelName2.EndsWith(".1"))
|
|
{
|
|
ChannelName2 = ChannelName2.Substring(0, ChannelName2.Length - 2) + ".2";
|
|
}
|
|
ChannelName2 += CurrentString;
|
|
}
|
|
break;
|
|
case SquibMeasurementType.INIT_SIGNAL:
|
|
ChannelDescriptionString += InitSignalString;
|
|
ChannelName2 += InitSignalString;
|
|
break;
|
|
case SquibMeasurementType.VOLTAGE:
|
|
ChannelDescriptionString += VoltageString;
|
|
ChannelName2 += VoltageString;
|
|
break;
|
|
case SquibMeasurementType.NONE:
|
|
ChannelDescriptionString += " (NONE)";
|
|
ChannelName2 += " (NONE)";
|
|
break;
|
|
default:
|
|
throw new NotSupportedException(
|
|
"unknown measurement type " + MeasurementType.ToString());
|
|
}
|
|
IsConfigured = squib.IsConfigured();
|
|
IsoCode = squib.ISOCode;
|
|
IsoChannelName = squib.IsoChannelName;
|
|
UserChannelName = squib.UserChannelName;
|
|
UserCode = squib.UserCode;
|
|
Number = squib.ModuleChannelNumber;
|
|
AbsoluteDisplayOrder = dasChannel.AbsoluteDisplayOrder;
|
|
UnitConversion = dasChannel.UnitConverision;
|
|
MvPerEu = 1;
|
|
ScaleFactorMv = squib.ScaleFactorMv;
|
|
PreTestZeroLevelAdc = squib.PreTestDataZeroLevelADC;
|
|
Start = squib.EventStartTime;
|
|
UserValue1 = squib.UserValue1;
|
|
UserValue2 = squib.UserValue2;
|
|
UserValue3 = squib.UserValue3;
|
|
SetupEID = squib.SetupEID;
|
|
DataCollectionEID = squib.DataCollectionEID;
|
|
HardwareChannelName = squib.HardwareChannelName;
|
|
if (squib.SoftwareFilterFrequency > 0)
|
|
{
|
|
CurrentFilter = new DefaultSaeJ211Filter(squib.SoftwareFilterFrequency);
|
|
DefaultFilter = new DefaultSaeJ211Filter(squib.SoftwareFilterFrequency);
|
|
}
|
|
Manufacturer = string.Empty;
|
|
Model = string.Empty;
|
|
SerialNumber = squib.SerialNumber;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception(
|
|
"encountered problem setting property values from " +
|
|
(null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
}
|
|
public partial class SquibDigitalChannel
|
|
: Channel
|
|
{
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.SquibEventChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
protected SquibDigitalChannel(Module parentModule, int absoluteNumber)
|
|
: base(parentModule, absoluteNumber)
|
|
{ //
|
|
// Intended only for constructing implicit conversion instances, hence the
|
|
// restrictive access modifier.
|
|
} //
|
|
|
|
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.SquibEventChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="channel">
|
|
/// The <see cref="DASChannel"/> with which to initialize this object.
|
|
/// </param>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
public SquibDigitalChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's analog input-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
MvPerEu = 1.0;
|
|
ScaleFactorMv = 1.0;
|
|
SetPropertyValuesFrom(channel);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Convert this object to a DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <returns>
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> equivalent for this object.
|
|
/// </returns>
|
|
///
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module parentModule)
|
|
{
|
|
throw new NotImplementedException("SquibDigitalChannel::ToDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize this object from the specified DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <param name="that">
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> from which to initialize this object.
|
|
/// </param>
|
|
///
|
|
public override void FromDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module.Channel that)
|
|
{
|
|
throw new NotImplementedException("SquibDigitalChannel::FromDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataEu() { throw new NotImplementedException("SquibDigitalChannel::GetUnfilteredDataEu"); }
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
throw new NotImplementedException("SquibDigitalChannel::GetUnFilteredDataMV");
|
|
}
|
|
/// <summary>
|
|
/// Get <see cref="bool"/> value indicating whether or not the specified channel is configured.
|
|
/// </summary>
|
|
public override bool IsConfigured
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
/// <summary>
|
|
/// Get the actual available maximum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMaxRangeEu => throw new NotImplementedException("SquibDigitalChannel::ActualMaxRangeEu");
|
|
|
|
public override double DesiredRangeEU => throw new NotImplementedException("SquibDigitalChannel:DesiredRangeEu");
|
|
|
|
public override double SensorCapacityEU => throw new NotImplementedException("SquibDigitalChannel:SensorCapacityEu");
|
|
|
|
/// <summary>
|
|
/// Get the actual available minimum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMinRangeEu => throw new NotImplementedException("SquibDigitalChannel::ActualMinRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data min in EU.
|
|
/// </summary>
|
|
public override double DataMinEu => throw new NotImplementedException("SquibDigitalChannel::DataMinEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data max in EU.
|
|
/// </summary>
|
|
public override double DataMaxEu => throw new NotImplementedException("SquibDigitalChannel::DataMaxEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range in EU.
|
|
/// </summary>
|
|
public override double DataRangeEu => throw new NotImplementedException("SquibDigitalChannel::DataRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range/2 in EU.
|
|
/// </summary>
|
|
public override double DataHalfRangeValueEu => throw new NotImplementedException("SquibDigitalChannel::DataHalfRangeValueEu");
|
|
|
|
/// <summary>
|
|
/// Get data zero level counts.
|
|
/// </summary>
|
|
public override short DataZeroLevelAdc => throw new NotImplementedException("SquibDigitalChannel::DataZeroLevelAdc");
|
|
|
|
/// <summary>
|
|
/// Set the appropriate properties in this class from the equivalent properties
|
|
/// of the specified object.
|
|
/// </summary>
|
|
///
|
|
///<param name="dasChannel">
|
|
/// The <see cref="DASChannel"/> object containing the
|
|
/// property values to be copied.
|
|
/// </param>
|
|
///
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
//apparently do nothing?
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting property values from " + (null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class TimestampChannel : Channel,
|
|
ITimestampAware
|
|
{
|
|
public TimestampChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's timestamp-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
SetPropertyValuesFrom(channel);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Convert this object to a DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <returns>
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> equivalent for this object.
|
|
/// </returns>
|
|
///
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module parentModule)
|
|
{
|
|
throw new NotImplementedException("TimestampChannel::ToDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize this object from the specified DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <param name="that">
|
|
/// A <see cref="Serialization.Test.Module.Channel"/> from which to initialize this object.
|
|
/// </param>
|
|
///
|
|
public override void FromDtsSerializationTestModuleChannel(
|
|
Serialization.Test.Module.Channel that)
|
|
{
|
|
throw new NotImplementedException("TimestampChannel::FromDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataEu() { throw new NotImplementedException("TimestampChannel::GetUnfilteredDataEu"); }
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
throw new NotImplementedException("TimestampChannel::GetUnFilteredDataMV");
|
|
}
|
|
/// <summary>
|
|
/// Get <see cref="bool"/> value indicating whether or not the specified channel is configured.
|
|
/// </summary>
|
|
public override bool IsConfigured
|
|
{
|
|
get => true;
|
|
set => throw new NotSupportedException();
|
|
}
|
|
/// <summary>
|
|
/// Get the actual available maximum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMaxRangeEu => throw new NotImplementedException("TimestampChannel::ActualMaxRangeEu");
|
|
|
|
public override double DesiredRangeEU => throw new NotImplementedException("TimestampChannel:DesiredRangeEu");
|
|
|
|
public override double SensorCapacityEU => throw new NotImplementedException("TimestampChannel:SensorCapacityEu");
|
|
|
|
/// <summary>
|
|
/// Get the actual available minimum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMinRangeEu => throw new NotImplementedException("TimestampChannel::ActualMinRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data min in EU.
|
|
/// </summary>
|
|
public override double DataMinEu => throw new NotImplementedException("TimestampChannel::DataMinEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data max in EU.
|
|
/// </summary>
|
|
public override double DataMaxEu => throw new NotImplementedException("TimestampChannel::DataMaxEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range in EU.
|
|
/// </summary>
|
|
public override double DataRangeEu => throw new NotImplementedException("TimestampChannel::DataRangeEu");
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range/2 in EU.
|
|
/// </summary>
|
|
public override double DataHalfRangeValueEu => throw new NotImplementedException("TimestampChannel::DataHalfRangeValueEu");
|
|
|
|
/// <summary>
|
|
/// Get data zero level counts.
|
|
/// </summary>
|
|
public override short DataZeroLevelAdc => throw new NotImplementedException("TimestampChannel::DataZeroLevelAdc");
|
|
|
|
public TimestampPartTypes TimestampPartType { get; set; }
|
|
|
|
/// <summary>
|
|
/// Set the appropriate properties in this class from the equivalent properties
|
|
/// of the specified object.
|
|
/// </summary>
|
|
///
|
|
///<param name="dasChannel">
|
|
/// The <see cref="DASChannel"/> object containing the
|
|
/// property values to be copied.
|
|
/// </param>
|
|
///
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
|
|
if (!(dasChannel is TimestampDASChannel timestampChannel))
|
|
throw new ArgumentException("could not interpret " + dasChannel.GetType().FullName + " initialization object as " + typeof(TimestampDASChannel).FullName);
|
|
|
|
ChannelDescriptionString = timestampChannel.ToString();
|
|
TimestampPartType = TimestampPartTypes.Reserved;
|
|
switch (timestampChannel.ToString())
|
|
{
|
|
case TimestampDASChannel.MARKER:
|
|
TimestampPartType = TimestampPartTypes.Marker;
|
|
break;
|
|
case TimestampDASChannel.SEC_H:
|
|
TimestampPartType = TimestampPartTypes.Seconds_High;
|
|
break;
|
|
case TimestampDASChannel.SEC_L:
|
|
TimestampPartType = TimestampPartTypes.Seconds_Low;
|
|
break;
|
|
case TimestampDASChannel.NANOS_H:
|
|
TimestampPartType = TimestampPartTypes.Nanoseconds_High;
|
|
break;
|
|
case TimestampDASChannel.NANOS_L:
|
|
TimestampPartType = TimestampPartTypes.Nanoseconds_Low;
|
|
break;
|
|
default:
|
|
TimestampPartType = TimestampPartTypes.Reserved;
|
|
break;
|
|
}
|
|
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting property values from " + (null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
}
|
|
public class CANInputChannel : Channel
|
|
{
|
|
#region NotImplemented members
|
|
public override double ActualMaxRangeEu => throw new NotImplementedException("CANInputChannel::ActualMaxRangeEu");
|
|
|
|
public override double ActualMinRangeEu => throw new NotImplementedException("CANInputChannel::ActualMinRangeEu");
|
|
|
|
public override double DesiredRangeEU => throw new NotImplementedException("CANInputChannel::DesiredRangeEU");
|
|
|
|
public override double SensorCapacityEU => throw new NotImplementedException("CANInputChannel::SensorCapacityEU");
|
|
|
|
public override double DataMinEu => throw new NotImplementedException("CANInputChannel::DataMinEu");
|
|
|
|
public override double DataMaxEu => throw new NotImplementedException("CANInputChannel::DataMaxEu");
|
|
|
|
public override double DataRangeEu => throw new NotImplementedException("CANInputChannel::DataRangeEu");
|
|
|
|
public override double DataHalfRangeValueEu => throw new NotImplementedException("CANInputChannel::DataHalfRangeValueEu");
|
|
|
|
public override short DataZeroLevelAdc => throw new NotImplementedException("CANInputChannel::DataZeroLevelAdc");
|
|
|
|
public override void FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel that)
|
|
{
|
|
throw new NotImplementedException("CANInputChannel::FromDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(Serialization.Test.Module parentModule)
|
|
{
|
|
throw new NotImplementedException("CANInputChannel::ToDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataEu()
|
|
{
|
|
throw new NotImplementedException("CANInputChannel::GetUnfilteredDataEu");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
throw new NotImplementedException("CANInputChannel::GetUnfilteredDataMV");
|
|
}
|
|
#endregion
|
|
|
|
public CANInputChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's timestamp-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
SetPropertyValuesFrom(channel);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
public override bool IsConfigured { get => true; set => throw new NotImplementedException("CANInputChannel::IsConfigured"); }
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
if (!(dasChannel is CANInputDASChannel streamInputChannel))
|
|
throw new ArgumentException("could not interpret " + dasChannel.GetType().FullName + " initialization object as " + typeof(CANInputDASChannel).FullName);
|
|
|
|
ChannelDescriptionString = streamInputChannel.ToString();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting property values from " + (null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
}
|
|
public partial class StreamInputChannel : Channel
|
|
{
|
|
#region NotImplemented members
|
|
public override double ActualMaxRangeEu => throw new NotImplementedException("StreamInputDASChannel::ActualMaxRangeEu");
|
|
|
|
public override double ActualMinRangeEu => throw new NotImplementedException("StreamInputDASChannel::ActualMinRangeEu");
|
|
|
|
public override double DesiredRangeEU => throw new NotImplementedException("StreamInputDASChannel::DesiredRangeEU");
|
|
|
|
public override double SensorCapacityEU => throw new NotImplementedException("StreamInputDASChannel::SensorCapacityEU");
|
|
|
|
public override double DataMinEu => throw new NotImplementedException("StreamInputDASChannel::DataMinEu");
|
|
|
|
public override double DataMaxEu => throw new NotImplementedException("StreamInputDASChannel::DataMaxEu");
|
|
|
|
public override double DataRangeEu => throw new NotImplementedException("StreamInputDASChannel::DataRangeEu");
|
|
|
|
public override double DataHalfRangeValueEu => throw new NotImplementedException("StreamInputDASChannel::DataHalfRangeValueEu");
|
|
|
|
public override short DataZeroLevelAdc => throw new NotImplementedException("StreamInputDASChannel::DataZeroLevelAdc");
|
|
|
|
public override void FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel that)
|
|
{
|
|
throw new NotImplementedException("StreamInputDASChannel::FromDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(Serialization.Test.Module parentModule)
|
|
{
|
|
throw new NotImplementedException("StreamInputDASChannel::ToDtsSerializationTestModuleChannel");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataEu()
|
|
{
|
|
throw new NotImplementedException("StreamInputDASChannel::GetUnfilteredDataEu");
|
|
}
|
|
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
throw new NotImplementedException("StreamInputDASChannel::GetUnfilteredDataMV");
|
|
}
|
|
#endregion
|
|
|
|
public StreamInputChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's timestamp-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
SetPropertyValuesFrom(channel);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
public override bool IsConfigured { get => true; set => throw new NotImplementedException("StreamInputDASChannel::IsConfigured"); }
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
if (!(dasChannel is StreamInputDASChannel streamInputChannel))
|
|
throw new ArgumentException("could not interpret " + dasChannel.GetType().FullName + " initialization object as " + typeof(StreamInputDASChannel).FullName);
|
|
|
|
ChannelDescriptionString = streamInputChannel.ToString();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting property values from " + (null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class IEPEInputChannel : AnalogInputChannel
|
|
{
|
|
public IEPEInputChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber) { }
|
|
}
|
|
/// <summary>
|
|
/// Representation of the DTS.Slice.Control.Event.Module.AnalogInputChannel class.
|
|
/// </summary>
|
|
public partial class AnalogInputChannel
|
|
: Channel,
|
|
IEngineeringUnitAware,
|
|
IInversionAware,
|
|
ISerialNumberAware,
|
|
IIsoCodeAware,
|
|
IShuntAware,
|
|
ICalSignalAware,
|
|
ILevelTriggerable,
|
|
ILinearized
|
|
{
|
|
public bool Saturated { get; set; }
|
|
/// <summary>
|
|
/// 14042 Flash Clear turns of excitation for s6
|
|
/// this allows for ILevelTriggerable channels to store and cache a sample average for checking
|
|
/// level triggered
|
|
/// </summary>
|
|
double? ILevelTriggerable.SampleAverageADC { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.AnalogInputChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
protected AnalogInputChannel(Module parentModule, int absoluteNumber)
|
|
: base(parentModule, absoluteNumber)
|
|
{ //
|
|
// Intended only for constructing implicit conversion instances, hence the
|
|
// restrictive access modifier.
|
|
} //
|
|
|
|
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.AnalogInputChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="channel">
|
|
/// The <see cref="DASChannel"/> with which to initialize this object.
|
|
/// </param>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
public AnalogInputChannel(DASChannel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's analog input-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
// channel.
|
|
//
|
|
MvPerEu = 1.0;
|
|
ScaleFactorMv = 1.0;
|
|
SetPropertyValuesFrom(channel);
|
|
DoRoundOffLevelTriggerThresholdValues = true;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module.AnalogInputChannel class.
|
|
/// </summary>
|
|
///
|
|
/// <param name="channel">
|
|
/// The <see cref="Serialization.Test.Module.Channel"/> with which to initialize this object.
|
|
/// </param>
|
|
///
|
|
/// <param name="parentModule">
|
|
/// The <see cref="Module"/> that contains this channel.
|
|
/// </param>
|
|
///
|
|
/// <param name="absoluteNumber">
|
|
/// The unique "absolute" <see cref="int"/> number of the channel with respect to all other channels
|
|
/// on all other DASes in the system.
|
|
/// </param>
|
|
///
|
|
public AnalogInputChannel(Serialization.Test.Module.Channel channel, Module parentModule, int absoluteNumber)
|
|
: base(channel, parentModule, absoluteNumber)
|
|
{
|
|
try
|
|
{ //
|
|
// Initialize this object's analog input-specific values with whatever we can
|
|
// squeeze out of the specified channel object.
|
|
//
|
|
if (channel is Serialization.Test.Module.AnalogInputChannel analogInputChannel)
|
|
{
|
|
Scaler.IEPE = analogInputChannel.Bridge == SensorConstants.BridgeType.IEPE;
|
|
Scaler.Digital = analogInputChannel.Bridge == SensorConstants.BridgeType.DigitalInput;
|
|
InitialOffset = analogInputChannel.InitialOffset;
|
|
}
|
|
|
|
MvPerEu = channel.Data.MvPerEu;
|
|
ScaleFactorMv = channel.Data.ScaleFactorMv;
|
|
ScaleFactorEU = channel.Data.ScaleFactorEU;
|
|
UseEUScaler = channel.Data.UseEUScaleFactors;
|
|
|
|
if (channel.Data.UseEUScaleFactors)
|
|
{
|
|
try
|
|
{
|
|
ScaleFactorEU = channel.Data.ScaleFactorEU;
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
ScaleFactorEU = 0;
|
|
}
|
|
}
|
|
Scaler.SetUseEUScaleFactors(channel.Data.UseEUScaleFactors);
|
|
RemovedADC = channel.RemovedADC;
|
|
ChannelId = channel.ChannelId;
|
|
ChannelGroupName = channel.ChannelGroupName;
|
|
AbsoluteDisplayOrder = channel.AbsoluteDisplayOrder;
|
|
UnitConversion = (channel as Serialization.Test.Module.AnalogInputChannel).UnitConversion;
|
|
AtCapacity = (channel as Serialization.Test.Module.AnalogInputChannel).AtCapacity;
|
|
CapacityOutputIsBasedOn = (channel as Serialization.Test.Module.AnalogInputChannel).CapacityOutputIsBasedOn;
|
|
SensitivityUnits = (channel as Serialization.Test.Module.AnalogInputChannel).SensitivityUnits;
|
|
FromDtsSerializationTestModuleChannel(channel);
|
|
try
|
|
{
|
|
if (channel.Data.UseEUScaleFactors && channel.TDASPersistentChannelInfo != null)
|
|
{
|
|
Scaler.SetDataZeroLevelADC((short)channel.TDASPersistentChannelInfo.DataZeroLevelInCnts);
|
|
}
|
|
else
|
|
{
|
|
Scaler.SetDataZeroLevelADC(DataZeroLevelAdc);
|
|
//if we have a linearized value and are set for none, the the datazeroleveladc shouldn't be used
|
|
//we should be using only the zeromvinadc...
|
|
if (channel is Serialization.Test.Module.AnalogInputChannel aic &&
|
|
aic.LinearizationFormula.IsValid() &&
|
|
aic.ZeroMethod == ZeroMethodType.None)
|
|
{
|
|
Scaler.SetDataZeroLevelADC(0);
|
|
}
|
|
}
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
Scaler.SetDataZeroLevelADC(PreTestZeroLevelAdc);
|
|
}
|
|
Scaler.SetRemovedADC(channel.RemovedADC);
|
|
Scaler.SetRemovedInternalADC(channel.RemovedInternalADC);
|
|
|
|
try
|
|
{
|
|
if (channel.Data.UseEUScaleFactors && channel.TDASPersistentChannelInfo != null)
|
|
{
|
|
_ = Convert.ToDouble(channel.TDASPersistentChannelInfo.DataZeroLevelInCnts);
|
|
}
|
|
else
|
|
{
|
|
_ = Convert.ToDouble(DataZeroLevelAdc);
|
|
}
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("Failed to get datazeroleveladc", ex);
|
|
}
|
|
|
|
|
|
try { _ = Convert.ToDouble(PreTestZeroLevelAdc); }
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("Failed to retreive PreTestZeroLevelAdc", ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
Scaler.SetZeroMvInADC(ZeroMvInADC);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("Failed to set ZeroMvInADC", ex);
|
|
}
|
|
try
|
|
{
|
|
Scaler.SetWindowAverageADC(WindowAverageADC);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("Failed to set WindowAverageADC", ex);
|
|
}
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="SensorConstants.BridgeType"/> bridge configuration of this channel.
|
|
/// </summary>
|
|
public SensorConstants.BridgeType Bridge
|
|
{
|
|
get => _Bridge.Value;
|
|
set => _Bridge.Value = value;
|
|
}
|
|
private readonly Property<SensorConstants.BridgeType> _Bridge
|
|
= new Property<SensorConstants.BridgeType>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.BridgeType",
|
|
SensorConstants.BridgeType.FullBridge,
|
|
false
|
|
);
|
|
|
|
|
|
private readonly Property<double> _ZeroPoint
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ZeroPoint",
|
|
0D,
|
|
false);
|
|
|
|
public double ZeroPoint
|
|
{
|
|
get
|
|
{
|
|
if (_ZeroPoint.IsValueInitialized)
|
|
{
|
|
return _ZeroPoint.Value;
|
|
}
|
|
return 0D;
|
|
}
|
|
set => _ZeroPoint.Value = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the bridge resistance for this channel.
|
|
/// </summary>
|
|
public double BridgeResistanceOhms
|
|
{
|
|
get => _BridgeResistanceOhms.Value;
|
|
set => _BridgeResistanceOhms.Value = value;
|
|
}
|
|
private readonly Property<double> _BridgeResistanceOhms
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.BridgeResistanceOhms",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the description for this channel.
|
|
/// </summary>
|
|
public string Description
|
|
{
|
|
get => _Description.Value ?? "";
|
|
set => _Description.Value = value;
|
|
}
|
|
private readonly Property<string> _Description
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.Description",
|
|
"",
|
|
true
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the manufacturer for this channel.
|
|
/// </summary>
|
|
public string Manufacturer
|
|
{
|
|
get => _Manufacturer.Value ?? "";
|
|
set => _Manufacturer.Value = value;
|
|
}
|
|
private readonly Property<string> _Manufacturer
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.Manufacturer",
|
|
"",
|
|
true
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the description for this channel.
|
|
/// </summary>
|
|
public string Model
|
|
{
|
|
get => _Model.Value ?? "";
|
|
set => _Model.Value = value;
|
|
}
|
|
private readonly Property<string> _Model
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.Model",
|
|
"",
|
|
true
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the desired range for this channel.
|
|
/// </summary>
|
|
public double DesiredRange
|
|
{
|
|
get => _DesiredRange.Value;
|
|
set => _DesiredRange.Value = value;
|
|
}
|
|
private readonly Property<double> _DesiredRange
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.DesiredRange",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the sensor capacity for this channel.
|
|
/// </summary>
|
|
public double SensorCapacity
|
|
{
|
|
get => _SensorCapacity.Value;
|
|
set => _SensorCapacity.Value = value;
|
|
}
|
|
private readonly Property<double> _SensorCapacity
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.SensorCapacity",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the sensor polarity for this channel.
|
|
/// </summary>
|
|
public string SensorPolarity
|
|
{
|
|
get => _SensorPolarity.Value;
|
|
set => _SensorPolarity.Value = value;
|
|
}
|
|
private readonly Property<string> _SensorPolarity
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.SensorPolarity",
|
|
"",
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the sensitivity for this channel.
|
|
/// </summary>
|
|
public double Sensitivity
|
|
{
|
|
get => _Sensitivity.Value;
|
|
set => _Sensitivity.Value = value;
|
|
}
|
|
private readonly Property<double> _Sensitivity
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.Sensitivity",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the descriptor indiciating whether or not this channel is
|
|
/// proportional to excitation.
|
|
/// </summary>
|
|
public bool ProportionalToExcitation
|
|
{
|
|
get
|
|
{
|
|
try { return Scaler.ProportionalToExcitation; }
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ProportionalToExcitation property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try { Scaler.ProportionalToExcitation = value; }
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ProportionalToExcitation property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the nominal excitation voltage for this channel.
|
|
/// </summary>
|
|
public ExcitationVoltageOptions.ExcitationVoltageOption ExcitationVoltage
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.NominalExcitationVoltage;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.NominalExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.NominalExcitationVoltage = (value == ExcitationVoltageOptions.ExcitationVoltageOption.Undefined
|
|
? ParentModule.NominalExcitationVoltage
|
|
: value);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.NominalExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the measured excitation voltage for this channel.
|
|
/// </summary>
|
|
public double MeasuredExcitationVoltage
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.MeasuredExcitationVoltage;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.MeasuredExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.MeasuredExcitationVoltage = value;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.MeasuredExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool FactoryExcitationVoltageValid
|
|
{
|
|
get
|
|
{
|
|
if (null == Scaler || !Scaler.FactoryExcitationVoltageValid)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the factory excitation voltage for this channel.
|
|
/// </summary>
|
|
public double FactoryExcitationVoltage
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.FactoryExcitationVoltage;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.FactoryExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.FactoryExcitationVoltage = value;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.FactoryExcitationVoltage property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Get/set the engineering units for this channel.
|
|
/// </summary>
|
|
public string EngineeringUnits
|
|
{
|
|
get => _EngineeringUnits.Value;
|
|
set => _EngineeringUnits.Value = value;
|
|
}
|
|
private readonly Property<string> _EngineeringUnits
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.EngineeringUnits",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="bool"/> flag indicating whether or not this channel is
|
|
/// actually configured.
|
|
/// </summary>
|
|
public override bool IsConfigured
|
|
{
|
|
get => _IsConfigured.Value;
|
|
set => _IsConfigured.Value = value;
|
|
}
|
|
private readonly Property<bool> _IsConfigured
|
|
= new Property<bool>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.IsConfigured",
|
|
false,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set channel inversion status.
|
|
/// </summary>
|
|
public bool IsInverted
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.IsInverted;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception($"encountered problem getting {typeof(AnalogInputChannel).Namespace}.Event.Module.AnalogInputChannel.IsInverted property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.IsInverted = value;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.IsInverted property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set channel inversion status.
|
|
/// </summary>
|
|
public Common.Classes.Sensors.LinearizationFormula LinearizationFormula
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.GetLinearizationFormula();
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception($"encountered problem getting {typeof(AnalogInputChannel).Namespace}.Event.Module.AnalogInputChannel.LinearizationFormula property value", ex);
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.SetLinearizationFormula(value);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.LinearizationFormula property value", ex);
|
|
}
|
|
}
|
|
}
|
|
public DigitalInputScaleMultiplier DigitalMultiplier
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return Scaler.GetDigitalMultiplier();
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception($"encountered problem getting {typeof(AnalogInputChannel).Namespace}.Event.Module.AnalogInputChannel.DigitalMultiplier property value", ex);
|
|
}
|
|
}
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.SetDigitalMultiplier(value);
|
|
Scaler.Digital = Bridge == SensorConstants.BridgeType.DigitalInput;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting " + typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.DigitalMultiplier property value", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
public DigitalInputModes DigitalMode
|
|
{
|
|
get => Scaler.DigitalMode;
|
|
set
|
|
{
|
|
try
|
|
{
|
|
Scaler.DigitalMode = value;
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
//eat exception?
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get/set the ISO code for this channel's data source.
|
|
/// </summary>
|
|
public string IsoCode
|
|
{
|
|
get => _IsoCode.Value;
|
|
set => _IsoCode.Value = value;
|
|
}
|
|
private readonly Property<string> _IsoCode
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.IsoCode",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="double"/> measured shunt deflection value.
|
|
/// </summary>
|
|
public double MeasuredShuntDeflectionMv
|
|
{
|
|
get => _MeasuredShuntDeflectionMv.Value;
|
|
set => _MeasuredShuntDeflectionMv.Value = value;
|
|
}
|
|
private readonly Property<double> _MeasuredShuntDeflectionMv
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.MeasuredShuntDeflectionMv",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="double"/> target shunt deflection value.
|
|
/// </summary>
|
|
public double TargetShuntDeflectionMv
|
|
{
|
|
get => _TargetShuntDeflectionMv.Value;
|
|
set => _TargetShuntDeflectionMv.Value = value;
|
|
}
|
|
private readonly Property<double> _TargetShuntDeflectionMv
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.TargetShuntDeflectionMv",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="double"/> measured shunt deflection value.
|
|
/// </summary>
|
|
public double MeasuredCalSignalMv
|
|
{
|
|
get => _MeasuredCalSignalMv.Value;
|
|
set => _MeasuredCalSignalMv.Value = value;
|
|
}
|
|
private readonly Property<double> _MeasuredCalSignalMv
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.MeasuredCalSignalMv",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the <see cref="double"/> target shunt deflection value.
|
|
/// </summary>
|
|
public double TargetCalSignalMv
|
|
{
|
|
get => _TargetCalSignalMv.Value;
|
|
set => _TargetCalSignalMv.Value = value;
|
|
}
|
|
private readonly Property<double> _TargetCalSignalMv
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.TargetCalSignalMv",
|
|
0.0,
|
|
false
|
|
);
|
|
/// <summary>
|
|
/// Get/set the serial number for this channel's data source.
|
|
/// </summary>
|
|
public string SerialNumber
|
|
{
|
|
get => _SerialNumber.Value;
|
|
set => _SerialNumber.Value = value;
|
|
}
|
|
private readonly Property<string> _SerialNumber
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.SerialNumber",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the shunt enable indicator for this channel.
|
|
/// </summary>
|
|
public bool CalSignalEnabled
|
|
{
|
|
get
|
|
{
|
|
if (_CalSignalEnabled.IsInitialized) { return _CalSignalEnabled.Value; }
|
|
return false;
|
|
}
|
|
set => _CalSignalEnabled.Value = value;
|
|
}
|
|
private readonly Property<bool> _CalSignalEnabled
|
|
= new Property<bool>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.CalSignalEnabled",
|
|
false,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the shunt enable indicator for this channel.
|
|
/// </summary>
|
|
public bool ShuntEnabled
|
|
{
|
|
get => _ShuntEnabled.Value;
|
|
set => _ShuntEnabled.Value = value;
|
|
}
|
|
private readonly Property<bool> _ShuntEnabled
|
|
= new Property<bool>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ShuntEnabled",
|
|
false,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the shunt enable indicator for this channel.
|
|
/// </summary>
|
|
public bool VoltageInsertionCheckEnabled
|
|
{
|
|
get => _VoltageInsertionCheckEnabled.Value;
|
|
set => _VoltageInsertionCheckEnabled.Value = value;
|
|
}
|
|
private readonly Property<bool> _VoltageInsertionCheckEnabled
|
|
= new Property<bool>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.VoltageInsertionCheckEnabled",
|
|
false,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the remove offset option for this channel.
|
|
/// </summary>
|
|
public bool RemoveOffset
|
|
{
|
|
get => _RemoveOffset.Value;
|
|
set => _RemoveOffset.Value = value;
|
|
}
|
|
private readonly Property<bool> _RemoveOffset
|
|
= new Property<bool>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.RemoveOffset",
|
|
false,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the zero method option for this channel.
|
|
/// </summary>
|
|
public ZeroMethodType ZeroMethod
|
|
{
|
|
get => _ZeroMethod.Value;
|
|
set
|
|
{
|
|
_ZeroMethod.Value = value;
|
|
Scaler.ZeroMethodType = value;
|
|
}
|
|
}
|
|
private readonly Property<ZeroMethodType> _ZeroMethod
|
|
= new Property<ZeroMethodType>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ZeroMethod",
|
|
SensorConstants.DefaultZeroMethodType, // FB12764: Default in SensorConstants
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set zero average window definition.
|
|
/// </summary>
|
|
public IntervalSec ZeroAverageWindow
|
|
{
|
|
get => _ZeroAverageWindow.Value;
|
|
set => _ZeroAverageWindow.Value = value;
|
|
}
|
|
private readonly Property<IntervalSec> _ZeroAverageWindow
|
|
= new Property<IntervalSec>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.ZeroAverageWindow",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the initial EU value.
|
|
/// </summary>
|
|
public double InitialEu
|
|
{
|
|
get => _InitialEu.Value;
|
|
set => _InitialEu.Value = value;
|
|
}
|
|
private readonly Property<double> _InitialEu
|
|
= new Property<double>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.InitialEu",
|
|
0.0,
|
|
false
|
|
);
|
|
|
|
public string InitialOffset
|
|
{
|
|
get => _initialOffset.Value ?? "";
|
|
set
|
|
{
|
|
_initialOffset.Value = value;
|
|
Scaler.SetInitialOffset(value);
|
|
}
|
|
}
|
|
private readonly Property<string> _initialOffset
|
|
= new Property<string>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.InitalOffset",
|
|
"",
|
|
true);
|
|
|
|
/// <summary>
|
|
/// Get/set whether or not level trigge threshold values are automatically rounded.
|
|
/// </summary>
|
|
public bool DoRoundOffLevelTriggerThresholdValues { get; set; }
|
|
|
|
/// <summary>
|
|
/// Get/set the number of decimal places level trigger threshold values will automatically
|
|
/// be rounded to if DoRoundOffValues property is true.
|
|
/// </summary>
|
|
public int NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces
|
|
{
|
|
get => _NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces.Value;
|
|
set => _NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces.Value = value;
|
|
}
|
|
private readonly Property<int> _NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces =
|
|
new Property<int>(
|
|
typeof(AnalogInputChannel).Namespace + ".NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces",
|
|
6,
|
|
true
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the "trigger below" threshold. Set to "null" to deactivate.
|
|
/// </summary>
|
|
public double? TriggerBelowThresholdEu
|
|
{
|
|
get => (DoRoundOffLevelTriggerThresholdValues && null != _TriggerBelowThreshold.Value)
|
|
? Math.Round((double)_TriggerBelowThreshold.Value, NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces)
|
|
: _TriggerBelowThreshold.Value;
|
|
set => _TriggerBelowThreshold.Value = value;
|
|
}
|
|
private readonly Property<double?> _TriggerBelowThreshold
|
|
= new Property<double?>(
|
|
typeof(AnalogInputChannel).FullName + ".TriggerBelowThresholdEu",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Get/set the "trigger above" threshold. Set to "null" to deactivate.
|
|
/// </summary>
|
|
public double? TriggerAboveThresholdEu
|
|
{
|
|
get => (DoRoundOffLevelTriggerThresholdValues && null != _TriggerAboveThreshold.Value)
|
|
? Math.Round((double)_TriggerAboveThreshold.Value, NumberOfLevelTriggerThresholdValueRoundingDecimalPlaces)
|
|
: _TriggerAboveThreshold.Value;
|
|
set => _TriggerAboveThreshold.Value = value;
|
|
}
|
|
private readonly Property<double?> _TriggerAboveThreshold
|
|
= new Property<double?>(
|
|
typeof(AnalogInputChannel).FullName + ".TriggerAboveThresholdEu",
|
|
null,
|
|
false
|
|
);
|
|
|
|
private readonly Property<LevelTriggerTypes> _LevelTriggerType
|
|
= new Property<LevelTriggerTypes>(
|
|
typeof(AnalogInputChannel).FullName + ".LevelTriggerType",
|
|
Common.DAS.Concepts.DAS.Channel.LevelTriggerTypes.NONE,
|
|
true);
|
|
public LevelTriggerTypes LevelTriggerType
|
|
{
|
|
get => _LevelTriggerType.Value;
|
|
set => _LevelTriggerType.Value = value;
|
|
}
|
|
/// <summary>
|
|
/// Get data zero level counts.
|
|
/// </summary>
|
|
public override short DataZeroLevelAdc
|
|
{
|
|
get
|
|
{
|
|
if (null == _DataZeroLevelCounts)
|
|
switch (ZeroMethod)
|
|
{
|
|
case ZeroMethodType.AverageOverTime:
|
|
if ((ZeroAverageWindow.Begin == 0) && (ZeroAverageWindow.End == 0))
|
|
{
|
|
_DataZeroLevelCounts = PreTestZeroLevelAdc;
|
|
}
|
|
else
|
|
//if we have Average Over Time we do two things, if we have a known average via WindowAverageADC we use it
|
|
//otherwise we try to calculate it on the fly, we can handle older data and newer and it's done in a way
|
|
//similar to the other zeroing methods
|
|
//FB 16075 use WindowAverageADC if it's valid
|
|
if (WindowAverageADC != InvalidWindowAverage) { _DataZeroLevelCounts = WindowAverageADC; }
|
|
else
|
|
{
|
|
var preTriggerTime = 0D;
|
|
if (null != ParentModule.TriggerSampleNumbers)
|
|
{
|
|
preTriggerTime = (ParentModule.TriggerSampleNumbers[0] -
|
|
(double)ParentModule.StartRecordSampleNumber) /
|
|
ParentModule.SampleRateHz;
|
|
}
|
|
if (preTriggerTime < 0)
|
|
{
|
|
preTriggerTime = 0;
|
|
}
|
|
try
|
|
{
|
|
|
|
var numSamples =
|
|
(ulong)
|
|
((ZeroAverageWindow.End - ZeroAverageWindow.Begin) *
|
|
ParentModule.SampleRateHz) + 1;
|
|
var windowSamples = new double[numSamples];
|
|
var startingIndex =
|
|
((ulong)
|
|
((preTriggerTime + ZeroAverageWindow.Begin) *
|
|
ParentModule.SampleRateHz));
|
|
|
|
var pc =
|
|
UnfilteredData as Serialization.SliceRaw.File.PersistentChannel;
|
|
|
|
//18966 Data incorrect when performing multiple ROI downloads with dual-sensitivity sensor
|
|
//if PersistentChannelInfo is not memorymapped before
|
|
//this process, then unmap it when we are done, otherwise
|
|
//we may hold onto a file handle
|
|
var disposeWhenDone = !pc.IsMemoryMapped;
|
|
//if you have no samples, don't go any further:
|
|
//14051 Stuck "Finishing download" in run test tile
|
|
if (0 == pc.NumberOfSamples)
|
|
{
|
|
return PreTestZeroLevelAdc;
|
|
}
|
|
|
|
var insertPoint = 0;
|
|
for (var i = startingIndex; i < startingIndex + numSamples; i++)
|
|
{
|
|
//don't access indices that are out of range
|
|
if (i >= 0 && (long)i < pc.Length && i < long.MaxValue)
|
|
{
|
|
windowSamples[insertPoint++] = Convert.ToDouble(pc[i]);
|
|
}
|
|
}
|
|
if (disposeWhenDone)
|
|
{
|
|
pc.Dispose();
|
|
}
|
|
_DataZeroLevelCounts = Convert.ToInt16(windowSamples.Average());
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log(ex);
|
|
_DataZeroLevelCounts = PreTestZeroLevelAdc;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case
|
|
ZeroMethodType
|
|
.UsePreEventDiagnosticsZero:
|
|
_DataZeroLevelCounts = PreTestZeroLevelAdc;
|
|
break;
|
|
|
|
case ZeroMethodType.None:
|
|
//all NonLinear sensors use GetMv() which already makes an adjustment for ZeroMvInADC, so we don't want to double adjust ...
|
|
//per RJW, ZeroMvInADC is not what we want to use, we want to use FinalOffsetADC, which I don't seem to have, but I do have
|
|
//PreTestZeroLevelADC
|
|
if (null != LinearizationFormula && LinearizationFormula.IsValid()) { _DataZeroLevelCounts = 0; }
|
|
else { _DataZeroLevelCounts = ZeroMvInADC; }
|
|
break;
|
|
default:
|
|
throw new NotImplementedException("Data zero level count generation for zero method \"" + ZeroMethod.ToString() + "\" is not implemented");
|
|
}
|
|
return (short)_DataZeroLevelCounts;
|
|
}
|
|
}
|
|
private short? _DataZeroLevelCounts = null;
|
|
|
|
/// <summary>
|
|
/// Get/set the average value of all ADC so far added to this channel's data set.
|
|
/// </summary>
|
|
public AverageShortValueOverTime AverageAdcOverTime
|
|
{
|
|
get => _AverageAdcOverTime.Value;
|
|
set => _AverageAdcOverTime.Value = value;
|
|
}
|
|
private readonly Property<AverageShortValueOverTime> _AverageAdcOverTime
|
|
= new Property<AverageShortValueOverTime>(
|
|
typeof(AnalogInputChannel).Namespace + ".Event.Module.AnalogInputChannel.AverageAdcOverTime",
|
|
null,
|
|
false
|
|
);
|
|
|
|
/// <summary>
|
|
/// Set applicable analog input channel values from the corresponding
|
|
/// <see cref="DASLib.Serivce.CalibrationResult"/>-borne properties.
|
|
/// </summary>
|
|
///
|
|
/// <param name="calibrationResults">
|
|
/// The <see cref="DASLib.Service.CalibrationResult"/> containing values to be transfered
|
|
/// to this channel.
|
|
/// </param>
|
|
///
|
|
public override void SetPropertyValuesFrom(IDiagnosticResult calibrationResults)
|
|
{
|
|
try
|
|
{
|
|
if (null != calibrationResults.MeasuredExcitationMilliVolts)
|
|
MeasuredExcitationVoltage = (double)(calibrationResults.MeasuredExcitationMilliVolts) / 1000.0;
|
|
FactoryExcitationVoltage = calibrationResults.ExpectedExcitationMilliVolts / 1000.0;
|
|
base.SetPropertyValuesFrom(calibrationResults);
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting analog input channel property values from calibration results", ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set the appropriate properties in this class from the equivalent properties
|
|
/// of the specified object.
|
|
/// </summary>
|
|
///
|
|
///<param name="dasChannel">
|
|
/// The <see cref="DASChannel"/> object containing the
|
|
/// property values to be copied.
|
|
/// </param>
|
|
///
|
|
public override void SetPropertyValuesFrom(DASChannel dasChannel)
|
|
{
|
|
try
|
|
{
|
|
if (null == dasChannel)
|
|
throw new ArgumentNullException("could not initialize from null das channel reference");
|
|
if (!(dasChannel is AnalogInputDASChannel analogChannel))
|
|
throw new ArgumentException("could not interpret " + dasChannel.GetType().FullName + " initialization object as " + typeof(AnalogOutputDASChannel).FullName);
|
|
Scaler.Digital = analogChannel.TypeOfBridge == SensorConstants.BridgeType.DigitalInput;
|
|
Scaler.IEPE = analogChannel.IEPEChannel;
|
|
OffsetToleranceLowMv = analogChannel.OffsetToleranceLowMilliVolts;
|
|
OffsetToleranceHighMv = analogChannel.OffsetToleranceHighMilliVolts;
|
|
SensorID = analogChannel.SensorID;
|
|
LastCalibrationDate = analogChannel.LastCalibrationDate;
|
|
CalDueDate = analogChannel.CalDueDate;
|
|
Bridge = analogChannel.TypeOfBridge;
|
|
BridgeResistanceOhms = analogChannel.BridgeResistanceOhms;
|
|
ZeroPoint = analogChannel.ZeroPoint;
|
|
ChannelDescriptionString = analogChannel.ToString();
|
|
OriginalChannelName = analogChannel.OriginalChannelName;
|
|
ChannelName2 = analogChannel.ChannelName2;
|
|
ChannelId = analogChannel.ChannelId;
|
|
ChannelGroupName = analogChannel.ChannelGroupName;
|
|
HardwareChannelName = analogChannel.HardwareChannelName;
|
|
UserValue1 = analogChannel.UserValue1;
|
|
UserValue2 = analogChannel.UserValue2;
|
|
UserValue3 = analogChannel.UserValue3;
|
|
SetupEID = analogChannel.SetupEID;
|
|
DataCollectionEID = analogChannel.DataCollectionEID;
|
|
Description = analogChannel.Description;
|
|
Manufacturer = analogChannel.Manufacturer;
|
|
Model = analogChannel.Model;
|
|
DesiredRange = analogChannel.SensorCapacityEU;
|
|
SensorCapacity = analogChannel.SensorCapacity;
|
|
SensorPolarity = analogChannel.SensorPolarity;
|
|
EngineeringUnits = analogChannel.EngineeringUnits;
|
|
ExcitationVoltage = analogChannel.Excitation;
|
|
IsConfigured = analogChannel.IsConfigured();
|
|
IsInverted = analogChannel.IsInverted;
|
|
LinearizationFormula = analogChannel.LinearizationFormula;
|
|
DigitalMultiplier = analogChannel.DigitalMultiplier;
|
|
DigitalMode = analogChannel.DigitalMode;
|
|
InitialEu = analogChannel.InitialEU;
|
|
ZeroMvInADC = analogChannel.ZeromVInADC;
|
|
InitialOffset = analogChannel.InitialOffset;
|
|
IsoCode = analogChannel.ISOCode;
|
|
Number = analogChannel.ModuleChannelNumber;
|
|
AbsoluteDisplayOrder = analogChannel.AbsoluteDisplayOrder;
|
|
ProportionalToExcitation = analogChannel.IsProportionalToExcitation;
|
|
AtCapacity = analogChannel.AtCapacity;
|
|
CapacityOutputIsBasedOn = analogChannel.CapacityOutputIsBasedOn;
|
|
SensitivityUnits = analogChannel.SensitivityUnits;
|
|
RemoveOffset = analogChannel.RemoveOffset;
|
|
MvPerEu = analogChannel.SensitivityMilliVoltsPerEU;// *(analogChannel.IsProportionalToExcitation ? DTS.Common.DAS.Concepts.Test.Module.Channel.Sensor.GetExcitationVoltageMagnitudeFromEnum(analogChannel.Excitation) : 1);
|
|
ScaleFactorMv = analogChannel.ScalefactorMilliVoltsPerADC;
|
|
UnitConversion = analogChannel.UnitConverision;
|
|
Sensitivity = analogChannel.SensitivityMilliVoltsPerEU;
|
|
SerialNumber = analogChannel.SerialNumber;
|
|
ShuntEnabled = analogChannel.ShuntIsEnabled;
|
|
VoltageInsertionCheckEnabled = analogChannel.VoltageInsertionCheckEnabled;
|
|
CalSignalEnabled = analogChannel.CalSignalIsEnabled;
|
|
Start = analogChannel.EventStartTime;
|
|
NoiseAsPercentageOfFullScale = analogChannel.NoiseAsPercentOfFullScale;
|
|
UserCode = analogChannel.UserCode;
|
|
UserChannelName = analogChannel.UserChannelName;
|
|
IsoChannelName = analogChannel.IsoChannelName;
|
|
LinearSensorCalibration = analogChannel.LinearSensorCalibration;
|
|
// Note that we'll have to change this logic when ISO codes are introduced, so
|
|
// we'll know to create a CFC filter instead of an ad hoc which appropriate, and
|
|
// vice versa.
|
|
if (analogChannel.SoftwareFilterFrequency < 0)
|
|
{
|
|
CurrentFilter = new SaeJ211Filter(ChannelFilter.UnfilteredZero);
|
|
}
|
|
else
|
|
{
|
|
CurrentFilter = analogChannel.SoftwareFilterFrequency > 0
|
|
? new SaeJ211Filter(analogChannel.SoftwareFilterFrequency)
|
|
: new SaeJ211Filter(ChannelFilter.Unfiltered);
|
|
}
|
|
|
|
if (!AvailableFilters.Contains(CurrentFilter))
|
|
AvailableFilters.Add(CurrentFilter);
|
|
|
|
UserValue1 = analogChannel.UserValue1;
|
|
UserValue2 = analogChannel.UserValue2;
|
|
UserValue3 = analogChannel.UserValue3;
|
|
|
|
ZeroAverageWindow = new IntervalSec(analogChannel.ZeroAverageStartSeconds,
|
|
analogChannel.ZeroAverageStopSeconds);
|
|
ZeroMethod = analogChannel.ZeroMethod;
|
|
|
|
DataCollectionEID = analogChannel.DataCollectionEID;
|
|
SetupEID = analogChannel.SetupEID;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem setting property values from " + (null != dasChannel ? dasChannel.GetType().FullName : "<<NULL>>") + " object", ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Convert this object to a DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <returns>
|
|
/// The <see cref="Serialization.Test.Module.Channel"/> equivalent to this object.
|
|
/// </returns>
|
|
///
|
|
public override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(Serialization.Test.Module parentModule)
|
|
{
|
|
try
|
|
{
|
|
var that
|
|
= new Serialization.Test.Module.AnalogInputChannel(parentModule);
|
|
|
|
if (!IsConfigured)
|
|
throw new Exception("cannot serialize unconfigured analog input channel");
|
|
|
|
that.AverageAdcOverTime = AverageAdcOverTime;
|
|
that.Bridge = Bridge;
|
|
that.BridgeResistanceOhms = BridgeResistanceOhms;
|
|
that.ZeroPoint = ZeroPoint;
|
|
that.ChannelDescriptionString = ChannelDescriptionString;
|
|
that.ChannelId = ChannelId;
|
|
that.ChannelGroupName = ChannelGroupName;
|
|
that.OriginalChannelName = OriginalChannelName ?? "N/A";
|
|
that.ChannelName2 = ChannelName2 ?? "N/A";
|
|
that.HardwareChannelName = HardwareChannelName ?? "N/A";
|
|
that.Description = Description;
|
|
that.Manufacturer = Manufacturer;
|
|
that.Model = Model;
|
|
that.DesiredRange = DesiredRange;
|
|
that.EngineeringUnits = EngineeringUnits;
|
|
that.ExcitationVoltage = ExcitationVoltage;
|
|
that.InitialOffset = InitialOffset;
|
|
that.InitialEu = InitialEu;
|
|
that.DigitalMultiplier = DigitalMultiplier;
|
|
that.DigitalMode = DigitalMode;
|
|
that.LinearizationFormula = LinearizationFormula;
|
|
that.LinearSensorCalibration = LinearSensorCalibration;
|
|
that.IsInverted = IsInverted;
|
|
that.IsSubsampled = IsSubsampled;
|
|
if (IsLastCalibrationDateValid) { that.LastCalibrationDate = LastCalibrationDate; }
|
|
if (IsCalDueDateValid) { that.CalDueDate = CalDueDate; }
|
|
if (IsSensorIDValid) { that.SensorID = SensorID; }
|
|
if (IsOffsetToleranceLowMvValid) { that.OffsetToleranceLowMv = OffsetToleranceLowMv; }
|
|
if (IsOffsetToleranceHighMvValid) { that.OffsetToleranceHighMv = OffsetToleranceHighMv; }
|
|
|
|
if (IsIsoChannelNameValid) { that.IsoChannelName = IsoChannelName; }
|
|
if (IsUserCodeValid) { that.UserCode = UserCode; }
|
|
if (IsUserChannelNameValid) { that.UserChannelName = UserChannelName; }
|
|
|
|
that.UserValue1 = UserValue1;
|
|
that.UserValue2 = UserValue2;
|
|
that.UserValue3 = UserValue3;
|
|
|
|
that.SetupEID = SetupEID;
|
|
that.DataCollectionEID = DataCollectionEID;
|
|
|
|
that.IsoCode = IsoCode;
|
|
that.NoiseAsPercentageOfFullScale = NoiseAsPercentageOfFullScale;
|
|
that.Number = Number;
|
|
that.AbsoluteDisplayOrder = AbsoluteDisplayOrder;
|
|
that.PreTestZeroLevelAdc = PreTestZeroLevelAdc;
|
|
that.ZeroMvInADC = ZeroMvInADC;
|
|
that.AbsoluteDisplayOrder = AbsoluteDisplayOrder;
|
|
that.WindowAverageADC = WindowAverageADC;
|
|
|
|
that.RemovedADC = RemoveOffset ? RemovedADC : 0;
|
|
|
|
that.ProportionalToExcitation = ProportionalToExcitation;
|
|
that.AtCapacity = AtCapacity;
|
|
that.CapacityOutputIsBasedOn = CapacityOutputIsBasedOn;
|
|
that.SensitivityUnits = SensitivityUnits;
|
|
that.RemoveOffset = RemoveOffset;
|
|
that.Sensitivity = Sensitivity;
|
|
that.SerialNumber = SerialNumber;
|
|
that.ShuntEnabled = ShuntEnabled;
|
|
that.VoltageInsertionCheckEnabled = VoltageInsertionCheckEnabled;
|
|
that.CalSignalEnabled = CalSignalEnabled;
|
|
that.Start = Start;
|
|
that.ZeroAverageWindow = ZeroAverageWindow;
|
|
that.ZeroMethod = ZeroMethod;
|
|
if (_MeasuredShuntDeflectionMv.IsInitialized)
|
|
{
|
|
try { that.MeasuredShuntDeflectionMv = MeasuredShuntDeflectionMv; }
|
|
catch { }; // *** potentially unitialized ***
|
|
}
|
|
if (_TargetShuntDeflectionMv.IsInitialized)
|
|
{
|
|
try { that.TargetShuntDeflectionMv = TargetShuntDeflectionMv; }
|
|
catch { }; //
|
|
}
|
|
if (_MeasuredCalSignalMv.IsInitialized)
|
|
{
|
|
try { that.MeasuredCalSignalMv = MeasuredCalSignalMv; }
|
|
catch { }; // *** potentially unitialized ***
|
|
}
|
|
if (_TargetCalSignalMv.IsInitialized)
|
|
{
|
|
try { that.TargetCalSignalMv = TargetCalSignalMv; }
|
|
catch { }; //
|
|
}
|
|
if (_TriggerAboveThreshold.IsInitialized)
|
|
{
|
|
try { that.TriggerAboveThresholdEu = TriggerAboveThresholdEu; }
|
|
catch { }; //
|
|
}
|
|
if (_TriggerBelowThreshold.IsInitialized)
|
|
{
|
|
try { that.TriggerBelowThresholdEu = TriggerBelowThresholdEu; }
|
|
catch { }; //
|
|
}
|
|
if (_LevelTriggerType.IsInitialized)
|
|
{
|
|
try { that.LevelTriggerType = LevelTriggerType; }
|
|
catch { };
|
|
}
|
|
if (Scaler.MeasuredExcitationVoltageValid)
|
|
{
|
|
try { that.MeasuredExcitationVoltage = MeasuredExcitationVoltage; }
|
|
catch { };
|
|
}
|
|
if (Scaler.FactoryExcitationVoltageValid)
|
|
{
|
|
try { that.FactoryExcitationVoltage = FactoryExcitationVoltage; }
|
|
catch { };
|
|
}
|
|
|
|
try
|
|
{
|
|
if (TimeOfFirstSampleSecValid)
|
|
{
|
|
that.TimeOfFirstSampleSec = TimeOfFirstSampleSec;
|
|
}
|
|
}
|
|
catch { };
|
|
//FB 13120 Mapping between FilterClassType and ChannelFilter
|
|
if (CurrentFilter.Type == ChannelFilter.UnfilteredZero)
|
|
{
|
|
that.SoftwareFilter = FilterClassType.Unfiltered.ToString();
|
|
}
|
|
else if (CurrentFilter.Type == ChannelFilter.Unfiltered)
|
|
{
|
|
that.SoftwareFilter = FilterClassType.None.ToString();
|
|
}
|
|
else
|
|
{
|
|
that.SoftwareFilter = CurrentFilter.ToBaseString();
|
|
}
|
|
that.UnitConversion = UnitConversion;
|
|
that.AtCapacity = AtCapacity;
|
|
that.CapacityOutputIsBasedOn = CapacityOutputIsBasedOn;
|
|
|
|
that.SensitivityUnits = SensitivityUnits;
|
|
|
|
that.Data = new Serialization.Test.Module.Channel.DataArray<short>
|
|
{
|
|
MvPerEu = GetMvPerEu(),
|
|
ScaleFactorMv = GetScaleFactorMv(),
|
|
UseEUScaleFactors = UseEUScaler,
|
|
ScaleFactorEU = ScaleFactorEU,
|
|
Multiplier = Multiplier,
|
|
UserOffsetEU = UserOffsetEU
|
|
}; // this.UnfilteredData.ToArray( ) );
|
|
that.UserOffsetEU = UserOffsetEU;
|
|
that.Multiplier = Multiplier;
|
|
if (UnfilteredData is Serialization.SliceRaw.File.PersistentChannel persistentChannelInfo)
|
|
that.PersistentChannelInfo = persistentChannelInfo;
|
|
that.SensorCapacity = SensorCapacity;
|
|
that.SensorPolarity = SensorPolarity;
|
|
|
|
that.IsSupersampled = IsSupersampled;
|
|
that.UnsupersampledSampleRateHz = UnsupersampledSampleRateHz;
|
|
|
|
if (Saturated && that.DataFlag == (int)DataFlag.Normal)
|
|
{
|
|
that.DataFlag = (int)DataFlag.Saturated;
|
|
}
|
|
|
|
return that;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem converting " + GetType().FullName + " to " + typeof(Serialization.Test.Module.AnalogInputChannel), ex);
|
|
}
|
|
}
|
|
private void FromDtsSerializationTestModuleChannelOptionalProperties(Serialization.Test.Module.AnalogInputChannel thatAnalogChannel)
|
|
{
|
|
try
|
|
{
|
|
if (thatAnalogChannel.MeasureShuntDeflectionMvValid)
|
|
{
|
|
MeasuredShuntDeflectionMv = thatAnalogChannel.MeasuredShuntDeflectionMv;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.TargetShuntDeflectionMvValid)
|
|
{
|
|
TargetShuntDeflectionMv = thatAnalogChannel.TargetShuntDeflectionMv;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.MeasuredCalSignalMvValid)
|
|
{
|
|
MeasuredCalSignalMv = thatAnalogChannel.MeasuredCalSignalMv;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.TargetCalSignalMvValid)
|
|
{
|
|
TargetCalSignalMv = thatAnalogChannel.TargetCalSignalMv;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.TriggerAboveThresholdValid)
|
|
{
|
|
TriggerAboveThresholdEu = thatAnalogChannel.TriggerAboveThresholdEu;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.TriggerBelowThresholdValid)
|
|
{
|
|
TriggerBelowThresholdEu = thatAnalogChannel.TriggerBelowThresholdEu;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
try
|
|
{
|
|
if (thatAnalogChannel.LevelTriggerTypeValid)
|
|
{
|
|
LevelTriggerType = thatAnalogChannel.LevelTriggerType;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.MeasuredExcitationVoltageValid)
|
|
{
|
|
MeasuredExcitationVoltage = thatAnalogChannel.MeasuredExcitationVoltage;
|
|
}
|
|
}
|
|
catch { /* leave it uninitialized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.FactoryExcitationVoltageValid)
|
|
{
|
|
FactoryExcitationVoltage = thatAnalogChannel.FactoryExcitationVoltage;
|
|
}
|
|
}
|
|
catch { /* leave it uninitialized */ }
|
|
|
|
try
|
|
{
|
|
if (thatAnalogChannel.TimeOfFirstSampleValid)
|
|
{
|
|
TimeOfFirstSampleSec = thatAnalogChannel.TimeOfFirstSampleSec;
|
|
}
|
|
}
|
|
catch { /* Leave uninitalized */ }
|
|
}
|
|
/// <summary>
|
|
/// Initialize this object from a DTS.Serialization.Test.Module.Channel.
|
|
/// </summary>
|
|
///
|
|
/// <param name="that">
|
|
/// The <see cref="Serialization.Test.Module.Channel"/> from which to initialize this object.
|
|
/// </param>
|
|
///
|
|
public override void FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel that)
|
|
{
|
|
try
|
|
{
|
|
if (null == that)
|
|
throw new ArgumentNullException("cannot initialize " + GetType().FullName + " object from a null test module channel reference");
|
|
if ((that is Serialization.Test.Module.AnalogInputChannel) || (that is Serialization.Test.Module.CalculatedChannel))
|
|
{
|
|
var thatAnalogChannel = (Serialization.Test.Module.AnalogInputChannel)that;
|
|
//FB 16075 copy WindowAverageADC
|
|
WindowAverageADC = thatAnalogChannel.WindowAverageADC;
|
|
AverageAdcOverTime = thatAnalogChannel.AverageAdcOverTime;
|
|
Bridge = thatAnalogChannel.Bridge;
|
|
BridgeResistanceOhms = thatAnalogChannel.BridgeResistanceOhms;
|
|
ZeroPoint = thatAnalogChannel.ZeroPoint;
|
|
ChannelId = thatAnalogChannel.ChannelId;
|
|
ChannelGroupName = thatAnalogChannel.ChannelGroupName;
|
|
ChannelDescriptionString = thatAnalogChannel.ChannelDescriptionString;
|
|
OriginalChannelName = thatAnalogChannel.OriginalChannelName;
|
|
ChannelName2 = thatAnalogChannel.ChannelName2;
|
|
HardwareChannelName = thatAnalogChannel.HardwareChannelName;
|
|
UserValue1 = thatAnalogChannel.UserValue1;
|
|
UserValue2 = thatAnalogChannel.UserValue2;
|
|
UserValue3 = thatAnalogChannel.UserValue3;
|
|
SetupEID = thatAnalogChannel.SetupEID;
|
|
DataCollectionEID = thatAnalogChannel.DataCollectionEID;
|
|
Description = thatAnalogChannel.Description;
|
|
Manufacturer = thatAnalogChannel.Manufacturer;
|
|
Model = thatAnalogChannel.Model;
|
|
DesiredRange = thatAnalogChannel.DesiredRange;
|
|
try
|
|
{
|
|
SensorCapacity = thatAnalogChannel.SensorCapacity;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("could not get sensorcapacity, ", ex);
|
|
}
|
|
try
|
|
{
|
|
SensorPolarity = thatAnalogChannel.SensorPolarity;
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("could not get sensorpolarity, ", ex);
|
|
}
|
|
EngineeringUnits = thatAnalogChannel.EngineeringUnits;
|
|
ExcitationVoltage = thatAnalogChannel.ExcitationVoltage;
|
|
IsConfigured = true;
|
|
IsInverted = thatAnalogChannel.IsInverted;
|
|
LinearizationFormula = thatAnalogChannel.LinearizationFormula;
|
|
DigitalMultiplier = thatAnalogChannel.DigitalMultiplier;
|
|
DigitalMode = thatAnalogChannel.DigitalMode;
|
|
IsSubsampled = thatAnalogChannel.IsSubsampled;
|
|
|
|
if (thatAnalogChannel.IsLastCalibrationDateValid) { LastCalibrationDate = thatAnalogChannel.LastCalibrationDate; }
|
|
if (thatAnalogChannel.IsCalDueDateValid) { CalDueDate = thatAnalogChannel.CalDueDate; }
|
|
if (thatAnalogChannel.IsSensorIDValid) { SensorID = thatAnalogChannel.SensorID; }
|
|
if (thatAnalogChannel.IsOffsetToleranceLowMvValid) { OffsetToleranceLowMv = thatAnalogChannel.OffsetToleranceLowMv; }
|
|
if (thatAnalogChannel.IsOffsetToleranceHighMvValid) { OffsetToleranceHighMv = thatAnalogChannel.OffsetToleranceHighMv; }
|
|
|
|
if (thatAnalogChannel.IsIsoChannelNameValid)
|
|
{
|
|
IsoChannelName = thatAnalogChannel.IsoChannelName;
|
|
}
|
|
|
|
if (thatAnalogChannel.IsUserCodeValid)
|
|
{
|
|
UserCode = thatAnalogChannel.UserCode;
|
|
}
|
|
|
|
if (thatAnalogChannel.IsUserChannelNameValid)
|
|
{
|
|
UserChannelName = thatAnalogChannel.UserChannelName;
|
|
}
|
|
InitialOffset = thatAnalogChannel.InitialOffset;
|
|
InitialEu = thatAnalogChannel.InitialEu;
|
|
if (thatAnalogChannel.IsIsoCodeValid) { IsoCode = thatAnalogChannel.IsoCode; }
|
|
NoiseAsPercentageOfFullScale = thatAnalogChannel.NoiseAsPercentageOfFullScale;
|
|
Number = thatAnalogChannel.Number;
|
|
PreTestZeroLevelAdc = thatAnalogChannel.PreTestZeroLevelAdc;
|
|
WindowAverageADC = thatAnalogChannel.WindowAverageADC;
|
|
|
|
ZeroMvInADC = thatAnalogChannel.ZeroMvInADC;
|
|
|
|
AbsoluteDisplayOrder = thatAnalogChannel.AbsoluteDisplayOrder;
|
|
RemovedADC = thatAnalogChannel.RemoveOffset ? thatAnalogChannel.RemovedADC : 0;
|
|
|
|
ProportionalToExcitation = thatAnalogChannel.ProportionalToExcitation;
|
|
RemoveOffset = thatAnalogChannel.RemoveOffset;
|
|
Sensitivity = thatAnalogChannel.Sensitivity;
|
|
SerialNumber = thatAnalogChannel.SerialNumber;
|
|
ShuntEnabled = thatAnalogChannel.ShuntEnabled;
|
|
VoltageInsertionCheckEnabled = thatAnalogChannel.VoltageInsertionCheckEnabled;
|
|
CalSignalEnabled = thatAnalogChannel.CalSignalEnabled;
|
|
Start = thatAnalogChannel.Start;
|
|
ZeroAverageWindow = thatAnalogChannel.ZeroAverageWindow;
|
|
ZeroMethod = thatAnalogChannel.ZeroMethod;
|
|
UnitConversion = thatAnalogChannel.UnitConversion;
|
|
AtCapacity = thatAnalogChannel.AtCapacity;
|
|
CapacityOutputIsBasedOn = thatAnalogChannel.CapacityOutputIsBasedOn;
|
|
|
|
SensitivityUnits = thatAnalogChannel.SensitivityUnits;
|
|
|
|
IsSupersampled = thatAnalogChannel.IsSupersampled;
|
|
UseEUScaler = thatAnalogChannel.Data.UseEUScaleFactors;
|
|
ScaleFactorEU = thatAnalogChannel.Data.ScaleFactorEU;
|
|
UnsupersampledSampleRateHz = thatAnalogChannel.UnsupersampledSampleRateHz;
|
|
|
|
FromDtsSerializationTestModuleChannelOptionalProperties(thatAnalogChannel);
|
|
|
|
CurrentFilter = SaeJ211Filter.Parse(thatAnalogChannel.SoftwareFilter);
|
|
|
|
if (!AvailableFilters.Contains(CurrentFilter))
|
|
AvailableFilters.Add(CurrentFilter);
|
|
|
|
MvPerEu = that.Data.MvPerEu;
|
|
ScaleFactorMv = that.Data.ScaleFactorMv;
|
|
|
|
if (thatAnalogChannel.PersistentChannelInfo == null)
|
|
{
|
|
UnfilteredData = thatAnalogChannel.TDASPersistentChannelInfo;
|
|
}
|
|
else
|
|
{
|
|
UnfilteredData = thatAnalogChannel.PersistentChannelInfo;
|
|
}
|
|
|
|
FileName = thatAnalogChannel.FileName ?? string.Empty;
|
|
|
|
}
|
|
else
|
|
{
|
|
throw new ArgumentException("Can't initialize from a " + that.GetType().FullName + " object");
|
|
}
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem initializing from " + GetType().FullName + " to " + typeof(Serialization.Test.Module.Channel).FullName, ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generate a <see cref="string"/> representation for this object.
|
|
/// </summary>
|
|
///
|
|
/// <returns>
|
|
/// The <see cref="string"/> representation of this object.
|
|
/// </returns>
|
|
///
|
|
public override string ToString()
|
|
{
|
|
try
|
|
{
|
|
return !string.IsNullOrEmpty(ChannelDescriptionString) ? ChannelDescriptionString : Description;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem getting string representation", ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range in EU.
|
|
/// </summary>
|
|
public override double DataRangeEu => Math.Abs(Scaler.GetEU(DataRangeAdc));
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data range/2 in EU.
|
|
/// </summary>
|
|
public override double DataHalfRangeValueEu => Scaler.GetEU(DataHalfRangeValueAdc);
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data min in EU.
|
|
/// </summary>
|
|
public override double DataMinEu => (Scaler.GetAdcToEuScalingFactor() >= 0) ?
|
|
Scaler.GetEU(DataMinAdc) :
|
|
Scaler.GetEU(DataMaxAdc);
|
|
|
|
/// <summary>
|
|
/// Get the <see cref="double"/> data max in EU.
|
|
/// </summary>
|
|
public override double DataMaxEu => (Scaler.GetAdcToEuScalingFactor() >= 0) ?
|
|
Scaler.GetEU(DataMaxAdc) :
|
|
Scaler.GetEU(DataMinAdc);
|
|
|
|
/// <summary>
|
|
/// Get the actual available maximum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMaxRangeEu
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
var min = Scaler.GetEU(ActualMinRangeAdc);
|
|
var max = Scaler.GetEU(ActualMaxRangeAdc);
|
|
if (double.IsNaN(min) || double.IsNaN(max))
|
|
{
|
|
min = -150;
|
|
max = 150;
|
|
}
|
|
else if (min > max)
|
|
{
|
|
var temp = min;
|
|
min = max;
|
|
max = temp;
|
|
}
|
|
|
|
if ((Scaler.GetAdcToEuScalingFactor() >= 0 || ((true == IsInverted) ^ (Sensitivity < 0))))
|
|
{
|
|
return max;
|
|
}
|
|
return min;
|
|
//return (Scaler.GetAdcToEuScalingFactor() >= 0) ? max : min;
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem calculating actual max EU range", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the actual available minimum EU range based on scaling factor and bit resolution.
|
|
/// </summary>
|
|
public override double ActualMinRangeEu
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
var min = Scaler.GetEU(ActualMinRangeAdc);
|
|
var max = Scaler.GetEU(ActualMaxRangeAdc);
|
|
if (double.IsNaN(min) || double.IsNaN(max))
|
|
{
|
|
min = -150;
|
|
max = 150;
|
|
}
|
|
else if (min > max)
|
|
{
|
|
var temp = min;
|
|
min = max;
|
|
max = temp;
|
|
}
|
|
if ((Scaler.GetAdcToEuScalingFactor() >= 0 || ((true == IsInverted) ^ (Sensitivity < 0))))
|
|
{
|
|
return min;
|
|
}
|
|
return max;
|
|
//return (Scaler.GetAdcToEuScalingFactor() >= 0) ? min : max;
|
|
|
|
}
|
|
|
|
catch (System.Exception ex)
|
|
{
|
|
throw new Exception("encountered problem calculating actual min EU range", ex);
|
|
}
|
|
}
|
|
}
|
|
public void PersistentChannelUnset()
|
|
{
|
|
if (UnfilteredData is Serialization.SliceRaw.File.PersistentChannel persistentChannelInfo)
|
|
{
|
|
persistentChannelInfo.UnSet();
|
|
}
|
|
else
|
|
{
|
|
//Viewing TDC data
|
|
((Serialization.TDAS.File.PersistentChannel)UnfilteredData).UnSet();
|
|
}
|
|
}
|
|
public override List<double> GetUnfilteredDataEu()
|
|
{
|
|
if (UnfilteredData is Serialization.SliceRaw.File.PersistentChannel persistentChannelInfo)
|
|
{
|
|
using (var persistentUnfilteredData = persistentChannelInfo)
|
|
{
|
|
var dataCount = persistentUnfilteredData.Count;
|
|
var adc = persistentChannelInfo.GetAllData();
|
|
var Unfiltered_Data_Eu = new List<double>(dataCount);
|
|
for (var i = 0; i < dataCount; i++)
|
|
{
|
|
try
|
|
{
|
|
var temp = Scaler.GetEU(adc[i]);
|
|
Unfiltered_Data_Eu.Add(temp);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("problem getting SliceRAW unfiltered data ", ex);
|
|
}
|
|
}
|
|
return Unfiltered_Data_Eu;
|
|
}
|
|
}
|
|
using (var persistentUnfilteredData = (Serialization.TDAS.File.PersistentChannel)UnfilteredData)
|
|
{
|
|
var dataCount = persistentUnfilteredData.Count;
|
|
var Unfiltered_Data_Eu = new List<double>(dataCount);
|
|
for (var i = 0; i < dataCount; i++)
|
|
{
|
|
try
|
|
{
|
|
var temp = Scaler.GetEU(persistentUnfilteredData[i]);
|
|
Unfiltered_Data_Eu.Add(temp);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("problem getting TDAS unfiltered data ", ex);
|
|
}
|
|
}
|
|
return Unfiltered_Data_Eu;
|
|
}
|
|
}
|
|
public override List<double> GetUnfilteredDataMV()
|
|
{
|
|
if (UnfilteredData is Serialization.SliceRaw.File.PersistentChannel persistentChannelInfo)
|
|
{
|
|
using (var persistentUnfilteredData = persistentChannelInfo)
|
|
{
|
|
var adc = persistentChannelInfo.GetAllData();
|
|
var dataCount = persistentUnfilteredData.Count;
|
|
var Unfiltered_Data_MV = new List<double>(dataCount);
|
|
for (var i = 0; i < dataCount; i++)
|
|
{
|
|
try
|
|
{
|
|
var temp = Scaler.GetMv(adc[i]);
|
|
Unfiltered_Data_MV.Add(temp);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("problem getting SliceRAW unfiltered data ", ex);
|
|
}
|
|
}
|
|
return Unfiltered_Data_MV;
|
|
}
|
|
}
|
|
using (var persistentUnfilteredData = (Serialization.TDAS.File.PersistentChannel)UnfilteredData)
|
|
{
|
|
var dataCount = persistentUnfilteredData.Count;
|
|
var Unfiltered_Data_MV = new List<double>(dataCount);
|
|
for (var i = 0; i < dataCount; i++)
|
|
{
|
|
try
|
|
{
|
|
var temp = Scaler.GetMv(persistentUnfilteredData[i]);
|
|
Unfiltered_Data_MV.Add(temp);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
APILogger.Log("problem getting TDAS unfiltered data ", ex);
|
|
}
|
|
}
|
|
return Unfiltered_Data_MV;
|
|
}
|
|
}
|
|
public override double DesiredRangeEU => DesiredRange;
|
|
public override double SensorCapacityEU => SensorCapacity;
|
|
}
|
|
}
|
|
}
|
|
} |