10 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:31:33.249057+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 248b93b117b62a27 |
DTS.Slice.Control.Event.Module.AnalogInputChannel.ReviewableAttribute Derivatives
1. Purpose
This module defines a set of concrete ReviewableAttribute subclasses used to expose specific channel metadata and calibration-related values for review in the DTS Slice control event system. Each attribute encapsulates a human-readable label and a delegate that dynamically computes a formatted string representation of a channel property at runtime—primarily for inclusion in audit trails, calibration reports, or diagnostic UIs. These attributes are attached to AnalogInputChannel instances and provide a standardized way to surface configuration, calibration, and measurement data without hardcoding display logic elsewhere in the system.
2. Public Interface
All classes are nested within DTS.Slice.Control.Event.Module.AnalogInputChannel and inherit from Slice.Control.Event.Module.Channel.ReviewableAttribute. Each constructor takes a single parameter of type Event.Module.Channel and passes a label string and a Func<string> (via delegate { ... }) to the base constructor.
| Class | Constructor Signature | Label | Behavior |
|---|---|---|---|
ReviewableShuntDeflectionAttribute |
ReviewableShuntDeflectionAttribute(Event.Module.Channel channel) |
"Shunt Deflection (mV)" |
Returns MeasuredShuntDeflectionMv.ToString("F1"), where MeasuredShuntDeflectionMv is accessed via (channel as IShuntAware).MeasuredShuntDeflectionMv. |
ReviewableFilterFrequencyAttribute |
ReviewableFilterFrequencyAttribute(Event.Module.Channel channel) |
"Filter Frequency" |
Returns (int)(channel.CurrentFilter as SaeJ211Filter).CutoffFrequencyHz formatted with ToString("N"). |
ReviewableIsoCodeAttribute |
ReviewableIsoCodeAttribute(Event.Module.Channel channel) |
"ISO Code" |
Returns (channel as AnalogInputChannel).IsoCode.ToString(). |
ReviewableDescriptionAttribute |
ReviewableDescriptionAttribute(Event.Module.Channel channel) |
"Description" |
Returns channel.ChannelDescriptionString. |
ReviewableSerialNumberAttribute |
ReviewableSerialNumberAttribute(Event.Module.Channel channel) |
"Serial Number" |
Returns (channel as AnalogInputChannel).SerialNumber.ToString(). |
ReviewableUnitsAttribute |
ReviewableUnitsAttribute(Event.Module.Channel channel) |
"Units" |
Returns (channel as IEngineeringUnitAware).EngineeringUnits.ToString(). |
ReviewableMinMaxEuAttribute |
ReviewableMinMaxEuAttribute(Event.Module.Channel channel) |
"Max/Min (EU)" |
Returns "${DataMaxFilteredEu:F1}/${DataMinFilteredEu:F1}". |
ReviewableCfcAttribute |
ReviewableCfcAttribute(Event.Module.Channel channel) |
"CFC" |
Returns "N/A" if channel.CurrentFilter.Type == ChannelFilter.AdHoc; otherwise returns new CfcValueAttributeCoder().DecodeAttributeValue((channel.CurrentFilter as SaeJ211Filter).Type).ToString(). |
ReviewableTargetShuntDeflectionAttribute |
ReviewableTargetShuntDeflectionAttribute(Event.Module.Channel channel) |
"Target Shunt Deflection (mV)" |
Returns TargetShuntDeflectionMv.ToString("F1"), via (channel as IShuntAware).TargetShuntDeflectionMv. |
ReviewableTargetCalSignalAttribute |
ReviewableTargetCalSignalAttribute(Event.Module.Channel channel) |
"Target Calibration Signal (mV)" |
Returns TargetCalSignalMv.ToString("F1"), via (channel as ICalSignalAware).TargetCalSignalMv. |
ReviewableMeasuredShuntDeflectionAttribute |
ReviewableMeasuredShuntDeflectionAttribute(Event.Module.Channel channel) |
"Measured Shunt Deflection (mV)" |
Same as ReviewableShuntDeflectionAttribute. |
ReviewableMeasuredCalSignalAttribute |
ReviewableMeasuredCalSignalAttribute(Event.Module.Channel channel) |
"Measured Calibration Signal (mV)" |
Same as ReviewableTargetCalSignalAttribute but for measured values: (channel as ICalSignalAware).MeasuredCalSignalMv.ToString("F1"). |
ReviewableShuntDeflectionPercentageAttribute |
ReviewableShuntDeflectionPercentageAttribute(Event.Module.Channel channel) |
"Shunt Error (%)" |
Computes (100.0 * (MeasuredShuntDeflectionMv - TargetShuntDeflectionMv) / TargetShuntDeflectionMv).ToString("F1"). |
ReviewableCalSignalPercentageAttribute |
ReviewableCalSignalPercentageAttribute(Event.Module.Channel channel) |
"Calibration Signal Error (%)" |
Computes (100.0 * (MeasuredCalSignalMv - TargetCalSignalMv) / TargetCalSignalMv).ToString("F1"). |
Note
:
IShuntAware,ICalSignalAware, andIEngineeringUnitAwareare interfaces defined inDTS.DAS.Concepts.DAS.Channel.SaeJ211Filter,CfcValueAttributeCoder, andChannelFilterare defined inDTS.Utilities.
3. Invariants
- All attributes require the
channelparameter to be non-null, and to support the specific interface(s) accessed in their delegate (e.g.,IShuntAwarefor shunt-related attributes). Failure to meet this requirement will cause a runtimeInvalidCastExceptionorNullReferenceException. - Format consistency: All numeric outputs use
"F1"(1 decimal place) or"N"(thousands separator, no decimals) formatting as shown. No validation or range checking is performed on the underlying values. - No side effects: The delegates are pure functions; they do not mutate state.
- No ordering guarantees: The module does not define or enforce any ordering among these attributes when used collectively (e.g., in a list or collection).
- Type assumptions: The code assumes
channel.CurrentFilteris always aSaeJ211Filterwhen accessing.Typeor.CutoffFrequencyHz. IfCurrentFilteris not aSaeJ211Filter, this will throw at runtime.
4. Dependencies
Internal Dependencies (from source):
DTS.Slice.Control.Event.Module.Channel.ReviewableAttribute— base class (not shown, but referenced).DTS.DAS.Concepts.DAS.Channel.IShuntAware— forMeasuredShuntDeflectionMv,TargetShuntDeflectionMv.DTS.DAS.Concepts.DAS.Channel.ICalSignalAware— forMeasuredCalSignalMv,TargetCalSignalMv.DTS.DAS.Concepts.DAS.Channel.IEngineeringUnitAware— forEngineeringUnits.DTS.Utilities.SaeJ211Filter— used inReviewableFilterFrequencyAttributeandReviewableCfcAttribute.DTS.Utilities.CfcValueAttributeCoder— used inReviewableCfcAttribute.DTS.Utilities.ChannelFilter— used inReviewableCfcAttribute(specificallyChannelFilter.AdHocconstant).DTS.Slice.Control.Event.Module.AnalogInputChannel— forIsoCode,SerialNumber, andChannelDescriptionStringproperties.
External Dependencies:
System(core namespaces:System,System.Linq,System.Text,System.Collections.Generic).DTS.Utilities— assembly reference required.
Inferred Consumers:
- Likely consumed by UI or reporting layers that enumerate
ReviewableAttributeinstances on channels (e.g., for serialization, audit logging, or calibration review forms). - May be used in conjunction with
DTS.Slice.Control.Eventinfrastructure (e.g., event logging, data export).
5. Gotchas
- Redundant classes:
ReviewableShuntDeflectionAttributeandReviewableMeasuredShuntDeflectionAttributehave identical implementation and labels. Same forReviewableTargetCalSignalAttributeandReviewableMeasuredCalSignalAttribute. This duplication may cause confusion or inconsistency if one is updated but not the other. - Unsafe casts: Multiple attributes use
ascasts without null checks (e.g.,(channel as IShuntAware)). If the channel does not implement the interface, the cast yieldsnull, leading toNullReferenceExceptionwhen accessing.MeasuredShuntDeflectionMv. - Assumed filter type:
ReviewableFilterFrequencyAttributeandReviewableCfcAttributeassumechannel.CurrentFilteris always aSaeJ211Filter. IfCurrentFilteris another type (e.g.,AdHoc), a runtimeInvalidCastExceptionoccurs. - Division by zero risk:
ReviewableShuntDeflectionPercentageAttributeandReviewableCalSignalPercentageAttributedivide byTargetShuntDeflectionMvorTargetCalSignalMvwithout checking for zero. If the target is0.0, this throwsDivideByZeroException. - Missing null guard in
ReviewableCfcAttribute: The commented-out line suggests prior use ofCfcValueAttributeCoder, but the current logic only handlesAdHocexplicitly. IfCurrentFilter.Typeis neitherAdHocnor a validSaeJ211Filter.Type,CfcValueAttributeCoder.DecodeAttributeValue(...)may throw or return unexpected results. - Inconsistent casing:
ReviewableDescriptionAttribute.csfile header incorrectly labels it as"ReviewableCfcAttribute.cs"— likely a copy-paste artifact. - No documentation of
IsoCode,SerialNumber,ChannelDescriptionString: These properties are used but not defined in the provided source; their existence and type must be inferred from usage. - No documentation of
CfcValueAttributeCoderbehavior: The behavior ofDecodeAttributeValue(...)(e.g., what it returns for invalid inputs) is unknown from this source.
Recommendation: Add runtime null checks and guard against zero denominators in percentage attributes. Consider consolidating duplicate classes or clarifying their intended distinction.