36. Quantity algebra, coordinate frames, clocks, uncertainty, and equivalence
A universal mobility system becomes dangerous when every value is merely number plus unit string. RTracer uses an exact quantity kind, dimensional signature, source lexical value, canonical value, method, frame, time support and uncertainty object.…
A universal mobility system becomes dangerous when every value is merely number plus unit string. RTracer uses an exact quantity kind, dimensional signature, source lexical value, canonical value, method, frame, time support and uncertainty object. Conversion is explicit and reversible where mathematically possible; comparison is prohibited when the measurement locations, frames or correction bases are not equivalent.
#36.1 QuantityValue 1.3
Exact quantity and uncertainty object
QuantityValue {
quantityKind: TermRef,
source: {value: DecimalString, unit: TermRef, resolution?: DecimalString},
canonical?: {value: DecimalString, unit: TermRef,
conversionRuleRef: TermRef, conversionReceiptRef: RecordRef},
dimension: {L, M, T, I, Theta, N, J, angle, information}, # signed small integers
frameRef?: EntityRef,
positionRef?: GeometryRef,
validTime?: HalfOpenInterval,
uncertainty?: Uncertainty,
qualityFlags: TermRef[],
methodRef?: RecordRef,
calibrationRef?: RecordRef
}
Uncertainty {
standardUncertainty: DecimalString,
distribution: normal | uniform | triangular | empirical | unknown,
coverageFactor?: DecimalString,
coverageProbability?: DecimalString,
degreesOfFreedom?: DecimalString,
covarianceGroupRef?: RecordRef,
contributors?: [{sourceRef, sensitivityCoefficient, standardUncertainty}],
evaluationMethod: typeA | typeB | mixed | unspecified
}The normative unit vocabulary is a governed UCUM-compatible subset with explicit RTracer TermRefs. Angle and information remain tagged semantic dimensions even when a pure SI reduction would call them dimensionless. Currency is never a physical dimension and uses Money plus exchange-rate records.
#36.2 Arithmetic and comparison rules
| Operation | Precondition | Result / rejection |
|---|---|---|
| add/subtract | same quantity kind or declared affine-compatible kinds; common frame/time basis | Exact decimal/rational conversion; propagate covariance; otherwise DIMENSION_OR_CONTEXT_MISMATCH |
| multiply/divide | dimension vectors and semantic-kind rule permit composition | Derived kind + dimension vector + formula receipt |
| compare | same kind, measurement location, frame, correction basis and compatible uncertainty | ordered/conflicting/indeterminate; never compare crank and wheel power directly |
| aggregate | unit-compatible observations and declared weighting/correlation | method, exclusions, window and uncertainty retained |
| differentiate/integrate | monotonic mapped time and sufficient sampling model | algorithm, boundary handling, filtering and clock uncertainty retained |
| convert | locked exact or bounded conversion rule | source always preserved; rounding mode/precision explicit |
| threshold | threshold uses same kind/context and declares inclusive/exclusive boundary | PASS/FAIL/INDETERMINATE plus margin and uncertainty rule |
Uncertainty propagation profile
For z = f(x1...xn) with covariance matrix Sigma and Jacobian J:
u(z)^2 = J * Sigma * transpose(J)
For independent multiplication z = x*y, first-order relative form:
(u(z)/z)^2 = (u(x)/x)^2 + (u(y)/y)^2
Independence may be assumed only when the method declares it. Shared calibration,
clock, environment or source equipment creates covariance and must not be counted twice.
Monte Carlo propagation records sampler, seed, distribution versions, sample count,
convergence checks and output quantiles; a seed is reproducibility metadata, not evidence.#36.3 Frame and pose contract
SE(3) frame and transform profile
FrameDefinition {
frameId, parentFrameId?, handedness: right,
axisDefinitions[], originDefinition, datumRef?, epoch?,
bodyFixed: boolean, configurationId?, validInterval
}
RigidTransform {
parentFrameId, childFrameId, validTime,
translationM: [DecimalString x3],
rotationQuaternionWxyz: [DecimalString x4],
covariance6x6?: [DecimalString x36],
sourceRefs[], interpolationPolicy, maxExtrapolationNs
}
Rules:
- quaternion norm error <= 1e-12 after decimal-to-working-precision conversion;
- canonical sign chooses the first non-zero component positive;
- composition order is parent_T_child; never inferred from field names;
- a transform cycle at one valid instant is rejected unless it closes within a
declared tolerance and is stored as a calibration residual, not canonical topology;
- pose is inseparable from frame, configuration and valid time.- Articulated machines store a kinematic tree/graph of joint definitions and time-varying joint states; a single vehicle pose cannot locate every link, wheel, wing, manipulator or trailer.
- Deformable hulls, sails, tires and soft robots reference a model/basis and state coefficients with a validity envelope; rigid transforms alone are insufficient.
- Geospatial coordinates name horizontal and vertical datum, coordinate epoch, axis order and uncertainty. A bare lat/lon/alt triple is invalid for precision claims.
- Privacy transforms such as delay, grid snap or noise produce a new GeometryProjection with a transform receipt. They never overwrite or masquerade as the source coordinate.
#36.4 Clock domains and piecewise-affine mapping
Clock mapping and uncertainty
ClockDomain {
clockId, producerDeviceId, tickUnit, counterBits?, nominalRate,
monotonicWithinBoot, bootId, oscillatorClass, leapBehavior
}
ClockMappingSegment {
clockId, referenceScale, deviceTickStart, deviceTickEnd,
t0Device, t0ReferenceSeconds, t0ReferenceNanos,
rateRatioA, offsetSecondsB,
covariance2x2, maxResidualNs, fitMethod, syncObservationRefs[]
}
t_reference = A * (t_device - t0Device) + B
u_time(t)^2 = [dt, 1] * Cov(A,B) * transpose([dt, 1]) + u_sync^2
Counter unwrap is valid only inside one bootId and wrap model. A reset, rate step,
GNSS reacquisition, PTP grandmaster change or residual breach closes the segment.UTC labels do not create simultaneity
Two channels may both print UTC while carrying different latency, synchronization, buffering and clock uncertainty. Cross-channel fusion must use ClockMappingSegment and the observation/capture time semantics of each channel.#36.5 Dyno, test, and performance equivalence
| Equivalence axis | Must match or be transformed explicitly |
|---|---|
| measurand | power/torque/thrust/energy kind, direction, phase and averaging definition |
| measurement location | crank, shaft, hub, wheel, roller, propeller, jet, electrical input or inferred boundary |
| configuration | exact snapshot, gearing, tire/track/propeller, control software, calibration and active limits |
| environment | temperature, pressure, humidity, altitude/density, wind/current and correction standard |
| setup | instrument/fixture model, inertia, ramp/steady profile, load, tie-down, cooling and warm-up |
| processing | sampling, filtering, smoothing, loss correction, run exclusion and uncertainty method |
| state | fuel/charge/thermal/health state, consumables, payload and operator mode |
| traceability | instrument calibration chain, raw data digest, procedure/version, personnel and review |
A PerformanceComparison record reports DIRECTLY_COMPARABLE, TRANSFORMED_COMPARABLE, CONTEXT_ONLY or NOT_COMPARABLE, names every transformation and exposes the uncertainty/margin. A chart renderer may not place unlike power locations on one unlabeled axis.
#36.6 Numerical implementation requirements
- Canonical parsing and money use exact decimal/integer arithmetic. Binary floating point is allowed inside declared numerical algorithms but never silently written back as an exact source value.
- Every algorithm declares working precision, rounding mode, overflow/underflow behavior, missing/invalid sample handling and deterministic reduction order where golden equality is required.
- Do not use NaN payloads as domain state. Validity, saturation, sensor failure and not-observed conditions use explicit quality bits and knowledge states.
- Comparisons near a boundary declare tolerance and uncertainty behavior. A generic epsilon is forbidden across quantity kinds and scales.
- Golden vectors include signed zero rejection, subnormal inputs, counter wrap, quaternion antipodes, transform composition, unit offsets, correlated uncertainty and extreme but schema-valid magnitudes.