14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:30:52.784383+00:00 | zai-org/GLM-5-FP8 | 1 | ac650a057eb86250 |
DTS.Common.Classes.TestSetups Module Documentation
1. Purpose
This module provides data structures and utilities for managing test setup configurations in the DTS system. It defines entity classes for hardware records, Regions of Interest (ROI), calculated channels, graph configurations, and sensor records. The module supports both in-memory representation and database persistence through IDataReader constructors, and includes functionality for reading/writing ISF (Instrument Setup File) format files used for sensor configuration interchange.
2. Public Interface
SimpleHardware
public class SimpleHardware : Tuple<string, string, int, int>
A lightweight data container representing hardware association.
Constructor:
SimpleHardware(string serialNumber, string parentDAS, int dasId, int dasType)
Properties:
string SerialNumber— ReturnsItem1from the tuplestring ParentDAS— ReturnsItem2from the tupleint DASId— ReturnsItem3from the tupleint DASType— ReturnsItem4from the tuple
TestSetupHelper
public abstract class TestSetupHelper
Static utility class for managing a process-wide cache of test setup names.
Static Methods:
void ClearTestSetupNames()— Clears the internal dictionaryvoid SetTestSetupName(int id, string name)— Associates a name with an ID (overwrites if exists)string GetTestSetupName(int Id)— Returns the name for the given ID, orstring.Emptyif not found
ROIPeriodChannelRecord
public class ROIPeriodChannelRecord : BasePropertyChanged, IROIPeriodChannelRecord
Represents a record from the ROIPeriodChannels table.
Constructor:
ROIPeriodChannelRecord(IDataReader reader)— Populates from a stored procedure result (sp_ROIPeriodChannelsGet)
Properties:
int TestSetupROIId— Foreign key to TestSetupROIs tablestring ChannelName— Name of a channel in an ROI period
ExtraProperty
public class ExtraProperty : IExtraProperty
Represents a key-value property with UI support.
Constructors:
ExtraProperty()ExtraProperty(string key, string value)ExtraProperty(IExtraProperty iep)— Copy constructor
Properties:
string Key— Property identifierstring Value— Property valueICommand PasteCommand— WPF command binding for paste operationsUIItemStatus ItemStatus— UI state tracking
Events:
PropertyChangedEventHandler PropertyChanged
TestSetupHardwareRecord
public class TestSetupHardwareRecord : BasePropertyChanged, ITestSetupHardwareRecord
Represents hardware configuration for a test setup.
Constructors:
TestSetupHardwareRecord()TestSetupHardwareRecord(IDataReader reader)— Populates from database queryTestSetupHardwareRecord(ITestSetupHardwareRecord copy)— Copy constructor
Properties:
int DASId— Default:-1int TestSetupIdbool AddDAS— Default:trueint SamplesPerSecondbool IsClockMaster— Default:falsebyte PTPDomainId— Default:0int AntiAliasFilterRate
TestSetupROIsRecord
public class TestSetupROIsRecord : BasePropertyChanged, ITestSetupROIRecord
Represents a Region of Interest period definition.
Constructor:
TestSetupROIsRecord(IDataReader reader)— Populates fromsp_TestSetupROIsGet
Properties:
int TestSetupROIIdint TestSetupIdstring Suffix— e.g., "_ROI Period 1"double ROIStart— Default:-1.0Ddouble ROIEnd— Default:1.0Dbool IsEnabled— Default:truebool IsDefault— Default:true
CalculatedChannelRecord
public class CalculatedChannelRecord : BasePropertyChanged, ICalculatedChannelRecord
Represents a calculated channel definition.
Constructors:
CalculatedChannelRecord()CalculatedChannelRecord(ICalculatedChannelRecord record)— Copy constructorCalculatedChannelRecord(IDataReader reader)— Populates from database query
Properties:
string Namestring TestSetupNameint Id— Database ID; default:-1Operations Operation— Default:Operations.SUMstring CalculatedValueCodestring[] InputChannelIds— Default:["-1"]string CFCForInputChannelsstring ChannelFilterClassForOutputint TestSetupIdbool ViewInRealtimeint ClipLength
GraphRecord
public class GraphRecord : BasePropertyChanged, IGraphRecord
Represents graph configuration for visualization.
Constructors:
GraphRecord()GraphRecord(IGraphRecord copy)— Copy constructorGraphRecord(IDataReader reader)— Populates from database query
Properties:
int GraphIdint TestSetupIdstring GraphName— MaxLength: 50string GraphDescription— MaxLength: 50string ChannelsString— MaxLength: 2048bool UseDomainMindouble DomainMin— Default:double.MinValuebool UseDomainMaxdouble DomainMax— Default:double.MaxValuebool UseRangeMindouble RangeMin— Default:double.MinValuebool UseRangeMaxdouble RangeMax— Default:double.MaxValuestring ThresholdsString— MaxLength: 2048bool LocalOnly— Default:false; marked as deprecated
RegionOfInterest
public class RegionOfInterest : IRegionOfInterest
Represents a time-based region of interest with channel assignments.
Static Properties:
bool Deserializing— Controls whether property changes trigger notifications (used during deserialization)
Constructors:
RegionOfInterest()RegionOfInterest(bool isDefault = false)RegionOfInterest(string suffix = "", bool isDefault = false, double start = -1D, double end = 1D)
Properties:
string Suffix— Automatically prepends "_" if not presentdouble Start— Default:double.MinValue; constrained to be less thanEnddouble End— Default:double.MaxValue; constrained to be greater thanStartbool IsEnabled— Default:truebool IsDefaultstring[] ChannelNames
Methods:
void ResetSuffix()— Clears suffix to empty stringvoid SetChannelNamesNoNotify(string[] names)— Sets channel names without triggering change notifications
Static Methods:
string GetAnalogChanName(string serialNumber, string hardwareChannelName, string startOfHardware, string originalChannelName = "")string GetChanName(string serialNumber, string hardwareChannelName, string originalChannelName = "")string RemoveParentDASName(string entireChannelName)string RemoveAssignedByIDFromHardwareString(string chHardware)
Events:
PropertyChangedEventHandler PropertyChanged
ISFFile
public class ISFFile
Handles reading and writing ISF (Instrument Setup File) format files.
Constructor:
ISFFile()
Properties:
char[] HeaderLine1— 80 characterschar[] TestSetupName— 8 characters starting at position 7char[] NumberOfRecords— 5 characters starting at position 15char[] TestType— 22 characters starting at position 20char[] TestDivision— 30 characters starting at position 42char[] TCFile— 8 characters starting at position 72IISFSensorRecord[] Records— Array of sensor records
Methods:
void AddRecord(IISFSensorRecord record)— Adds a record and updates countvoid WriteToFile(string pathToFile)— Writes the ISF file to diskvoid AddSensors(ISensorData[] sensors)— Converts sensors to ISFSensorRecord and adds them
ISFSensorRecord
public class ISFSensorRecord : IISFSensorRecord
Represents a sensor record in ISF file format (4 records of 80 characters each).
Constructor:
ISFSensorRecord()— Initializes with spaces and setsTOMConfigurationNameto "STANDARD"
Properties (Record 1):
char[] Record1— 80 characterschar[] Tag— 2 characters at position 75char[] DataChannelNumber— 5 characters at position 7bool UserIdSensorIDIsNotSpecified— 1 character at position 15char[] CapacityCharacters— 11 characters at position 19char[] SerialNumber— 12 characters at position 30char[] Sensitivity— 11 characters at position 42char[] BridgeResistance— 11 characters at position 53
Properties (Record 2):
char[] Record2— 80 characterschar[] EngineeringUnits— 12 characters at position 7char[] C1— 11 characters at position 20char[] EID— 17 characters at position 31char[] Unknown1— 4 characters at position 49char[] Unknown2— 2 characters at position 53char[] FireDelay— 11 characters at position 55char[] TOMConfigurationName— 8 characters at position 66
Properties (Record 3):
char[] Record3— 80 characterschar[] CommentPart1— 15 characters at position 14char[] CommentPart2— 40 characters at position 33
Properties (Record 4):
char[] Record4— 80 characterschar[] CommentPart3— 15 characters at position 12char[] SensorType— 20 characters at position 30char[] C2— 11 characters at position 50char[] C3— 11 characters at position 61
Methods:
void SetDataChannelNumber(short value)void SetCapacity(double capacity)double GetCapacity()void SetSensitivity(double sensitivity)double GetSensitivity()void SetC1(double c1)/double GetC1()void SetC2(double c2)void SetC3(double c3)void SetFireDelay(double fireDelay)void SetSensorComment(string s)void Write(System.IO.BinaryWriter writer)void SetSensor(ISensorData sensor)
ArrayExtensions (Static Class)
public static class ArrayExtensions
Extension methods for array manipulation.
Methods:
void Fill<T>(this T[] sourceArray, T with)— Fills entire array with valuevoid SubFill<T>(this T[] source, T with, int startIndex, int finalIndex)— Fills a rangevoid SetValues<T>(this T[] source, T[] with, int startIndex, int length, T pad)— Copies values with paddingT[] GetValues<T>(this T[] source, int startIndex, int length)— Extracts a sub-array
3. Invariants
- SimpleHardware is immutable (inherits from
Tuple<...>). - TestSetupHardwareRecord.DASId defaults to
-1, indicating an unset/unassigned state. - CalculatedChannelRecord.Id defaults to
-1, indicating a new/unpersisted record. - CalculatedChannelRecord.InputChannelIds is never null after construction (defaults to
["-1"]). - RegionOfInterest.Start is always less than
End(enforced by property setters with 0.01 minimum separation). - RegionOfInterest.Suffix is automatically normalized to start with
_if non-empty. - ISFFile uses fixed record length of 80 characters (
ConstantsAndEnums.RECORD_LENGTH). - ISFSensorRecord always consists of exactly 4 records of 80 characters each.
- ISFSensorRecord.NumberOfRecords in the file header equals
Records.Length * 4. - GraphRecord.DomainMin/Max and RangeMin/Max have default values of
double.MinValue/double.MaxValueand are only meaningful when their correspondingUse*boolean istrue.
4. Dependencies
This module depends on:
DTS.Common.Base—BasePropertyChangedbase classDTS.Common.Interface.TestSetups— Interface contracts (IROIPeriodChannelRecord,ITestSetupHardwareRecord,ITestSetupROIRecord,ICalculatedChannelRecord,IISFSensorRecord)DTS.Common.Interface.Graphs—IGraphRecordDTS.Common.Interface.Sensors—ISensorDataDTS.Common.Interface.ISO.ExtraProperties—IExtraPropertyDTS.Common.Interface.RegionOfInterest—IRegionOfInterestDTS.Common.Enums—Operationsenum,UIItemStatusenumDTS.Common.Enums.Sensors—SensorConstantsDTS.Common.Events.RegionOfInterest—RegionOfInterestChangedEventMicrosoft.Practices.Prism.Events—IEventAggregatorMicrosoft.Practices.ServiceLocation—ServiceLocatorSystem.Data—IDataReaderfor database record constructionSystem.ComponentModel—INotifyPropertyChanged,PropertyChangedEventHandlerSystem.Windows.Input—ICommand
What depends on this module:
- Not determinable from the source files alone.
5. Gotchas
TestSetupROIsRecord Constructor Bug
In TestSetupROIsRecord(IDataReader reader), the TestSetupId property is incorrectly assigned from the TestSetupROIId column:
TestSetupId = Utility.GetInt(reader, "TestSetupROIId"); // Should likely be "TestSetupId"
This appears to be a copy-paste error; TestSetupId should probably read from the "TestSetupId" column.
RegionOfInterest Static State
RegionOfInterest.Deserializing is a static property that controls change notifications globally. If multiple threads are deserializing ROIs concurrently, or if the flag is not properly reset, notifications may be incorrectly suppressed or fired.
RegionOfInterest.NotifyChanged Silent Failures
The NotifyChanged() method catches and swallows all exceptions silently. Failures in ServiceLocator or IEventAggregator resolution will go unnoticed.
ISFFile Overwrites Without Prompt
ISFFile.WriteToFile() will delete an existing file at the target path without user confirmation via Utils.FileUtils.DeleteFileOrMove().
GraphRecord.LocalOnly Deprecated
The `