init
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
using IRIGCh10;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.TMATS.DataConversion
|
||||
{
|
||||
public enum CoefficientsAttributes
|
||||
{
|
||||
[Description("CO\\N")]
|
||||
OrderOfCurveFit,
|
||||
[Description("CO1")]
|
||||
DerivedFromPairSet,
|
||||
[Description("CO")]
|
||||
Coefficient0,
|
||||
[Description("CO-1")]
|
||||
Coefficient1,
|
||||
[Description("CO-2")]
|
||||
Coefficient2,
|
||||
[Description("CO-3")]
|
||||
Coefficient3,
|
||||
[Description("CO-4")]
|
||||
Coefficient4,
|
||||
[Description("CO-5")]
|
||||
Coefficient5,
|
||||
[Description("CO-6")]
|
||||
Coefficient6,
|
||||
[Description("CO-7")]
|
||||
Coefficient7
|
||||
}
|
||||
/// <summary>
|
||||
/// implements the coefficient section of the tmats document
|
||||
/// </summary>
|
||||
public class CoefficientSection : TMATSSection<CoefficientsAttributes>
|
||||
{
|
||||
public CoefficientSection(int number)
|
||||
: base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// SPECIFY THE ORDER OF THE POLYNOMINAL CURVE FIT, n.
|
||||
/// </summary>
|
||||
public int? OrderOfCurveFit
|
||||
{
|
||||
get => GetIntOrNull(CoefficientsAttributes.OrderOfCurveFit);
|
||||
set => SetIntOrNull(CoefficientsAttributes.OrderOfCurveFit, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VALUE OF THE ZERO ORDER TERM (OFFSET), SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string Coefficient0
|
||||
{
|
||||
get => GetValue(CoefficientsAttributes.Coefficient0);
|
||||
set => SetValueWithLength(CoefficientsAttributes.Coefficient0, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// VALUE OF THE COEFFICIENT OF THE N-TH POWER OF X (FIRST ORDER COEFFICIENT IS
|
||||
/// THE EQUIVALENT OF BIT WEIGHT).
|
||||
/// SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string Coefficient1
|
||||
{
|
||||
get => GetValue(CoefficientsAttributes.Coefficient1);
|
||||
set => SetValueWithLength(CoefficientsAttributes.Coefficient1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using IRIGCh10;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.Attributes
|
||||
{
|
||||
public enum DataConversionAttributes
|
||||
{
|
||||
[Description("DCT")]
|
||||
ConversionType
|
||||
}
|
||||
|
||||
public enum ConversionTypes
|
||||
{
|
||||
[Description("NON")]
|
||||
None,
|
||||
[Description("PRS")]
|
||||
PairSets,
|
||||
[Description("COE")]
|
||||
Coefficients,
|
||||
[Description("NPC")]
|
||||
CoefficientsNegative,
|
||||
[Description("DER")]
|
||||
Derived,
|
||||
[Description("DIS")]
|
||||
Discrete,
|
||||
[Description("PTM")]
|
||||
PCMTime,
|
||||
[Description("BTM")]
|
||||
Time1553,
|
||||
[Description("VOI")]
|
||||
DigitalVoice,
|
||||
[Description("VID")]
|
||||
DigitalVideo,
|
||||
[Description("SP")]
|
||||
SpecializedProcessing,
|
||||
[Description("OTH")]
|
||||
Other
|
||||
}
|
||||
/// <summary>
|
||||
/// implements the data conversion section of the tmats packet
|
||||
/// </summary>
|
||||
public class DataConversionSection : TMATSSection<DataConversionAttributes>
|
||||
{
|
||||
public DataConversionSection(int number) : base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
}
|
||||
public void SetConversionType(ConversionTypes type)
|
||||
{
|
||||
SetValueWithLength(DataConversionAttributes.ConversionType,
|
||||
DescriptionDecoder.GetDescription(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using IRIGCh10;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.TMATS.DataConversion
|
||||
{
|
||||
public enum MeasurandAttributes
|
||||
{
|
||||
[Description("MN1")]
|
||||
[MaxLength(64)]
|
||||
Description,
|
||||
[Description("MNA")]
|
||||
[MaxLength(32)]
|
||||
MeasurementAlias,
|
||||
[Description("MN2")]
|
||||
[MaxLength(10)]
|
||||
ExcitationVoltage,
|
||||
[Description("MN3")]
|
||||
[MaxLength(16)]
|
||||
EngineeringUnits,
|
||||
[Description("MN4")]
|
||||
[MaxLength(3)]
|
||||
LinkType
|
||||
}
|
||||
|
||||
public enum SourceDataTypeLinks
|
||||
{
|
||||
[Description("ANA")]
|
||||
FM,
|
||||
[Description("PCM")]
|
||||
PCM,
|
||||
[Description("PAM")]
|
||||
PAM,
|
||||
[Description("OTH")]
|
||||
Other
|
||||
}
|
||||
/// <summary>
|
||||
/// implements the measurand section of the tmats document
|
||||
/// </summary>
|
||||
public class MeasurandSection : TMATSSection<MeasurandAttributes>
|
||||
{
|
||||
public MeasurandSection(int number) : base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// DESCRIBE THE PARAMETER BEING MEASURED.
|
||||
/// </summary>
|
||||
public string Description
|
||||
{
|
||||
get => GetValue(MeasurandAttributes.Description);
|
||||
set => SetValueWithLength(MeasurandAttributes.Description, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// ALTERNATE MEASURAND NAME
|
||||
/// </summary>
|
||||
public string MeasurementAlias
|
||||
{
|
||||
get => GetValue(MeasurandAttributes.MeasurementAlias);
|
||||
set => SetValueWithLength( MeasurandAttributes.MeasurementAlias, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// SENSOR REFERENCE VOLTAGE, IN VOLTS
|
||||
/// </summary>
|
||||
public string ExcitationVoltage
|
||||
{
|
||||
get => GetValue(MeasurandAttributes.ExcitationVoltage);
|
||||
set => SetValueWithLength(MeasurandAttributes.ExcitationVoltage, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// DEFINE THE ENGINEERING UNITS APPLICABLE TO THE OUTPUT DATA.
|
||||
/// </summary>
|
||||
public string EngineeringUnits
|
||||
{
|
||||
get => GetValue(MeasurandAttributes.EngineeringUnits);
|
||||
set => SetValueWithLength(MeasurandAttributes.EngineeringUnits, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// DEFINE THE SOURCE DATA LINK TYPE:
|
||||
/// </summary>
|
||||
/// <param name="linkType"></param>
|
||||
public void SetLinkType(SourceDataTypeLinks linkType)
|
||||
{
|
||||
SetValueWithLength(MeasurandAttributes.LinkType, DescriptionDecoder.GetDescription(linkType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using IRIGCh10;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.Attributes
|
||||
{
|
||||
public enum OtherInformationAttributes
|
||||
{
|
||||
[MaxLength(32)]
|
||||
[Description("MOT1")]
|
||||
HighMeasurementValue,
|
||||
[MaxLength(32)]
|
||||
[Description("MOT2")]
|
||||
LowMeasurementValue,
|
||||
[MaxLength(32)]
|
||||
[Description("MOT3")]
|
||||
HighAlertLimitValue,
|
||||
[MaxLength(32)]
|
||||
[Description("MOT4")]
|
||||
LowAlertLimitValue,
|
||||
[MaxLength(32)]
|
||||
[Description("MOT5")]
|
||||
HighWarningLimitValue,
|
||||
[MaxLength(32)]
|
||||
[Description("MOT6")]
|
||||
LowWarningLimitValue,
|
||||
[Description("SR")]
|
||||
[MaxLength(6)]
|
||||
SampleRate
|
||||
}
|
||||
/// <summary>
|
||||
/// implements the other information section of the TMAT packet, see chapter 9
|
||||
/// </summary>
|
||||
public class OtherInformationSection : TMATSSection<OtherInformationAttributes>
|
||||
{
|
||||
public OtherInformationSection(int number)
|
||||
: base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// HIGHEST ENGINEERING UNIT VALUE DEFINED BY THE CALIBRATION DATA,
|
||||
/// SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string HighMeasurementValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.HighMeasurementValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.HighMeasurementValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// LOWEST ENGINEERING UNIT VALUE DEFINED IN THE CALIBRATION DATA,
|
||||
/// SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string LowMeasurementValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.LowMeasurementValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.LowMeasurementValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// HIGHEST ENGINEERING UNIT VALUE EXPECTED OR SAFE OPERATING VALUE OF
|
||||
/// THE PARAMETER (“RED”), SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string HighAlertLimitValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.HighAlertLimitValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.HighAlertLimitValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// LOWEST ENGINEERING UNIT VALUE EXPECTED OR SAFE OPERATING VALUE OF
|
||||
/// THE PARAMETER (“RED”), SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string LowAlertLimitValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.LowAlertLimitValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.LowAlertLimitValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// HIGHEST ENGINEERING UNIT VALUE EXPECTED OR SAFE OPERATING VALUE OF
|
||||
/// THE PARAMETER (“YELLOW”), SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string HighWarningLimitValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.HighWarningLimitValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.HighWarningLimitValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// LOWEST ENGINEERING UNIT VALUE EXPECTED OR SAFE OPERATING VALUE OF
|
||||
/// THE PARAMETER (“YELLOW”), SCIENTIFIC NOTATION MAY BE USED.
|
||||
/// </summary>
|
||||
public string LowWarningLimitValue
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.LowWarningLimitValue);
|
||||
set => SetValueWithLength(OtherInformationAttributes.LowWarningLimitValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// ENTER THE SAMPLE RATE IN TERMS OF SAMPLES/SECOND.
|
||||
/// </summary>
|
||||
public string SampleRate
|
||||
{
|
||||
get => GetValue(OtherInformationAttributes.SampleRate);
|
||||
set => SetValueWithLength(OtherInformationAttributes.SampleRate, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using IRIGCh10;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.TMATS.DataConversion
|
||||
{
|
||||
public enum TelemetryAttributes
|
||||
{
|
||||
[Description("BFM")]
|
||||
[MaxLength(3)]
|
||||
BinaryFormat
|
||||
}
|
||||
|
||||
public enum BinaryFormats
|
||||
{
|
||||
[Description("INT")]
|
||||
Integer,
|
||||
[Description("UNS")]
|
||||
UnsignedBinary,
|
||||
[Description("SIG")]
|
||||
SignAndMagnitudeSig,
|
||||
[Description("SIM")]
|
||||
SignAndMagnitudeSim,
|
||||
[Description("ONE")]
|
||||
OnesCompliment,
|
||||
[Description("TWO")]
|
||||
TwosCompliment,
|
||||
[Description("OFF")]
|
||||
OffsetBinary,
|
||||
[Description("FPT")]
|
||||
FloatingPoint,
|
||||
[Description("BCD")]
|
||||
BinaryCodedDecimal,
|
||||
[Description("BWT")]
|
||||
BitWeight,
|
||||
[Description("OTH")]
|
||||
Other
|
||||
}
|
||||
/// <summary>
|
||||
/// implements part of the telemetry section of the TMATS packet (see chapter 9)
|
||||
/// </summary>
|
||||
public class TelemetrySection : TMATSSection<TelemetryAttributes>
|
||||
{
|
||||
public TelemetrySection(int number) : base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetBinaryFormat(BinaryFormats format)
|
||||
{
|
||||
SetValueWithLength(TelemetryAttributes.BinaryFormat,
|
||||
DescriptionDecoder.GetDescription(format));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
using IRIGCh10;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.TMATS.DataConversion
|
||||
{
|
||||
public enum TransducerInformation
|
||||
{
|
||||
[Description("DCN")] [MaxLength(32)] MeasurementName,
|
||||
[Description("TRD1")] [MaxLength(32)] Type,
|
||||
[Description("TRD2")] [MaxLength(32)] ModelNumber,
|
||||
[Description("TRD3")] [MaxLength(32)] SerialNumber,
|
||||
[Description("TRD4")] [MaxLength(2)] SecurityClassification,
|
||||
[Description("TRD5")] [MaxLength(10)] OriginationDate,
|
||||
[Description("TRD6")] [MaxLength(4)] RevisionNumber,
|
||||
[MaxLength(32)] [Description("TRD7")] Orientation,
|
||||
[MaxLength(24)] [Description("POC1")] PointOfContactName,
|
||||
[MaxLength(48)] [Description("POC2")] PointOfContactAgency,
|
||||
[MaxLength(48)] [Description("POC3")] PointOfContectAddress,
|
||||
[MaxLength(20)] [Description("POC4")] PointOfContactTelephone,
|
||||
}
|
||||
|
||||
public enum ClassificationTypes
|
||||
{
|
||||
[Description("U")] Unclassified,
|
||||
[Description("C")] Confidential,
|
||||
[Description("S")] Secret,
|
||||
[Description("T")] TopSecret,
|
||||
[Description("O")] Other
|
||||
}
|
||||
/// <summary>
|
||||
/// this class handles the transducer information section of the TMAT packet (see chapter 9.pdf)
|
||||
/// </summary>
|
||||
public class TransducerInformationSection : TMATSSection<TransducerInformation>
|
||||
{
|
||||
public TransducerInformationSection(int number) : base(AttributeIdentifiers.DataConversionAttributes, number)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GIVE THE MEASUREMENT NAME.
|
||||
/// </summary>
|
||||
public string MeasurementName
|
||||
{
|
||||
get => GetValue(TransducerInformation.MeasurementName);
|
||||
set => SetValueWithLength(TransducerInformation.MeasurementName, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TYPE OF SENSOR, IF APPROPRIATE
|
||||
/// </summary>
|
||||
public string Type
|
||||
{
|
||||
get => GetValue(TransducerInformation.Type);
|
||||
set => SetValueWithLength(TransducerInformation.Type, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// IF APPROPRIATE
|
||||
/// </summary>
|
||||
public string ModelNumber
|
||||
{
|
||||
get => GetValue(TransducerInformation.ModelNumber);
|
||||
set => SetValueWithLength(TransducerInformation.ModelNumber, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// IF APPLICABLE
|
||||
/// </summary>
|
||||
public string SerialNumber
|
||||
{
|
||||
get => GetValue(TransducerInformation.SerialNumber);
|
||||
set => SetValueWithLength(TransducerInformation.SerialNumber, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// ENTER THE SECURITY CLASSIFICATION OF THIS MEASURAND.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="signalClassified"></param>
|
||||
/// <param name="measurandClassified"></param>
|
||||
public void SetSecurityClassification(ClassificationTypes type,
|
||||
bool signalClassified, bool measurandClassified)
|
||||
{
|
||||
var val = DescriptionDecoder.GetDescription(type);
|
||||
if (signalClassified && measurandClassified)
|
||||
{
|
||||
val = $"{val}B";
|
||||
}
|
||||
else if (signalClassified)
|
||||
{
|
||||
val = $"{val}R";
|
||||
}
|
||||
else if (measurandClassified)
|
||||
{
|
||||
val = $"{val}E";
|
||||
}
|
||||
|
||||
SetValueWithLength(TransducerInformation.SecurityClassification, val);
|
||||
}
|
||||
/// <summary>
|
||||
/// DATE OF ORIGINATION OF THIS DATA FILE. DD – DAY MM – MONTH
|
||||
/// YYYY – YEAR (MM-DD-YYYY)
|
||||
/// </summary>
|
||||
public DateTime? OriginationDate
|
||||
{
|
||||
get
|
||||
{
|
||||
var val = GetValue(TransducerInformation.OriginationDate);
|
||||
if (string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (DateTime.TryParse(val, out var dt))
|
||||
{
|
||||
return dt;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (null == value)
|
||||
{
|
||||
SetValueWithLength(TransducerInformation.OriginationDate, string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = (DateTime) value;
|
||||
SetValueWithLength(TransducerInformation.OriginationDate,
|
||||
$"{dt.Month:00}-{dt.Day:00}-{dt.Year:0000}");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// SPECIFY THE REVISION NUMBER OF THE DATA PROVIDED.
|
||||
/// </summary>
|
||||
public string RevisionNumber
|
||||
{
|
||||
get => GetValue(TransducerInformation.RevisionNumber);
|
||||
set => SetValueWithLength(TransducerInformation.RevisionNumber, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// DESCRIBE THE PHYSICAL ORIENTATION OF THE SENSOR.
|
||||
/// </summary>
|
||||
public string Orientation
|
||||
{
|
||||
get => GetValue(TransducerInformation.Orientation);
|
||||
set => SetValueWithLength(TransducerInformation.Orientation, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// POINT OF CONTACT WITH THE ORGANIZATION THAT PROVIDED THE CALIBRATION DATA
|
||||
/// </summary>
|
||||
public POC PointOfContact
|
||||
{
|
||||
get => new POC()
|
||||
{
|
||||
Name = GetValue(TransducerInformation.PointOfContactName),
|
||||
Agency = GetValue(TransducerInformation.PointOfContactAgency),
|
||||
Address = GetValue(TransducerInformation.PointOfContectAddress),
|
||||
Telephone = GetValue(TransducerInformation.PointOfContectAddress)
|
||||
};
|
||||
set
|
||||
{
|
||||
SetValueWithLength(TransducerInformation.PointOfContactName, value.Name);
|
||||
SetValueWithLength(TransducerInformation.PointOfContactAgency, value.Agency);
|
||||
SetValueWithLength(TransducerInformation.PointOfContectAddress, value.Address);
|
||||
SetValueWithLength(TransducerInformation.PointOfContactTelephone, value.Telephone);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Point Of Contact structure
|
||||
/// </summary>
|
||||
public class POC
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Agency { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string Telephone { get; set; }
|
||||
|
||||
public POC(string name, string agency, string address, string telephone)
|
||||
{
|
||||
Name = name;
|
||||
Agency = agency;
|
||||
Address = address;
|
||||
Telephone = telephone;
|
||||
}
|
||||
|
||||
public POC()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user