Skip to main content

no_std_generated_fixtures/tests/fixtures/
observation_guards_generated.rs

1// Auto-generated by ph-curves-gen. Do not edit.
2
3use ph_curves::{BoundaryBehavior, MonotonicDirection, ObservationGuardBehavior, ObservationGuardMetadata, PiecewiseLinearTransfer, TransferMetadata};
4
5#[rustfmt::skip]
6static GUARDED_ERROR_INPUTS: [u16; 2] = [1, 10];
7#[rustfmt::skip]
8static GUARDED_ERROR_OUTPUTS: [i32; 2] = [1, 10];
9/// "guarded\_error" sparse physical transfer function.
10///
11/// Source provenance: none declared.
12/// Representation: "formula y = x".
13/// Generation policy: requested interpolation error <= 1; max_knots = 8; below = error; above = clamp.
14/// Domain: 1..=10 "count"; output: "unit" x 1.
15/// Knots: 2 (12 bytes array payload).
16/// Exhaustive numerical error: requested <= 1, achieved 0.000000 output quanta
17/// (conservative metadata bound 0) at input 1.
18/// This is table/quantization error against the configured ideal source, not total sensor accuracy.
19/// Observation guard: code 65535 with Error behavior.
20/// Classification of this code as saturation is declared consumer/device policy, not inferred from the integer value.
21#[rustfmt::skip]
22pub const GUARDED_ERROR: PiecewiseLinearTransfer<2> =
23PiecewiseLinearTransfer::new(&GUARDED_ERROR_INPUTS, &GUARDED_ERROR_OUTPUTS, MonotonicDirection::Increasing)
24.with_boundaries(BoundaryBehavior::Error, BoundaryBehavior::Clamp)
25.with_observation_guard(65535, ObservationGuardBehavior::Error);
26/// Metadata for [`GUARDED_ERROR`].
27pub const GUARDED_ERROR_METADATA: TransferMetadata = TransferMetadata {
28    input_unit: "count",
29    output_unit: "unit",
30    output_scale: 1,
31    domain_min: 1,
32    domain_max: 10,
33    range_min: 1,
34    range_max: 10,
35    direction: MonotonicDirection::Increasing,
36    knot_count: 2,
37    strictly_monotonic: true,
38    flat_segment_count: 0,
39    requested_max_error: 1,
40    achieved_max_error: 0,
41    worst_case_input: 1,
42    achieved_max_inverse_code_error: 0,
43};
44/// Optional observation-code guard for [`GUARDED_ERROR`].
45///
46/// Classification of a code as saturation is declared consumer/device policy,
47/// not inferred from the integer value. The runtime getter and this constant agree.
48pub const GUARDED_ERROR_OBSERVATION_GUARD: Option<ObservationGuardMetadata> = Some(ObservationGuardMetadata {
49    code: 65535,
50    behavior: ObservationGuardBehavior::Error,
51});
52
53#[rustfmt::skip]
54static GUARDED_FAMILY_VARIANT_CLAMP_INPUTS: [u16; 2] = [1, 10];
55#[rustfmt::skip]
56static GUARDED_FAMILY_VARIANT_CLAMP_OUTPUTS: [i32; 2] = [10, 1];
57/// Family: "guarded\_family".
58/// Selectors: "variant" = "clamp".
59/// "guarded\_family\_variant\_clamp" sparse physical transfer function.
60///
61/// Source provenance: identity "test fixture".
62/// Representation: "formula y = 11 - x".
63/// Generation policy: requested interpolation error <= 1; max_knots = 8; below = clamp; above = error.
64/// Domain: 1..=10 "count"; output: "unit" x 1.
65/// Knots: 2 (12 bytes array payload).
66/// Exhaustive numerical error: requested <= 1, achieved 0.000000 output quanta
67/// (conservative metadata bound 0) at input 1.
68/// This is table/quantization error against the configured ideal source, not total sensor accuracy.
69/// Observation guard: code 65535 with Clamp behavior.
70/// Classification of this code as saturation is declared consumer/device policy, not inferred from the integer value.
71#[rustfmt::skip]
72pub const GUARDED_FAMILY_VARIANT_CLAMP: PiecewiseLinearTransfer<2> =
73PiecewiseLinearTransfer::new(&GUARDED_FAMILY_VARIANT_CLAMP_INPUTS, &GUARDED_FAMILY_VARIANT_CLAMP_OUTPUTS, MonotonicDirection::Decreasing)
74.with_boundaries(BoundaryBehavior::Clamp, BoundaryBehavior::Error)
75.with_observation_guard(65535, ObservationGuardBehavior::Clamp);
76/// Metadata for [`GUARDED_FAMILY_VARIANT_CLAMP`].
77pub const GUARDED_FAMILY_VARIANT_CLAMP_METADATA: TransferMetadata = TransferMetadata {
78    input_unit: "count",
79    output_unit: "unit",
80    output_scale: 1,
81    domain_min: 1,
82    domain_max: 10,
83    range_min: 1,
84    range_max: 10,
85    direction: MonotonicDirection::Decreasing,
86    knot_count: 2,
87    strictly_monotonic: true,
88    flat_segment_count: 0,
89    requested_max_error: 1,
90    achieved_max_error: 0,
91    worst_case_input: 1,
92    achieved_max_inverse_code_error: 0,
93};
94/// Optional observation-code guard for [`GUARDED_FAMILY_VARIANT_CLAMP`].
95///
96/// Classification of a code as saturation is declared consumer/device policy,
97/// not inferred from the integer value. The runtime getter and this constant agree.
98pub const GUARDED_FAMILY_VARIANT_CLAMP_OBSERVATION_GUARD: Option<ObservationGuardMetadata> = Some(ObservationGuardMetadata {
99    code: 65535,
100    behavior: ObservationGuardBehavior::Clamp,
101});