init
This commit is contained in:
17
docs/ai/DataPRO/DASFactoryDb/ARM.md
Normal file
17
docs/ai/DataPRO/DASFactoryDb/ARM.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/ARM/ARM.cs
|
||||
generated_at: "2026-04-17T16:13:50.702908+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "acbb01a214cec676"
|
||||
---
|
||||
|
||||
# ARM
|
||||
|
||||
### Purpose
|
||||
This module manages ARM (Armed/Recording Mode) status updates for DAS devices during factory operations. It persists comprehensive device state information including arming status, trigger states, recording progress, diagnostic data, and fault information to the database for monitoring and tracking purposes.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`ARM.SetArmStatus(int iDASRecordId, bool isArmed, bool isTriggered, bool isTriggerShorted, bool isStartShorted, bool isRecording, bool isFaulted, bool isInRealtime, bool isInFlashWrite, bool isUndefined, bool isInPostTestDiagnostics, double timeRemainingSeconds, double percentComplete, ulong totalSamples, ulong currentSample, uint sampleRate, double? inputMilliVolts, double? batteryMilliVolts, int? eventNumber, int recordingMode, string faultMessage, bool isRear
|
||||
62
docs/ai/DataPRO/DASFactoryDb/Config.md
Normal file
62
docs/ai/DataPRO/DASFactoryDb/Config.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/Config/Config.cs
|
||||
generated_at: "2026-04-17T16:45:55.734203+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b40972ee3c12f7cc"
|
||||
---
|
||||
|
||||
# Documentation: `DASFactoryDb.Config.Config`
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a static utility class for persisting and managing DAS (Data Acquisition System) configuration data to a SQL Server database. It serves as a data access layer that wraps stored procedure calls for inserting DAS device information, clearing DAS records, and storing XML configuration data. The class abstracts away ADO.NET command construction, parameter handling, and connection management for consumers.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DASInfoInsert`
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static int DASInfoInsert(
|
||||
int iDASRecordId,
|
||||
string macAddress,
|
||||
int owningDASId,
|
||||
uint maxNumberOfModules,
|
||||
ulong? maxEventStorageSpaceInBytes,
|
||||
ulong? numberOfBytesPerSampleClock,
|
||||
string batteryId,
|
||||
DateTime? calibrationDate
|
||||
)
|
||||
```
|
||||
|
||||
**Behavior:** Inserts a new DAS information record by calling the `sp_DASInfoInsert` stored procedure. Returns the newly generated record ID as an `int`. Handles null `macAddress` by substituting an empty string. Clamps `calibrationDate` values below `SqlDateTime.MinValue` to `SqlDateTime.MinValue`. Null values for `maxEventStorageSpaceInBytes` and `numberOfBytesPerSampleClock` are converted to 0. Errors from the stored procedure are processed via `DbWrapper.ProcessReturn()`.
|
||||
|
||||
---
|
||||
|
||||
### `DASInfoClear`
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void DASInfoClear(int iDASRecordId)
|
||||
```
|
||||
|
||||
**Behavior:** Clears DAS information for the specified record by calling the `sp_DASInfoClear` stored procedure. **Silently returns without action** if `DbWrapper.Connected` is `false`. Errors from the stored procedure are processed via `DbWrapper.ProcessReturn()`.
|
||||
|
||||
---
|
||||
|
||||
### `SetConfiguration`
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void SetConfiguration(
|
||||
int iDASRecordId,
|
||||
string xml,
|
||||
int fileStore
|
||||
)
|
||||
```
|
||||
|
||||
**Behavior:** Persists configuration data by calling the `sp_ConfigDataSet` stored procedure. The `xml` string is converted to a UTF-8 byte array and stored as `Var
|
||||
41
docs/ai/DataPRO/DASFactoryDb/DAS.md
Normal file
41
docs/ai/DataPRO/DASFactoryDb/DAS.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/DAS/DAS.cs
|
||||
generated_at: "2026-04-17T16:13:50.698481+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "02b33d07988ee1e0"
|
||||
---
|
||||
|
||||
# DAS
|
||||
|
||||
### Purpose
|
||||
This module provides data access layer functionality for DAS (Data Acquisition System) communication records. It exists to insert new DAS device records into the factory database, capturing device identification (serial number), firmware version, and connection metadata through a stored procedure interface.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DAS.InsertDASSimple(string serialNumber, string firmwareVersion, string connectString)`** → `int`
|
||||
- Inserts a new record into the DAS communication table via the `sp_IDASCommunicationTableSimpleInsert` stored procedure.
|
||||
- Parameters:
|
||||
- `serialNumber` (string): Device serial number, passed as `NVarChar(50)`
|
||||
- `firmwareVersion` (string): Firmware version string, passed as `NVarChar(50)`
|
||||
- `connectString` (string): Connection string, passed as `NVarChar(255)`
|
||||
- Returns the newly created record ID from the `@new_id` output parameter.
|
||||
- Throws or propagates errors via `DbWrapper.ProcessReturn()` if the stored procedure sets `@errorNumber`.
|
||||
|
||||
### Invariants
|
||||
- The stored procedure `sp_IDASCommunicationTableSimpleInsert` must exist in the target database.
|
||||
- `DbWrapper.GetDASFactoryCommand()` must return a valid, executable command object with an open connection.
|
||||
- The returned `new_id` will be a valid integer upon successful insertion.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `DbWrapper` (static class providing `GetDASFactoryCommand()` and `ProcessReturn(SqlParameter, SqlParameter)` methods) - inferred from usage but not shown in source.
|
||||
- **Depends on**: `System.Data`, `System.Data.SqlClient` for ADO.NET infrastructure.
|
||||
- **Consumers**: Unknown from source alone - likely factory calibration or device registration workflows.
|
||||
|
||||
### Gotchas
|
||||
- **Parameter naming inconsistency**: The `connectString` parameter is added as `"ConnectString"` (camelCase vs PascalCase) - this may cause issues if the stored procedure is case-sensitive.
|
||||
- **Connection disposal pattern**: The `cmd.Connection.Dispose()` is called in a `finally` block, but the `using` statement wrapping `cmd` would typically handle command disposal. This suggests the connection lifecycle is managed separately from the command.
|
||||
- **No null validation**: The method does not validate input parameters before passing to the stored procedure.
|
||||
|
||||
---
|
||||
116
docs/ai/DataPRO/DASFactoryDb/Diagnostics.md
Normal file
116
docs/ai/DataPRO/DASFactoryDb/Diagnostics.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/Diagnostics/Diagnostics.cs
|
||||
generated_at: "2026-04-17T15:59:34.341673+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "82e5a9a5a5472a3a"
|
||||
---
|
||||
|
||||
# Documentation: DASFactoryDb.Diagnostics
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a data access layer for recording and clearing diagnostic actions and results for a Data Acquisition System (DAS). It serves as the persistence mechanism for diagnostic test configurations and their outcomes across analog, digital, and squib (pyrotechnic) channels. The class abstracts database stored procedure calls into simple static methods, handling parameter construction, execution, and error reporting for factory diagnostic operations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ClearDiagnosticActionsAllChannels(int idasRecordId)`
|
||||
**Signature:** `public static void ClearDiagnosticActionsAllChannels(int idasRecordId)`
|
||||
|
||||
Clears all diagnostic actions for all channels associated with a given DAS communication record. Invokes the stored procedure `sp_DiagnosticActionsClear`, passing `null` for the channel number parameter to indicate "all channels." Silently returns without action if `DbWrapper.Connected` is false.
|
||||
|
||||
---
|
||||
|
||||
### `InsertDiagnosticAction(...)`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void InsertDiagnosticAction(
|
||||
int dasRecordId,
|
||||
int dasChannelNumber,
|
||||
bool measureExcitation,
|
||||
bool measureOffset,
|
||||
bool checkDigitalState,
|
||||
bool measureInternalOffset,
|
||||
bool removeOffset,
|
||||
bool measureNoise,
|
||||
bool performShuntCheck,
|
||||
bool squibFireCheck,
|
||||
bool performVoltageInsertCheck,
|
||||
bool performCalSignalCheck,
|
||||
bool measureBridgeResistance
|
||||
)
|
||||
```
|
||||
|
||||
Inserts a diagnostic action configuration for a specific DAS channel. Each boolean parameter specifies whether a particular diagnostic check should be performed. Invokes `sp_DiagnosticsActionsInsert`. The stored procedure returns a `@new_id` output parameter, but this value is not exposed to callers. Silently returns without action if `DbWrapper.Connected` is false.
|
||||
|
||||
---
|
||||
|
||||
### `ClearExistingDiagnosticsAllChannels(int idasRecordId = -1)`
|
||||
**Signature:** `public static void ClearExistingDiagnosticsAllChannels(int idasRecordId = -1)`
|
||||
|
||||
Clears all diagnostics and events results for all channels associated with a DAS record. Invokes `sp_DiagnosticsResultsClear`, passing `null` for both `@DASChannelNumber` and `@EventNumber` parameters to indicate "all." The default parameter value of `-1` is used if no argument is provided. Silently returns without action if `DbWrapper.Connected` is false.
|
||||
|
||||
---
|
||||
|
||||
### `InsertAnalogDiagnosticResult(...)`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void InsertAnalogDiagnosticResult(
|
||||
int iDASRecordId,
|
||||
int dasChannelNumber,
|
||||
int eventNumber,
|
||||
double scalefactorMilliVoltsPerADC,
|
||||
double expectedExcitationMilliVolts,
|
||||
double? measuredExcitationMilliVolts,
|
||||
bool negativeExcitation,
|
||||
double? measuredOffsetMilliVolts,
|
||||
double? measuredInternalOffsetMilliVolts,
|
||||
double? autoZeroPercentDeviation,
|
||||
short? finalOffsetADC,
|
||||
int? removedOffsetADC,
|
||||
int? removedInternalOffsetADC,
|
||||
double? noisePercentFullScale,
|
||||
bool shuntDeflectionFailed,
|
||||
bool calSignalCheckFailed,
|
||||
double? measuredShuntDeflectionMv,
|
||||
double? measuredCalSignalMv,
|
||||
double? targetCalSignalMv,
|
||||
double? targetGain,
|
||||
double? measuredGain,
|
||||
double? queriedGain,
|
||||
double? targetShuntDeflectionMv,
|
||||
double? bridgeResistance,
|
||||
double zeroMVInADC,
|
||||
double windowAverageADC
|
||||
)
|
||||
```
|
||||
|
||||
Inserts analog diagnostic measurement results for a specific channel and event. Captures excitation measurements, offset values, noise metrics, shunt check results, calibration signal data, gain measurements, and bridge resistance. Invokes `sp_DiagnosticsResultsAnalogInsert`. Silently returns without action if `DbWrapper.Connected` is false.
|
||||
|
||||
---
|
||||
|
||||
### `InsertSquibDiagnosticResult(...)`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static void InsertSquibDiagnosticResult(
|
||||
int iDASRecordId,
|
||||
int dasChannelNumber,
|
||||
int eventNumber,
|
||||
double[] squibFireCurrentData,
|
||||
double[] squibFireVoltageData,
|
||||
double[] squibFireTimeAxis,
|
||||
double? measuredDurationMS,
|
||||
double? measuredDelayMS,
|
||||
bool? squibFirePassed,
|
||||
bool? squibDurationPassed,
|
||||
bool? squibDelayPassed,
|
||||
double squibThreshold,
|
||||
double squibVoltageScaler,
|
||||
double squibCurrentScaler
|
||||
)
|
||||
```
|
||||
|
||||
Inserts squib (pyrotechnic firing) diagnostic results. The `squibFireCurrentData`, `squibFireVoltageData`, and `squibFireTimeAxis` arrays are serialized to binary format (8 bytes per double using `BitConverter.GetBytes`)
|
||||
80
docs/ai/DataPRO/DASFactoryDb/Download.md
Normal file
80
docs/ai/DataPRO/DASFactoryDb/Download.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/Download/Download.cs
|
||||
generated_at: "2026-04-17T15:59:45.195241+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "419e1018bcd6dde6"
|
||||
---
|
||||
|
||||
# Documentation: `DASFactoryDb.Download.Download`
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a data access layer for managing download-related database operations in a DAS (Data Acquisition System) Factory context. It serves as an abstraction layer for persisting and clearing event metadata—including download statuses, fault flags, arm attempts, event information, download requests, and event GUIDs—via SQL Server stored procedures. The class is designed to support the lifecycle of data recorder events from initial recording through download completion.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Clear Methods
|
||||
|
||||
| Method | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| `ClearExistingEventDownloadStatus` | `void ClearExistingEventDownloadStatus(int idasRecordId)` | Clears all existing download status records for the specified DAS record via `sp_EventDownloadStatusClear`. |
|
||||
| `ClearExistingEventArmAttempts` | `void ClearExistingEventArmAttempts(int idasRecordId)` | Clears all arm attempt records for a given data recorder via `sp_EventArmAttemptsClear`. |
|
||||
| `ClearExistingFaultFlags` | `void ClearExistingFaultFlags(int idasRecordId)` | Clears event fault flag records via `sp_EventFaultFlagsClear`. |
|
||||
| `ClearExistingDownloadReports` | `void ClearExistingDownloadReports(int idasRecordId)` | Clears event info/download report records via `sp_DownloadReportClear`. |
|
||||
| `ClearExistingEventGuids` | `void ClearExistingEventGuids(int idasRecordId)` | Clears event GUID records via `sp_EventGuidsClear`. |
|
||||
| `ClearExistingDownloadRequests` | `void ClearExistingDownloadRequests(int idasRecordId)` | Clears download request records via `sp_DownloadRequestsClear`. |
|
||||
| `ClearExistingUARTDownloadRequests` | `void ClearExistingUARTDownloadRequests(int idasRecordId)` | Clears UART download request records via `sp_UARTDownloadRequestsClear`. |
|
||||
|
||||
### Insert Methods
|
||||
|
||||
| Method | Signature | Behavior |
|
||||
|--------|-----------|----------|
|
||||
| `InsertEventFaultFlags` | `void InsertEventFaultFlags(int iDASRecordId, ushort faultFlag)` | Inserts a fault flag record via `sp_EventFaultFlagsInsert`. The `ushort` is stored as `SmallInt`. |
|
||||
| `InsertEventArmAttempts` | `void InsertEventArmAttempts(int iDASRecordId, int armAttempts)` | Inserts arm attempt count via `sp_EventArmAttemptsInsert`. The `int` is stored as `SmallInt`. |
|
||||
| `InsertEventInfo` | `void InsertEventInfo(int iDASRecordId, int eventNumber, Guid testGUID, ushort faultFlags, int armAttempts, DateTime testTime, string testID, string description, bool hasBeenDownloaded, bool wasTriggered, string xml)` | Inserts comprehensive event information via `sp_EventInfoInsert`. The `xml` parameter is stored as UTF-8 encoded bytes in a `VarBinary` field named `@Modules`. |
|
||||
| `InsertEventDownloadStatus` | `void InsertEventDownloadStatus(int iDASRecordId, bool downloadStatus)` | Inserts download status via `sp_EventDownloadStatusInsert`. |
|
||||
| `DownloadRequestInsert` | `void DownloadRequestInsert(int iDASRecordId, ushort eventNumber, int dasChannelNumber, ulong startSample, ulong endSample, ulong samplesToSkip, double startRecordTimeStampSec, double triggerTimeStampSec, double startRecordTimeStampNanoSec, double triggerTimestampNanoSec, bool PTPMasterSync)` | Inserts a download request via `sp_DownloadRequestsInsert`. Sample values are stored as `Int`; timestamps as `Decimal`. |
|
||||
| `UARTDownloadRequestInsert` | `void UARTDownloadRequestInsert(int iDASRecordId, ushort eventNumber, ulong totalByteCount, ulong triggerByteCount, ulong faultByteCount, ulong startTimestamp, ulong endTimestamp, int baudRate)` | Inserts a UART download request via `sp_UARTDownloadRequestsInsert`. Byte counts and timestamps stored as `Decimal`. |
|
||||
| `EventGuidInsert` | `void EventGuidInsert(int iDASRecordId, Guid guid)` | Inserts an event GUID via `sp_EventGuidsInsert`. The GUID is converted to uppercase string. |
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Connection Guard**: All public methods immediately return without action if `DbWrapper.Connected` is `false`.
|
||||
- **Stored Procedure Usage**: All database operations are performed via stored procedures; no inline SQL is used.
|
||||
- **Error Parameter Pattern**: Every stored procedure call includes `@errorNumber` (output, `Int`) and `@errorMessage` (output, `NVarChar(255)`) parameters.
|
||||
- **Connection Disposal**: All methods dispose of the database connection in a `finally` block, ensuring cleanup even on exception.
|
||||
- **Command Source**: All methods obtain commands via `DbWrapper.GetDASFactoryCommand()`.
|
||||
- **GUID Normalization**: GUIDs are stored as uppercase strings in `NVarChar(50)` fields.
|
||||
- **DateTime Handling**: In `InsertEventInfo`, `DateTime.MinValue` is converted to `SqlDateTime.MinValue` before storage.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On
|
||||
- **`DbWrapper`** (external, not shown): Provides `Connected` property, `GetDASFactoryCommand()` factory method, and `ProcessReturn(SqlParameter, SqlParameter)` error handling.
|
||||
- **`System.Data.SqlClient`**: ADO.NET SQL Server provider.
|
||||
- **SQL Server Database**: Requires the following stored procedures to exist:
|
||||
- `sp_EventDownloadStatusClear`, `sp_EventDownloadStatusInsert`
|
||||
- `sp_EventArmAttemptsClear`, `sp_EventArmAttemptsInsert`
|
||||
- `sp_EventFaultFlagsClear`, `sp_EventFaultFlagsInsert`
|
||||
- `sp_DownloadReportClear`
|
||||
- `sp_EventGuidsClear`, `sp_EventGuidsInsert`
|
||||
- `sp_DownloadRequestsClear`, `sp_DownloadRequestsInsert`
|
||||
- `sp_UARTDownloadRequestsClear`, `sp_UARTDownloadRequestsInsert`
|
||||
- `sp_EventInfoInsert`
|
||||
|
||||
### What Depends On This Module
|
||||
- **Unclear from source alone**: No consumers are visible in this file.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Critical Bug: Incorrect Parameter Value in `DownloadRequestInsert`
|
||||
```csharp
|
||||
cmd.Parameters.Add(
|
||||
new SqlParameter("@StartRecordTimestampNanoSec", SqlDbType.Decimal)
|
||||
{ Value = startRecordTimeStampSec }); // BUG: Should be startRecordTimeStampNanoSec
|
||||
```
|
||||
The parameter `@StartRecordTimestampNanoSec` is incorrectly assigned `startRecordTimeStampSec` instead of `startRecordTimeStampNanoSec`. This will result in incorrect nanosecond timestamp data being persisted.
|
||||
|
||||
### Missing `@` Prefix in `
|
||||
34
docs/ai/DataPRO/DASFactoryDb/Properties.md
Normal file
34
docs/ai/DataPRO/DASFactoryDb/Properties.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/DASFactoryDb/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:13:50.701613+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "966fd7b974b6fce8"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly-level metadata for the `DASFactoryDb` assembly. It provides versioning, copyright, and COM visibility configuration for the compiled output. It contains no executable logic.
|
||||
|
||||
### Public Interface
|
||||
None. This module contains only assembly attributes:
|
||||
- `AssemblyTitle`: "DASFactoryDb"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: "49c60032-9c8a-4ea5-9e26-2f1663555759"
|
||||
|
||||
### Invariants
|
||||
- Assembly version is fixed at 1.0.0.0.
|
||||
- COM visibility is disabled for all types in this assembly.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
|
||||
- **Consumers**: Build system and any projects that reference the DASFactoryDb assembly.
|
||||
|
||||
### Gotchas
|
||||
None identified from source alone - this is a standard AssemblyInfo file with no custom logic.
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user