init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ChannelDefinition.h
|
||||
// --------------------
|
||||
// Defines a data channel (based on DDAS testplan.h)
|
||||
//
|
||||
//
|
||||
// AUTHOR: A. J. Owski
|
||||
// LOC: 1250
|
||||
// DEPT: 5260 Tool Development
|
||||
// (formerly Instrument Systems)
|
||||
//
|
||||
// COPYRIGHT: (c) 2002 DaimlerChrysler Corp.
|
||||
//
|
||||
// REVISIONS: (most-recent at top of list).
|
||||
//
|
||||
// Date Init Description of Change
|
||||
// ---- ---- ---------------------
|
||||
// 11/08/04 wjp Remove redundant CalDate from Channel definition and label the
|
||||
// field as spare bytes. Use the date in the transducer structure,
|
||||
// which is part of the channel definition.
|
||||
//
|
||||
|
||||
#if !defined( CHANNEL_H )
|
||||
#define CHANNEL_H
|
||||
|
||||
#include "TransducerDefinition.h"
|
||||
|
||||
enum ChannelFlags{CHANFLAG_ACTIVE};
|
||||
|
||||
|
||||
// Channel State Macro's
|
||||
|
||||
#define ISCHANACTIVE(pChan)(pChan->Flags&(1<<CHANFLAG_ACTIVE)?1:0)
|
||||
#define SETCHANACTIVE(pChan)(pChan->Flags|=(1<<CHANFLAG_ACTIVE))
|
||||
#define CLRCHANACTIVE(pChan)(pChan->Flags&=(~(1<<CHANFLAG_ACTIVE)))
|
||||
|
||||
|
||||
// Channel Data Structure
|
||||
|
||||
typedef struct tagCHANNEL
|
||||
{
|
||||
short Size; // Size of this object
|
||||
short Flags; // Channel Flags
|
||||
char Name[64]; // Channel Name
|
||||
char Sign[8]; // Sign +, -, or blank
|
||||
char Axis[8]; // X,Y,Z,FX,MX,AX,...
|
||||
float FilterFreq; // Channel Filter Class (in Hz)
|
||||
float SetGain; // Gain setting (1 - n)
|
||||
float ActGain; // Actual (measured?) gain setting.
|
||||
float Rcal; // Shunt cal resistance
|
||||
float Excitation; // Excitation Voltage (when programable)
|
||||
// time_t CalDate; // Calibration date (Remove - redundant)
|
||||
byte byteSpares[4]; // Spare bytes (was Cal Date)
|
||||
TRANSDUCER Transducer; // "Snapshot" of transducer values
|
||||
} CHANNEL;
|
||||
|
||||
typedef CHANNEL *PCHANNEL; // Pointer to a channel
|
||||
typedef CHANNEL *PCHAN; // Even shorter version of above
|
||||
|
||||
#endif // !defined( CHANNEL_H )
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* SoMat.File.Writer.cs
|
||||
*
|
||||
* Copyright © 2009
|
||||
* Diversified Technical Systems, Inc.
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace DTS.Serialization.DDAS
|
||||
{
|
||||
// *** see DDAS.File.Writer.cs ***
|
||||
public partial class File
|
||||
{ ///
|
||||
/// <summary>
|
||||
/// Utility object for serializing <see cref="DTS.Serialization.Test"/>s to disk
|
||||
/// in the Diadem
|
||||
/// </summary>
|
||||
///
|
||||
public class Writer : Writer<File>, IWriter<Test>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize an instance of the SoMat.File.Writer class.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="fileType">
|
||||
/// The associated <see cref="DTS.SErialization.Diadem.File"/> object.
|
||||
/// </param>
|
||||
///
|
||||
internal Writer(File fileType, int encoding)
|
||||
: base(fileType, encoding)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Write the specified test to the specified pathname.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="pathname">
|
||||
/// The <see cref="string"/> pathname to which the specified test should be serialized.
|
||||
/// </param>
|
||||
///
|
||||
/// <param name="test">
|
||||
/// The <see cref="DTS.Serialization.Test"/> to be written out.
|
||||
/// </param>
|
||||
///
|
||||
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of data samples that need to be written for a "tick" to be dispatched.
|
||||
/// </summary>
|
||||
private int DataSamplesPerTick => 1000;
|
||||
|
||||
/// <summary>
|
||||
/// Return the number of data to be written per "tick".
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
private uint GetChannelTicks(Test.Module.Channel channel)
|
||||
{
|
||||
try
|
||||
{ //
|
||||
// Most of our wait time will be spent writing data, so we need to give
|
||||
// the process a little finer granularity.
|
||||
//
|
||||
return (uint)(channel.PersistentChannelInfo.Length / DataSamplesPerTick);
|
||||
}
|
||||
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw new Exception("encountered problem determining number of status ticks for channel " + (null != channel ? "\"" + channel.Number.ToString() + "\"" : "<NULL>"), ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string ExtensionPrefix { get; set; } = string.Empty;
|
||||
public DDASTest MyTVTTest { get; set; }
|
||||
/// <summary>
|
||||
/// Write the representation file/files of the specified DTS.Serialization.Test
|
||||
/// at the given pathname.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="targetPathname">
|
||||
/// The <see cref="string"/> pathname of the specified object's resulting file
|
||||
/// representation.
|
||||
/// </param>
|
||||
///
|
||||
public void Write(string pathname,
|
||||
string id,
|
||||
string dataFolder,
|
||||
Test test,
|
||||
bool bFiltering,
|
||||
bool includeGroupNameInISOExport,
|
||||
FilteredData fd,
|
||||
Test.Module.Channel tmChannel,
|
||||
int channelNumber,
|
||||
BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler,
|
||||
EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler,
|
||||
ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested,
|
||||
double minStartTime,
|
||||
int dataCollectionLength)
|
||||
{
|
||||
System.Exception exception = null;
|
||||
uint totalWriteTicksNeeded = 0;
|
||||
if (test.Channels.Count > 0)
|
||||
totalWriteTicksNeeded = GetChannelTicks(test.Channels[0]);
|
||||
try
|
||||
{
|
||||
beginEventHandler?.Invoke(this, totalWriteTicksNeeded); foreach (var channel in MyTVTTest.Channels) { channel.Serialize(tickEventHandler); }
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
}
|
||||
tickEventHandler?.Invoke(this, 100D);
|
||||
if (null != errorEventHandler && null != exception)
|
||||
{
|
||||
endEventHandler(this);
|
||||
errorEventHandler(this, exception);
|
||||
}
|
||||
else if (null != exception) { throw exception; }
|
||||
else
|
||||
{
|
||||
tickEventHandler?.Invoke(this, 100.0);
|
||||
endEventHandler?.Invoke(this);
|
||||
}
|
||||
}
|
||||
public void Initialize(string pathname,
|
||||
string id,
|
||||
string dataFolder,
|
||||
Test test,
|
||||
bool bFiltering,
|
||||
bool includeGroupNameInISOExport,
|
||||
FilteredData fd,
|
||||
Test.Module.Channel tmChannel,
|
||||
int channelNumber,
|
||||
BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler,
|
||||
EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler,
|
||||
ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDAS.File.cs
Normal file
53
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDAS.File.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* SoMat.File.cs
|
||||
*
|
||||
* Copyright © 2013
|
||||
* Diversified Technical Systems, Inc.
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
namespace DTS.Serialization.DDAS
|
||||
{
|
||||
///
|
||||
/// <summary>
|
||||
/// File
|
||||
/// </summary>
|
||||
///
|
||||
public partial class File
|
||||
: Serialization.File, IWritable<Test>
|
||||
{ ///
|
||||
/// <summary>
|
||||
/// Initialize an instance of the FtssCsv.File class.
|
||||
/// </summary>
|
||||
///
|
||||
public File()
|
||||
: base("DDAS")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get this file format's extension.
|
||||
/// </summary>
|
||||
public static string Extension => ".ddas";
|
||||
|
||||
/// <summary>
|
||||
/// Get the file writer for this file type.
|
||||
/// </summary>
|
||||
public IWriter<Test> Exporter
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null == _Exporter) { _Exporter = new Writer(this, DefaultEncoding); }
|
||||
return _Exporter;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw new Exception("encountered problem getting exporter", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
private IWriter<Test> _Exporter = null;
|
||||
}
|
||||
}
|
||||
317
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASChannel.cs
Normal file
317
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASChannel.cs
Normal file
@@ -0,0 +1,317 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace DTS.Serialization.DDAS
|
||||
{
|
||||
public class DDASChannel
|
||||
{
|
||||
private readonly DDASTest _parentTest;
|
||||
|
||||
private readonly Dictionary<DDASTest.Fields, string> _values = new Dictionary<DDASTest.Fields, string>();
|
||||
|
||||
public string GetValue(DDASTest.Fields field)
|
||||
{
|
||||
if (!_values.ContainsKey(field)) _values.Add(field, "#NOVALUE");
|
||||
return _values[field];
|
||||
}
|
||||
|
||||
public void SetValue(DDASTest.Fields field, string value)
|
||||
{
|
||||
_values[field] = value;
|
||||
switch (field)
|
||||
{
|
||||
case DDASTest.Fields.DataType:
|
||||
if (value == "Raw")
|
||||
{
|
||||
SetValue(DDASTest.Fields.EngineeringUnits, "ADC");
|
||||
SetValue(DDASTest.Fields.DigitalFilterType, "");
|
||||
var actualRange = _parentTest.ActualRangesADC[_channelIndex];
|
||||
|
||||
SetValue(DDASTest.Fields.BitResolution, (2D * actualRange / ushort.MaxValue).ToString());
|
||||
|
||||
FileName = Path.Combine(Path.Combine(_path, "DDAS"), "Raw");
|
||||
FileName = Path.Combine(FileName, $"{_parentTest.Test.Id}_{ChannelNumber}.DDAS");
|
||||
}
|
||||
else if (value == "Processed")
|
||||
{
|
||||
SetValue(DDASTest.Fields.EngineeringUnits, _engineeringUnits);
|
||||
SetValue(DDASTest.Fields.DigitalFilterType,
|
||||
$"CFC {_parentTest.DataUnfilteredEU[_channelIndex].FilterDescription}/{_parentTest.DataUnfilteredEU[_channelIndex].FilterFrequencyHz}");
|
||||
var actualRange = _parentTest.ActualRangesEUFiltered[_channelIndex];
|
||||
|
||||
SetValue(DDASTest.Fields.BitResolution, (2D * actualRange / ushort.MaxValue).ToString());
|
||||
FileName = Path.Combine(Path.Combine(_path, "DDAS"), "Processed");
|
||||
FileName = Path.Combine(FileName, $"{_parentTest.Test.Id}_{ChannelNumber}.DDAS");
|
||||
}
|
||||
else if (value == "Converted")
|
||||
{
|
||||
SetValue(DDASTest.Fields.EngineeringUnits, _engineeringUnits);
|
||||
SetValue(DDASTest.Fields.DigitalFilterType, "");
|
||||
var actualRange = _parentTest.ActualRangesEUUnfiltered[_channelIndex];
|
||||
|
||||
SetValue(DDASTest.Fields.BitResolution, (2D * actualRange / ushort.MaxValue).ToString());
|
||||
FileName = Path.Combine(Path.Combine(_path, "DDAS"), "Converted");
|
||||
FileName = Path.Combine(FileName, $"{_parentTest.Test.Id}_{ChannelNumber}.DDAS");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly string _engineeringUnits = "";
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Serialize(TickEventHandler tickHandler)
|
||||
{
|
||||
if (!Directory.Exists(new FileInfo(FileName).Directory.FullName))
|
||||
Directory.CreateDirectory(new FileInfo(FileName).Directory.FullName);
|
||||
using (var bw = new BinaryWriter(System.IO.File.Open(FileName, FileMode.Create)))
|
||||
{
|
||||
// First write the "fileinfoblock"
|
||||
//typedef struct tagFILEINFOBLOCK
|
||||
//{
|
||||
// UINT Size; // Block Size (including nSize)
|
||||
// char FileTypeName[12]; // Software Type Name
|
||||
// char FileTypeVers[12]; // File Version Name
|
||||
// UINT FileTypeFlags; // File Type Flags
|
||||
// // - Hardware Type in upper 16 bits
|
||||
// // - File Type in lower 16 bits
|
||||
// char CreatedByName[16]; // Created by T-number
|
||||
// char UpdatedByName[16]; // Updated by T-number
|
||||
//}FILEINFOBLOCK;
|
||||
|
||||
bw.Write((uint)0x40);
|
||||
var fileType = "DDAS FlPt";
|
||||
bw.Write(Encoding.ASCII.GetBytes(fileType.PadRight(12, '\0')));
|
||||
var fileTypeVersion = "Ver 500";
|
||||
bw.Write(Encoding.ASCII.GetBytes(fileTypeVersion.PadRight(12, '\0')));
|
||||
bw.Write((uint)0);
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(
|
||||
_parentTest.Test.Id.Substring(0, Math.Min(16, _parentTest.Test.Id.Length)).PadRight(16, '\0')));
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(
|
||||
_parentTest.Test.Id.Substring(0, Math.Min(16, _parentTest.Test.Id.Length)).PadRight(16, '\0')));
|
||||
|
||||
// Now the test info
|
||||
// typedef struct tagTESTINFO
|
||||
// {
|
||||
// unsigned long Size; // Block Size (including Size)
|
||||
// unsigned long DeviceID; // DAQ device ID
|
||||
// long ChannelNo; // Channel number (1-32)
|
||||
// long SampleRate; // Samples per second
|
||||
// long TotalSamples; // Total samples in data record
|
||||
// long PreEventSamples; // Samples before event
|
||||
// short ChanNumInSys; // Channel Number (1-128) in system (many devices)
|
||||
// short NumPreCalPts; // Number of preCal points included with data
|
||||
// short NumPostCalPts; // Number of preCal points included with data
|
||||
// char TestCreation[TESTPATHSIZE]; // Test path and date
|
||||
// char TimeAxisTitle[32]; // Time axis title
|
||||
// byte SpareBytes[2]; // 2 bytes of spare (for 4 byte alignment)
|
||||
//
|
||||
// } TESTINFO;
|
||||
|
||||
var channel = _parentTest.Test.Channels[_channelIndex] as Test.Module.AnalogInputChannel;
|
||||
|
||||
bw.Write((uint)0xC0);
|
||||
bw.Write((uint)(1 + channel.ParentModule.Number));
|
||||
bw.Write((uint)(1 + _channelIndex));
|
||||
bw.Write((uint)channel.ParentModule.SampleRateHz);
|
||||
bw.Write((uint)channel.ParentModule.NumberOfSamples);
|
||||
bw.Write((uint)(channel.ParentModule.PreTriggerSeconds * channel.ParentModule.SampleRateHz));
|
||||
bw.Write((ushort)channel.Number);
|
||||
bw.Write((ushort)0);
|
||||
bw.Write((ushort)0);
|
||||
var testPathAndDate = FileName + " " + channel.ParentModule.ParentTest.InceptionDate.ToLongDateString();
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(
|
||||
testPathAndDate.Substring(0, Math.Min(128, testPathAndDate.Length)).PadRight(128, '\0')));
|
||||
var TimeLabel = "Time (msec)";
|
||||
bw.Write(Encoding.ASCII.GetBytes(TimeLabel.PadRight(32, '\0')));
|
||||
bw.Write((byte)0x00);
|
||||
bw.Write((byte)0x00);
|
||||
|
||||
// Channel
|
||||
//typedef struct tagCHANNEL
|
||||
// {
|
||||
// short Size; // Size of this object
|
||||
// short Flags; // Channel Flags
|
||||
// char Name[64]; // Channel Name
|
||||
// char Sign[8]; // Sign +, -, or blank
|
||||
// char Axis[8]; // X,Y,Z,FX,MX,AX,...
|
||||
// float FilterFreq; // Channel Filter Class (in Hz)
|
||||
// float SetGain; // Gain setting (1 - n)
|
||||
// float ActGain; // Actual (measured?) gain setting.
|
||||
// float Rcal; // Shunt cal resistance
|
||||
// float Excitation; // Excitation Voltage (when programable)
|
||||
// byte byteSpares[4]; // Spare bytes (was Cal Date)
|
||||
// TRANSDUCER Transducer; // "Snapshot" of transducer values
|
||||
// } CHANNEL;
|
||||
|
||||
bw.Write((ushort)0x1001);
|
||||
bw.Write((ushort)0x0100);
|
||||
var description =
|
||||
Encoding.ASCII.GetBytes(
|
||||
channel.Description.Substring(0, Math.Min(64, channel.Description.Length)).PadRight(64, '\0'));
|
||||
bw.Write(description);
|
||||
|
||||
var polarity = "+";
|
||||
if (channel.IsInverted)
|
||||
polarity = "-";
|
||||
bw.Write(Encoding.ASCII.GetBytes(polarity.PadRight(8, (char)0x00)));
|
||||
|
||||
const string empty = "";
|
||||
bw.Write(Encoding.ASCII.GetBytes(empty.PadRight(8, (char)0x00)));
|
||||
|
||||
//ChannelFilter[] filterClasses = Enum.GetValues(typeof(ChannelFilter)).Cast<ChannelFilter>().ToArray();
|
||||
//float effectiveCFCFrequency = 0;
|
||||
//foreach(var f in filterClasses)
|
||||
//{
|
||||
// if((int)f == (int)_parentTest.DataUnfilteredEU[_channelIndex].FilterFrequencyHz)
|
||||
// {
|
||||
// var type = typeof(ChannelFilter);
|
||||
// var memInfo = type.GetMember(f.ToString());
|
||||
// var attributes = memInfo[0].GetCustomAttributes(typeof(CFCValueAttribute),
|
||||
// false);
|
||||
// effectiveCFCFrequency = (float)((CFCValueAttribute)attributes[0]).CFCValue;
|
||||
// }
|
||||
//}
|
||||
//if (0 == effectiveCFCFrequency) { effectiveCFCFrequency = (float)_parentTest.DataUnfilteredEU[_channelIndex].FilterFrequencyHz; }
|
||||
bw.Write(channel.ParentModule.AaFilterRateHz);
|
||||
|
||||
if (channel.ExpectedGainValid)
|
||||
bw.Write((float)channel.ExpectedGain);
|
||||
else
|
||||
bw.Write((float)(2500.0 / channel.DesiredRange));
|
||||
if (channel.MeasuredGainValid)
|
||||
bw.Write((float)channel.MeasuredGain);
|
||||
else if (channel.ExpectedGainValid)
|
||||
bw.Write((float)channel.ExpectedGain);
|
||||
else
|
||||
bw.Write((float)1.0);
|
||||
|
||||
bw.Write((float)channel.BridgeResistanceOhms);
|
||||
|
||||
if (channel.MeasuredExcitationVoltageValid)
|
||||
bw.Write((float)channel.MeasuredExcitationVoltage);
|
||||
else
|
||||
bw.Write((float)channel.ExcitationVoltage);
|
||||
bw.Write((byte)0x00);
|
||||
bw.Write((byte)0x00);
|
||||
bw.Write((byte)0x00);
|
||||
bw.Write((byte)0x00);
|
||||
|
||||
//typedef struct tagTRANSDUCER
|
||||
//{
|
||||
//char Mfr[32]; // Manufacturer
|
||||
//char Model[32]; // Model
|
||||
//char SN[32]; // Transducer Serial No
|
||||
//char Type[16]; // Transducer Type (load cell, accel, etc)
|
||||
//char EngUnits[16]; // Engineering Units (applies to Capacity,
|
||||
// // Sensitivity, and EUCalValue
|
||||
//float Capacity; // Max applied accel, force, displacement, etc
|
||||
//float XdcrRactive; // Bridge arm resistance of active half
|
||||
//float XdcrRinactive; // Bridge arm resistance of inactive half
|
||||
//float Sensitivity; // Sensitivity in V/EU
|
||||
//float EUCalValue; // Engineering unit cal value with Rcal
|
||||
//float Rcal; // Cal Resistor in Ohms
|
||||
//float Excitation; // Excitation Voltage (when specified)
|
||||
//long CalDate; // Cal date as time_t (seconds since 1970)
|
||||
// // (Good til 2038...shouldn't be an issue
|
||||
// // for this developer).
|
||||
// long Spare; // Spare long
|
||||
//} TRANSDUCER;
|
||||
|
||||
|
||||
var Manufacturer = "CHRYSLER";
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(Manufacturer.Substring(0, Math.Min(32, Manufacturer.Length))
|
||||
.PadRight(32, '\0')));
|
||||
bw.Write(Encoding.ASCII.GetBytes(empty.PadRight(32, (char)0x00)));
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(
|
||||
channel.SerialNumber.Substring(0, Math.Min(32, channel.SerialNumber.Length)).PadRight(32, '\0')));
|
||||
var SensorType = "UNKNOWN";
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(SensorType.Substring(0, Math.Min(16, SensorType.Length)).PadRight(16, '\0')));
|
||||
bw.Write(
|
||||
Encoding.ASCII.GetBytes(
|
||||
channel.EngineeringUnits.Substring(0, Math.Min(16, channel.EngineeringUnits.Length))
|
||||
.PadRight(16, '\0')));
|
||||
|
||||
bw.Write((float)channel.DesiredRange);
|
||||
bw.Write((float)0);
|
||||
bw.Write((float)0);
|
||||
bw.Write((float)(1000 * channel.Sensitivity));
|
||||
bw.Write((float)0);
|
||||
bw.Write((float)channel.BridgeResistanceOhms);
|
||||
bw.Write((float)channel.ExcitationVoltage);
|
||||
|
||||
var Epoch = new DateTime(1971, 1, 1, 0, 0, 0);
|
||||
bw.Write((int)(channel.LastCalibrationDate - Epoch).TotalSeconds);
|
||||
var TransducerSpare = 0;
|
||||
bw.Write(TransducerSpare);
|
||||
|
||||
var Spare = new byte[0x0230 - 0x0210];
|
||||
bw.Write(Spare);
|
||||
|
||||
double percentageComplete = (float)_channelIndex / _parentTest.Channels.Length;
|
||||
var weight = 1D / _parentTest.Channels.Length;
|
||||
|
||||
for (var i = 0; i < _parentTest.DataUnfilteredEU[_channelIndex].Data.Length; i++)
|
||||
{
|
||||
bw.Write((float)_parentTest.DataUnfilteredEU[_channelIndex].Data[i]);
|
||||
if (0 == i % 1000)
|
||||
{
|
||||
var percent = 100D * (percentageComplete + i * weight / channel.ParentModule.NumberOfSamples);
|
||||
tickHandler(this, percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly int _channelIndex;
|
||||
|
||||
public int ChannelNumber => 1 + _channelIndex;
|
||||
|
||||
private readonly string _path;
|
||||
|
||||
public DDASChannel(DDASTest parentTest, int channelIndex, string path)
|
||||
{
|
||||
_path = path;
|
||||
_parentTest = parentTest;
|
||||
_channelIndex = channelIndex;
|
||||
var aic = parentTest.Test.Channels[channelIndex] as Test.Module.AnalogInputChannel;
|
||||
|
||||
_engineeringUnits = aic.EngineeringUnits;
|
||||
|
||||
SetValue(DDASTest.Fields.EngineeringUnits, aic.EngineeringUnits);
|
||||
SetValue(DDASTest.Fields.SensorMakeModelSerial, aic.SerialNumber);
|
||||
SetValue(DDASTest.Fields.SensorLocation, aic.Description);
|
||||
|
||||
// double actualRange = _parentTest.ActualRangesEUFiltered[_channelIndex];
|
||||
double actualRange = 0;
|
||||
|
||||
SetValue(DDASTest.Fields.BitResolution, (2D * actualRange / ushort.MaxValue).ToString());
|
||||
//FB14282: Option to Flatten Export Folders
|
||||
FileName = path;
|
||||
|
||||
var channel = _parentTest.Test.Channels[_channelIndex] as Test.Module.AnalogInputChannel;
|
||||
|
||||
// We need a list of bases in order to properly formulate the file name.
|
||||
var moduleSerialNumbers = new List<string>();
|
||||
foreach (var currentChannel in _parentTest.Test.Channels)
|
||||
if (!moduleSerialNumbers.Contains(currentChannel.ParentModule.SerialNumber))
|
||||
moduleSerialNumbers.Add(currentChannel.ParentModule.SerialNumber);
|
||||
|
||||
var baseIndex = moduleSerialNumbers.IndexOf(channel.ParentModule.SerialNumber);
|
||||
// Another SLICE Specific short cut. To properly number the channels, we need to know how many channels per module. However, in the case
|
||||
// of SLICE where a bridge only has one channel _assigned_, channel.ParentModule.NumberOfChannels is 1. AFAIK, in this context, there is
|
||||
// no way other than assumption to know a bridge has three channels.
|
||||
var numberOfChannelsPerModule = (channel.ParentModule.NumberOfChannels + 2) / 3 * 3;
|
||||
FileName = Path.Combine(FileName, $"ch{1 + baseIndex:D2}{1 + channel.Number + numberOfChannelsPerModule * channel.ParentModule.Number:D2}.fpd");
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASTest.cs
Normal file
93
Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASTest.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DTS.Serialization.DDAS
|
||||
{
|
||||
public class DDASTest
|
||||
{
|
||||
public enum Fields
|
||||
{
|
||||
LabName,
|
||||
POCName,
|
||||
POCPhoneAndEmail,
|
||||
TestDate,
|
||||
TestTime,
|
||||
TestNumber,
|
||||
TestType,
|
||||
TestObject,
|
||||
DataType,
|
||||
SensorMakeModelSerial,
|
||||
SensorLocation,
|
||||
SensorAxis,
|
||||
SensorMountType,
|
||||
EngineeringUnits,
|
||||
ChannelErrors,
|
||||
SamplingRate,
|
||||
AAFilterCutoffDescription,
|
||||
BitResolution,
|
||||
DigitalFilterType,
|
||||
Notes
|
||||
}
|
||||
|
||||
private readonly Dictionary<Fields, string> _values = new Dictionary<Fields, string>();
|
||||
|
||||
public string GetValue(Fields field)
|
||||
{
|
||||
if (!_values.ContainsKey(field)) _values.Add(field, "#NOVALUE");
|
||||
return _values[field];
|
||||
}
|
||||
|
||||
public void SetValue(Fields field, string value)
|
||||
{
|
||||
_values[field] = value;
|
||||
foreach (var channel in _channels) channel.SetValue(field, value);
|
||||
}
|
||||
|
||||
private readonly List<DDASChannel> _channels = new List<DDASChannel>();
|
||||
|
||||
public DDASChannel[] Channels
|
||||
{
|
||||
get => _channels.ToArray();
|
||||
set
|
||||
{
|
||||
_channels.Clear();
|
||||
_channels.AddRange(value);
|
||||
}
|
||||
}
|
||||
|
||||
public Test Test { get; }
|
||||
|
||||
public FilteredData[] DataUnfilteredEU { get; }
|
||||
|
||||
public FilteredData[] DataADC { get; }
|
||||
|
||||
public double[] ActualRangesEUFiltered { get; }
|
||||
|
||||
public double[] ActualRangesEUUnfiltered { get; }
|
||||
|
||||
public double[] ActualRangesADC { get; }
|
||||
|
||||
public bool FlatFolders { get; }
|
||||
|
||||
public DDASTest(Test test, FilteredData[] adc, FilteredData[] euUnfiltered, string path,
|
||||
double[] actualRangesEUFiltered,
|
||||
double[] actualRangesEUUnfiltered,
|
||||
double[] actualRAngesADC,
|
||||
bool flatFolders)
|
||||
{
|
||||
Test = test;
|
||||
|
||||
DataADC = adc;
|
||||
DataUnfilteredEU = euUnfiltered;
|
||||
|
||||
ActualRangesADC = actualRAngesADC;
|
||||
ActualRangesEUUnfiltered = actualRangesEUUnfiltered;
|
||||
ActualRangesEUFiltered = actualRangesEUFiltered;
|
||||
FlatFolders = flatFolders;
|
||||
for (var i = 0; i < test.Channels.Count && i < DataADC.Length; i++)
|
||||
_channels.Add(new DDASChannel(this, i, path));
|
||||
SetValue(Fields.TestNumber, test.Id);
|
||||
SetValue(Fields.TestDate, test.InceptionDate.ToShortDateString());
|
||||
SetValue(Fields.TestTime, test.InceptionDate.ToShortTimeString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DDASTestDefinition.h
|
||||
// --------------------
|
||||
// Defines the data acquisition system configuration and channels for a test.
|
||||
//
|
||||
//
|
||||
// AUTHOR: A. J. Owski
|
||||
// LOC: 1250
|
||||
// DEPT: 5260 Tool Development
|
||||
// (formerly Instrument Systems)
|
||||
//
|
||||
// COPYRIGHT: (c) 2002-2004 DaimlerChrysler Corp.
|
||||
//
|
||||
// REVISIONS: (most-recent at top of list).
|
||||
//
|
||||
// Date Init Description of Change
|
||||
// -------- --- ---------------------
|
||||
// 06/22/05 WJP Add support for MemoryOptionFlags bits MEMOPT_PREEVENT and
|
||||
// MEMOPT_PREEVENTXXX, Programmable Pre-Event blocks up to 99 and
|
||||
// 511 introduced in Memory Units versions 2.40 and 3.10,
|
||||
// respectively.
|
||||
// 10/19/04 WJP Add support for channel (analog) triggers.
|
||||
// 04/02/04 WJP General clean up
|
||||
// 07/22/03 WJP Added HardwareType
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef DDASTYPENAME // If these def's aren't def'd,
|
||||
|
||||
#define TESTDEFEXT ".tdf"
|
||||
#define DDASTYPENAME "DDAS V5"
|
||||
#define DDASFILEVERS "Ver 500"
|
||||
|
||||
enum FileTypeFlags
|
||||
{
|
||||
FILETYPE_IMPORTED4X // Test was imported from 4x
|
||||
};
|
||||
|
||||
enum HardwareType // Hardware type values
|
||||
{ // in upper 16 bits of FileTypeFlags
|
||||
HWTYPE_UNKNOWN, // None specified - old DDAS
|
||||
HWTYPE_DDAS3, // DDAS III hardware
|
||||
HWTYPE_KAYSERTHREDE, // Kayser-Threde hardware (future)
|
||||
HWTYPE_COUNT
|
||||
};
|
||||
|
||||
typedef struct tagFILEINFOBLOCK
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
char FileTypeName[12]; // Software Type Name
|
||||
char FileTypeVers[12]; // File Version Name
|
||||
UINT FileTypeFlags; // File Type Flags
|
||||
// - Hardware Type in upper 16 bits
|
||||
// - File Type in lower 16 bits
|
||||
char CreatedByName[16]; // Created by T-number
|
||||
char UpdatedByName[16]; // Updated by T-number
|
||||
}FILEINFOBLOCK;
|
||||
|
||||
|
||||
typedef struct tagDATASYSTEMBLOCK
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
UINT NumberOfSystems; // No of systems in this definition
|
||||
UINT ChannelsPerSystem; // Chan per system in this definition
|
||||
UINT MaxSampleRate; // Max (or default) sample rate
|
||||
UINT SizeOfConfig; // Size of 1 DDASCONFIGBLOCK
|
||||
}DATASYSTEMBLOCK;
|
||||
|
||||
|
||||
typedef struct tagDDASCONFIGBLOCK // One config block per system
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
short AnalogUnitNo; // DDAS analog unit for this test
|
||||
short AnalogOptions; // DDAS analog unit options
|
||||
short MemoryUnitNo; // DDAS memory unit for this test
|
||||
short MemoryOptions; // DDAS memory unit options
|
||||
long MemorySize; // DDAS memory unit RAM (bytes)
|
||||
}DDASCONFIGBLOCK;
|
||||
|
||||
enum AnalogOptionFlags
|
||||
{
|
||||
ANAOPT_CHANTRIGGERS // Analog unit has channel triggers
|
||||
};
|
||||
|
||||
enum MemoryOptionFlags
|
||||
{
|
||||
MEMOPT_TAPEMODE, // Memory unit has tape mode
|
||||
MEMOPT_PREEVENT, // Memory unit can sel pre-event to 99
|
||||
MEMOPT_PREEVENTXXX // Memory unit can sel pre-event to 511
|
||||
};
|
||||
|
||||
|
||||
enum RecordModes
|
||||
{
|
||||
RECORDMODE_EVENT, // Normal (event) mode
|
||||
RECORDMODE_TAPE // Tape (manual) mode
|
||||
};
|
||||
|
||||
|
||||
typedef struct tagACQUISITIONBLOCK // Defines data acq params this test
|
||||
{
|
||||
long nSize; // Block Size (including nSize)
|
||||
long nRecordMode; // Enumerated constant data mode
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in record
|
||||
long PreEventSamples; // Pre-Event samples (Rec Mode only!)
|
||||
long TapeModeChannels; // No of Channels (Tape Mode only!)
|
||||
// long nTrigBlock; // Trigger block size if non-zero
|
||||
long nTrigBlock; // Number of trigger entries (can be 0).
|
||||
}ACQUISITIONBLOCK;
|
||||
|
||||
|
||||
// To enable trigger,
|
||||
// ChanNo and LevelPct must be nonzero
|
||||
// and TRIGCHANDSBL must not be set in LevelPct
|
||||
typedef struct tagTRIGCHANDEF // Defines chan (analog) trigger
|
||||
{
|
||||
BYTE ChanNo; // Channel number to use as trigger
|
||||
BYTE LevelPct; // Trig level in % full scale (0=off)
|
||||
}TRIGCHANDEF; // Trigger when signal exceeds +/-level.
|
||||
|
||||
#define MAXTRIGCHANS 4
|
||||
#define TRIGCHANDSBL 0x80
|
||||
|
||||
typedef struct tagTRIGCHANBLOCK // Defines chan (analog) trigs this test
|
||||
{
|
||||
unsigned short SizeBlock; // Block Size in bytes (including nSize)
|
||||
unsigned short NumTrigs; // Number of entries in array TrigChan
|
||||
TRIGCHANDEF TrigChan[MAXTRIGCHANS]; // Channel (analog) triggers. (NOTE that
|
||||
}TRIGCHANBLOCK; // this will be a variable size array,
|
||||
// but we sized it to 1 to avoid warnings.)
|
||||
|
||||
#endif
|
||||
166
Common/DTS.Common.Serialization/DDAS (Chrysler)/DataFloat.h
Normal file
166
Common/DTS.Common.Serialization/DDAS (Chrysler)/DataFloat.h
Normal file
@@ -0,0 +1,166 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DataFloat.h: interface for the CDataFloat class.
|
||||
// -----------------------------------------------
|
||||
//
|
||||
// REVISIONS:
|
||||
// 6-22-10 AJO Add bool GetTimeAtValue(float fValue, float *pTvalue)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FilePath.h" // Added by ClassView for def of CFilePath
|
||||
#include "ChannelDefinition.h" // for def of CHANNEL
|
||||
#include "DDASTestDefinition.h" // for def of FILEINFOBLOCK
|
||||
#include <Afxtempl.h> // CArray definitions
|
||||
|
||||
|
||||
#ifndef TESTPATHSIZE
|
||||
#define TESTPATHSIZE 128
|
||||
#endif
|
||||
|
||||
enum FileTypes {UNKNOWN, FLOATPOINT, PROCESSED}; // File types
|
||||
|
||||
//File Definitions
|
||||
#define FILEERROR -1 // Error in file I/O
|
||||
|
||||
// File Types and Version
|
||||
#define FLOATDATANAME "DDAS FlPt" // Floating Point Data File type
|
||||
#define FLOATDATARAW "DDAS fpRAW" // Float Raw data
|
||||
#define FLOATDATAVER "Ver 500" // Floating Point Data File version
|
||||
|
||||
// Standard Messages
|
||||
#define CantOpenMsg "Could not open file "
|
||||
#define NonExistMsg "Non-existent file "
|
||||
|
||||
typedef struct tagTESTINFO
|
||||
{
|
||||
unsigned long Size; // Block Size (including Size)
|
||||
unsigned long DeviceID; // DAQ device ID
|
||||
long ChannelNo; // Channel number (1-32)
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in data record
|
||||
long PreEventSamples; // Samples before event
|
||||
short ChanNumInSys; // Channel Number (1-128) in system (many devices)
|
||||
short NumPreCalPts; // Number of preCal points included with data
|
||||
short NumPostCalPts; // Number of preCal points included with data
|
||||
char TestCreation[TESTPATHSIZE]; // Test path and date
|
||||
char TimeAxisTitle[32]; // Time axis title
|
||||
byte SpareBytes[2]; // 2 bytes of spare (for 4 byte alignment)
|
||||
|
||||
} TESTINFO;
|
||||
|
||||
typedef struct tagFILEHEADER
|
||||
{
|
||||
FILEINFOBLOCK FileInfo;
|
||||
TESTINFO TestInfo;
|
||||
CHANNEL Channel;
|
||||
|
||||
//---------------the following must add up to 32 bytes -----------------
|
||||
byte SpareBytes[32]; // 32 bytes of spare
|
||||
} FILEHEADER;
|
||||
|
||||
/* DATA PEAK STRUCTURE TYPE DEFINITION */
|
||||
typedef struct tagDATAPEAK
|
||||
{
|
||||
float Min;
|
||||
short Xmin;
|
||||
float Max;
|
||||
short Xmax;
|
||||
} DATAPEAK;
|
||||
|
||||
typedef DATAPEAK *PDATAPEAK; // Pointer to data peak structure
|
||||
typedef DATAPEAK *LPDP; // Pointer to data peak
|
||||
|
||||
// types of peak value calculations
|
||||
enum PeakTypes {PEAKS_MINMAX, PEAKS_3MSCONTIN, PEAKS_3MSCUMUL};
|
||||
|
||||
typedef struct tagDATAHIST // Histogram (number of occurrences) of data values
|
||||
{
|
||||
float fVal; // Data value
|
||||
int nOccurrences; // Number of occurrences in data set
|
||||
// float fX; // First x value of occurrence
|
||||
// int nX; // First x index of occurrence
|
||||
} DATAHIST;
|
||||
|
||||
|
||||
class CDataFloat
|
||||
{
|
||||
public:
|
||||
CDataFloat(unsigned int nSize);
|
||||
CDataFloat();
|
||||
virtual ~CDataFloat();
|
||||
|
||||
class CPeakList
|
||||
{
|
||||
public:
|
||||
CPeakList() { };
|
||||
virtual ~CPeakList() {};
|
||||
void RemoveAll() { m_lstDHist.RemoveAll(); }
|
||||
void AddDataPoint(DATAHIST* pDHist);
|
||||
void Get3msMin(int nPtPer3ms, DATAHIST* pDHist);
|
||||
void Get3msMax(int nPtPer3ms, DATAHIST* pDHist);
|
||||
private:
|
||||
CList<DATAHIST, DATAHIST&> m_lstDHist;
|
||||
// int m_nMaxXIndex;
|
||||
// float m_fMaxXVal;
|
||||
};
|
||||
|
||||
int GetChannelNumberInBox();
|
||||
bool VerifyAndCoerceAxis(bool bNegativeSign, const char* szAxis, BOOL bVerbose);
|
||||
void SetEngrgUnits(char *szNewEngrgUnits);
|
||||
void SetChannelName(char* szNewChannelName);
|
||||
int CalcSampIn3mSecInt();
|
||||
int ConvertTimeToIndex(float fTime);
|
||||
float ConvertIndexToTime(int nIndex);
|
||||
const CString GetFileName();
|
||||
int AppendArrayFloat(CArray<float, float&>* srcArray);
|
||||
CArray<float, float&>* GetDataArray();
|
||||
|
||||
bool GetTimeAtValue(float fValue, float *pTvalue);
|
||||
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTStart, float* pTEnd, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, int *pXMin, float *pTMin, float *pDMin, int *pXMax, float *pTMax, float *pDMax);
|
||||
|
||||
int GetChannelNumber();
|
||||
float GetStartTime(bool bmSec);
|
||||
float GetStartTimeData(bool bmSec);
|
||||
float GetStopTime(bool bmSec);
|
||||
float GetStopTimeData(bool bmSec);
|
||||
const char* GetFileExt();
|
||||
const char* GetFileTitle();
|
||||
long GetSampleRate();
|
||||
const char* GetFilePathAndName();
|
||||
int SetFilePathAndName(char* szNewFileSpec);
|
||||
int ClearAll(long NewNumberElements);
|
||||
TESTINFO* GetTestInfo();
|
||||
FILEINFOBLOCK* GetFileInfo();
|
||||
CHANNEL* GetChannel();
|
||||
float GetFilterClass();
|
||||
int GetEventOffset();
|
||||
// char* GetDataSetName();
|
||||
CString GetDataSetName(CString &csName);
|
||||
FILEHEADER* CDataFloat::GetFileHeader();
|
||||
bool WriteToFile(const char *lpFilename, bool bPrint);
|
||||
bool ReadFromFile(const char *lpFilename);
|
||||
float* GetDataBuffer();
|
||||
bool SetSize(long lNumberElements);
|
||||
long GetSize();
|
||||
bool GetDataNext(float* fData);
|
||||
bool StoreDataNext(float fData);
|
||||
bool SetIndexToStart();
|
||||
void operator=(const CDataFloat &src);
|
||||
|
||||
// File Extensions
|
||||
#define RawExt ".raw" // Unprocessed Data File Extension
|
||||
#define FlPtExt ".fpd" // Floating Point Data File Extension
|
||||
|
||||
enum FPDVerbosity {FPD_SILENT, // Amount of messages printed
|
||||
FPD_ERRORS, FPD_STATUS, FPD_RESULTS, FPD_VERBOSE};
|
||||
|
||||
protected:
|
||||
void Peak3mS(float *pfDataBlock, PDATAPEAK p3msPeak);
|
||||
CFilePath FilePathAndName;
|
||||
FILEHEADER FileHeader;
|
||||
CArray<float, float&> FloatData; // Floating point Data array
|
||||
float * pfBfr; // working pointer to buffer at FloatData
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ChannelDefinition.h
|
||||
// --------------------
|
||||
// Defines a data channel (based on DDAS testplan.h)
|
||||
//
|
||||
//
|
||||
// AUTHOR: A. J. Owski
|
||||
// LOC: 1250
|
||||
// DEPT: 5260 Tool Development
|
||||
// (formerly Instrument Systems)
|
||||
//
|
||||
// COPYRIGHT: (c) 2002 DaimlerChrysler Corp.
|
||||
//
|
||||
// REVISIONS: (most-recent at top of list).
|
||||
//
|
||||
// Date Init Description of Change
|
||||
// ---- ---- ---------------------
|
||||
// 11/08/04 wjp Remove redundant CalDate from Channel definition and label the
|
||||
// field as spare bytes. Use the date in the transducer structure,
|
||||
// which is part of the channel definition.
|
||||
//
|
||||
|
||||
#if !defined( CHANNEL_H )
|
||||
#define CHANNEL_H
|
||||
|
||||
#include "TransducerDefinition.h"
|
||||
|
||||
enum ChannelFlags{CHANFLAG_ACTIVE};
|
||||
|
||||
|
||||
// Channel State Macro's
|
||||
|
||||
#define ISCHANACTIVE(pChan)(pChan->Flags&(1<<CHANFLAG_ACTIVE)?1:0)
|
||||
#define SETCHANACTIVE(pChan)(pChan->Flags|=(1<<CHANFLAG_ACTIVE))
|
||||
#define CLRCHANACTIVE(pChan)(pChan->Flags&=(~(1<<CHANFLAG_ACTIVE)))
|
||||
|
||||
|
||||
// Channel Data Structure
|
||||
|
||||
typedef struct tagCHANNEL
|
||||
{
|
||||
short Size; // Size of this object
|
||||
short Flags; // Channel Flags
|
||||
char Name[64]; // Channel Name
|
||||
char Sign[8]; // Sign +, -, or blank
|
||||
char Axis[8]; // X,Y,Z,FX,MX,AX,...
|
||||
float FilterFreq; // Channel Filter Class (in Hz)
|
||||
float SetGain; // Gain setting (1 - n)
|
||||
float ActGain; // Actual (measured?) gain setting.
|
||||
float Rcal; // Shunt cal resistance
|
||||
float Excitation; // Excitation Voltage (when programable)
|
||||
// time_t CalDate; // Calibration date (Remove - redundant)
|
||||
byte byteSpares[4]; // Spare bytes (was Cal Date)
|
||||
TRANSDUCER Transducer; // "Snapshot" of transducer values
|
||||
} CHANNEL;
|
||||
|
||||
typedef CHANNEL *PCHANNEL; // Pointer to a channel
|
||||
typedef CHANNEL *PCHAN; // Even shorter version of above
|
||||
|
||||
#endif // !defined( CHANNEL_H )
|
||||
@@ -0,0 +1,133 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DDASTestDefinition.h
|
||||
// --------------------
|
||||
// Defines the data acquisition system configuration and channels for a test.
|
||||
//
|
||||
//
|
||||
// AUTHOR: A. J. Owski
|
||||
// LOC: 1250
|
||||
// DEPT: 5260 Tool Development
|
||||
// (formerly Instrument Systems)
|
||||
//
|
||||
// COPYRIGHT: (c) 2002-2004 DaimlerChrysler Corp.
|
||||
//
|
||||
// REVISIONS: (most-recent at top of list).
|
||||
//
|
||||
// Date Init Description of Change
|
||||
// -------- --- ---------------------
|
||||
// 06/22/05 WJP Add support for MemoryOptionFlags bits MEMOPT_PREEVENT and
|
||||
// MEMOPT_PREEVENTXXX, Programmable Pre-Event blocks up to 99 and
|
||||
// 511 introduced in Memory Units versions 2.40 and 3.10,
|
||||
// respectively.
|
||||
// 10/19/04 WJP Add support for channel (analog) triggers.
|
||||
// 04/02/04 WJP General clean up
|
||||
// 07/22/03 WJP Added HardwareType
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef DDASTYPENAME // If these def's aren't def'd,
|
||||
|
||||
#define TESTDEFEXT ".tdf"
|
||||
#define DDASTYPENAME "DDAS V5"
|
||||
#define DDASFILEVERS "Ver 500"
|
||||
|
||||
enum FileTypeFlags
|
||||
{
|
||||
FILETYPE_IMPORTED4X // Test was imported from 4x
|
||||
};
|
||||
|
||||
enum HardwareType // Hardware type values
|
||||
{ // in upper 16 bits of FileTypeFlags
|
||||
HWTYPE_UNKNOWN, // None specified - old DDAS
|
||||
HWTYPE_DDAS3, // DDAS III hardware
|
||||
HWTYPE_KAYSERTHREDE, // Kayser-Threde hardware (future)
|
||||
HWTYPE_COUNT
|
||||
};
|
||||
|
||||
typedef struct tagFILEINFOBLOCK
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
char FileTypeName[12]; // Software Type Name
|
||||
char FileTypeVers[12]; // File Version Name
|
||||
UINT FileTypeFlags; // File Type Flags
|
||||
// - Hardware Type in upper 16 bits
|
||||
// - File Type in lower 16 bits
|
||||
char CreatedByName[16]; // Created by T-number
|
||||
char UpdatedByName[16]; // Updated by T-number
|
||||
}FILEINFOBLOCK;
|
||||
|
||||
|
||||
typedef struct tagDATASYSTEMBLOCK
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
UINT NumberOfSystems; // No of systems in this definition
|
||||
UINT ChannelsPerSystem; // Chan per system in this definition
|
||||
UINT MaxSampleRate; // Max (or default) sample rate
|
||||
UINT SizeOfConfig; // Size of 1 DDASCONFIGBLOCK
|
||||
}DATASYSTEMBLOCK;
|
||||
|
||||
|
||||
typedef struct tagDDASCONFIGBLOCK // One config block per system
|
||||
{
|
||||
UINT Size; // Block Size (including nSize)
|
||||
short AnalogUnitNo; // DDAS analog unit for this test
|
||||
short AnalogOptions; // DDAS analog unit options
|
||||
short MemoryUnitNo; // DDAS memory unit for this test
|
||||
short MemoryOptions; // DDAS memory unit options
|
||||
long MemorySize; // DDAS memory unit RAM (bytes)
|
||||
}DDASCONFIGBLOCK;
|
||||
|
||||
enum AnalogOptionFlags
|
||||
{
|
||||
ANAOPT_CHANTRIGGERS // Analog unit has channel triggers
|
||||
};
|
||||
|
||||
enum MemoryOptionFlags
|
||||
{
|
||||
MEMOPT_TAPEMODE, // Memory unit has tape mode
|
||||
MEMOPT_PREEVENT, // Memory unit can sel pre-event to 99
|
||||
MEMOPT_PREEVENTXXX // Memory unit can sel pre-event to 511
|
||||
};
|
||||
|
||||
|
||||
enum RecordModes
|
||||
{
|
||||
RECORDMODE_EVENT, // Normal (event) mode
|
||||
RECORDMODE_TAPE // Tape (manual) mode
|
||||
};
|
||||
|
||||
|
||||
typedef struct tagACQUISITIONBLOCK // Defines data acq params this test
|
||||
{
|
||||
long nSize; // Block Size (including nSize)
|
||||
long nRecordMode; // Enumerated constant data mode
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in record
|
||||
long PreEventSamples; // Pre-Event samples (Rec Mode only!)
|
||||
long TapeModeChannels; // No of Channels (Tape Mode only!)
|
||||
// long nTrigBlock; // Trigger block size if non-zero
|
||||
long nTrigBlock; // Number of trigger entries (can be 0).
|
||||
}ACQUISITIONBLOCK;
|
||||
|
||||
|
||||
// To enable trigger,
|
||||
// ChanNo and LevelPct must be nonzero
|
||||
// and TRIGCHANDSBL must not be set in LevelPct
|
||||
typedef struct tagTRIGCHANDEF // Defines chan (analog) trigger
|
||||
{
|
||||
BYTE ChanNo; // Channel number to use as trigger
|
||||
BYTE LevelPct; // Trig level in % full scale (0=off)
|
||||
}TRIGCHANDEF; // Trigger when signal exceeds +/-level.
|
||||
|
||||
#define MAXTRIGCHANS 4
|
||||
#define TRIGCHANDSBL 0x80
|
||||
|
||||
typedef struct tagTRIGCHANBLOCK // Defines chan (analog) trigs this test
|
||||
{
|
||||
unsigned short SizeBlock; // Block Size in bytes (including nSize)
|
||||
unsigned short NumTrigs; // Number of entries in array TrigChan
|
||||
TRIGCHANDEF TrigChan[MAXTRIGCHANS]; // Channel (analog) triggers. (NOTE that
|
||||
}TRIGCHANBLOCK; // this will be a variable size array,
|
||||
// but we sized it to 1 to avoid warnings.)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,166 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DataFloat.h: interface for the CDataFloat class.
|
||||
// -----------------------------------------------
|
||||
//
|
||||
// REVISIONS:
|
||||
// 6-22-10 AJO Add bool GetTimeAtValue(float fValue, float *pTvalue)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FilePath.h" // Added by ClassView for def of CFilePath
|
||||
#include "ChannelDefinition.h" // for def of CHANNEL
|
||||
#include "DDASTestDefinition.h" // for def of FILEINFOBLOCK
|
||||
#include <Afxtempl.h> // CArray definitions
|
||||
|
||||
|
||||
#ifndef TESTPATHSIZE
|
||||
#define TESTPATHSIZE 128
|
||||
#endif
|
||||
|
||||
enum FileTypes {UNKNOWN, FLOATPOINT, PROCESSED}; // File types
|
||||
|
||||
//File Definitions
|
||||
#define FILEERROR -1 // Error in file I/O
|
||||
|
||||
// File Types and Version
|
||||
#define FLOATDATANAME "DDAS FlPt" // Floating Point Data File type
|
||||
#define FLOATDATARAW "DDAS fpRAW" // Float Raw data
|
||||
#define FLOATDATAVER "Ver 500" // Floating Point Data File version
|
||||
|
||||
// Standard Messages
|
||||
#define CantOpenMsg "Could not open file "
|
||||
#define NonExistMsg "Non-existent file "
|
||||
|
||||
typedef struct tagTESTINFO
|
||||
{
|
||||
unsigned long Size; // Block Size (including Size)
|
||||
unsigned long DeviceID; // DAQ device ID
|
||||
long ChannelNo; // Channel number (1-32)
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in data record
|
||||
long PreEventSamples; // Samples before event
|
||||
short ChanNumInSys; // Channel Number (1-128) in system (many devices)
|
||||
short NumPreCalPts; // Number of preCal points included with data
|
||||
short NumPostCalPts; // Number of preCal points included with data
|
||||
char TestCreation[TESTPATHSIZE]; // Test path and date
|
||||
char TimeAxisTitle[32]; // Time axis title
|
||||
byte SpareBytes[2]; // 2 bytes of spare (for 4 byte alignment)
|
||||
|
||||
} TESTINFO;
|
||||
|
||||
typedef struct tagFILEHEADER
|
||||
{
|
||||
FILEINFOBLOCK FileInfo;
|
||||
TESTINFO TestInfo;
|
||||
CHANNEL Channel;
|
||||
|
||||
//---------------the following must add up to 32 bytes -----------------
|
||||
byte SpareBytes[32]; // 32 bytes of spare
|
||||
} FILEHEADER;
|
||||
|
||||
/* DATA PEAK STRUCTURE TYPE DEFINITION */
|
||||
typedef struct tagDATAPEAK
|
||||
{
|
||||
float Min;
|
||||
short Xmin;
|
||||
float Max;
|
||||
short Xmax;
|
||||
} DATAPEAK;
|
||||
|
||||
typedef DATAPEAK *PDATAPEAK; // Pointer to data peak structure
|
||||
typedef DATAPEAK *LPDP; // Pointer to data peak
|
||||
|
||||
// types of peak value calculations
|
||||
enum PeakTypes {PEAKS_MINMAX, PEAKS_3MSCONTIN, PEAKS_3MSCUMUL};
|
||||
|
||||
typedef struct tagDATAHIST // Histogram (number of occurrences) of data values
|
||||
{
|
||||
float fVal; // Data value
|
||||
int nOccurrences; // Number of occurrences in data set
|
||||
// float fX; // First x value of occurrence
|
||||
// int nX; // First x index of occurrence
|
||||
} DATAHIST;
|
||||
|
||||
|
||||
class CDataFloat
|
||||
{
|
||||
public:
|
||||
CDataFloat(unsigned int nSize);
|
||||
CDataFloat();
|
||||
virtual ~CDataFloat();
|
||||
|
||||
class CPeakList
|
||||
{
|
||||
public:
|
||||
CPeakList() { };
|
||||
virtual ~CPeakList() {};
|
||||
void RemoveAll() { m_lstDHist.RemoveAll(); }
|
||||
void AddDataPoint(DATAHIST* pDHist);
|
||||
void Get3msMin(int nPtPer3ms, DATAHIST* pDHist);
|
||||
void Get3msMax(int nPtPer3ms, DATAHIST* pDHist);
|
||||
private:
|
||||
CList<DATAHIST, DATAHIST&> m_lstDHist;
|
||||
// int m_nMaxXIndex;
|
||||
// float m_fMaxXVal;
|
||||
};
|
||||
|
||||
int GetChannelNumberInBox();
|
||||
bool VerifyAndCoerceAxis(bool bNegativeSign, const char* szAxis, BOOL bVerbose);
|
||||
void SetEngrgUnits(char *szNewEngrgUnits);
|
||||
void SetChannelName(char* szNewChannelName);
|
||||
int CalcSampIn3mSecInt();
|
||||
int ConvertTimeToIndex(float fTime);
|
||||
float ConvertIndexToTime(int nIndex);
|
||||
const CString GetFileName();
|
||||
int AppendArrayFloat(CArray<float, float&>* srcArray);
|
||||
CArray<float, float&>* GetDataArray();
|
||||
|
||||
bool GetTimeAtValue(float fValue, float *pTvalue);
|
||||
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTStart, float* pTEnd, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, int *pXMin, float *pTMin, float *pDMin, int *pXMax, float *pTMax, float *pDMax);
|
||||
|
||||
int GetChannelNumber();
|
||||
float GetStartTime(bool bmSec);
|
||||
float GetStartTimeData(bool bmSec);
|
||||
float GetStopTime(bool bmSec);
|
||||
float GetStopTimeData(bool bmSec);
|
||||
const char* GetFileExt();
|
||||
const char* GetFileTitle();
|
||||
long GetSampleRate();
|
||||
const char* GetFilePathAndName();
|
||||
int SetFilePathAndName(char* szNewFileSpec);
|
||||
int ClearAll(long NewNumberElements);
|
||||
TESTINFO* GetTestInfo();
|
||||
FILEINFOBLOCK* GetFileInfo();
|
||||
CHANNEL* GetChannel();
|
||||
float GetFilterClass();
|
||||
int GetEventOffset();
|
||||
// char* GetDataSetName();
|
||||
CString GetDataSetName(CString &csName);
|
||||
FILEHEADER* CDataFloat::GetFileHeader();
|
||||
bool WriteToFile(const char *lpFilename, bool bPrint);
|
||||
bool ReadFromFile(const char *lpFilename);
|
||||
float* GetDataBuffer();
|
||||
bool SetSize(long lNumberElements);
|
||||
long GetSize();
|
||||
bool GetDataNext(float* fData);
|
||||
bool StoreDataNext(float fData);
|
||||
bool SetIndexToStart();
|
||||
void operator=(const CDataFloat &src);
|
||||
|
||||
// File Extensions
|
||||
#define RawExt ".raw" // Unprocessed Data File Extension
|
||||
#define FlPtExt ".fpd" // Floating Point Data File Extension
|
||||
|
||||
enum FPDVerbosity {FPD_SILENT, // Amount of messages printed
|
||||
FPD_ERRORS, FPD_STATUS, FPD_RESULTS, FPD_VERBOSE};
|
||||
|
||||
protected:
|
||||
void Peak3mS(float *pfDataBlock, PDATAPEAK p3msPeak);
|
||||
CFilePath FilePathAndName;
|
||||
FILEHEADER FileHeader;
|
||||
CArray<float, float&> FloatData; // Floating point Data array
|
||||
float * pfBfr; // working pointer to buffer at FloatData
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
// FilePath.h: interface for the CFilePath class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_)
|
||||
#define AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
#define PATHLENMAX 300 // Longest path length allowed
|
||||
|
||||
enum FileSpecOK
|
||||
{
|
||||
// FileExtOK,
|
||||
// FileNameOK,
|
||||
// FilePathOK,
|
||||
// FileRootOK,
|
||||
// RootDriveSpecified,
|
||||
// RootPathSpecified,
|
||||
// RelativePathSpecified,
|
||||
|
||||
FSPEC_EXTOK = 0x1, // File Extension OK
|
||||
FSPEC_NAMEOK = 0x2, // File Name OK
|
||||
FSPEC_PATHOK = 0x4, // File Path OK
|
||||
FSPEC_ROOTOK = 0x8, // File Drive or computer OK
|
||||
FSPEC_RELATIVEPATH = 0x10 // Path is relative
|
||||
};
|
||||
|
||||
class CFilePath
|
||||
{
|
||||
public:
|
||||
bool IsFileValid(const char* szFileSpec, const char *szFileTypeExt, CString* pcsError);
|
||||
BOOL FileExists();
|
||||
const CString GetFileNameExt();
|
||||
int ParseFilePathAndName(char *szPathAndName);
|
||||
void Clear();
|
||||
const char* GetFileExtension();
|
||||
const char* GetFileName();
|
||||
const char* GetFullFilePathAndName();
|
||||
bool IsFileType(char *szFileTypeExt);
|
||||
bool IsPathComplete(int *pFlgValid);
|
||||
int SetFile(char *szNewFile, int *nNext);
|
||||
bool IsAllValidChars(char* szInString, int* pnPosBad);
|
||||
int SetDir(char *szNewDir, int* nNext);
|
||||
int SetDrive(int nDriveAis1);
|
||||
int SetDriveOrResource(char *szNewDrive, int* nNext);
|
||||
int SetExtension(char *szNewExt);
|
||||
int SetFullFilePathAndName(char* szPathAndName);
|
||||
// int SetFullFilePathAndName(const char* szPathAndName);
|
||||
void operator =(const CFilePath &src);
|
||||
CFilePath();
|
||||
virtual ~CFilePath();
|
||||
|
||||
protected:
|
||||
char* FindLastDir(char *pStrDir);
|
||||
char* FindNextDir(char* pStrDir);
|
||||
int BuildFullPath();
|
||||
int Status;
|
||||
bool AllocString(char **pChar, long nSize);
|
||||
int FreeMem(void** pMem);
|
||||
char* szFullPathNameExt;
|
||||
char* szRootDrvOrComp;
|
||||
char* szDir;
|
||||
char* szName;
|
||||
char* szExt;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_FILEPATH_H__A46C856A_61D3_4A43_A232_12CBDE99D7BE__INCLUDED_)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
process ch0601.fpd * 1.0 "processed"
|
||||
Binary file not shown.
Binary file not shown.
178
Common/DTS.Common.Serialization/DDAS (Chrysler)/TSVSettingsWindow.Designer.cs
generated
Normal file
178
Common/DTS.Common.Serialization/DDAS (Chrysler)/TSVSettingsWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,178 @@
|
||||
namespace DTS.Serialization.TSV
|
||||
{
|
||||
partial class TSVSettingsWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TSVSettingsWindow));
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.c1GridGlobal = new C1.Win.C1FlexGrid.C1FlexGrid();
|
||||
this.c1GridChannels = new C1.Win.C1FlexGrid.C1FlexGrid();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.c1GridGlobal)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.c1GridChannels)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.button1, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 494F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(731, 570);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(3, 544);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Export";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(3, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(656, 20);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Use Global tab to set values across all channels. Use Channels tab to set indivi" +
|
||||
"dual channel values.";
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(3, 50);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(725, 488);
|
||||
this.tabControl1.TabIndex = 2;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.c1GridGlobal);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(717, 462);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Global Settings";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.c1GridChannels);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(717, 462);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Channel Settings";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// c1GridGlobal
|
||||
//
|
||||
this.c1GridGlobal.ColumnInfo = resources.GetString("c1GridGlobal.ColumnInfo");
|
||||
this.c1GridGlobal.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.c1GridGlobal.ExtendLastCol = true;
|
||||
this.c1GridGlobal.Location = new System.Drawing.Point(3, 3);
|
||||
this.c1GridGlobal.Name = "c1GridGlobal";
|
||||
this.c1GridGlobal.Rows.Count = 1;
|
||||
this.c1GridGlobal.Rows.DefaultSize = 19;
|
||||
this.c1GridGlobal.Size = new System.Drawing.Size(711, 456);
|
||||
this.c1GridGlobal.TabIndex = 0;
|
||||
this.c1GridGlobal.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.c1GridGlobal_CellChanged);
|
||||
this.c1GridGlobal.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this.c1GridGlobal_AfterEdit);
|
||||
//
|
||||
// c1GridChannels
|
||||
//
|
||||
this.c1GridChannels.AutoGenerateColumns = false;
|
||||
this.c1GridChannels.ColumnInfo = "1,1,0,0,0,95,Columns:";
|
||||
this.c1GridChannels.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.c1GridChannels.Location = new System.Drawing.Point(3, 3);
|
||||
this.c1GridChannels.Name = "c1GridChannels";
|
||||
this.c1GridChannels.Rows.Count = 1;
|
||||
this.c1GridChannels.Rows.DefaultSize = 19;
|
||||
this.c1GridChannels.Size = new System.Drawing.Size(711, 456);
|
||||
this.c1GridChannels.TabIndex = 0;
|
||||
this.c1GridChannels.CellChanged += new C1.Win.C1FlexGrid.RowColEventHandler(this.gridChannels_CellChanged);
|
||||
this.c1GridChannels.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this.c1GridChannels_AfterEdit);
|
||||
//
|
||||
// TSVSettingsWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(246)))), ((int)(((byte)(253)))));
|
||||
this.ClientSize = new System.Drawing.Size(731, 570);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "TSVSettingsWindow";
|
||||
this.Text = "TSV Options";
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.c1GridGlobal)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.c1GridChannels)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private C1.Win.C1FlexGrid.C1FlexGrid c1GridGlobal;
|
||||
private C1.Win.C1FlexGrid.C1FlexGrid c1GridChannels;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DTS.Serialization.TSV
|
||||
{
|
||||
public partial class TSVSettingsWindow : Form
|
||||
{
|
||||
protected TSVSettingsWindow() { InitializeComponent(); }
|
||||
|
||||
private volatile bool _bPopulating = false;
|
||||
private TSVTest _test;
|
||||
public TSVSettingsWindow(TSVTest test)
|
||||
{
|
||||
InitializeComponent();
|
||||
_test = test;
|
||||
_bPopulating = true;
|
||||
try
|
||||
{
|
||||
c1GridGlobal.AutoGenerateColumns = false;
|
||||
c1GridGlobal.Styles.Alternate.BackColor = Properties.Settings1.Default.AlternatingRow;
|
||||
c1GridGlobal.Styles.Fixed.BackColor = Properties.Settings1.Default.TableHeader;
|
||||
|
||||
TSVTest.Fields[] fields = Enum.GetValues(typeof(TSVTest.Fields)).Cast<TSVTest.Fields>().ToArray();
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case TSVTest.Fields.AAFilterCutoffDescription:
|
||||
case TSVTest.Fields.BitResolution:
|
||||
case TSVTest.Fields.ChannelErrors:
|
||||
case TSVTest.Fields.DataType:
|
||||
case TSVTest.Fields.DigitalFilterType:
|
||||
case TSVTest.Fields.EngineeringUnits:
|
||||
case TSVTest.Fields.SensorAxis:
|
||||
case TSVTest.Fields.SensorLocation:
|
||||
case TSVTest.Fields.SensorMakeModelSerial:
|
||||
case TSVTest.Fields.SensorMountType:
|
||||
//do not display
|
||||
break;
|
||||
default:
|
||||
var row = c1GridGlobal.Rows.Add();
|
||||
row["colField"] = TSVStrings.ResourceManager.GetString(string.Format("{0}_Title", field.ToString()));
|
||||
row["colDescription"] = TSVStrings.ResourceManager.GetString(string.Format("{0}_Description", field.ToString()));
|
||||
row["colValue"] = test.GetValue(field);
|
||||
row.UserData = field;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
c1GridChannels.Styles.Fixed.BackColor = Properties.Settings1.Default.TableHeader;
|
||||
c1GridChannels.Styles.Alternate.BackColor = Properties.Settings1.Default.AlternatingRow;
|
||||
|
||||
var c = c1GridChannels.Cols.Add();
|
||||
c.Caption = "Channel Number";
|
||||
c.AllowEditing = false;
|
||||
c.DataType = typeof(int);
|
||||
c.Name = "colNumber";
|
||||
c.UserData = null;
|
||||
|
||||
c = c1GridChannels.Cols.Add();
|
||||
c.Caption = "File Name";
|
||||
c.AllowEditing = true;
|
||||
c.DataType = typeof(string);
|
||||
c.Name = "colFileName";
|
||||
c.UserData = null;
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
c = c1GridChannels.Cols.Add();
|
||||
c.Caption = TSVStrings.ResourceManager.GetString(string.Format("{0}_Title", field.ToString()));
|
||||
c.DataType = typeof(string);
|
||||
c.AllowEditing = true;
|
||||
c.Name = "col" + field.ToString();
|
||||
c.UserData = field;
|
||||
}
|
||||
|
||||
foreach (var channel in test.Channels)
|
||||
{
|
||||
var r = c1GridChannels.Rows.Add();
|
||||
r["colNumber"] = channel.ChannelNumber;
|
||||
r["colFileName"] = channel.FileName;
|
||||
foreach (var field in fields) { r["col" + field.ToString()] = channel.GetValue(field); }
|
||||
r.UserData = channel;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_bPopulating = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void c1GridGlobal_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridChannels_CellChanged(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void c1GridChannels_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
if (_bPopulating) { return; }
|
||||
try
|
||||
{
|
||||
_bPopulating = true;
|
||||
if (null != c1GridChannels.Rows[e.Row].UserData)
|
||||
{
|
||||
TSVChannel channel = c1GridChannels.Rows[e.Row].UserData as TSVChannel;
|
||||
if (null == channel) { return; }
|
||||
|
||||
if (null != c1GridChannels.Cols[e.Col].UserData)
|
||||
{
|
||||
TSVTest.Fields field = (TSVTest.Fields)c1GridChannels.Cols[e.Col].UserData;
|
||||
channel.SetValue(field, c1GridChannels.Rows[e.Row][e.Col] as string);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_bPopulating = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void c1GridGlobal_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
if (_bPopulating) { return; }
|
||||
try
|
||||
{
|
||||
if (null != c1GridGlobal.Rows[e.Row].UserData)
|
||||
{
|
||||
TSVTest.Fields field = (TSVTest.Fields)c1GridGlobal.Rows[e.Row].UserData;
|
||||
_test.SetValue(field, c1GridGlobal.Rows[e.Row]["colValue"] as string);
|
||||
|
||||
for (int i = 0; i < c1GridChannels.Rows.Count; i++)
|
||||
{
|
||||
if (null != c1GridChannels.Rows[i].UserData)
|
||||
{
|
||||
TSVChannel channel = c1GridChannels.Rows[i].UserData as TSVChannel;
|
||||
if (null != channel)
|
||||
{
|
||||
c1GridChannels.Rows[i]["col" + field.ToString()] = channel.GetValue(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally { _bPopulating = false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="c1GridGlobal.ColumnInfo" xml:space="preserve">
|
||||
<value>4,1,0,0,0,95,Columns:1{Name:"colField";Caption:"Field";AllowEditing:False;Style:"DataType:System.String;TextAlign:LeftCenter;";} 2{Name:"colValue";Caption:"Value";Style:"DataType:System.String;TextAlign:LeftCenter;";} 3{Name:"colDescription";Caption:"Description";AllowEditing:False;Style:"DataType:System.String;TextAlign:LeftCenter;";} </value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user