9.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-17T15:38:52.319168+00:00 | zai-org/GLM-5-FP8 | 1 | 75b02305d1c7a319 |
Documentation: DTS.Serialization.FtssCsv / FtssTsv
1. Purpose
This module provides file serialization support for FTSS (presumably "Flight Test Data System" or similar) CSV and TSV (Tab-Separated Values) export formats. It enables writing Test objects to delimited text files with extensive metadata headers and channel data. The module implements a writer pattern with progress reporting events and supports features like data filtering, subsampling, and disk space verification before export.
2. Public Interface
FtssCsv.File Class
Namespace: DTS.Serialization.FtssCsv
Inheritance: Serialization.File, IWritable<Test>
| Member | Signature | Description |
|---|---|---|
File() |
public File() |
Constructor initializing the file with "CSV" format type. |
Extension |
public static string Extension |
Static property returning ".csv". |
Exporter |
public IWriter<Test> Exporter |
Lazily instantiates and returns a Writer<Test> for exporting test data. Uses DefaultEncoding. |
FtssTsv.File Class
Namespace: DTS.Serialization.FtssTsv
Inheritance: Serialization.File, IWritable<Test>
| Member | Signature | Description |
|---|---|---|
File() |
public File() |
Constructor initializing the file with "TSV" format type. |
Extension |
public static string Extension |
Static property returning ".tsv". |
Exporter |
public IWriter<Test> Exporter |
Lazily instantiates and returns a Writer<Test> for exporting test data. Uses DefaultEncoding. |
FtssTsv.File.Writer Class
Namespace: DTS.Serialization.FtssTsv
Inheritance: Writer<File>, IWriter<Test>
Constructor
| Signature | Description |
|---|---|
internal Writer(File fileType, int encoding) |
Internal constructor; requires associated File instance and encoding integer. |
Enum: ExportMode
public enum ExportMode
{
FtssExcel,
Ttc,
Standard,
}
Events
| Event | Type | Description |
|---|---|---|
OnBegin |
BeginEventHandler |
Notifies subscribers that write is starting. |
OnEnd |
EndEventHandler |
Notifies subscribers that write is finished. |
OnTick |
TickEventHandler |
Notifies subscribers of progress (one tick per 1000 data samples). |
OnCancel |
CancelEventHandler |
Notifies subscribers that write was cancelled. |
OnError |
ErrorEventHandler |
Notifies subscribers of fatal errors. |
Properties
| Property | Type | Description |
|---|---|---|
CurrentExportMode |
ExportMode |
Gets/sets the current export format. Defaults to ExportMode.FtssExcel. |
FilteredChannelData |
List<FilteredData> |
Filtered channel data to use instead of raw data. |
DataChannelFilename |
string |
Filename identifying the data channel to export. |
LaboratoryName |
string |
Laboratory metadata for header. |
LaboratoryContactName |
string |
Contact name for header. |
LaboratoryContactPhone |
string |
Contact phone for header. |
LaboratoryContactEmail |
string |
Contact email for header. |
TestEngineerName |
string |
Engineer name for header. |
TestEngineerPhone |
string |
Engineer phone for header. |
TestEngineerEmail |
string |
Engineer email for header. |
NumChannelsWritten |
int |
Counter for channels written. |
UseISOCodeFilterMapping |
bool |
Whether to adjust ISO codes based on filter class. |
UseZeroForUnfiltered |
bool |
Whether to use zero for unfiltered data in ISO code mapping. |
Start |
double |
Export start time (default: 0D). |
Stop |
double |
Export stop time (default: 0D). |
SubSampleInterval |
ushort |
Subsampling interval for data export. |
Filtered |
bool |
Whether filtered data is being exported. |
Methods
| Method | Signature | Description |
|---|---|---|
Write |
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength) |
Simplified write method delegating to the full overload. |
Write |
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) |
Full write method with all parameters. Creates directory if needed, deletes existing file, writes header and data. Only ExportMode.FtssExcel is currently supported. |
Initialize |
public void Initialize(...) |
Empty implementation (no-op). |
WriteChannelInfo |
protected void WriteChannelInfo(StreamWriter fileWriter, string id, Test test, List<FilteredData> filteredData, string targetPath, TickEventHandler tickEventHandler, uint totalWriteTicksNeeded, ref uint totalWriteTicksDispatched, CancelRequested cancelRequested, int channelNumber, double minStartTime, int dataCollectionLength) |
Writes header lines and channel data to the stream. Handles subsampling, scaling, and filtering. |
Enum: FtssHeaderLine (Private)
Defines 31 header line types including: Headers, TestDate, TestTime, TestId, TestDescription, LaboratoryName, SampleRate, HardwareAntiAliasFilter, DataChannelName, IsoCode, ChannelDescription, ChannelLocation, SensorSerialNumber, SoftwareFilter, SoftwareFilterDb, EngineeringUnits, UserComment, PreZero, PostZero, DataZero, ScaleEu, ScaleMv, DataStart, Labels.
3. Invariants
- Exporter Lazy Initialization: The
_Exporterfield is lazily initialized; once created, it is reused for subsequent accesses. - Only FtssExcel ExportMode Supported: The
Writemethod throwsNotSupportedExceptionfor anyCurrentExportModeother thanExportMode.FtssExcel. - Tab Separator: The TSV format uses
"\t"(TAB) as the list separator constant. - Number Format: All numeric data values are formatted using
"F8"(8 decimal places). - Progress Granularity: Progress ticks are dispatched every 1000 data samples (
DataSamplesPerTick). - Single Channel Export: The
WriteChannelInfomethod exports only the channel whose filename matchesDataChannelFilename; it breaks after finding the first match. - Directory Creation: If the target directory does not exist, it will be created automatically during
Write. - File Overwrite: If the target file exists, it will be deleted (or moved if deletion fails) before writing.
4. Dependencies
This Module Depends On:
System(Collections.Generic, ComponentModel, Linq, IO, Text)DTS.Common.DAS.Concepts(includingDTS.Common.DAS.Concepts.DAS.Channel)DTS.Common.UtilitiesDTS.Common.Utilities.DotNetProgrammingConstructsDTS.Common.Utilities.LoggingDTS.CommonDTS.Common.Enums.SensorsDTS.Common.UtilsSystem.Windows.Forms.Application(forDoEvents()during progress reporting)- Base class
Serialization.File(inferred from inheritance) - Interface
IWritable<Test>(inferred from implementation) - Types:
Test,Test.Module.Channel,Test.Module.AnalogInputChannel,FilteredData,DataScaler,NHTSASubSample<T>,Property<T>,DescriptionAttributeCoder<T>,DiskUtility,FileUtils,APILogger,UserException,Exception(custom DTS type)
What Depends On This Module:
- Not determinable from the provided source alone.
5. Gotchas
-
UI Thread Coupling: The
WriteChannelInfomethod callsSystem.Windows.Forms.Application.DoEvents()during the write loop, creating a dependency on Windows Forms and implying the write may be intended to run on a UI thread. -
Empty Initialize Method: The
Initializemethod has an empty body despite accepting numerous parameters. It is unclear if this is intentional or incomplete. -
Unused ExportMode Values:
ExportMode.TtcandExportMode.Standardare defined but throwNotSupportedExceptionif used. -
Exception Wrapping: All exceptions are caught and re-thrown wrapped in a custom
Exceptiontype with descriptive messages, potentially obscuring original stack traces. -
Hardcoded Channel Selection: The
WriteChannelInfomethod filters channels by comparingPath.GetFileName(((Test.Module.AnalogInputChannel)ch).FileName)toDataChannelFilename. If no channel matches, the export proceeds with empty channel data. -
Subsampling Side Effect: When
SubSampleInterval > 1, the method modifiesFilteredChannelData[iChannel].DataandChannelList[iChannel].PersistentChannelInfo.Datain-place, mutating the input test data. -
PreZero/PostZero Calculation Edge Cases: The code clamps
preTriggerSamplesto be non-negative, not exceedNumberOfSamples, and not exceedStart * sampleRate, but the logic may produce unexpected results ifStartis not properly set. -
Missing CSV Writer Implementation: The
FtssCsv.Fileclass references aWriterclass, but noFtssCsv.File.Writer.csis provided. It is unclear whether this shares the TSV writer or has a separate implementation.