# Shenron Antenna Gain & Compensation Logic ## 📡 Azimuth & Elevation Gain Integration The latest iteration implements a **separable antenna pattern model**. This ensures that targets detected at the edges of the radar's Field of View (FOV) are correctly attenuated, matching real-world hardware behavior. ### 1. Implementation Details (`Sceneset.py`) In `get_loss_3()`, the antenna gain $G_{ant}$ is calculated as the product of horizontal and vertical patterns: $$G_{ant}(\theta, \phi) = G_{az}(\theta) \times G_{el}(\phi)$$ - **Azimuth ($\theta$):** Uses a Look-Up Table (LUT) for symmetric gain interpolation. Points outside the precise LUT range are clamped to the nearest edge value. - **Elevation ($\phi$):** Implements a **Hard FOV Cutoff**. Points beyond the mechanical vertical beamwidth receive zero gain, accurately simulating physical sensor limitations. - **Physics Order:** Gain is applied to the incident power *after* the path loss but *before* the material interaction, ensuring that the antenna pattern does not affect target reflectivity. ### 2. High-Level System Gain (`gain = 110 dB`) In `ConfigureRadar.py`, the parameter `self.gain` is set to values like `10 ** (110 / 10)`. **Why 110 dB?** This is a **System-Level Calibration Constant** that encapsulates several physical and simulation factors: 1. **Transmit Power ($P_t$):** The actual chirping power emitted (typically ~10-15 dBm). 2. **Peak Antenna Gain ($G_t, G_r$):** The boresight gain of the TX and RX patches. 3. **Signal Chain Amplification:** Hardware-specific gains in the LNA and Mixer. 4. **Simulation Scaling:** In physics-based simulations, units computed for unit scatterers ($1/R^2$) result in extremely small floating-point values. The 110 dB factor "lifts" these signals into a dynamic range that maps correctly to real 16-bit or 32-bit ADC data formats. By tuning this single "dial," the simulation can be calibrated to match the peak Signal-to-Noise Ratio (SNR) seen in real-world hardware datasets. ## ⚙️ Calibration Flow - **Standard Baseline:** 110 dB (Calibrated for Iteration 16/18 physics). - **Match Hardware:** Adjust this dial ±5 dB if targets at 10m in simulation appear significantly stronger/weaker than in real sensor captures.