Lab042: transmit an image over the air, add the air loopback mode
First transmission through a real radio path in the project. A 4756-byte JPEG went from transmitter to receiver over two antennas 60 cm apart at 225 MHz and reassembled byte-identical, reproduced across three runs. The cable loopback still needs an SMA male-to-male adapter that has not arrived, so this air run is a track verification, not the controlled measurement: room levels are not held the way a cable holds them. Its purpose was to exercise the device wrapper the models cannot cover. Four defects the software model passed but the hardware exposed, each reproduced and fixed: - a 566 528-sample frame did not fit the 262 144 receive buffer, and the sample stream is not continuous across separate reads, so a frame on the seam was destroyed. Reception now uses one buffer sized to the frame - carrier correction was always applied, but with a shared reference the true offset is near zero and the 80-symbol marker estimate is noise; correcting by it rotated phase along the whole frame, 65% bit errors measured. Ported should_apply_cfo_correction from Lab023 - receiver gain of 20 dB left the signal at 0.0003 of full scale. Levels set by measurement: RX 50 dB, TX -10 dB give zero bit errors with margin - the error-vector metric returned zero on a failed receive, reporting a perfect signal where there was none, the same class of defect as the written-in figures of Lab041. Replaced with an explicit not-computed value The air TX gain ceiling is now derived from the link budget by antenna distance rather than a constant. Three loopback modes: software, cable, air. PROJECT_LOG entry 019 records the run and the defects. Software and cable results stay reproducible; 125 tests pass, gate passes.
This commit is contained in:
@@ -31,6 +31,13 @@ SYMBOL_RATE = 20_000
|
||||
CFO_REFINEMENT_HALF_WIDTH_HZ = 200.0
|
||||
CFO_REFINEMENT_STEP_HZ = 1.0
|
||||
|
||||
# Пороги разрешения частотной коррекции. Значения из Lab023. Смысл в том,
|
||||
# что при малом истинном уходе оценка по короткому маркеру состоит почти
|
||||
# целиком из шума, и коррекция таким значением портит длинный кадр сильнее,
|
||||
# чем отсутствие коррекции вообще.
|
||||
CFO_DEAD_ZONE_HZ = 15.0
|
||||
MINIMUM_PHASE_CONSISTENCY = 0.55
|
||||
|
||||
MAXIMUM_PROTOCOL_PACKET_BYTES = 4096
|
||||
|
||||
# Перенесено дословно из Lab023 (tests/lab023_guarded_cfo_correction.py).
|
||||
@@ -800,3 +807,35 @@ def radio_frame_bit_count(protocol_packet_bytes: int) -> int:
|
||||
+ RADIO_HEADER_BIT_COUNT
|
||||
+ protocol_packet_bytes * 8
|
||||
)
|
||||
|
||||
|
||||
# Перенесено дословно из Lab023 (experiments/lab023_guarded_cfo_correction.py).
|
||||
def should_apply_cfo_correction(
|
||||
estimated_frequency_hz: float,
|
||||
phase_consistency: float,
|
||||
coherence_gain: float,
|
||||
) -> bool:
|
||||
"""
|
||||
Разрешить CFO-коррекцию только при наличии
|
||||
достаточных оснований.
|
||||
|
||||
Требования:
|
||||
|
||||
1. Оценка находится вне мёртвой зоны.
|
||||
2. Межсимвольное вращение достаточно согласованно.
|
||||
3. Компенсация CFO действительно повышает
|
||||
когерентность известного маркера.
|
||||
"""
|
||||
|
||||
MINIMUM_COHERENCE_GAIN = 0.02
|
||||
|
||||
return (
|
||||
abs(
|
||||
estimated_frequency_hz
|
||||
)
|
||||
>= CFO_DEAD_ZONE_HZ
|
||||
and phase_consistency
|
||||
>= MINIMUM_PHASE_CONSISTENCY
|
||||
and coherence_gain
|
||||
>= MINIMUM_COHERENCE_GAIN
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user