Add RFG UDP source to rph_radar

This commit is contained in:
Ayzen
2026-10-06 19:36:00 +03:00
parent a185e61495
commit cfe81f782b
29 changed files with 817 additions and 279 deletions
+30 -22
View File
@@ -89,8 +89,12 @@ class RphRadarBandModel:
@dataclass(slots=True)
class RphRadarModel:
"""External RadioPhotonic radar (RPH) acquisition process settings."""
"""RadioPhotonic radar (RPH) acquisition: E-502 collector process or RFG board UDP stream."""
# "e502": the C++ collector streams over tty_path (project_dir..stop_timeout_s are its
# settings); "rfg_udp": the RFG ADC board sends averaged sweep points to udp_bind.
source: str = "e502"
udp_bind: str = "0.0.0.0:5000"
project_dir: str = ""
executable_path: str = ""
tty_path: str = ""
@@ -107,12 +111,12 @@ class RphRadarModel:
@dataclass(slots=True)
class LaserManualModeModel:
"""Manual laser-control setpoints."""
"""Manual laser-control setpoints (defaults: the lab GUI, RadioPhotonic_PCB_PC_software)."""
temp1: float = 25.0
temp2: float = 25.0
current1: float = 30.0
current2: float = 30.0
temp1: float = 24.0
temp2: float = 24.9
current1: float = 97.3
current2: float = 102.0
@dataclass(slots=True)
@@ -120,15 +124,15 @@ class LaserVariationModeModel:
"""Laser-control variation task parameters."""
variation_type: str = "CHANGE_CURRENT_LD1"
static_temp1: float = 25.0
static_temp2: float = 25.0
static_current1: float = 30.0
static_current2: float = 30.0
min_value: float = 30.0
max_value: float = 35.0
step: float = 0.1
time_step: int = 20
delay_time: int = 3
static_temp1: float = 24.0
static_temp2: float = 24.9
static_current1: float = 97.3
static_current2: float = 102.0
min_value: float = 97.3
max_value: float = 107.0
step: float = 0.05
time_step: int = 50
delay_time: int = 10
@dataclass(slots=True)
@@ -138,10 +142,10 @@ class LaserControlModel:
enabled: bool = False
port: str = ""
mode: str = "manual"
pi_coeff1_p: int = 2560
pi_coeff1_i: int = 128
pi_coeff2_p: int = 2560
pi_coeff2_i: int = 128
pi_coeff1_p: int = 1280
pi_coeff1_i: int = 25
pi_coeff2_p: int = 1280
pi_coeff2_i: int = 179
manual: LaserManualModeModel = field(default_factory=LaserManualModeModel)
variation: LaserVariationModeModel = field(default_factory=LaserVariationModeModel)
@@ -410,10 +414,14 @@ class RunConfigModel:
laser = radar.laser_control
mode = laser.mode.strip().lower()
optical = asdict(laser.variation if mode == "variation" else laser.manual)
physical = (asdict(radar.rph_radar.band), asdict(radar.rph_radar.phase_calibration),
radar.rph_radar.args, (self.input_switch.positions, self.output_switch.positions),
rph = radar.rph_radar
# The RFG source always runs the profile's sweep (its length and step timing), even when
# the laser is started elsewhere; E-502 keys stay as they were before the source field.
rfg = rph.source == "rfg_udp"
physical = (asdict(rph.band), asdict(rph.phase_calibration), rph.source if rfg else rph.args,
(self.input_switch.positions, self.output_switch.positions),
(mode, optical, laser.pi_coeff1_p, laser.pi_coeff1_i,
laser.pi_coeff2_p, laser.pi_coeff2_i) if laser.enabled else None)
laser.pi_coeff2_p, laser.pi_coeff2_i) if laser.enabled or rfg else None)
digest = hashlib.sha256(json.dumps(physical, sort_keys=True).encode()).hexdigest()[:16]
return f"{radar.model}_{digest}"
serials = [radar.serial or "no_serial"]