init
This commit is contained in:
@@ -0,0 +1,332 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/Test.Module.Channel.Sensor.Bridge.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/Test.Module.Channel.Sensor.SensorUnits.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/Test.Module.Channel.Sensor.ZeroMethod.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/DigitalInputScaleMultiplier.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/Test.Module.Channel.Sensor.ExcitationVoltage.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/InitialOffset.cs
|
||||
- DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/DASConcepts/LinearizationFormula.cs
|
||||
generated_at: "2026-04-17T15:51:32.545999+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9877a194e4f0eb7d"
|
||||
---
|
||||
|
||||
# Documentation: DAS Concepts (DatabaseExport Namespace)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures and enumerations defining sensor configuration concepts for a Data Acquisition System (DAS). It encapsulates properties for sensor bridge types, excitation voltage options, sensitivity units, zero calculation methods, digital input scaling, initial offsets, and linearization formulas. These types are used to serialize and deserialize sensor calibration and configuration data for database storage, supporting both modern and legacy data formats.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.BridgeType`
|
||||
**Location:** `Test.Module.Channel.Sensor.Bridge.cs`
|
||||
|
||||
Defines available bridge/sensor types as bit-flagged values:
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `IEPE` | `1 << 0` (1) | IEPE sensor setup |
|
||||
| `QuarterBridge` | `1 << 1` (2) | Quarter bridge setup |
|
||||
| `HalfBridge` | `1 << 2` (4) | Half bridge setup |
|
||||
| `FullBridge` | `1 << 3` (8) | Full bridge setup |
|
||||
| `DigitalInput` | `1 << 4` (16) | Digital input |
|
||||
| `SQUIB` | `1 << 5` (32) | SQUIB sensor |
|
||||
| `TOMDigital` | `1 << 6` (64) | TOM Digital |
|
||||
|
||||
---
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.SensUnits`
|
||||
**Location:** `Test.Module.Channel.Sensor.SensorUnits.cs`
|
||||
|
||||
Defines sensitivity unit types:
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `NONE` | 0 | No sensitivity units (polynomial sensor) |
|
||||
| `mV` | 1 | mV output at capacity EU |
|
||||
| `mVperV` | 2 | mV/V output at capacity EU |
|
||||
| `mVperVperEU` | 3 | mV/V/EU |
|
||||
| `mVperEU` | 4 | mV/EU |
|
||||
|
||||
---
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.ZeroMethodType`
|
||||
**Location:** `Test.Module.Channel.Sensor.ZeroMethod.cs`
|
||||
|
||||
Defines zero calculation methods:
|
||||
|
||||
| Member | Value | Description |
|
||||
|--------|-------|-------------|
|
||||
| `AverageOverTime` | 0 | Calculate electrical zero using average over time |
|
||||
| `UsePreEventDiagnosticsZero` | 1 | Calculate zero using pre-event diagnostics |
|
||||
| `None` | 2 | Absolute zero (injected value) |
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.OriginalZeroMethodType`
|
||||
**Location:** `Test.Module.Channel.Sensor.ZeroMethod.cs`
|
||||
|
||||
Legacy version of zero method types (for backward compatibility):
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `AverageOverTime` | Average over time |
|
||||
| `UsePreCalZero` | Use pre-calibration zero |
|
||||
| `None` | Absolute zero |
|
||||
|
||||
---
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.ExcitationVoltageOption`
|
||||
**Location:** `Test.Module.Channel.Sensor.ExcitationVoltage.cs`
|
||||
|
||||
Defines excitation voltage options with associated magnitude attributes:
|
||||
|
||||
| Member | Value | Magnitude |
|
||||
|--------|-------|-----------|
|
||||
| `Undefined` | 1 | 0.0V |
|
||||
| `Volt1` | 64 | 1.0V |
|
||||
| `Volt2` | 2 | 2.0V |
|
||||
| `Volt2_5` | 4 | 2.5V |
|
||||
| `Volt3` | 8 | 3.0V |
|
||||
| `Volt5` | 16 | 5.0V |
|
||||
| `Volt10` | 32 | 10.0V |
|
||||
|
||||
### Static Methods: `Test.Module.Channel.Sensor`
|
||||
|
||||
```csharp
|
||||
public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOption target)
|
||||
```
|
||||
Converts an `ExcitationVoltageOption` enum value to its associated numeric magnitude (in volts). Throws `Exception` on failure.
|
||||
|
||||
```csharp
|
||||
public static ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)
|
||||
```
|
||||
Converts a voltage magnitude (in volts) to the corresponding `ExcitationVoltageOption`. Throws `NotSupportedException` if no matching enum exists.
|
||||
|
||||
### Nested Classes: `Test.Module.Channel.Sensor`
|
||||
|
||||
```csharp
|
||||
public class VoltageMagnitudeAttribute : System.Attribute
|
||||
```
|
||||
Attribute for specifying voltage magnitude on enum fields. Constructor: `VoltageMagnitudeAttribute(double value)`. Property: `Value` (read-only).
|
||||
|
||||
```csharp
|
||||
public class VoltageMagnitudeAttributeCoder : AttributeCoder<ExcitationVoltageOption, VoltageMagnitudeAttribute, double>
|
||||
```
|
||||
Helper class for encoding/decoding voltage magnitude attributes. Constructor: `VoltageMagnitudeAttributeCoder()`.
|
||||
|
||||
---
|
||||
|
||||
### Class: `DigitalInputScaleMultiplier`
|
||||
**Location:** `DigitalInputScaleMultiplier.cs`
|
||||
|
||||
Transforms digital input data by defining 0/1 output values.
|
||||
|
||||
**Nested Enums:**
|
||||
|
||||
```csharp
|
||||
public enum InputModes
|
||||
```
|
||||
| Member | Value |
|
||||
|--------|-------|
|
||||
| `TLH` | `1 << 1` (2) | Transition Low to High |
|
||||
| `THL` | `1 << 2` (4) | Transition High to Low |
|
||||
| `CCNO` | `1 << 3` (8) | Contact closure normally open |
|
||||
| `CCNC` | `1 << 4` (16) | Contact closure normally closed |
|
||||
|
||||
```csharp
|
||||
public enum Forms { ArbitraryLowAndHigh }
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `Forms Form { get; set; }` — Default: `Forms.ArbitraryLowAndHigh`
|
||||
- `double DefaultValue { get; set; }` — Value for "OFF" (0)
|
||||
- `double ActiveValue { get; set; }` — Value for "ON" (1), default: `1.0`
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public DigitalInputScaleMultiplier()
|
||||
public DigitalInputScaleMultiplier(DigitalInputScaleMultiplier copy)
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public string ToSerializeDbString()
|
||||
```
|
||||
Serializes the scaler to a database-safe string. Throws `NotSupportedException` for unsupported forms.
|
||||
|
||||
```csharp
|
||||
public void FromDbSerializeString(string s)
|
||||
```
|
||||
Deserializes from a string. **Note:** Current implementation returns silently if input is null; parsing logic is commented out.
|
||||
|
||||
---
|
||||
|
||||
### Class: `InitialOffset`
|
||||
**Location:** `InitialOffset.cs`
|
||||
|
||||
Represents initial offset for post-data-collection adjustment to engineering units.
|
||||
|
||||
**Nested Enum:**
|
||||
```csharp
|
||||
public enum Forms { None = 0, EU = 1, EUAtMV = 2 }
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `Forms Form { get; set; }` — Format of the offset
|
||||
- `double EU { get; set; }` — EU value (offset in EU, or EU@mV value)
|
||||
- `double MV { get; set; }` — mV value (only for `EUAtMV` form)
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public InitialOffset()
|
||||
public InitialOffset(InitialOffset copy)
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public string ToDbSerializeString()
|
||||
```
|
||||
Serializes to a database-safe string using invariant culture list separator.
|
||||
|
||||
```csharp
|
||||
public void FromDbSerializeString(string input)
|
||||
```
|
||||
Deserializes from string. Throws `System.IO.InvalidDataException` for invalid format or `FormatException` for parse errors.
|
||||
|
||||
---
|
||||
|
||||
### Class: `LinearizationFormula`
|
||||
**Location:** `LinearizationFormula.cs`
|
||||
|
||||
Handles linearization formulas for converting sensor voltage to engineering units.
|
||||
|
||||
**Nested Enum:**
|
||||
```csharp
|
||||
public enum Styles
|
||||
{
|
||||
IRTraccManual,
|
||||
IRTraccDiagnosticsZero,
|
||||
IRTraccZeroMMmV,
|
||||
IRTraccAverageOverTime,
|
||||
Polynomial,
|
||||
IRTraccCalFactor
|
||||
}
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `Styles Style { get; set; }` — Default: `Styles.IRTraccDiagnosticsZero`
|
||||
- `double PolynomialSensitivity { get; set; }` — Default: `1.0`
|
||||
- `double LinearizationExponent { get; set; }` — Default: `1.0`
|
||||
- `double MMPerV { get; set; }` — Millimeters per volt
|
||||
- `double MVAt0MM { get; set; }` — mV at 0mm
|
||||
- `double Slope { get; set; }`
|
||||
- `double Intercept { get; set; }`
|
||||
- `double CalibrationFactor { get; set; }`
|
||||
- `double ZeroPositionIntercept { get; set; }`
|
||||
- `bool UsemVOverVForPolys { get; set; }` — Default: `true`
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public LinearizationFormula()
|
||||
public LinearizationFormula(LinearizationFormula copy)
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public bool IsValid()
|
||||
public void MarkValid(bool bValid)
|
||||
```
|
||||
Validity state management.
|
||||
|
||||
```csharp
|
||||
public string ToSerializeString()
|
||||
```
|
||||
Serializes formula to string format: `Style_data`. Throws `NotSupportedException` for unknown styles.
|
||||
|
||||
```csharp
|
||||
public void FromSerializeString(string s)
|
||||
public void FromSerializeString(string s, System.Globalization.CultureInfo culture)
|
||||
```
|
||||
Deserializes from string. Handles legacy formats `"1"`, `"0"`, `"1 "` as invalid.
|
||||
|
||||
**Style-specific serialization methods:**
|
||||
```csharp
|
||||
public string ToIRTraccDiagnosticZeroString()
|
||||
public string ToIRTraccCalFactorString()
|
||||
public string ToIRTraccManualString()
|
||||
public string ToIRTraccZeroMMmVString()
|
||||
public string ToIRTraccAverageOverTimeString()
|
||||
public string ToPolynomialString()
|
||||
```
|
||||
|
||||
**Style-specific deserialization methods:**
|
||||
```csharp
|
||||
public void FromIRTraccCalFactorString(string s, System.Globalization.CultureInfo culture)
|
||||
public void FromIRTraccDiagnosticZeroString(string s, System.Globalization.CultureInfo culture)
|
||||
public void FromIRTraccManualString(string s, System.Globalization.CultureInfo culture)
|
||||
public void FromIRTraccZeroMMmVString(string s, System.Globalization.CultureInfo culture)
|
||||
public void FromIRTraccAverageOverTimeString(string s, System.Globalization.CultureInfo culture)
|
||||
public void FromPolynomialString(string s, System.Globalization.CultureInfo culture)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Bit-flag enum values:** `BridgeType` and `InputModes` use bit-shifted values (`1 << n`) to allow bitwise combination/flagging operations.
|
||||
|
||||
2. **ZeroMethodType ordering:** The comment explicitly states: *"Lots of legacy compatibility (e.g. importing GM ISF) depends on the order/value of this enum."* Values must remain `AverageOverTime = 0`, `UsePreEventDiagnosticsZero = 1`, `None = 2`.
|
||||
|
||||
3. **Invariant culture serialization:** All serialization methods use `System.Globalization.CultureInfo.InvariantCulture` for consistent cross-platform parsing.
|
||||
|
||||
4. **List separator format:** Serialization uses `CultureInfo.InvariantCulture.TextInfo.ListSeparator` as the delimiter.
|
||||
|
||||
5. **LinearizationFormula validity:** A formula is considered invalid if `ToSerializeString()` returns an empty string, or if the serialized string is `"1"`, `"0"`, or `"1 "`.
|
||||
|
||||
6. **ExcitationVoltageOption magnitude uniqueness:** Each enum value maps to exactly one voltage magnitude via the `VoltageMagnitudeAttribute`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` — Base types, exceptions, attributes
|
||||
- `System.ComponentModel` — `DescriptionAttribute` for enum display names
|
||||
- `System.Collections.Generic` — `List<T>` for coefficient/exponent storage
|
||||
- `System.Linq` — LINQ operations (imported but usage unclear from visible code)
|
||||
- `System.Text` — `StringBuilder` for string construction
|
||||
- `System.Globalization` — Culture-specific parsing/formatting
|
||||
|
||||
### External dependencies (referenced but not defined in source):
|
||||
- `AttributeCoder<ExcitationVoltageOption, VoltageMagnitudeAttribute, double>` — Base class for `VoltageMagnitudeAttributeCoder` (not included in source files)
|
||||
|
||||
### Partial class structure:
|
||||
The `Test` class and its nested `Module`, `Channel`, `Sensor` classes are defined as `partial` across multiple files. The following files are referenced but not provided:
|
||||
- `Test.cs`
|
||||
- `Test.Module.Channel.cs`
|
||||
- `Test.Module.Channel.Sensor.cs`
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **DigitalInputScaleMultiplier deserialization is non-functional:** The `FromDbSerializeString` method has all parsing logic commented out. It only returns silently on null input and does nothing otherwise. This appears to be incomplete/broken functionality.
|
||||
|
||||
2. **Misleading class name:** The comment in `DigitalInputScaleMultiplier` states: *"the scaler is a bit different than an ordinary scaler, so the name here is inaccurate."*
|
||||
|
||||
3. **Misleading variable name:** In `LinearizationFormula`, the comment notes: *"THIS IS MM/V, (UI has already been updated, we need to update the variable name)"* referring to `MMPerV`.
|
||||
|
||||
4. **Extensive commented-out code:** Multiple files contain large blocks of commented-out code including:
|
||||
- `DigitalInputScaleMultiplier`: `Equals`, `GetHashCode`, `SimpleEquals`, deserialization logic
|
||||
- `InitialOffset`: `Equals`, display methods
|
||||
- `LinearizationFormula`: `GetLinearizedValue`, polynomial calculation methods, SLICEWare serialization
|
||||
|
||||
5. **Legacy ZeroMethodType enum:** The existence of `OriginalZeroMethodType` with `UsePreCalZero` (vs. `UsePreEventDiagnosticsZero`) suggests a migration path for legacy data. The naming difference (`UsePreCalZero` vs `UsePreEventDiagnosticsZero`) may cause confusion.
|
||||
|
||||
6. **ExcitationVoltageOption non-sequential values:** Enum values are not sequential (1, 2, 4, 8, 16, 32, 64) suggesting they may have been designed as flags or for specific hardware register mapping.
|
||||
|
||||
7. **Polynomial serialization format:** The polynomial format uses `x` as a coefficient/exponent separator (e.g., `"c0xe0,c1xe1"`) and includes special tokens `S=` for sensitivity and `mV=` for the `UsemVOverVForPolys` flag.
|
||||
Reference in New Issue
Block a user