Files
DP44/enriched-qwen3-coder-next/DataPRO/IService/Classes/PowerProInput.md
2026-04-17 14:55:32 -04:00

73 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- DataPRO/IService/Classes/PowerProInput/SLICE.PowerPro.Input.Reader.cs
generated_at: "2026-04-16T03:57:12.321531+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "155f476d57ed5515"
---
# PowerProInput
## 1. Purpose
This module provides a concrete implementation of `SLICEBaseInputReader` for reading diagnostic inputs from a PowerPro device via the SLICE DAS (Data Acquisition System) infrastructure. It enables retrieval of key power-related diagnostic metrics—specifically input voltage, device temperature, and direct backup (battery) voltage—by executing synchronous measurements using the `MeasurePowerProDiagnosticChannel` command class. Its role is to abstract low-level communication details and expose standardized, type-safe properties for downstream system components (e.g., monitoring, diagnostics, or control logic) to consume real-time PowerPro hardware state.
---
## 2. Public Interface
### `SLICEPowerProInputReader(ICommunication comm)`
- **Type**: Constructor
- **Behavior**: Initializes a new instance with the specified `ICommunication` interface (`_comm`) used for hardware interaction. Delegates to the base class constructor with the same `comm` instance.
### `override double InputMilliVolts { get; }`
- **Type**: Read-only property
- **Behavior**: Returns the PowerPro input voltage in millivolts. Internally creates a `MeasurePowerProDiagnosticChannel` instance, configures it to read `InputVoltage_A` on device group `0`, device ID `0`, executes a synchronous measurement, and returns `Measurement * 1000.0`.
### `override double TemperatureC { get; }`
- **Type**: Read-only property
- **Behavior**: Returns the PowerPro internal temperature in degrees Celsius. Internally creates a `MeasurePowerProDiagnosticChannel`, sets `Channel` to `TemperatureC`, configures device group and ID to `0`, executes a synchronous measurement, and returns `Measurement` directly.
### `override double DirectBackupMilliVolts { get; }`
- **Type**: Read-only property
- **Behavior**: Returns the direct backup (battery) voltage in millivolts. Internally creates a `MeasurePowerProDiagnosticChannel`, sets `Channel` to `BatteryVoltage`, configures device group and ID to `0`, executes a synchronous measurement, and returns `Measurement * 1000.0`.
> **Note**: All three properties override abstract members defined in the base class `SLICEBaseInputReader`. Each property performs a *synchronous* hardware read on every access.
---
## 3. Invariants
- **Device targeting**: All measurements are hard-coded to `DeviceGroup = 0` and `DeviceID = 0`. No support for multi-device or configurable addressing is present.
- **Unit consistency**:
- `InputMilliVolts` and `DirectBackupMilliVolts` are returned in **millivolts** (i.e., `Measurement * 1000.0`).
- `TemperatureC` is returned in **degrees Celsius** (i.e., raw `Measurement` value).
- **Synchronous execution**: Every property getter performs a blocking `SyncExecute()` call; no async or buffered reads are used.
- **Channel mapping**: Only three specific diagnostic channels are supported: `InputVoltage_A`, `TemperatureC`, and `BatteryVoltage`. Other channels in `PowerProDiagnosticChannelList` are not exposed via this class.
---
## 4. Dependencies
### Dependencies *on* this module:
- `SLICEBaseInputReader` (base class) — defines the abstract properties (`InputMilliVolts`, `TemperatureC`, `DirectBackupMilliVolts`) implemented here.
- `ICommunication` — injected dependency for low-level hardware communication.
- `MeasurePowerProDiagnosticChannel` — concrete command class from `DTS.DASLib.Command.SLICE` used to perform synchronous measurements.
### Dependencies *of* this module:
- **External libraries**:
- `DTS.Common.Interface.DASFactory` (for `ICommunication`)
- `DTS.DASLib.Command.SLICE` (for `MeasurePowerProDiagnosticChannel`)
- **Inferred callers**: Likely consumed by higher-level services (e.g., monitoring daemons, status reporters) that inherit from or use `SLICEBaseInputReader` polymorphically.
---
## 5. Gotchas
- **Repeated hardware calls per property access**: Each property read triggers a *new* `MeasurePowerProDiagnosticChannel` instance and a full `SyncExecute()` round-trip to the device. This may cause performance issues if properties are accessed frequently (e.g., in tight loops or high-frequency telemetry). Caching is not implemented.
- **Hard-coded device addressing**: All reads target `DeviceGroup = 0`, `DeviceID = 0`. If the PowerPro system supports multiple devices, this class cannot be used without modification.
- **No error handling visible**: The source does not show explicit exception handling (e.g., for communication failures, invalid measurements). Failures in `SyncExecute()` or invalid `measure.Measurement` values may propagate unhandled exceptions.
- **Unit ambiguity in base `Measurement`**: The raw `measure.Measurement` values unit (e.g., volts, °C) is assumed by context but not enforced by this class. Incorrect assumptions about the underlying `MeasurePowerProDiagnosticChannel`s output units could lead to incorrect scaling.
- **No thread-safety guarantees**: Since each property creates a new `MeasurePowerProDiagnosticChannel` and calls `SyncExecute()` on `_comm`, concurrent access to multiple properties *may* be safe *if* `_comm` is thread-safe, but this is not documented or verified in the source.
> **None identified from source alone.** *(Note: The above gotchas are inferred from observed patterns in the code, not explicit warnings.)*