1249 lines
59 KiB
Plaintext
1249 lines
59 KiB
Plaintext
|
|
/*
|
||
|
|
* DTS.Slice.Control.Event.Module.cs
|
||
|
|
*
|
||
|
|
* Copyright © 2009
|
||
|
|
* Diversified Technical Systems, Inc.
|
||
|
|
* All Rights Reserved
|
||
|
|
*/
|
||
|
|
|
||
|
|
using DTS.Common.DAS.Concepts;
|
||
|
|
using DTS.Common.Utilities;
|
||
|
|
using DTS.Common.Utilities.DotNetProgrammingConstructs;
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Diagnostics;
|
||
|
|
using System.Linq;
|
||
|
|
using DTS.Common.Enums.Sensors;
|
||
|
|
using DTS.Common.Classes.Sensors;
|
||
|
|
using DTS.Common.DASResource;
|
||
|
|
using DTS.Common.Enums;
|
||
|
|
using DTS.Common.Utilities.Logging;
|
||
|
|
using DTS.Common.Enums.DASFactory;
|
||
|
|
|
||
|
|
namespace DTS.Slice.Control
|
||
|
|
{
|
||
|
|
// *** see DTS.Slice.Control.Event.cs ***
|
||
|
|
public partial class Event
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Representation of a Slice Control event module.
|
||
|
|
/// </summary>
|
||
|
|
public partial class Module
|
||
|
|
: Exceptional,
|
||
|
|
Serialization.Test.Module.IConvertable
|
||
|
|
{
|
||
|
|
public Module()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
//this.InitializeReviewableAttributes(this.ReviewableAttributes);
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem zero-parameter constructing " + GetType().FullName, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module class.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="parentEvent">
|
||
|
|
/// The parent <see cref="DTS.Slice.Control.Event"/> of this module.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
//TODO: this() is not base class
|
||
|
|
public Module(Event parentEvent)
|
||
|
|
: this()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
ParentEvent = parentEvent;
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encounterd problem 1-parameter constructing " + GetType().FullName, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Initialize an instance of the DTS.Slice.Control.Event.Module class.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="that">
|
||
|
|
/// A <see cref="DTS.Serialization.Test.Module"/> with which to initialize this object.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
/// <param name="parentEvent">
|
||
|
|
/// The parent <see cref="DTS.Slice.Control.Event"/> of this module.
|
||
|
|
/// </param>
|
||
|
|
/// <param name="parent"></param>
|
||
|
|
/// <param name="reportErrors"></param>
|
||
|
|
public Module(Serialization.Test.Module that, Event parent, Serialization.Test.ReportErrors reportErrors)
|
||
|
|
: this(parent)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
FromDtsSerializationTestModule(that, reportErrors);
|
||
|
|
}
|
||
|
|
catch (System.IO.InvalidDataException) { throw; }
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem 2-parameter constructing " + GetType().FullName, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// The <see cref="Event"/> that contains this module.
|
||
|
|
/// </summary>
|
||
|
|
public Event ParentEvent
|
||
|
|
{
|
||
|
|
get => _ParentEvent.Value;
|
||
|
|
private set => _ParentEvent.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<Event> _ParentEvent
|
||
|
|
= new Property<Event>(
|
||
|
|
typeof(Module).Namespace + ".Event.Module.ParentEvent",
|
||
|
|
null,
|
||
|
|
false
|
||
|
|
);
|
||
|
|
public void SetParentEvent(Event e) { _ParentEvent.Value = e; }
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the list of channels on this event module.
|
||
|
|
/// </summary>
|
||
|
|
public List<Channel> Channels
|
||
|
|
{
|
||
|
|
get => _Channels.Value;
|
||
|
|
set => _Channels.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<List<Channel>> _Channels = new Property<List<Channel>>("Event.Module.Channels", new List<Channel>(), true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="int"/> module number of this event module.
|
||
|
|
/// </summary>
|
||
|
|
public int Number
|
||
|
|
{
|
||
|
|
get => _Number.Value;
|
||
|
|
set => _Number.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<int> _Number = new Property<int>("Event.Module.Number", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the serial number <see cref="string"/> for this DAS.
|
||
|
|
/// </summary>
|
||
|
|
public string DasSerialNumber
|
||
|
|
{
|
||
|
|
get => _dasSerialNumber.Value;
|
||
|
|
set => _dasSerialNumber.Value = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
private readonly Property<string> _dasSerialNumber = new Property<string>(typeof(Module).Namespace + ".Event.Module.DasSerialNumber", "", true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the serial number <see cref="string"/> for this DAS.
|
||
|
|
/// </summary>
|
||
|
|
public string Description
|
||
|
|
{
|
||
|
|
get => _Description.Value;
|
||
|
|
set => _Description.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<string> _Description
|
||
|
|
= new Property<string>(
|
||
|
|
typeof(Module).Namespace + ".Event.Module.Description",
|
||
|
|
"",
|
||
|
|
true
|
||
|
|
);
|
||
|
|
public bool IsSlice6DBModule()
|
||
|
|
{
|
||
|
|
return Description == DTS.Common.Constants.DUMMY_MOD_DESCRIP_S6DB;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the base serial number <see cref="string"/> for this DAS.
|
||
|
|
/// </summary>
|
||
|
|
public string BaseSerialNumber
|
||
|
|
{
|
||
|
|
get => _BaseSerialNumber.Value;
|
||
|
|
set => _BaseSerialNumber.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<string> _BaseSerialNumber
|
||
|
|
= new Property<string>(
|
||
|
|
typeof(Module).Namespace + ".Event.Module.BaseSerialNumber",
|
||
|
|
"",
|
||
|
|
true
|
||
|
|
);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> number of requested seconds pre-trigger for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double RequestedPreTriggerSeconds
|
||
|
|
{
|
||
|
|
get => _RequestedPreTriggerSeconds.Value;
|
||
|
|
set => _RequestedPreTriggerSeconds.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _RequestedPreTriggerSeconds = new Property<double>("Event.Module.RequestedPreTriggerSeconds", 0.0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> number of requested seconds post-trigger for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double RequestedPostTriggerSeconds
|
||
|
|
{
|
||
|
|
get => _RequestedPostTriggerSeconds.Value;
|
||
|
|
set => _RequestedPostTriggerSeconds.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _RequestedPostTriggerSeconds = new Property<double>("Event.Module.RequestedPostTriggerSeconds", 0.0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> number of seconds pre-trigger for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double PreTriggerSeconds
|
||
|
|
{
|
||
|
|
get => _PreTriggerSeconds.Value;
|
||
|
|
set => _PreTriggerSeconds.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _PreTriggerSeconds = new Property<double>("Event.Module.PreTriggerSeconds", 0.0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> number of seconds post-trigger for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double PostTriggerSeconds
|
||
|
|
{
|
||
|
|
get => _PostTriggerSeconds.Value;
|
||
|
|
set => _PostTriggerSeconds.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _PostTriggerSeconds = new Property<double>("Event.Module.PostTriggerSeconds", 0.0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the number of <see cref="UInt64"/> samples in this event modules.
|
||
|
|
/// </summary>
|
||
|
|
public ulong NumberOfSamples
|
||
|
|
{
|
||
|
|
get => _NumberOfSamples.Value;
|
||
|
|
set => _NumberOfSamples.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<ulong> _NumberOfSamples = new Property<ulong>("Event.Module.NumberOfSamples", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the number of unsubsampled <see cref="UInt64"/> samples in this event modules.
|
||
|
|
/// </summary>
|
||
|
|
public ulong UnsubsampledNumberOfSamples
|
||
|
|
{
|
||
|
|
get => _UnsubsampledNumberOfSamples.Value;
|
||
|
|
set => _UnsubsampledNumberOfSamples.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<ulong> _UnsubsampledNumberOfSamples = new Property<ulong>("Event.Module.UnsubsampledNumberOfSamples", 0, true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="UInt64"/> trigger sample numbers for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public List<ulong> TriggerSampleNumbers
|
||
|
|
{
|
||
|
|
get => _TriggerSampleNumbers.Value;
|
||
|
|
set => _TriggerSampleNumbers.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<List<ulong>> _TriggerSampleNumbers = new Property<List<ulong>>("Event.Module.TriggerSampleNumbers", null, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="UInt64"/> unsubsampled trigger sample numbers for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public List<ulong> UnsubsampledTriggerSampleNumbers
|
||
|
|
{
|
||
|
|
get => _UnsubsampledTriggerSampleNumbers.Value;
|
||
|
|
set => _UnsubsampledTriggerSampleNumbers.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<List<ulong>> _UnsubsampledTriggerSampleNumbers = new Property<List<ulong>>("Event.Module.UnsubsampledTriggerSampleNumbers", new List<ulong>(), true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="UInt64"/> start record sample number for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public ulong StartRecordSampleNumber
|
||
|
|
{
|
||
|
|
get => _StartRecordSampleNumber.Value;
|
||
|
|
set => _StartRecordSampleNumber.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<ulong> _StartRecordSampleNumber = new Property<ulong>("Event.Module.StartRecordSampleNumber", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="float"/> sample rate for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public float SampleRateHz
|
||
|
|
{
|
||
|
|
get => _SampleRateHz.Value;
|
||
|
|
set => _SampleRateHz.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _SampleRateHz = new Property<float>("Event.Module.SampleRateHz", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> start record timestamp in seconds for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double StartRecordTimestampSec
|
||
|
|
{
|
||
|
|
get => _StartRecordTimestampSec.Value;
|
||
|
|
set => _StartRecordTimestampSec.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _StartRecordTimestampSec = new Property<double>("Event.Module.StartRecordTimestampSec", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> start record timestamp in nanoseconds for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double StartRecordTimestampNanoSec
|
||
|
|
{
|
||
|
|
get => _StartRecordTimestampNanoSec.Value;
|
||
|
|
set => _StartRecordTimestampNanoSec.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _StartRecordTimestampNanoSec = new Property<double>("Event.Module.StartRecordTimestampNanoSec", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> trigger timestamp in seconds for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double TriggerTimestampSec
|
||
|
|
{
|
||
|
|
get => _TriggerTimestampSec.Value;
|
||
|
|
set => _TriggerTimestampSec.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TriggerTimestampSec = new Property<double>("Event.Module.TriggerTimestampSec", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="double"/> trigger timestamp in nanoseconds for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public double TriggerTimestampNanoSec
|
||
|
|
{
|
||
|
|
get => _TriggerTimestampNanoSec.Value;
|
||
|
|
set => _TriggerTimestampNanoSec.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TriggerTimestampNanoSec = new Property<double>("Event.Module.TriggerTimestampNanoSec", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="bool"/> whether or not PTP master sync is used for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public bool PTPMasterSync
|
||
|
|
{
|
||
|
|
get => _PTPMasterSync.Value;
|
||
|
|
set => _PTPMasterSync.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<bool> _PTPMasterSync = new Property<bool>("Event.Module.PTPMasterSync", false, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the System Id <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public string SystemID
|
||
|
|
{
|
||
|
|
get => _systemID.Value;
|
||
|
|
set => _systemID.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<string> _systemID = new Property<string>(typeof(Module).Namespace + ".Event.Module.SystemID", "", true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the System Location <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public string SystemLocation
|
||
|
|
{
|
||
|
|
get => _systemLocation.Value;
|
||
|
|
set => _systemLocation.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<string> _systemLocation = new Property<string>(typeof(Module).Namespace + ".Event.Module.SystemLocation", "", true);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set TargetAxisOne <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double TargetAxisOne
|
||
|
|
{
|
||
|
|
get => _targetAxisOne.Value;
|
||
|
|
set => _targetAxisOne.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _targetAxisOne = new Property<double>(".Event.Module.TargetAxisOne", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set TargetAxisTwo <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double TargetAxisTwo
|
||
|
|
{
|
||
|
|
get => _targetAxisTwo.Value;
|
||
|
|
set => _targetAxisTwo.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _targetAxisTwo = new Property<double>(".Event.Module.TargetAxisTwo", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set TargetAxisX <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double TargetAxisX
|
||
|
|
{
|
||
|
|
get => _targetAxisX.Value;
|
||
|
|
set => _targetAxisX.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _targetAxisX = new Property<double>(".Event.Module.TargetAxisX", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set TargetAxisY <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double TargetAxisY
|
||
|
|
{
|
||
|
|
get => _targetAxisY.Value;
|
||
|
|
set => _targetAxisY.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _targetAxisY = new Property<double>(".Event.Module.TargetAxisY", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set TargetAxisZ <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double TargetAxisZ
|
||
|
|
{
|
||
|
|
get => _targetAxisZ.Value;
|
||
|
|
set => _targetAxisZ.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _targetAxisZ = new Property<double>(".Event.Module.TargetAxisZ", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor X axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisXDegreesPre
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisXDegreesPre.Value;
|
||
|
|
set => _TiltSensorAxisXDegreesPre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisXDegreesPre = new Property<double>("Event.Module.TiltSensorAxisXDegreesPre", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor Y axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisYDegreesPre
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisYDegreesPre.Value;
|
||
|
|
set => _TiltSensorAxisYDegreesPre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisYDegreesPre = new Property<double>("Event.Module.TiltSensorAxis2DegreesPre", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor Z axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisZDegreesPre
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisZDegreesPre.Value;
|
||
|
|
set => _TiltSensorAxisZDegreesPre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisZDegreesPre = new Property<double>("Event.Module.TiltSensorAxisZDegreesPre", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor X axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisXDegreesPost
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisXDegreesPost.Value;
|
||
|
|
set => _TiltSensorAxisXDegreesPost.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisXDegreesPost = new Property<double>("Event.Module.TiltSensorAxisXDegreesPost", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor Y axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisYDegreesPost
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisYDegreesPost.Value;
|
||
|
|
set => _TiltSensorAxisYDegreesPost.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisYDegreesPost = new Property<double>("Event.Module.TiltSensorAxisYDegreesPost", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the tilt sensor Z axis value.
|
||
|
|
/// </summary>
|
||
|
|
public double TiltSensorAxisZDegreesPost
|
||
|
|
{
|
||
|
|
get => _TiltSensorAxisZDegreesPost.Value;
|
||
|
|
set => _TiltSensorAxisZDegreesPost.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _TiltSensorAxisZDegreesPost = new Property<double>("Event.Module.TiltSensorAxisZDegreesPost", double.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 1 value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation1Pre
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation1Pre.Value;
|
||
|
|
set => _TemperatureLocation1Pre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation1Pre = new Property<float>("Event.Module.TemperatureLocation1Pre", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 2 value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation2Pre
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation2Pre.Value;
|
||
|
|
set => _TemperatureLocation2Pre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation2Pre = new Property<float>("Event.Module.TemperatureLocation2Pre", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 3 value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation3Pre
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation3Pre.Value;
|
||
|
|
set => _TemperatureLocation3Pre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation3Pre = new Property<float>("Event.Module.TemperatureLocation3Pre", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 4 value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation4Pre
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation4Pre.Value;
|
||
|
|
set => _TemperatureLocation4Pre.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation4Pre = new Property<float>("Event.Module.TemperatureLocation4Pre", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 1 post value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation1Post
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation1Post.Value;
|
||
|
|
set => _TemperatureLocation1Post.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation1Post = new Property<float>("Event.Module.TemperatureLocation1Post", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 2 value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation2Post
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation2Post.Value;
|
||
|
|
set => _TemperatureLocation2Post.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation2Post = new Property<float>("Event.Module.TemperatureLocation2Post", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 3 post value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation3Post
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation3Post.Value;
|
||
|
|
set => _TemperatureLocation3Post.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation3Post = new Property<float>("Event.Module.TemperatureLocation3Post", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the temperature sensor location 4 post value.
|
||
|
|
/// </summary>
|
||
|
|
public float TemperatureLocation4Post
|
||
|
|
{
|
||
|
|
get => _TemperatureLocation4Post.Value;
|
||
|
|
set => _TemperatureLocation4Post.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _TemperatureLocation4Post = new Property<float>("Event.Module.TemperatureLocation4Post", float.NaN, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the InputVoltage <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double InputVoltage
|
||
|
|
{
|
||
|
|
get => _inputVoltage.Value;
|
||
|
|
set => _inputVoltage.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _inputVoltage = new Property<double>("Event.Module.InputVoltage", 0, false);
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the BatteryVoltage <see cref="string"/>
|
||
|
|
/// </summary>
|
||
|
|
public double BatteryVoltage
|
||
|
|
{
|
||
|
|
get => _batteryVoltage.Value;
|
||
|
|
set => _batteryVoltage.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<double> _batteryVoltage = new Property<double>("Event.Module.BatteryVoltage", 0, false);
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="float"/> AA filter rate for this event module.
|
||
|
|
/// </summary>
|
||
|
|
public float AaFilterRateHz
|
||
|
|
{
|
||
|
|
get => _AaFilterRateHz.Value;
|
||
|
|
set => _AaFilterRateHz.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<float> _AaFilterRateHz = new Property<float>("Event.Module.AaFilterRateHz", 0, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="ExcitationVoltageOptions.ExcitationVoltageOption"/> nominal
|
||
|
|
/// excitation voltage of this module.
|
||
|
|
/// </summary>
|
||
|
|
public ExcitationVoltageOptions.ExcitationVoltageOption NominalExcitationVoltage
|
||
|
|
{
|
||
|
|
get => _NominalExcitationVoltage.Value;
|
||
|
|
set => _NominalExcitationVoltage.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<ExcitationVoltageOptions.ExcitationVoltageOption> _NominalExcitationVoltage
|
||
|
|
= new Property<ExcitationVoltageOptions.ExcitationVoltageOption>(
|
||
|
|
typeof(Module).Namespace + ".Event.Module.NominalExcitationVoltage",
|
||
|
|
ExcitationVoltageOptions.ExcitationVoltageOption.Volt5,
|
||
|
|
true
|
||
|
|
);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="Test.Module.RecordingMode"/> of this module.
|
||
|
|
/// </summary>
|
||
|
|
public DFConstantsAndEnums.RecordingMode RecordingMode
|
||
|
|
{
|
||
|
|
get => _RecordingMode.Value;
|
||
|
|
set => _RecordingMode.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<DFConstantsAndEnums.RecordingMode> _RecordingMode = new Property<DFConstantsAndEnums.RecordingMode>("Event.Module.RecordingMode", DFConstantsAndEnums.RecordingMode.CircularBuffer, false);
|
||
|
|
|
||
|
|
public LinkedList<short[]> PartialUnfilteredData = null;
|
||
|
|
|
||
|
|
// Method for creating channel files directly to disk.
|
||
|
|
// Change that linked list class to something that will handle this...
|
||
|
|
// I think what we need to do instead is to change the class/data structure that represents
|
||
|
|
// the channel data into an object that maybe double passes the reference, or derives from the
|
||
|
|
// memory-mapped file objecct, but it can also have extra methods and throw an exception if we
|
||
|
|
// try to access it before it's been properly initialized.
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="short"/> data value list for this channel.
|
||
|
|
/// </summary>
|
||
|
|
public List<short> UnfilteredData
|
||
|
|
{
|
||
|
|
get => _UnfilteredData.Value;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
// Reset unfiltered data caches.
|
||
|
|
_UnfilteredData.Value = value;
|
||
|
|
|
||
|
|
// Reset filtered data caches.
|
||
|
|
_Data = null;
|
||
|
|
|
||
|
|
//lock (previouslyFilteredDataLock)
|
||
|
|
//{
|
||
|
|
// _previouslyFilteredData.Clear();
|
||
|
|
//}
|
||
|
|
|
||
|
|
// Update the data count.
|
||
|
|
if (value is Serialization.SliceRaw.File.PersistentDasTimestamp persistentModule)
|
||
|
|
DataCount = persistentModule.Count;
|
||
|
|
else DataCount = value.Count;
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem setting unfiltered data", ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
private readonly Property<List<short>> _UnfilteredData = new Property<List<short>>("DTS.Control.Event.Module.Data", null, false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Get the filtered long-converted data for this channel.
|
||
|
|
/// </summary>
|
||
|
|
public List<long> Data
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (UseFilterCaching)
|
||
|
|
{
|
||
|
|
if (null == _Data)
|
||
|
|
return _Data = new List<long>(/*GetDataFilteredBy(CurrentFilter, DataDisplayUnits.Adc)*/);
|
||
|
|
return _Data;
|
||
|
|
}
|
||
|
|
return new List<long>(/*GetDataFilteredBy(CurrentFilter, DataDisplayUnits.Adc)*/);
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem getting filtered data", ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
private List<long> _Data = null;
|
||
|
|
/// <summary>
|
||
|
|
/// Get/set the <see cref="bool"/> switch to enable/disable filter caching.
|
||
|
|
/// </summary>
|
||
|
|
public bool UseFilterCaching
|
||
|
|
{
|
||
|
|
//for now NEVER cache
|
||
|
|
/*get { return _UseFilterCaching.Value; }
|
||
|
|
set
|
||
|
|
{
|
||
|
|
if (false == (_UseFilterCaching.Value = value))
|
||
|
|
{ //
|
||
|
|
// If we disable filter caching on the fly, make sure the caches are cleared.
|
||
|
|
//
|
||
|
|
_Data = null;
|
||
|
|
_DataEu = null;
|
||
|
|
_DataMv = null;
|
||
|
|
|
||
|
|
lock (previouslyFilteredDataLock)
|
||
|
|
{
|
||
|
|
_previouslyFilteredData.Clear();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}*/
|
||
|
|
get => false;
|
||
|
|
set { }
|
||
|
|
}
|
||
|
|
/*private Property<bool> _UseFilterCaching
|
||
|
|
= new Property<bool>(
|
||
|
|
typeof(Event.Module.Channel).Namespace + ".Event.Module.Channel.UseFilterCaching",
|
||
|
|
true,
|
||
|
|
true
|
||
|
|
);
|
||
|
|
*/
|
||
|
|
/// <summary>
|
||
|
|
/// Get the data count for this channel.
|
||
|
|
/// </summary>
|
||
|
|
public int DataCount
|
||
|
|
{
|
||
|
|
get;
|
||
|
|
private set;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string FileName
|
||
|
|
{
|
||
|
|
get => _FileName.Value;
|
||
|
|
set => _FileName.Value = value;
|
||
|
|
}
|
||
|
|
private readonly Property<string> _FileName
|
||
|
|
= new Property<string>(
|
||
|
|
typeof(Channel).Namespace + ".Event.Module.FileName",
|
||
|
|
"",
|
||
|
|
true
|
||
|
|
);
|
||
|
|
|
||
|
|
public void UnSet()
|
||
|
|
{
|
||
|
|
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.Batch;
|
||
|
|
System.Runtime.GCSettings.LargeObjectHeapCompactionMode = System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce;
|
||
|
|
GC.Collect();
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// Set the applicable properties of this object from the specified target object.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="that">
|
||
|
|
/// The <see cref="DTS.DASLib.Service.DASModule"/> that is to have the information it
|
||
|
|
/// shares with this object copied.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
public void SetPropertyValuesFrom(DASLib.Service.DASModule that, int eventIndex)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
TriggerSampleNumbers = new List<ulong>(null != that.TriggerSampleNumbers ? that.TriggerSampleNumbers : new ulong[] { });
|
||
|
|
NumberOfSamples = that.NumberOfSamples;
|
||
|
|
if (null != that.OwningDAS.EventGuids && that.OwningDAS.EventGuids.Any())
|
||
|
|
{
|
||
|
|
ParentEvent.Guid = that.OwningDAS.EventGuids[0];
|
||
|
|
}
|
||
|
|
ushort faultFlag = 0;
|
||
|
|
|
||
|
|
try
|
||
|
|
{
|
||
|
|
faultFlag = ParentEvent.FaultFlags;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("Failed to set fault flags", ex);
|
||
|
|
}
|
||
|
|
if (null != that.OwningDAS.FaultFlags && that.OwningDAS.FaultFlags.Any())
|
||
|
|
{
|
||
|
|
if (eventIndex >= that.OwningDAS.FaultFlags.Length || eventIndex < 0)
|
||
|
|
{
|
||
|
|
eventIndex = 0;
|
||
|
|
}
|
||
|
|
ParentEvent.FaultFlags = Convert.ToUInt16(faultFlag | that.OwningDAS.FaultFlags[eventIndex]);
|
||
|
|
//this is very tricky - we are always using index 0 here because the service ownload downloads one event at a time and so
|
||
|
|
//the actual fault flags available at this time are only for that one given event being downloaded ...
|
||
|
|
}
|
||
|
|
SetExtendedFaultFlags(ParentEvent, that);
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem setting property from target object " + (null != that ? "\"" + that.ToString() + "\"" : "<NULL>"), ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void SetExtendedFaultFlags(Event parentEvent, DASLib.Service.DASModule that)
|
||
|
|
{
|
||
|
|
uint extendedFaultFlag1 = 0, extendedFaultFlag2 = 0, extendedFaultFlag3 = 0, extendedFaultFlag4 = 0;
|
||
|
|
uint dasExtFaultFlag1 = 0, dasExtFaultFlag2 = 0, dasExtFaultFlag3 = 0, dasExtFaultFlag4 = 0;
|
||
|
|
try
|
||
|
|
{
|
||
|
|
extendedFaultFlag1 = parentEvent.ExtendedFaultFlags1;
|
||
|
|
extendedFaultFlag2 = parentEvent.ExtendedFaultFlags2;
|
||
|
|
extendedFaultFlag3 = parentEvent.ExtendedFaultFlags3;
|
||
|
|
extendedFaultFlag4 = parentEvent.ExtendedFaultFlags4;
|
||
|
|
|
||
|
|
if (null != that.OwningDAS && null != that.OwningDAS.ExtendedFaultFlags1 && that.OwningDAS.ExtendedFaultFlags1.Length > 0)
|
||
|
|
{
|
||
|
|
dasExtFaultFlag1 = that.OwningDAS.ExtendedFaultFlags1[0];
|
||
|
|
dasExtFaultFlag2 = that.OwningDAS.ExtendedFaultFlags2[0];
|
||
|
|
dasExtFaultFlag3 = that.OwningDAS.ExtendedFaultFlags3[0];
|
||
|
|
dasExtFaultFlag4 = that.OwningDAS.ExtendedFaultFlags4[0];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
catch (Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log(ex);
|
||
|
|
}
|
||
|
|
parentEvent.ExtendedFaultFlags1 = Convert.ToUInt32(extendedFaultFlag1 | dasExtFaultFlag1);
|
||
|
|
parentEvent.ExtendedFaultFlags2 = Convert.ToUInt32(extendedFaultFlag2 | dasExtFaultFlag2);
|
||
|
|
parentEvent.ExtendedFaultFlags3 = Convert.ToUInt32(extendedFaultFlag3 | dasExtFaultFlag3);
|
||
|
|
parentEvent.ExtendedFaultFlags4 = Convert.ToUInt32(extendedFaultFlag4 | dasExtFaultFlag4);
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// Test the specified object for equality with this object.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="obj">
|
||
|
|
/// The <see cref="object"/> to be tested for equality.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// <see cref="bool"/> true if the specified object has memeberwise equality with
|
||
|
|
/// this object; false otherwise.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
public override bool Equals(object obj)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
var that = obj as Module;
|
||
|
|
return null != that
|
||
|
|
&& Description.Equals(that.Description)
|
||
|
|
&& AaFilterRateHz.Equals(that.AaFilterRateHz)
|
||
|
|
&& Number.Equals(that.Number)
|
||
|
|
&& DasSerialNumber.Equals(that.DasSerialNumber)
|
||
|
|
&& NumberOfSamples.Equals(that.NumberOfSamples)
|
||
|
|
&& UnsubsampledNumberOfSamples.Equals(that.UnsubsampledNumberOfSamples)
|
||
|
|
&& RequestedPostTriggerSeconds.Equals(that.RequestedPostTriggerSeconds)
|
||
|
|
&& RequestedPreTriggerSeconds.Equals(that.RequestedPreTriggerSeconds)
|
||
|
|
&& PostTriggerSeconds.Equals(that.PostTriggerSeconds)
|
||
|
|
&& PreTriggerSeconds.Equals(that.PreTriggerSeconds)
|
||
|
|
&& RecordingMode.Equals(that.RecordingMode)
|
||
|
|
&& SampleRateHz.Equals(that.SampleRateHz)
|
||
|
|
&& StartRecordSampleNumber.Equals(that.StartRecordSampleNumber)
|
||
|
|
&& TriggerSampleNumbersEquals(that.TriggerSampleNumbers)
|
||
|
|
&& UnsubsampledTriggerSampleNumbersEquals(that.UnsubsampledTriggerSampleNumbers)
|
||
|
|
&& ChannelsEquals(that.Channels);
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception(
|
||
|
|
string.Format(
|
||
|
|
Strings.DTS_Slice_Control_Equals_ComparisonFailedString, null != obj ? "\"" + obj.ToString() + "\"" : Strings.DTS_Slice_Control_NullIndicatorString),
|
||
|
|
ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Test the specified object's trigger sample number list for equality with this
|
||
|
|
/// object's module list.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="thoseTriggerSampleNumbers">
|
||
|
|
/// The list of <see cref="UInt64"/> object to be
|
||
|
|
/// compared for equality with this event's equivalent.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
|
||
|
|
/// false otherwise.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
private bool TriggerSampleNumbersEquals(List<ulong> thoseTriggerSampleNumbers)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (null == thoseTriggerSampleNumbers || TriggerSampleNumbers.Count != thoseTriggerSampleNumbers.Count)
|
||
|
|
return false;
|
||
|
|
return !thoseTriggerSampleNumbers.Where((t, i) => !TriggerSampleNumbers[i].Equals(t)).Any();
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception(Strings.DTS_Slice_Control_Event_Module_TriggerSampleNumbersEquals_ComparisonFailedString, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Test the specified object's unsubsampled trigger sample number list for equality with this
|
||
|
|
/// object's module list.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="thoseUnsubsampledTriggerSampleNumbers">
|
||
|
|
/// The list of <see cref="UInt64"/> object to be
|
||
|
|
/// compared for equality with this event's equivalent.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
|
||
|
|
/// false otherwise.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
private bool UnsubsampledTriggerSampleNumbersEquals(List<ulong> thoseUnsubsampledTriggerSampleNumbers)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (null == thoseUnsubsampledTriggerSampleNumbers || UnsubsampledTriggerSampleNumbers.Count != thoseUnsubsampledTriggerSampleNumbers.Count)
|
||
|
|
return false;
|
||
|
|
return !thoseUnsubsampledTriggerSampleNumbers.Where((t, i) => !UnsubsampledTriggerSampleNumbers[i].Equals(t)).Any();
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("unsubsampled trigger sample number arrays do not match", ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Test the specified object's module list for equality with this object's
|
||
|
|
/// module list.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="thoseChannels">
|
||
|
|
/// The list of <see cref="DTS.Slice.Control.Event.Module.Channel"/> objects to be
|
||
|
|
/// compared for equality with this module's equivalent.
|
||
|
|
/// </param>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// <see cref="bool"/> true if the two lists contain equivalent-valued members;
|
||
|
|
/// false otherwise.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
private bool ChannelsEquals(List<Channel> thoseChannels)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (null == thoseChannels || Channels.Count != thoseChannels.Count)
|
||
|
|
return false;
|
||
|
|
return !thoseChannels.Where((t, i) => !Channels[i].Equals(t)).Any();
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception(Strings.DTS_Slice_Control_Event_Module_ChannelsEquals_ComparisonFailedString, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Return the hash code for this object.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// The <see cref="int"/> hash code for this object.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
public override int GetHashCode()
|
||
|
|
{
|
||
|
|
return base.GetHashCode();
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Convert this object into a DTS.Serialization.Test.Module.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <returns>
|
||
|
|
/// A <see cref="DTS.Serialization.Test.Module"/> equivalent to this object.
|
||
|
|
/// </returns>
|
||
|
|
///
|
||
|
|
public Serialization.Test.Module ToDtsSerializationTestModule(Serialization.Test parentTest)
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
var that = new Serialization.Test.Module(parentTest)
|
||
|
|
{
|
||
|
|
Description = Description,
|
||
|
|
AaFilterRateHz = AaFilterRateHz,
|
||
|
|
Number = Number,
|
||
|
|
SerialNumber = DasSerialNumber,
|
||
|
|
NumberOfSamples = NumberOfSamples,
|
||
|
|
UnsubsampledNumberOfSamples = UnsubsampledNumberOfSamples,
|
||
|
|
RequestedPostTriggerSeconds = RequestedPostTriggerSeconds,
|
||
|
|
RequestedPreTriggerSeconds = RequestedPreTriggerSeconds,
|
||
|
|
PostTriggerSeconds = PostTriggerSeconds,
|
||
|
|
PreTriggerSeconds = PreTriggerSeconds,
|
||
|
|
RecordingMode = RecordingMode,
|
||
|
|
SampleRateHz = SampleRateHz,
|
||
|
|
StartRecordSampleNumber = StartRecordSampleNumber,
|
||
|
|
TriggerSampleNumbers = TriggerSampleNumbers,
|
||
|
|
UnsubsampledTriggerSampleNumbers = UnsubsampledTriggerSampleNumbers,
|
||
|
|
BaseSerialNumber = BaseSerialNumber,
|
||
|
|
StartRecordTimestampSec = StartRecordTimestampSec,
|
||
|
|
StartRecordTimestampNanoSec = StartRecordTimestampNanoSec,
|
||
|
|
TriggerTimestampSec = TriggerTimestampSec,
|
||
|
|
TriggerTimestampNanoSec = TriggerTimestampNanoSec,
|
||
|
|
PTPMasterSync = PTPMasterSync,
|
||
|
|
SystemID = SystemID,
|
||
|
|
SystemLocation = SystemLocation,
|
||
|
|
TargetAxisOne = TargetAxisOne,
|
||
|
|
TargetAxisTwo = TargetAxisTwo,
|
||
|
|
TargetAxisX = TargetAxisX,
|
||
|
|
TargetAxisY = TargetAxisY,
|
||
|
|
TargetAxisZ = TargetAxisZ,
|
||
|
|
TiltSensorAxisXDegreesPre = TiltSensorAxisXDegreesPre,
|
||
|
|
TiltSensorAxisYDegreesPre = TiltSensorAxisYDegreesPre,
|
||
|
|
TiltSensorAxisZDegreesPre = TiltSensorAxisZDegreesPre,
|
||
|
|
TiltSensorAxisXDegreesPost = TiltSensorAxisXDegreesPost,
|
||
|
|
TiltSensorAxisYDegreesPost = TiltSensorAxisYDegreesPost,
|
||
|
|
TiltSensorAxisZDegreesPost = TiltSensorAxisZDegreesPost,
|
||
|
|
TemperatureLocation1Pre = TemperatureLocation1Pre,
|
||
|
|
TemperatureLocation2Pre = TemperatureLocation2Pre,
|
||
|
|
TemperatureLocation3Pre = TemperatureLocation3Pre,
|
||
|
|
TemperatureLocation4Pre = TemperatureLocation4Pre,
|
||
|
|
TemperatureLocation1Post = TemperatureLocation1Post,
|
||
|
|
TemperatureLocation2Post = TemperatureLocation2Post,
|
||
|
|
TemperatureLocation3Post = TemperatureLocation3Post,
|
||
|
|
TemperatureLocation4Post = TemperatureLocation4Post,
|
||
|
|
InputVoltage = InputVoltage,
|
||
|
|
BatteryVoltage = BatteryVoltage,
|
||
|
|
Channels = new List<Serialization.Test.Module.Channel>()
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// Create a test module channel to embody each channel conversion, and then
|
||
|
|
// copy over all relevant channel data members.
|
||
|
|
foreach (var thisChannel in Channels)
|
||
|
|
{
|
||
|
|
//10988 Do not download/write/purge unneeded files; Only write required channels
|
||
|
|
if (thisChannel.IsConfigured)
|
||
|
|
{
|
||
|
|
//
|
||
|
|
// Create a test module channel to embody each channel conversion, and then
|
||
|
|
// copy over all relevant channel data members.
|
||
|
|
//
|
||
|
|
that.Channels.Add(thisChannel.ToDtsSerializationTestModuleChannel(that));
|
||
|
|
if (!string.IsNullOrWhiteSpace(thisChannel.LinearSensorCalibration))
|
||
|
|
{
|
||
|
|
var newThisChannel = new Event.Module.AnalogInputChannel(that.Channels.Last(), thisChannel.ParentModule, thisChannel.AbsoluteNumber);
|
||
|
|
var values = thisChannel.LinearSensorCalibration.Split(SensorConstants.LinearValuesSeparator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||
|
|
var records = new CalibrationRecords(values[0]);
|
||
|
|
var methods = new ZeroMethods(values[1]);
|
||
|
|
var offsets = new InitialOffsets(values[2]);
|
||
|
|
//write over
|
||
|
|
newThisChannel.ZeroPoint = records.Records.First().ZeroPoint;
|
||
|
|
//newThisChannel.DesiredRangeEU
|
||
|
|
newThisChannel.EngineeringUnits = records.Records.First().EngineeringUnits;
|
||
|
|
newThisChannel.InitialOffset = offsets.Offsets.First().ToDbSerializeString();
|
||
|
|
switch (offsets.Offsets.First().Form)
|
||
|
|
{
|
||
|
|
case InitialOffsetTypes.EU:
|
||
|
|
newThisChannel.InitialEu = offsets.Offsets.First().EU; break;
|
||
|
|
default:
|
||
|
|
newThisChannel.InitialEu = 0D;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
newThisChannel.IsoCode = records.Records.First().ISOCode;
|
||
|
|
if (thisChannel is DTS.Common.DAS.Concepts.DAS.Channel.IIsoCodeAware isoThisChannel)
|
||
|
|
{
|
||
|
|
//14226 Exports not using test obj/pos set by the group in a test when using a nonlinear sensor with a linear CAL
|
||
|
|
//the calibration record here has the iso code set from the linear added cal from the sensor db
|
||
|
|
//however we want the position and test object fields to come from the non linear channel as it was set up in the test properly
|
||
|
|
//and the non linear was not
|
||
|
|
//BUT we really only want to do this if in fact both channels have a test object and position field filled in
|
||
|
|
//if they don't that means the user did not require unique isocodes and never filled them in ...
|
||
|
|
if (newThisChannel.IsoCode.Length >= 2 && isoThisChannel.IsoCode.Length >= 2)
|
||
|
|
{
|
||
|
|
var iso = new DTS.Common.ISO.IsoCode(newThisChannel.IsoCode);
|
||
|
|
var isoThis = new DTS.Common.ISO.IsoCode(isoThisChannel.IsoCode);
|
||
|
|
iso.Position = isoThis.Position;
|
||
|
|
iso.TestObject = isoThis.TestObject;
|
||
|
|
newThisChannel.IsoCode = iso.StringRepresentation;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
newThisChannel.LinearizationFormula = new Common.Classes.Sensors.LinearizationFormula();
|
||
|
|
newThisChannel.AtCapacity = records.Records.First().AtCapacity;
|
||
|
|
newThisChannel.MvPerEu = records.Records.First().Sensitivity;
|
||
|
|
newThisChannel.Sensitivity = records.Records.First().Sensitivity;
|
||
|
|
newThisChannel.SensitivityUnits = records.Records.First().SensitivityUnits;
|
||
|
|
newThisChannel.CapacityOutputIsBasedOn = records.Records.First().CapacityOutputIsBasedOn;
|
||
|
|
newThisChannel.ZeroAverageWindow = new IntervalSec(methods.Methods.First().Start, methods.Methods.First().End);
|
||
|
|
newThisChannel.ZeroMethod = methods.Methods.First().Method;
|
||
|
|
|
||
|
|
var newThatChannel = newThisChannel.ToDtsSerializationTestModuleChannel(that);
|
||
|
|
if (thisChannel.UnfilteredAlternateData is Serialization.SliceRaw.File.PersistentChannel)
|
||
|
|
newThatChannel.PersistentChannelInfo = (thisChannel.UnfilteredAlternateData as Serialization.SliceRaw.File.PersistentChannel);
|
||
|
|
|
||
|
|
that.Channels.Add(newThatChannel);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return that;
|
||
|
|
}
|
||
|
|
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem converting " + GetType().FullName + " to " + typeof(Serialization.Test.Module).FullName, ex);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Initialize this object from a DTS.Serialization.Test.Module.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="that">
|
||
|
|
/// A <see cref="DTS.Serialization.Test.Module"/> from which to initialize this object.
|
||
|
|
/// </param>
|
||
|
|
/// <param name="reportErrors"></param>
|
||
|
|
//TODO: use more descriptive variable names
|
||
|
|
public void FromDtsSerializationTestModule(Serialization.Test.Module that, Serialization.Test.ReportErrors reportErrors)
|
||
|
|
{
|
||
|
|
var errors = new List<string>();
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (null == that) { throw new ArgumentNullException($"cannot set this object's properties from null serialization test module reference"); }
|
||
|
|
|
||
|
|
Description = that.Description;
|
||
|
|
AaFilterRateHz = that.AaFilterRateHz;
|
||
|
|
Number = that.Number;
|
||
|
|
DasSerialNumber = that.SerialNumber;
|
||
|
|
NumberOfSamples = that.NumberOfSamples;
|
||
|
|
UnsubsampledNumberOfSamples = that.UnsubsampledNumberOfSamples;
|
||
|
|
RequestedPostTriggerSeconds = that.RequestedPostTriggerSeconds;
|
||
|
|
RequestedPreTriggerSeconds = that.RequestedPreTriggerSeconds;
|
||
|
|
PostTriggerSeconds = that.PostTriggerSeconds;
|
||
|
|
PreTriggerSeconds = that.PreTriggerSeconds;
|
||
|
|
RecordingMode = that.RecordingMode;
|
||
|
|
SampleRateHz = that.SampleRateHz;
|
||
|
|
StartRecordSampleNumber = that.StartRecordSampleNumber;
|
||
|
|
TriggerSampleNumbers = that.TriggerSampleNumbers;
|
||
|
|
UnsubsampledTriggerSampleNumbers = that.UnsubsampledTriggerSampleNumbers;
|
||
|
|
BaseSerialNumber = that.BaseSerialNumber;
|
||
|
|
try
|
||
|
|
{
|
||
|
|
StartRecordTimestampSec = that.StartRecordTimestampSec;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get StartRecordTimestampSec", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
StartRecordTimestampNanoSec = that.StartRecordTimestampNanoSec;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get StartRecordTimestampSec", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
TriggerTimestampSec = that.TriggerTimestampSec;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get TriggerTimestampSec", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
TriggerTimestampNanoSec = that.TriggerTimestampNanoSec;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get TriggerTimestampNanoSec", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
PTPMasterSync = that.PTPMasterSync;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get PTPMasterSync", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
SystemID = that.SystemID;
|
||
|
|
SystemLocation = that.SystemLocation;
|
||
|
|
TargetAxisOne = that.TargetAxisOne;
|
||
|
|
TargetAxisTwo = that.TargetAxisTwo;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get tilt sensor config attributes", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
TiltSensorAxisXDegreesPre = that.TiltSensorAxisXDegreesPre;
|
||
|
|
TiltSensorAxisYDegreesPre = that.TiltSensorAxisYDegreesPre;
|
||
|
|
TiltSensorAxisZDegreesPre = that.TiltSensorAxisZDegreesPre;
|
||
|
|
TiltSensorAxisXDegreesPost = that.TiltSensorAxisXDegreesPost;
|
||
|
|
TiltSensorAxisYDegreesPost = that.TiltSensorAxisYDegreesPost;
|
||
|
|
TiltSensorAxisZDegreesPost = that.TiltSensorAxisZDegreesPost;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get tilt information", ex);
|
||
|
|
}
|
||
|
|
//TODO: inappropriate using try/catch!!!
|
||
|
|
try
|
||
|
|
{
|
||
|
|
TemperatureLocation1Pre = that.TemperatureLocation1Pre;
|
||
|
|
TemperatureLocation2Pre = that.TemperatureLocation2Pre;
|
||
|
|
TemperatureLocation3Pre = that.TemperatureLocation3Pre;
|
||
|
|
TemperatureLocation4Pre = that.TemperatureLocation4Pre;
|
||
|
|
TemperatureLocation1Post = that.TemperatureLocation1Post;
|
||
|
|
TemperatureLocation2Post = that.TemperatureLocation2Post;
|
||
|
|
TemperatureLocation3Post = that.TemperatureLocation3Post;
|
||
|
|
TemperatureLocation4Post = that.TemperatureLocation4Post;
|
||
|
|
InputVoltage = that.InputVoltage;
|
||
|
|
BatteryVoltage = that.BatteryVoltage;
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
APILogger.Log("failed to get temperature information", ex);
|
||
|
|
}
|
||
|
|
//APILogger.DoPerformanceLog("DTS.Slice.Control.Event.Module:FromDTSSerializationTestModule:6");
|
||
|
|
var absoluteChannelNumber = ParentEvent.LastAbsoluteChannelNumberInEvent + 1;
|
||
|
|
|
||
|
|
Channels.Clear();
|
||
|
|
foreach (var thatChannel in that.Channels)
|
||
|
|
{ //
|
||
|
|
// Create a Slice Control channel corresponding to the specified serialization
|
||
|
|
// channel and populate its relevant properties.
|
||
|
|
//
|
||
|
|
try
|
||
|
|
{
|
||
|
|
if (thatChannel.AbsoluteDisplayOrder != -2)
|
||
|
|
{
|
||
|
|
//Have to count the channels this way as the module isn't a part of the event yet.
|
||
|
|
var emc = Channel.CreateChannel(thatChannel, this, absoluteChannelNumber++);
|
||
|
|
Channels.Add(emc);
|
||
|
|
thatChannel.emc = emc;
|
||
|
|
Trace.WriteLine("Created EMC: " + absoluteChannelNumber.ToString());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
catch (System.IO.InvalidDataException ex) { errors.Add(ex.Message); }
|
||
|
|
}
|
||
|
|
foreach (var thatCalculatedChannel in that.CalculatedChannels)
|
||
|
|
{
|
||
|
|
//Have to count the channels this way as the module isn't a part of the event yet.
|
||
|
|
var emc = Channel.CreateChannel(thatCalculatedChannel, this, absoluteChannelNumber++);
|
||
|
|
Trace.WriteLine("Created EMC: " + absoluteChannelNumber.ToString());
|
||
|
|
Channels.Add(emc);
|
||
|
|
thatCalculatedChannel.emc = emc;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
catch (System.Exception ex)
|
||
|
|
{
|
||
|
|
throw new Exception("encountered problem initializing " + GetType().FullName + " using " + typeof(Serialization.Test.Module).FullName, ex);
|
||
|
|
}
|
||
|
|
if (errors.Count > 0 && null != reportErrors) { reportErrors(errors); }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|