+103
−29
+12
−22
+28
−14
Loading
When target power falls outside the feasible range at a given head,
the HPF interpolation now clamps to the nearest feasible boundary
(min or max) rather than returning NaN. This maintains roundtrip
consistency between P→Q and Q→P functions.
Changes:
- src/helpers.rs: Implement symmetric clamping for infeasible power,
use linear scan for P index lookup (binary search unreliable with
approx_eq), remove duplicate actual_power calculation in lib.rs
- tests/test_hpf.py: Update tolerances for flat regions (~2 MW corner,
~1.5 MW edge), filter clamping cases from roundtrip tests, increase
performance thresholds for linear scan algorithm
Fixes NaN values in target_release for Cumberland example simulation.
Co-Authored-By:
Claude Opus 4.5 <noreply@anthropic.com>