///|
/// A geometric feature used by a measurement plan.
pub(all) enum FeatureKind {
Hole
Shaft
Plane
Slot
Circle
Cylinder
Datum
} derive(Eq)
///|
/// Measurement feature definition.
pub(all) struct Feature {
id : String
kind : FeatureKind
nominal : Double
lower : Double
upper : Double
datum : Bool
}
///|
/// A calibrated device available to the planner.
pub(all) struct Device {
id : String
accuracy : Double
reach : Double
supported_kinds : Array[FeatureKind]
}
///|
/// Construct a calibrated device record.
pub fn new_device(
id : String,
accuracy : Double,
reach : Double,
supported_kinds : Array[FeatureKind],
) -> Device {
{ id, accuracy, reach, supported_kinds }
}
///|
/// A measurement strategy selected for one feature.
pub enum Strategy {
SinglePoint
RepeatedPoint(count~ : Int)
Scan(count~ : Int)
}
///|
/// A planned measurement operation.
pub(all) struct MeasurementStep {
feature_id : String
device_id : String
strategy : Strategy
direction : String
uncertainty : Double
}
///|
/// Result of one observed measurement.
pub(all) struct Observation {
feature_id : String
value : Double
sample_count : Int
}
///|
/// Construct an observed measurement record.
pub fn new_observation(
feature_id : String,
value : Double,
sample_count : Int,
) -> Observation {
{ feature_id, value, sample_count }
}
///|
/// Human-readable quality result.
pub enum Verdict {
Pass
Fail(reason~ : String)
Unmeasured
}
///|
/// Plan quality summary.
pub(all) struct PlanSummary {
coverage : Double
capability : Bool
steps : Int
warnings : Array[String]
}
///|
/// Complete plan and optional observed results.
pub(all) struct MeasurementPlan {
part_id : String
steps : Array[MeasurementStep]
summary : PlanSummary
}
///|
/// A coarse risk level used to prioritize review and execution.
pub(all) enum RiskLevel {
Low
Medium
High
} derive(Eq, Debug)
///|
/// A stable phase in the execution lifecycle.
pub(all) enum PlanPhase {
EstablishDatum
Calibrate
Measure
Verify
Closeout
} derive(Eq, Debug)
///|
/// Reason explaining why a device was selected or rejected.
pub(all) enum SelectionReason {
Supported
UnsupportedKind
OutOfReach
InsufficientCapability
NoCandidate
LowerScore
StableTieBreak
} derive(Eq, Debug)
///|
/// Context carried by an observation batch.
pub(all) struct MeasurementContext {
operator : String
instrument : String
environment : String
timestamp : String
}
///|
/// A group of observations for one feature and measurement context.
pub(all) struct ObservationBatch {
feature_id : String
observations : Array[Observation]
context : MeasurementContext
}
///|
/// Capability indices calculated for a feature and its values.
pub(all) struct CapabilitySummary {
cp : Double
cpk : Double
adequate : Bool
sample_count : Int
uncertainty : Double
}
///|
/// Per-feature classification and normalized deviation.
pub(all) struct FeatureResult {
feature_id : String
verdict : Verdict
deviation : Double
risk : RiskLevel
sample_count : Int
}
///|
/// Aggregate quality statistics for a feature batch.
pub(all) struct BatchSummary {
feature_id : String
count : Int
pass_count : Int
fail_count : Int
unmeasured_count : Int
mean : Double
minimum : Double?
maximum : Double?
range : Double
standard_deviation : Double
defect_rate : Double
capability : CapabilitySummary
}