Add check for turning off transmission expnasion if limit reached#952
Conversation
|
Sounds familiar. We also came across this issue for the volume limit recently and fixed it very similarly in pypsa-eur/scripts/add_brownfield.py Lines 123 to 145 in 16e2286 I think this is the slightly better place to handle this since it only affects the myopic optimization. Maybe you can expand this function to also cover the cost limit case? It should just be adding a |
3ffcab3 to
61e4123
Compare
|
Right, somehow I missed that this already existed but just for the volume limit! I've just force-pushed a sort of combination; you can see if you like it. Probably the for loop over global constraints of a particular type is slightly unnecessary but I don't think it hurts just in case. I think when checking where two things are numerically "close" it's better to normalise first so that this works for models of different scales. |
…ibility When brownfield carries forward s_nom_opt from a previous horizon as s_nom_min, solver floating-point tolerance can make s_nom_min exceed s_nom_max by a tiny amount (e.g., 0.00013 MW on a 33,585 MW line). This creates an infeasible constraint that crashes the solver. Extends the fix from PRs PyPSA#840 and PyPSA#952 (which handle global transmission constraints) to also cover per-line s_nom_max and DC link p_nom_max.
…ibility (#2115) * fix: clamp s/p_nom_max in brownfield to prevent floating-point infeasibility When brownfield carries forward s_nom_opt from a previous horizon as s_nom_min, solver floating-point tolerance can make s_nom_min exceed s_nom_max by a tiny amount (e.g., 0.00013 MW on a 33,585 MW line). This creates an infeasible constraint that crashes the solver. Extends the fix from PRs #840 and #952 (which handle global transmission constraints) to also cover per-line s_nom_max and DC link p_nom_max. * fix: clip H2/gas retrofit remaining capacity to non-negative When barrier solutions without crossover produce slightly imprecise p_nom_opt values, the already-retrofitted H2 pipeline capacity can marginally exceed the original pipe capacity. This makes remaining_capacity negative, setting p_nom_max < p_nom_min = 0, which causes infeasibility at the next planning horizon. Observed on 115-cluster myopic runs with BarConvTol=1e-4: H2 pipeline retrofitted ES2 7 -> FR2 1: p_nom_max = -0.000649 MW H2 pipeline retrofitted GB1 3 -> GB1 7: p_nom_max = -0.000169 MW Apply the same clip(lower=0) pattern used for AC lines and DC links. --------- Co-authored-by: Fabian Neumann <[email protected]> Co-authored-by: Lukas Trippe <[email protected]>
Changes proposed in this Pull Request
I recently ran into an issue with myopic optimisations where if the transmission expansion limit has been reached in one time horizon, this could run into model infeasibility when solving at the next time horizon. What happened was that the minimum transmission network capacity given by
s_nom_minandp_nom_mincombined equalled the global limit set inn.global_constraintsup to 12 significant digits. But with the lower limit through*_nom_minso close to the upper limit given by the global constraint, the model ran into numerical problems and was declared infeasible.I think the "morally correct" approach is to check of transmission is already at the limit, and if so, fix the capacities at those given by
*_nom_min, make them non-extendable and remove the global limit. That's what I've implemented in this PR.The implementation seems to be working fine on my side, though I haven't gotten around to testing it yet for the volume limit, only the cost limit. However, do let me know if anyone can think of any potential issues or better ways of dealing with this.
Checklist
envs/environment.yaml.config.default.yaml.doc/configtables/*.csv.doc/release_notes.rstis added.