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_dtat 50 ns sample period.tae_v1:temperature_eV,density_m3,axial_field_T,phase_lock_error_radat 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
¶
RawDaqFrame(mode, profile, sequence, t_ns, values)
dataclass
¶
Byte-stable DAQ frame carrying one ordered diagnostic value vector.
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:
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.