Below is a **precise, implementation‑ready plan** tailored to your current Shenron architecture. This plan assumes **both Azimuth and Elevation LUTs already exist** and focuses on *minimal, safe, radar‑local integration*. *** # Implementation Plan: Azimuth & Elevation Radiation Gain Integration ## Goal Introduce **radar‑specific azimuth and elevation antenna gains** into Shenron such that: * Each radar applies its own antenna pattern * No shared energy values are contaminated * Existing energy models and ADC pipelines remain intact * Integration aligns with current physics and code structure *** ## 1. Data Model Extensions (ConfigureRadar.py) ### 1.1 Add Antenna LUT Fields to Radar Configuration Extend the radar configuration object to carry antenna patterns. **New Radar Attributes** * `radar.azimuth_lut` * `radar.elevation_lut` * `radar.azimuth_lut_angles` (degrees or radians) * `radar.elevation_lut_angles` * `radar.antenna_gain_mode` (e.g., `"separable"`) These must be **radar‑instance local**, not global. *** ### 1.2 LUT Normalization Convention (Decide Once) Choose and enforce one convention: * **Linear gain** (recommended, to match existing loss math) * LUT values ∈ ℝ⁺ * OR * **dB gain**, converted to linear on load ✅ Best practice: Convert LUTs to **linear gain at load time** and store only linear values. *** ## 2. Angle Availability Contract ### 2.1 Confirm Angle Variables From your architecture: * Azimuth (`theta`) * Elevation (`elev_angle`) are already computed in `specularpoints()`. **Action** * Ensure both angles are: * In a known unit (prefer radians internally) * Passed directly to `get_loss_3()` with no recomputation No structural changes needed here. *** ## 3. Loss Chain Integration Point (Sceneset.py) ### 3.1 Insert Antenna Gain in get\_loss\_3() Modify `get_loss_3()` to include antenna LUT gain. **Exact placement** * After range loss * Before material / roughness losses * Adjacent to existing vertical antenna gain logic This preserves physical correctness: > Antenna attenuates the incident and received wave, not the material physics. *** ### 3.2 Compute Antenna Gain Per Point For each point $$i$$: 1. Clamp / wrap angles to LUT domain * Azimuth: e.g. $$[-90°, +90°]$$ * Elevation: e.g. $$[-45°, +45°]$$ 2. Lookup gains: * `G_az[i] = interp(radar.az_lut, theta[i])` * `G_el[i] = interp(radar.el_lut, elev_angle[i])` 3. Combine gains (separable model): $$ G_{ant}[i] = G_{az}[i] \times G_{el}[i] $$ 4. Apply: $$ loss[i] \leftarrow loss[i] \times G_{ant}[i] $$ ✅ Fully vectorized NumPy operation. *** ## 4. Multi‑Radar Safety Guarantees No special handling required **if the following rules are followed**: * Never modify shared `semantic_lidar_data` * Antenna gain applied only to: * Local loss arrays inside `get_loss_3()` * No mutation of radar‑agnostic structures Your architecture already satisfies these conditions. *** ## 5. Configuration Loading & Switching ### 5.1 Attach LUTs per Radar Profile In `ConfigureRadar.py`: * Load LUTs as part of radar initialization * Support per‑profile antenna selection: * `"awrl1432_front"` * `"awrl1432_corner"` * `"generic_patch"` ### 5.2 Runtime Safety Since each `ShenronRadarModel` owns its radar instance: * Switching patterns between radars is safe * No cross‑profile contamination possible *** ## 6. ADC Pipeline Interaction (No Changes Required) Because: * Antenna gain is applied **before ADC synthesis** * Noise is added later in `heatmap_gen_fast.py` You automatically get: * Angle‑dependent SNR * Realistic CFAR behavior * Hardware‑like edge‑of‑FOV noise dominance ✅ Do **not** touch ADC or noise code. *** ## 7. Validation Hooks (Strongly Recommended) ### 7.1 Internal Diagnostics Add (optional but useful): * Store `G_az`, `G_el`, `G_ant` in `last_metrology` * Log min / max / mean gain per frame ### 7.2 Visual Validation Confirm: * Point density decreases smoothly at FOV edges * Peak intensity aligns at boresight * Multiple radars show different angular falloff in the same scene *** ## 8. Performance Impact * Operations: O(N) per radar, vectorized * N ≈ 5k–15k points * LUT interpolation cost negligible ✅ Safe for real‑time simulation with multiple radars. *** ## 9. Extension‑Ready Design This structure naturally supports later: * 2D az‑el LUTs * Per‑virtual‑antenna offsets * Beamforming‑aware gain shaping No redesign required. *** ## ✅ Final Summary | Aspect | Status | | ----------------------- | ------ | | Radar‑specific | ✅ Yes | | Multi‑radar safe | ✅ Yes | | Minimal code changes | ✅ Yes | | Physically correct | ✅ Yes | | ADC‑correct integration | ✅ Yes | **This plan integrates azimuth & elevation radiation patterns into Shenron cleanly, deterministically, and without architectural risk.** If you want, next I can: * Write **exact pseudocode for get\_loss\_3()** * Define **LUT file formats** * Suggest **default az/el cutoffs for AWRL1432** * Design a **radar antenna profile schema** Just say what’s next.