Files
2026-04-17 14:55:32 -04:00

152 lines
6.8 KiB
C#

using System.ComponentModel;
namespace IRIGCh10
{
public enum AttributeIdentifiers
{
[Description("G")] GeneralInformation,
[Description("T")] TransmitionAttributes,
[Description("R")] StorageSourceAttributes,
[Description("M")] MultiplexingAttributes,
[Description("P")] PCMFormatAttributes,
[Description("D")] PCMMeasurementDescription,
[Description("B")] BusDataAttributes,
[Description("S")] PacketFormatAttributes,
[Description("A")] PAMAttributes,
[Description("C")] DataConversionAttributes,
[Description("H")] AirborneHardwareAttributes,
[Description("V")] VendorSpecificAttributes
}
public class TMATSCreationTest
{
public static string CreateTMATS()
{
var sb = new System.Text.StringBuilder();
var gi = new GeneralInformationGroup();
gi.ProgramName = "netacquire-3-pcm-sine-waves";
gi.IRIG106RevisionLevel = "07";
gi.NumberOfDataSources = 1;
gi.SetDataSourceField(1, GeneralInformationGroup.Information.DataSourceIdentificationTags.DataSourceID,
"DATASOURCE");
gi.SetDataSourceType(1, GeneralInformationGroup.Information.DataSourceTypes.Storage);
gi.OriginationDate = new System.DateTime(2018, 11, 20);
sb.Append(gi.Serialize());
var storage = new Storage(1);
storage.DataSourceID = "DATASOURCE";
storage.StorageID = "DATASOURCE";
storage.NumberOfChannels = 4;
storage.OriginalStorage = true;
storage.DateTimeCreated = new System.DateTime(2018, 11, 20);
storage.NumberOfSourceBits = 0;
storage.RecordingEventsEnabled = false;
storage.RecordingIndexEnabled = true;
storage.RecordingIndexType = RecordingIndexTypes.Time;
storage.RecordingIndexTimeValue = 10000000;
storage.SetDataSourceID(1, "Time");
storage.SetChannelDataType(1, ChannelDataTypes.IRIGTimeInput);
storage.SetTrackNumber(1, 65535);
storage.SetPhysicalChannelNumber(1, 65535);
storage.SetChannelEnabled(1, true);
storage.SetChannelDataLinkName(1, "Time");
storage.SetTimeChannelDataTypeFormat();
storage.SetTimeFormat(TimeFormats.IRIGB);
storage.SetTimeSource(TimeSources.Internal);
storage.SetDataSourceID(2, "sio/0/in0-10");
storage.SetChannelDataType(2, ChannelDataTypes.PCMInput);
storage.SetTrackNumber(2, 10);
storage.SetPhysicalChannelNumber(2, 10);
storage.SetChannelEnabled(2, true);
storage.SetChannelDataLinkName(2, "sio/0/in0-10");
storage.SetPCMDataTimeFormat(2);
storage.SetPCMDataPackingOption(2, DataPackingOptions.ThroughputMode);
storage.SetPCMInputClockEdge(2, InputClockEdges.ZeroDegrees);
storage.SetPCMInputSignalType(2, InputSignalTypes.SingleEndedWithTTL);
storage.SetPCMVideoTypeFormat(2, VideoFormats.None);
var pcm = new PCM(1);
pcm.DataLinkName = "sio/0/in0-10";
pcm.PCMCode = PCMCodes.NRZL;
pcm.BitsPerSecond = "1000000";
pcm.Polarity = Polarities.Normal;
pcm.DataDirection = PCMDataDirections.Normal;
pcm.TypeFormat = PCMTypeFormats.ClassI;
pcm.NumberOfBitsInCommonWordLength = 16;
pcm.WordTransferOrder = PCMWordTransferOrders.MostSignificantBit;
pcm.PCMWordParity = PCMWordParities.None;
sb.Append(pcm.Serialize());
var minorFrameSection = new MinorFrameSection();
minorFrameSection.NumberOfMinorFramesInAMajorFrame = 1;
minorFrameSection.NumberOfWordsInMinorFrame = 500;
minorFrameSection.NumberOfBitsInMinorFrame = 8000;//500*16
minorFrameSection.SyncLength = 16;
minorFrameSection.SynchronizationPattern = "1110101110010000";
sb.Append(minorFrameSection.Serialize());
var subframeSync = new SubframeSync();
sb.Append(subframeSync.Serialize());
storage.SetDataSourceID(3, "sio/0/in1-20");
storage.SetChannelDataType(3, ChannelDataTypes.PCMInput);
storage.SetTrackNumber(3, 20);
storage.SetPhysicalChannelNumber(3, 20);
storage.SetChannelEnabled(3, true);
storage.SetChannelDataLinkName(3, "sio/0/in1-20");
storage.SetPCMDataTimeFormat(3);
storage.SetPCMDataPackingOption(3, DataPackingOptions.PackedWithFrameSync);
storage.SetPCMInputClockEdge(3, InputClockEdges.ZeroDegrees);
storage.SetPCMInputSignalType(3, InputSignalTypes.SingleEndedWithTTL);
storage.SetPCMVideoTypeFormat(3, VideoFormats.None);
var pcm2 = new PCM(2);
pcm2.DataLinkName = "sio/0/in1-20";
pcm2.PCMCode = PCMCodes.NRZL;
pcm2.BitsPerSecond = "1920000";
pcm2.Polarity = Polarities.Normal;
pcm2.DataRandomized = false;
pcm2.TypeFormat = PCMTypeFormats.ClassI;
pcm2.NumberOfBitsInCommonWordLength = 16;
pcm2.WordTransferOrder = PCMWordTransferOrders.MostSignificantBit;
pcm2.PCMWordParity = PCMWordParities.None;
sb.Append(pcm2.Serialize());
var minorFrameSection2 = new MinorFrameSection(2);
minorFrameSection2.NumberOfMinorFramesInAMajorFrame = 1;
minorFrameSection2.NumberOfWordsInMinorFrame = 300;
minorFrameSection2.NumberOfBitsInMinorFrame = 4800;//300*16
minorFrameSection2.SyncLength = 16;
minorFrameSection2.SynchronizationPattern = "1110101110010000";
sb.Append(minorFrameSection2.Serialize());
var subframeSync2 = new SubframeSync(2);
sb.Append(subframeSync2.Serialize());
storage.SetDataSourceID(4, "sio/0/in2-30");
storage.SetChannelDataType(4, ChannelDataTypes.MessageDataInput);
storage.SetTrackNumber(4, 30);
storage.SetPhysicalChannelNumber(4, 30);
storage.SetChannelEnabled(4, true);
storage.SetChannelDataLinkName(4, "sio/0/in2-30");
sb.Append(storage.Serialize());
MessageDataType mdt = new MessageDataType(1);
mdt.SetMessageTypeFormat(4, "0");
mdt.SetNumberOfMessageSubChannels(4, 1);
mdt.SetMessageSubChannelNumber(4, 1, 1);
mdt.SetMessageSubChannelName(4, 1, "sio/0/in2-30");
sb.Append(mdt.Serialize());
return sb.ToString();
}
}
}