Skip to content

DAQ Bus Mock

MIF-018 provides a deterministic ingestion contract for reactor-style DAQ delivery semantics before hardware onboarding. It supports UDP multicast-style delivery and PCIe DMA ring replay using the same byte-stable frame format.

Frame Contract

Each frame starts with the fixed magic MIFDAQ1\0, version 1, delivery mode, descriptor profile, sequence number, timestamp in nanoseconds, value count, zero-valued reserved header bits, payload length, and FNV-1a payload checksum. Payload values are finite little-endian float64 values in descriptor channel order.

Replay is fail-closed: injected frames must have strictly increasing sequence numbers and monotone timestamps. Equal timestamps are allowed to represent same-sample bursts, but timestamp regression and sequence replay are rejected before the mock mutates its FIFO/ring state.

Two descriptor profiles are included:

  • helion_v1: temperature_eV, density_m3, bdot_V, bdot_dv_dt at 50 ns sample period.
  • tae_v1: temperature_eV, density_m3, axial_field_T, phase_lock_error_rad at 100 ns sample period.

Python API

bus_mock

Standardised DAQ bus mock for UDP multicast and PCIe DMA replay (MIF-018).

DescriptorProfile(profile_id, sample_period_ns, channels, units, aer_addresses) dataclass

Config-driven descriptor for a vendor-style diagnostic frame.

profile_code property

Return the stable on-wire profile code.

__post_init__()

Validate the descriptor profile identifier, channel count, and addresses.

RawDaqFrame(mode, profile, sequence, t_ns, values) dataclass

Byte-stable DAQ frame carrying one ordered diagnostic value vector.

__post_init__()

Validate the raw DAQ frame metadata and finite payload values.

to_bytes()

Encode the frame into the stable MIF-018 little-endian wire format.

to_diagnostic_frame()

Return the decoded diagnostic sample in descriptor channel order.

ReplayConfig(mode, profile, ring_capacity=1024, min_replay_throughput_fps=10000.0) dataclass

Configuration for a DAQ replay bus mock.

__post_init__()

Validate replay mode, ring capacity, and throughput threshold.

ReplayThroughputReport(frame_count, first_t_ns, last_t_ns, replay_duration_s, throughput_fps, meets_baseline) dataclass

Deterministic timestamp-semantics throughput report.

DataBusMock(config)

Deterministic in-memory DAQ bus mock for UDP multicast and PCIe DMA modes.

dropped_frames property

Return the number of frames overwritten by the PCIe-style ring.

bound_endpoint property

Return the validated mock endpoint, if one has been bound.

__len__()

Return the number of frames currently held in the replay ring.

bind(bind_addr)

Validate and record the mock endpoint without opening real sockets.

inject_frame(frame)

Inject one frame into the selected delivery mock.

emit_frame()

Emit the next frame in deterministic FIFO order.

emit_diagnostic_sample()

Emit the next frame as a diagnostic sample.

replay_throughput_report(frames)

Return deterministic throughput from frame timestamps.

helion_descriptor_profile()

Return the Helion-style MIF-018 descriptor profile.

tae_descriptor_profile()

Return the TAE-style MIF-018 descriptor profile.

encode_daq_frame(frame)

Encode a raw DAQ frame into the stable little-endian byte contract.

decode_daq_frame(blob, profile=None)

Decode and validate a DAQ frame from the stable byte contract.

Dispatch

Use scpn_mif_core.daq.dispatched_data_bus_mock(...) for the fastest measured runtime backend:

"daq.udp_multicast_mock" = ["rust", "python", "go"]
"daq.pcie_dma_ring_mock" = ["rust", "python"]

The Go surface is the optional network-service scaffold for UDP-style replay. The PCIe DMA ring mock is allocated to Python and Rust.

Validation

The committed tests verify:

  • exact byte fixture and round-trip decode for the Helion UDP profile;
  • Helion and TAE descriptor profiles;
  • UDP multicast endpoint validation;
  • PCIe ring overwrite and drop accounting;
  • monotone timestamp replay throughput semantics and strictly increasing packet sequence order;
  • corrupt payload and mode/profile mismatch rejection;
  • reserved-header rejection;
  • Python/Rust parity for both profiles and delivery modes;
  • Go encode/decode parity through go test ./go/....

Benchmarks

The benchmark harness ships at bench/kernels/bench_daq_bus_mock.py. It measures UDP frame round-trip across Python, Rust, and Go, plus PCIe ring replay across Python and Rust. The committed results are local comparison evidence, not CPU-isolated production latency evidence; host load, governor, and runtime versions are recorded in the MIF-018 benchmark JSON files.