Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions INVESTIGATION_SUMMARY_2025-11-14.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Signal Power Investigation Summary - 2025-11-14

## What Was Done

Following NEXT_STEPS.md Priority 1 (Week 2), investigated signal power issues causing 30-60 dB errors in daytime E-layer modes.

## Key Findings

### ✅ Achievements

1. **Established Baseline**: 72.2% validation pass rate (156/216 tests passing)
2. **Identified Root Cause**: Above-MUF operation causes excessive xls penalty (87+ dB)
3. **Verified Nighttime Predictions**: Working well with ~7 dB deviation (acceptable)
4. **Documented Signal Chain**: Full analysis of absorption, deviation, and xls calculations

### ⚠️ Core Issue: Above-MUF Operation

**Problem**: When operating frequency exceeds MUF (e.g., 25.90 MHz vs 19.1 MHz MUF):
- Python applies large xls penalty: 87 dB
- Results in SNR = -5.2 dB
- VOACAP expects SNR = 42.0 dB
- **Error: 47.2 dB**

**Investigation**:
- Attempted fix: Remove secant multiplication from xls → **Made it worse** (67.6% pass rate)
- Conclusion: Formula is **correct as coded**, but may not match VOACAP's actual algorithm

**Root Cause**: One of the following:
1. VOACAP uses different MUF probability calculation
2. VOACAP clamps xls penalty to maximum value
3. VOACAP considers additional propagation modes we don't
4. calc_muf_prob function doesn't match VOACAP's SIGDIS.FOR algorithm

## Validation Results

| Condition | Pass Rate | Notes |
|-----------|-----------|-------|
| Baseline (all tests) | 72.2% | 156/216 passing |
| Nighttime F-layer | ~90% | Within 7 dB typically |
| Daytime below MUF | ~85% | Working reasonably |
| Daytime above MUF | ~20% | 30-60 dB errors |
| After attempted fix | 67.6% | Overcorrected |

## Files Created

1. `SIGNAL_POWER_INVESTIGATION.md` - Detailed technical analysis
2. `debug_signal_power.py` - Debug script with detailed loss breakdowns
3. `baseline_validation.log` - Initial validation run results
4. `INVESTIGATION_SUMMARY_2025-11-14.md` - This file

## Next Steps to Reach >80% Pass Rate

### High Priority
1. **Investigate calc_muf_prob function**
- Compare implementation with FORTRAN SIGDIS.FOR
- Verify normal distribution calculation
- Check standard deviation usage

2. **Test xls penalty clamping**
- Try: `xls = min(xls, 50.0)` to limit maximum penalty
- May match VOACAP's practical limits

3. **Verify MUF calculation at control points**
- Ensure using correct control point for circuit MUF
- Check if oblique MUF calculation is correct

### Medium Priority
4. **Expand test suite** (per NEXT_STEPS.md Priority 2)
- Add short paths (<1000 km): Philadelphia → Boston
- Add long paths (>10000 km): Philadelphia → Tokyo
- Test more frequencies and solar conditions
- Generate 10+ diverse reference cases

5. **Check for other low-hanging fruit**
- Review deviation term calculation edge cases
- Verify XNSQ calculation for boundary conditions
- Check ground reflection loss calculation

### Low Priority (Requires External Resources)
6. **Access FORTRAN source code**
- Need REGMOD.FOR to verify signal calculation
- Need SIGDIS.FOR to verify MUF probability
- Line-by-line comparison with Python code

7. **Consult VOACAP community**
- Contact original VOACAP developers
- Check VOACAP mailing lists/forums
- Look for documentation on xls penalty limits

## Recommendations

### For Immediate Use
- **Current 72.2% pass rate is operational and usable**
- Nighttime predictions are reliable
- Use with caution for daytime high-frequency predictions
- Be aware of ~20-30% reliability underestimation

### For Development
- Focus on calc_muf_prob investigation and xls clamping (most likely fixes)
- Expand test suite to identify more patterns
- Consider gradual improvements: 72% → 75% → 80% vs. aiming for 80% immediately

## Conclusion

The DVOACAP-Python engine is **fundamentally sound** with 72% validation. The remaining issues are concentrated in daytime/above-MUF scenarios where the xls penalty calculation appears mathematically correct but produces different results than VOACAP.

Reaching >80% pass rate will require either:
1. Finding and fixing a subtle bug in calc_muf_prob or related functions
2. Adding penalty clamping to match VOACAP's practical limits
3. Accessing FORTRAN source for direct algorithm comparison

**Status**: Ready for Week 3-4 work (systematic validation and test expansion)
175 changes: 175 additions & 0 deletions SIGNAL_POWER_INVESTIGATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Signal Power Investigation - 2025-11-14

## Summary

Investigated signal power calculation issues causing 30-60 dB errors in daytime E-layer modes. Identified the xls penalty calculation as a key factor, but found that the formula is correct as coded. The issue is that VOACAP handles above-MUF operation differently than our implementation.

## Current Status

- **Baseline pass rate**: 72.2% (156/216 test cases)
- **Nighttime predictions**: Working well (~7 dB deviation, acceptable)
- **Daytime high-frequency predictions**: Failing with 30-60 dB SNR errors
- **Target**: >80% pass rate

## Investigation Results

### 1. XLS Penalty Calculation (Lines 764-769)

**What it does**: Calculates additional loss when operating near or above the MUF.

**Formula**:
```python
sec = 1.0 / cos_of_incidence(elevation, true_height)
xmuf = vert_freq * sec # Oblique MUF for this mode
xls_prob = calc_muf_prob(frequency, xmuf, circuit_muf, sig_lo, sig_hi)
xls = -10 * log10(xls_prob) * sec # Convert to dB and apply secant
total_loss += hop_count * xls
```

**Example** (UTC 06, 25.90 MHz, F2 mode):
- Operating frequency: 25.90 MHz
- Mode oblique MUF: 19.06 MHz (below operating freq!)
- Circuit MUF: 19.1 MHz
- MUF probability: 0.000708 (very low - we're above MUF)
- xls penalty: **87.29 dB**
- Result: SNR = -5.2 dB (VOACAP expects 42.0 dB)
- **Error: 47.2 dB**

### 2. Attempted Fix: Remove Secant Multiplication

Hypothesis: The secant is applied twice (once in xmuf, once in xls calculation).

```python
# Attempted change:
xls = -10 * log10(xls_prob) # Remove * sec
```

**Result**: Pass rate **decreased** from 72.2% to 67.6% ❌

**Analysis**: Removing the secant overcorrected:
- Before: SNR too low (e.g., -5.2 dB vs 42.0 dB expected)
- After: SNR too high (e.g., 65.6 dB vs 29.0 dB expected)

**Conclusion**: The secant multiplication is **correct** as coded.

### 3. Why VOACAP Differs

VOACAP gets 42.0 dB SNR at UTC 06, 25.90 MHz with 1F2 mode (same mode we select).

Possible explanations:
1. **Different MUF calculation**: VOACAP may calculate MUF differently
2. **Different xls formula**: VOACAP may use a different penalty formula
3. **Additional propagation modes**: VOACAP may consider sporadic E or other modes
4. **Clamping/limits**: VOACAP may cap the xls penalty at a maximum value
5. **Different probability function**: calc_muf_prob may not match VOACAP's algorithm

### 4. Other Loss Components

**Absorption Loss** (already fixed in previous PR):
- Coefficient: 677.2 * absorption_index ✓
- Working correctly for most cases

**Deviation Term**:
- Formula appears correct
- Shows small values (~1-2 dB) for most modes
- Not a major contributor to the 30-60 dB errors

**XNSQ Calculation**:
- Uses 10.2 for F-layer and high E-layer reflections
- Uses height-dependent formula for low E-layer
- Appears correct based on FORTRAN reference

## Test Case Examples

### Working Case: UTC 01, 7.20 MHz (Nighttime F-layer)
- Mode: 1F2
- Operating freq: 7.20 MHz
- Circuit MUF: 16.25 MHz (well above operating freq)
- xls penalty: 0.00 dB ✓
- **DVOACAP SNR**: 72.29 dB
- **VOACAP SNR**: 79.0 dB
- **Error**: 7 dB ✓ (acceptable)

### Failing Case: UTC 06, 25.90 MHz (Daytime, above MUF)
- Mode: 1F2
- Operating freq: 25.90 MHz
- Circuit MUF: 19.1 MHz (below operating freq!)
- xls penalty: 87.29 dB ❌
- **DVOACAP SNR**: -5.2 dB
- **VOACAP SNR**: 42.0 dB
- **Error**: 47.2 dB ❌

### Pattern

| Condition | xls Penalty | Result |
|-----------|-------------|--------|
| Freq << MUF | ~0 dB | ✓ Works |
| Freq ≈ MUF | ~10-30 dB | ⚠️ Marginal |
| Freq >> MUF | ~50-300 dB | ❌ Fails |

## Recommendations

### Short Term (to reach >80% pass rate)

1. **Investigate calc_muf_prob function**
- Compare with FORTRAN SIGDIS.FOR
- Check if probability calculation matches VOACAP
- May need adjustment to standard deviations

2. **Add xls penalty clamping**
- VOACAP may limit xls to a maximum value (e.g., 50 dB)
- Test with: `xls = min(xls, 50.0)`

3. **Check MUF calculation at control points**
- Verify that circuit MUF is correctly calculated
- May be using wrong control point for MUF

4. **Expand test suite** (per NEXT_STEPS.md)
- Add more diverse paths (short, medium, long)
- Test different times of day and solar conditions
- Identify patterns in failures

### Long Term

1. **Access FORTRAN source code**
- Get REGMOD.FOR to verify xls calculation
- Get SIGDIS.FOR to verify MUF probability calculation
- Line-by-line comparison

2. **Consider alternative approaches**
- Use VOACAP DLL directly for validation
- Consult with VOACAP developers/community

## Files Modified

None (investigation only, reverted attempted fix)

## Related Documents

- `NEXT_STEPS.md` - Overall project plan
- `RELIABILITY_INVESTIGATION.md` - Previous reliability investigation
- `ABSORPTION_BUG_ANALYSIS.md` - Absorption coefficient fix

## Debug Commands

```bash
# Run reference validation
python test_voacap_reference.py

# Debug specific case
python debug_signal_power.py

# Enable detailed logging (edit prediction_engine.py)
# Line 736: debug_loss = True
# Line 847: debug = True
```

## Conclusion

The 72.2% pass rate indicates the engine is fundamentally working, but there's a systematic issue with daytime/above-MUF predictions. The xls penalty calculation is mathematically correct as coded, but may not match VOACAP's actual algorithm. Further investigation requires:

1. Access to FORTRAN source code for verification
2. More detailed understanding of VOACAP's MUF probability calculation
3. Possible adjustment to penalty clamping or probability calculation

The engine is **operational and usable** at 72% pass rate. Reaching >80% will require deeper investigation into VOACAP's specific algorithms.
Loading