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

12 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Constant/XamlConstants.xaml.cs
Common/DTS.Common/Constant/DigitalInputs.cs
Common/DTS.Common/Constant/EmbeddedSensors.cs
Common/DTS.Common/Constant/Constants.cs
2026-04-16T02:55:10.398143+00:00 Qwen/Qwen3-Coder-Next-FP8 1 b24dcc791db74827

Documentation: DTS.Common.Constant Namespace

1. Purpose

This module centralizes application-wide constants used across the DTS (Data Acquisition and Test System) platform. It consolidates magic numbers, default values, validation ranges, and configuration flags related to digital inputs, embedded sensors, and general system behavior. The constants are used to ensure consistency in thresholds, UI behavior, data processing, and hardware configuration across multiple components (e.g., SLICE, TSR AIR, DIM, embedded firmware interfaces). By isolating these values, the module reduces duplication, improves maintainability, and clarifies the source of truth for critical operational parameters.

2. Public Interface

DTS.Common.Constant.DigitalInputs

  • public const double ConstantCurrentBreakPointDefault = 19005D;
    Default threshold (in ADC units) for detecting contact closure transitions. A transition across this value flips the digital input bit.

  • public const double VoltageInputBreakPointDefault = 19661D;
    Default threshold (in ADC units) for voltage input mode (used for THL/TLH digital modes), where a transition across this value flips the digital input bit.

  • public const bool DisplaySPDADCDefault = false;
    Default value controlling whether the SLICE PRO Digital ADC is displayed in the UI.

  • public static double ConstantCurrentBreakPoint { get; set; } = ConstantCurrentBreakPointDefault;
    Runtime-configurable threshold for contact closure detection. Does not persist or query storage—value must be set externally.

  • public static double VoltageInputBreakPoint { get; set; } = VoltageInputBreakPointDefault;
    Runtime-configurable threshold for voltage input detection. Does not persist or query storage—value must be set externally.

  • public static bool DisplaySPDADC { get; set; } = DisplaySPDADCDefault;
    Runtime-configurable flag for SLICE PRO Digital ADC visibility. Does not persist or query storage—value must be set externally.


DTS.Common.Constant.EmbeddedSensors

Contains constants for embedded sensor specifications, sample rates, CAN/UART configuration, and file format options. All values are const or static readonly.

  • Timeouts & Limits

    • MotionDetectInactivitySMaximum = 300 (5 minutes)
    • MagnetTimeoutMsMaximum = 300000 (5 minutes)
    • TimedIntervalEventDurationMsMinimum = 30
    • TimedIntervalEventDurationMsMaximum = 300000 (5 minutes)
    • TimedIntervalNumberOfEventsMaximum = 100
    • IntervalBetweenEventStartsMinutesMaximum = 1440 (24 hours)
  • Sensor Ranges

    • EmbeddedLowGLinearAccelerometerRange = 8
    • EmbeddedHighGLinearAccelerometerRange = 400
    • EmbeddedAngularAccelerometerRange = 2000
    • EmbeddedAngularRateSensorRange = 2000
    • HumidityMinimum = 10, HumidityMaximum = 100
    • PressureMinimum = 5, PressureMaximum = 15
    • TemperatureMinimum = 0, TemperatureMaximum = 65
  • Sample Rates

    • EmbeddedLowGLinearAccelerometerSampleRateMinimum/Maximum = 1/6400
    • EmbeddedHighGLinearAccelerometerSampleRateMinimum/Maximum = 1/5120
    • EmbeddedAngularAccelerometerSampleRateMinimum/Maximum = 1/1600
    • EmbeddedAngularAccelerometerAndRateSensorSampleRateMinimum/Maximum = 1/5120
    • EmbeddedAtmosphericSensorSampleRateMinimum/Maximum = 1/157
    • Default sample rates (e.g., DefaultEmbeddedLowGLinearAccelerometerSampleRate = 6400)
  • UART & CAN Configuration

    • BAUD_RATE_MIN = 96, BAUD_RATE_DEFAULT = 57600, BAUD_RATE_MAX = 921600
    • BAUD_RATES (array of supported rates)
    • CANISFD_DEFAULT = true
    • CAN FD arbitration/base bitrate ranges and defaults (CANFD_ARB_BASE_BITRATE_*, NON_CANFD_ARB_BASE_BITRATE_*)
    • CAN FD/non-CAN FD SJW values (e.g., CANFD_500000_ARB_BASE_SJW_DEFAULT = 8, CANFD_1000000_ARBBASESJW_VALUES)
    • Data bitrate (DATA_BITRATE_DEFAULT = 4000000, DATABITRATE_VALUES)
    • Data SJW arrays (e.g., NON_CANFD_500000_DATASJW_VALUES)
    • FILETYPE_DEFAULT = "asc", FILETYPE_VALUES = { "asc", "blf" }

DTS.Common.Constant.Constants

Contains broad system constants, many tied to specific hardware (SLICE6AIR, TSR AIR), UI behavior, file formats, and protocol details.

  • Timeouts & Intervals

    • GETARMSTATUS_TIMEOUT = 30000
    • PING_ICMP_TIMEOUT { get; set; } = 500
    • EXECUTABLE_TIMEOUT = 30000
    • UpdateIntervalRealtimeCharts { get; set; } = 100
  • Graphing & Autozoom

    • GRAPH_MIN_AUTOZOOM = 0.01D (1% of full scale)
    • GRAPH_MAX_AUTOZOOM = 1.2D (120% of full scale)
    • CheckStatusLinesInRealtime { get; set; } = true
  • Units & Tags

    • ACCELERATION_UNITS = { "g", "msec", "m/sec", "m/sec^2", "m/s^2" }
    • ROI_TAG = "ROI", ALL_TAG = "ALL", ALL = "ALL"
    • DAS_TEST_SETUPS = "DASTestSetup", DAS_CONFIGS = "DASConfigs"
  • File & Data Handling

    • BACKUP_HEADER_EXTENSION = ".header.bak", BACKUP_FILE_EXTENSION = ".bak"
    • TEMP_FILE_EXTENSION = ".tmp", CHANNEL_FILE_EXTENSION = ".chn", BINARY_FILE_EXTENSION = ".bin"
    • REPORT_DIR_NAME = "Reports", REPORT_TEMPLATE_DIR_NAME = "ReportTemplates"
    • BINARY = "Binary", CURRENT_SUFFIX = "_CU"
    • MAX_USER_CHANNEL_NAME_LENGTH = 100
    • ALLOWED_DOWNLOAD_FILE_LENGTH = 260, ALLOWED_DOWNLOAD_DIRECTORY_LENGTH = 248
    • UNUSED_START_TIME = 0, UNUSED_DATA_COLLECTION_LENGTH = 0
  • Hardware & Protocol

    • BITS_PER_MINOR_FRAME_S6A = 128
    • BITS_PER_MINOR_FRAME_TSRAIR = 320
    • ADC_MIDPOINT = 32767 (16-bit midpoint)
    • UDP_STREAMPROFILES_MAX = 15
    • UART_MODE_MAX_SAMPLERATE = 30000
    • SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE = 10000
    • SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE_20k = 20000
    • SLICE6AIR_20K_DIGITAL_FILTER_MIN_PROTOCOL = 46
    • SLICE6AIR_BR_DB_VERSION = 95, SLICE_PRO_CAN_FD_DB_VERSION = 100, etc.
  • Clock Sync & Recording Modes

    • MasterProfiles, SlaveProfiles, OnePPSOutProfiles (arrays of ClockSyncProfile)
    • NonStreamingRecordingModes (array of RecordingModes)
  • NMEA Parsing

    • $GPRMC and $GPGGA field positions (e.g., NMEA_GPRMC_LAT_POSN = 3, NMEA_GPGGA_ALT_POSN = 9)
  • UI & Formatting

    • TABANDPAGEBUTTONSFontSizeMin = 12, TabAndPageButtonsFontSizeMax = 32
    • MINIMUM_VOLTAGE_INSERTION_RANGE_MV_SLICE = 10
    • SENSITIVITY_CHANGE_TOLERANCE_PERCENT_DEFAULT = 5D
    • NOVALUE = "NOVALUE"
    • ISO_CH_ONLY_PREFIX = "__ISO_CH_ONLY__"
    • ExportNameFilters = { "(Voltage)" → "Voltage", "(Current)" → "Current" }
  • Special Values

    • NANOS_PER_SECOND = 1000000000m, TEN_MILLIS_IN_SEC = 0.01D
    • MAX_VIEWER_POINTS = 45000000
    • LOWEST_NONZERO_TSR_AIR_PRETRIGGER_SECONDS = 0.0128D
  • Properties with Dynamic Errors

    • ScheduleStartTimeError: Formatted error string using StringResources.EditTestSetupPage_ScheduleMustBeInFuture and DFConstantsAndEnums.SCHEDULE_AHEAD_IN_MINUTES.
    • IntervalError: Formatted error string using StringResources.EditTestSetupPage_EventLengthTooLong and DFConstantsAndEnums.TIME_TO_REARM_SECONDS.

DTS.Common.Constant.XamlConstants

  • public partial class XamlConstants { }
    Currently an empty partial class. No public members defined.

3. Invariants

  • Digital Input Thresholds:

    • ConstantCurrentBreakPoint and VoltageInputBreakPoint are not persisted or auto-loaded; they rely on external initialization (e.g., from config or UI settings).
    • ConstantCurrentBreakPointDefault (19005) is used for contact closure; VoltageInputBreakPointDefault (19661) is used for THL/TLH voltage modes.
  • Embedded Sensor Ranges:

    • All minimum/maximum values for sensors (e.g., humidity, temperature, sample rates) are hard limits derived from device IC specifications.
    • Default sample rates are set to the maximum supported rate per sensor type.
  • CAN Configuration:

    • CANISFD_DEFAULT = true implies CAN FD is enabled by default.
    • SJW (Sample Jump Width) arrays are strictly bounded by hardware constraints for specific bitrates.
  • Graph Autozoom:

    • GRAPH_MIN_AUTOZOOM = 0.01 and GRAPH_MAX_AUTOZOOM = 1.2 define the scaling envelope for auto-zoomed graphs (as % of full scale), regardless of signal amplitude.
  • Download Paths:

    • File paths must not exceed ALLOWED_DOWNLOAD_FILE_LENGTH = 260 characters (Windows MAX_PATH), and directories must not exceed ALLOWED_DOWNLOAD_DIRECTORY_LENGTH = 248.
  • Clock Sync Profiles:

    • MasterProfiles, SlaveProfiles, and OnePPSOutProfiles are exhaustive and exclude unsupported combinations (commented-out values indicate deprecated/invalid options).

4. Dependencies

Imports/References (from source):

  • DTS.Common.Constant depends on:
    • DTS.Common.Enums (for ClockSyncProfile, RecordingModes)
    • DTS.Common.SharedResource.Strings (for StringResources in Constants)

Referenced By:

  • DTS.Common.Constant is used throughout the codebase for:
    • Hardware configuration (e.g., embedded sensor setup, CAN/UART initialization)
    • UI validation (e.g., thresholds, timeouts, sample rate limits)
    • Data export (NMEA, file formats, path length checks)
    • Graphing logic (autozoom, units, tags)
    • Protocol-specific constants (e.g., BITS_PER_MINOR_FRAME_*, SLICE6AIR_*)

5. Gotchas

  • Static Properties Are Not Persistent:
    DigitalInputs.ConstantCurrentBreakPoint, VoltageInputBreakPoint, and DisplaySPDADC are mutable static properties. They do not read from configuration storage—consumers must explicitly set them (e.g., from a config file or UI).

  • XamlConstants Is Empty:
    The XamlConstants class is declared but contains no members. Its purpose is unclear from the source alone.

  • ScheduleStartTimeError and IntervalError Are Dynamically Formatted:
    These properties use string.Format with external resources (StringResources) and enums (DFConstantsAndEnums). Their values depend on runtime localization and enum definitions not visible here.

  • CAN FD vs. Non-CAN FD Bitrate Arrays:
    CANFD_ARBBASEBITRATE_VALUES and NON_CANFD_ARBBASEBITRATE_VALUES are not contiguous ranges (e.g., NON_CANFD_ARBBASEBITRATE_VALUES includes non-standard rates like 62000, 83000). Consumers must use the arrays, not assume min/max.

  • Sample Rate Limits Are Protocol-Dependent:
    SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE = 10000 applies to older firmware, while SLICE6AIR_20K_DIGITAL_FILTER_MIN_PROTOCOL = 46 and SLICE6AIR_STREAMING_DIGITAL_FILTERING_MAX_SAMPLERATE_20k = 20000 indicate newer firmware relaxes this limit.

  • ALL vs. ALL_TAG:
    Both ALL = "ALL" and ALL_TAG = "ALL" exist. Their usage context is unclear—ensure consistency with downstream consumers.

  • UNUSED_START_TIME and UNUSED_DATA_COLLECTION_LENGTH:
    Both are 0, but their semantic meaning ("unused") may conflict with valid data (e.g., 0-length recordings). Validation logic must distinguish intent.

  • NANOS_PER_SECOND Is Decimal:
    Used for high-precision time calculations (e.g., TEN_MILLIS_IN_SEC = 0.01D). Mixing double and decimal could cause precision issues if not handled carefully.

  • MAX_VIEWER_POINTS = 45000000:
    This is a hard limit for Viewer graphs. Exceeding it may cause crashes or performance degradation—consumers must enforce truncation or sampling.