5.0 KiB
5.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T14:11:35.779677+00:00 | zai-org/GLM-5-FP8 | 1 | a50bc074e645dae7 |
Documentation: DTS.Common.Utilities
1. Purpose
This module serves as a core utility library for the DTS codebase, providing a collection of reusable components ranging from mathematical helpers (standard deviation, signal-to-noise ratio, CRC32) and data structures (sortable binding lists, thread-safe queues) to Windows Forms extensions and low-level file I/O wrappers. It centralizes common programming constructs, exception definitions, and conversion logic (time, firmware versions, XML) to promote code reuse across the system.
2. Public Interface
Math & Signal Processing
DTS.Utilities.StandardDevdouble StandardDeviation(IEnumerable<double> values): Calculates the sample standard deviation of a dataset. Returns 0 if the collection is empty.
DTS.Utilities.SignalToNoiseRatiodouble CalculateSNR(IEnumerable<double> values, double fullScalePP = 65536.0): Calculates the Signal-to-Noise Ratio based on the standard deviation of the provided values.
DTS.Common.Utilities.DegreesFromADCdouble GetDegrees(double Sxyz, double SG): Converts raw ADC values to degrees using the arcsine function.
DTS.Utilities.Crc32uint Get<T>(IEnumerable<T> byteStream): Calculates a 32-bit CRC checksum for a generic byte stream.
DTS.Common.Utilities.AverageQueuedouble Push(double newValue): Adds a value to the queue and returns the current average.double GetAverage(): Returns the current average.void Reset(): Clears the queue.double GetMin(),double GetMax(): Returns the minimum/maximum values in the queue.
Time & Conversion
DTS.Common.Utilities.TimeUInt32 DateTimeToUnixTimestamp(DateTime dateTime): Converts aDateTimeto a Unix timestamp (seconds since 1/1/1970).UInt32 CurrentUtcUnixTimestamp(),UInt32 CurrentLocalUnixTimestamp(): Returns the current UTC or local Unix timestamp.DateTime ToDateTime(UInt32 seconds): Converts a Unix timestamp back to aDateTime.bool IsBeginningOfTime(DateTime dateTime): Checks if the time is exactly 1/1/1970 00:00:00.
DTS.Common.Utilities.FirmwareVersionToLonglong Query(string version): Converts a firmware version string to alongby bit-shifting the first 4 characters.
DTS.Common.Utilities.Xml.XmlToObjectT FromXml(string xml): Deserializes an XML string into an object of typeT. Returnsdefault(T)on failure.
Data Structures & Collections
DTS.Common.Utilities.SortableBindingList- Inherits from
BindingList. Provides sorting capabilities for data-bound controls.
- Inherits from
DTS.Common.Utilities.UpdateNotifyingList- A wrapper around
Listthat fires anOnUpdateevent when theItemsproperty is set.
- A wrapper around