Skip to main content

DsfbRfEngine

Struct DsfbRfEngine 

Source
pub struct DsfbRfEngine<const W: usize, const K: usize, const M: usize> { /* private fields */ }
Expand description

Main DSFB Structural Semiotics Engine.

A zero-allocation, deterministic observer that combines envelope admissibility, sign-segment grammar, DSA scoring, Lyapunov exponent estimation, heuristics, and policy evaluation into a single state machine operating on IQ residuals.

§Type Parameters

  • W — sliding window length for sign-segment and DSA statistics.
  • K — grammar state-machine size (number of grammar states).
  • M — heuristics bank capacity.

§Non-Intrusion Contract

The engine is a read-only observer. It never modifies, delays, or discards samples from the underlying signal chain. See NON_INTRUSIVE_CONTRACT.

§Example

use dsfb_rf::engine::DsfbRfEngine;
use dsfb_rf::platform::PlatformContext;
let mut eng = DsfbRfEngine::<10, 4, 8>::new(0.05, 3.0);
let ctx = PlatformContext::operational();
let _obs = eng.observe(0.1, ctx);

Implementations§

Source§

impl<const W: usize, const K: usize, const M: usize> DsfbRfEngine<W, K, M>

Source

pub fn new(rho: f32, tau: f32) -> Self

Construct engine with given envelope radius ρ and DSA threshold τ.

Source

pub fn from_calibration(healthy_norms: &[f32], tau: f32) -> Option<Self>

Construct from a healthy-window norm slice (Stage III calibration).

Computes ρ = μ + 3σ from healthy_norms. Returns None if slice is empty.

Source

pub fn with_snr_floor(self, db: f32) -> Self

Set a custom SNR floor (default: −10 dB).

Source

pub fn with_decimation(self, factor: u32) -> Self

Set the semiotic decimation factor (default: 1 — no decimation).

With factor = D, the full semiotic pipeline runs once per D input samples. The input window accumulates the RMS of D norms before forwarding to the sign → grammar → syntax → semantics → DSA → policy chain.

§When to use

At high sample rates (≥ 1 MS/s) where structural changes of interest (thermal drift, PA aging, mask approach) occur at kHz or Hz rates. Decimation effectively sets the structural monitoring bandwidth to sample_rate / D Hz, which is appropriate for the physics timescale.

§Non-intrusion guarantee is preserved

The accumulator is entirely internal. observe_decimated() still takes only &[f32] immutable slices from the caller. factor=1 (default) means observe_decimated() === observe() with zero overhead.

§Example
use dsfb_rf::engine::DsfbRfEngine;
// 1 GSPS receiver; monitor at 100 kHz structural rate
let eng = DsfbRfEngine::<10, 4, 8>::new(0.1, 2.0)
    .with_decimation(10_000);
assert_eq!(eng.decimation_factor(), 10_000);
Source

pub fn decimation_factor(&self) -> u32

Current decimation factor.

Source

pub fn observe( &mut self, residual_norm: f32, ctx: PlatformContext, ) -> ObservationResult

Process one residual norm observation.

The full pipeline stages run in order. Returns an ObservationResult containing the complete audit chain for this observation.

§Non-Intrusion

residual_norm and ctx are consumed by value or immutable reference. No caller-owned data is mutated. The engine advances only its own internal state.

Source

pub fn observe_decimated( &mut self, residual_norm: f32, ctx: PlatformContext, ) -> Option<ObservationResult>

Process one residual norm through the decimation accumulator, then (only when a full epoch completes) through the full semiotic pipeline.

Returns None for all intermediate samples within an epoch. Returns Some(ObservationResult) once per decimation_factor() calls.

With decimation_factor() == 1 (the default), this is identical to observe() and returns Some on every call.

§Motivation (paper §XIX-A — Semiotic Decimation)

DSFB monitors the envelope of the physics, not the cycle of the carrier. Structural state changes (thermal drift, oscillator aging, mask approach) occur at kHz/Hz rates. Running the full Fisher-Rao, Lyapunov, and grammar machinery at 1 GSPS is unnecessary and violates the sensor physics. Decimation resolves the “Computational Wall” criticism without sacrificing structural detection sensitivity.

§Non-intrusion guarantee preserved

The norm argument is consumed by value; ctx is passed by value. No caller-owned data is mutated.

§Example
use dsfb_rf::engine::DsfbRfEngine;
use dsfb_rf::platform::PlatformContext;
let mut eng = DsfbRfEngine::<10, 4, 8>::new(0.05, 2.0)
    .with_decimation(100);
let ctx = PlatformContext::with_snr(20.0);
for i in 0..99 {
    assert!(eng.observe_decimated(0.02, ctx).is_none());
}
let result = eng.observe_decimated(0.02, ctx);
assert!(result.is_some()); // 100th sample triggers epoch
Source

pub fn obs_count(&self) -> u64

Current observation count.

Source

pub fn episode_count(&self) -> u32

Current escalation-episode count.

Source

pub fn rho(&self) -> f32

Current envelope radius ρ.

Source

pub fn grammar_state(&self) -> GrammarState

Current grammar state.

Source

pub fn contract(&self) -> NonIntrusiveContract

Return the typed non-intrusion contract for this observer.

Use this in operator advisories, SigMF dsfb:contract annotations, and VITA 49.2 context packets to formally assert the integration guarantees provided by this implementation.

§Example
use dsfb_rf::engine::DsfbRfEngine;
let eng = DsfbRfEngine::<10, 4, 8>::new(0.1, 2.0);
let c = eng.contract();
assert_eq!(c.integration_mode, "read_only_side_channel");
assert_eq!(c.unsafe_count, 0);
Source

pub fn reset(&mut self)

Reset all internal state.

Auto Trait Implementations§

§

impl<const W: usize, const K: usize, const M: usize> Freeze for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> RefUnwindSafe for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> Send for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> Sync for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> Unpin for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> UnsafeUnpin for DsfbRfEngine<W, K, M>

§

impl<const W: usize, const K: usize, const M: usize> UnwindSafe for DsfbRfEngine<W, K, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.