Skip to content

OldCrow/ewcalc

Repository files navigation

ewcalc — EW Engineering Calculator

A multi-platform electronic warfare engineering calculator covering antenna analysis, RF propagation, link budgets, receiver performance, jamming analysis, emitter location, radar, and spread-spectrum communications — based on the EW101 series by David Adamy.

Architecture

Three layers with clean separation:

  • libew — pure C++20 calculation library, no UI, no external dependencies
  • ewpresenter — platform-agnostic presenter/viewmodel layer
  • frontend/ — platform-native UIs: WinUI 3 (Windows), SwiftUI (macOS), Qt6 (Linux)

libew modules

Module Content
core Strong-type units (Dbm, Db, Km, Mhz, Kelvin, …), constants
propagation FSPL, 2-ray ground reflection, Fresnel zone, knife-edge diffraction, earth bulge, radar horizon range
antenna ERP, gain conversions, beamwidth
link One-way link budget, effective range
receiver Sensitivity, cascaded NF (Friis), SFDR, digital DR, noise temperature conversions
jamming J/S ratio, burnthrough range, partial-band optimization
location CEP from AOA bearing error, TDOA timing error, and EEP
radar Radar range equation, pulse compression, coherent integration gain, LPI advantage
digital Eb/N₀ ↔ SNR conversion (both directions), DSSS process gain, jamming margin, required J/S

ewpresenter

Eight presenters wrap the libew modules for use by any view layer:

Presenter Inputs Key outputs
PropagationPresenter distance, frequency, antenna heights, obstruction height FSPL, 2-ray loss, Fresnel zone, regime, earth bulge, radar horizon, knife-edge diffraction loss
AntennaPresenter gain, az/el beamwidth, Tx power, frequency ERP, beamwidth from gain, gain from beamwidth, wavelength
LinkPresenter Tx power/gain, Rx gain, geometry, sensitivity Received power, link margin, effective range
ReceiverPresenter Bandwidth, NF, SNR, stage chain, ADC bits Sensitivity, cascaded NF, system noise temp, SFDR, digital DR
JammingPresenter Signal/jammer ERP, geometry, frequency, J/S threshold J/S ratio, burnthrough range, partial-band optimum BW (N/A when hop range = 0)
LocationPresenter Bearing error, range, TDOA timing error, EEP semi-axes CEP (AOA, TDOA, and EEP methods)
RadarPresenter Tx power, gain, RCS, frequency, NF, TB product Max range, two-way loss, PC gain, coherent integration gain, LPI advantage
DigitalPresenter SNR, bandwidth, data rate, chip rate, required Eb/N₀, impl. loss Eb/N₀, SNR from Eb/N₀, DSSS process gain, jamming margin, required J/S

Each presenter validates inputs, calls libew, and fires a std::function callback with formatted output strings. No platform types are exposed.

A console harness (ewpresenter_harness) exercises all presenters against default inputs.

Building

Core libraries and tests

cmake -B build
cmake --build build --config Release
ctest --test-dir build -C Release --output-on-failure

To run the presenter harness:

build/bin/Release/ewpresenter_harness

Platform frontends

Platform build scripts are in scripts/. Each builds the native libs then the frontend, and accepts --config Debug|Release and (on Linux/macOS) --package to produce a distributable artifact.

Platform Script Package output
Windows scripts/build-windows.ps1 (MSIX, future)
macOS scripts/build-macos.sh signed + notarized .dmg
Linux scripts/build-linux.sh .AppImage

macOS packaging requires a Developer ID Application certificate in the keychain and xcrun notarytool credentials stored under the ewcalc-notarytool profile.

Current status

v0.8.0 — UX Parity & Accessibility milestone (7 issues, #15–#21): per-field validation errors are now surfaced on all 8 Windows pages and on macOS (previously Propagation-only on Windows, absent on macOS); macOS text fields clamp out-of-range typed input to their declared bounds; VoiceOver labels (macOS), AutomationProperties.Name (Windows), and setAccessibleName (Linux) added across every input and output control on all three platforms; macOS help-text tooltips ported to Windows (ToolTipService) and Linux (setToolTip); user inputs now persist across sessions on all three platforms (versioned, per-platform storage, with a "Reset to Defaults" action); each calculator page gains a "Copy results" clipboard button on all three platforms.

v0.7.0 — Correctness milestone (8 issues): partial_band_jamming() no longer caps jamming bandwidth at the signal bandwidth for J/S ≥ 0 dB — it now widens correctly per Adamy EW101 ch. 10; -0.0 values normalize to 0.0 in formatted output; stage NF input ranges on macOS/Linux now match the presenter's [0, 30] dB validation; ReceiverPresenter sensitivity uses the cascaded NF from the stage chain when one is defined; the Digital page's SNR-from-Eb/N₀ output is replaced with the SNR required to hit a target Eb/N₀; missing jamming RX-gain bridge getters added; Windows adapters no longer truncate input to 6 significant figures via RoundInput; new lpi_advantage and partial-band regression tests.

v0.6.6 — Architectural audit fixes: SFDR2 coefficient corrected to 1/2; presenter validators reject non-finite values; Receiver stage gain validation; public API invalid-input sentinels; full 2-ray burnthrough inversion; Dbsm - Dbsm -> Db; formatter dash sentinel consolidation; macOS receiver stage-state fix; Windows obstruction-height error binding and stage reindexing.

v0.6.5 — Complete FieldValidationError coverage across all 8 Windows C++/CLI adapters (Antenna, Digital, Jamming were 0/N; Location, Receiver, Propagation were partial); partial_band_jamming domain guard assert.

v0.6.4 — Bug fixes from follow-on review: finalizer use-after-free in all 8 C++/CLI adapters; ewp_receiver_stage()/ewp_receiver_set_stages() UB and null-pointer guards; copy_str production truncation sentinel; lpi_advantage_str missing DASH; chip_rate < data_rate DSSS guard; LocationPresenter EEP axis error field + independent sub-section validity; ReceiverPresenter system_nf now derives from cascaded NF; NaN stage NF fix; RadarAdapter FieldError properties; LinkOutput two-ray-regime booleans; CallbackBridge.h dead code removed.

v0.6.3 — Architecture review remediation: C++/CLI adapter lifetime safety (double-free, use-after-free, stale GCHandle access, constructor exception safety); presenter validation gaps closed (Jamming gains, Receiver stage NF, num_pulses/adc_bits error fields); C bridge per-field error accessors (EwpFieldError); bridge and formatter integration tests; PresenterBase<Derived> CRTP base eliminates setter boilerplate across all 8 presenters; cppcheck clean.

v0.6.2 — Bug fix: DigitalPresenter validity split (invalid DSSS inputs no longer suppress Eb/N₀); ewpresenter assertion test suite; harness registered in CI.

v0.6.0 — Antenna calculator added across all platforms; knife-edge diffraction and SNR↔Eb/N₀ wired up.

  • Phase 1 ✓ — libew: nine calculation modules, full test harness
  • Phase 2 ✓ — ewpresenter: eight presenters; all libew functions surfaced
  • Phase 3 ✓ — Windows frontend (WinUI 3 / C#) — Antenna page, diffraction input, extended outputs
  • Phase 4 ✓ — macOS frontend (SwiftUI) — Antenna page, diffraction input, extended outputs
  • Phase 5 ✓ — Linux frontend (Qt6 Widgets) — Antenna page, diffraction input, extended outputs

Release artifacts (.dmg, .AppImage) are attached to each GitHub Release.

About

Multi-platform EW engineering calculator — C++20, SwiftUI, WinUI3, Qt6

Topics

Resources

License

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors