Allow energy not served to be forbidden rather than penalised - #169
Merged
Conversation
Energy not served is a free variable penalised at pENSCost, so a system that cannot meet its demand still returns a solution and has to be screened after the fact on the value of vENS. That is fine for costing, but it cannot answer whether a configuration is adequate at all: a small non-zero value and a genuinely infeasible system look the same until someone inspects the output. IndHardZeroENS fixes the variable at zero, so the model is infeasible exactly when the demand cannot be served. The option sits in the option table with the other modelling indicators rather than in the environment, and defaults to zero when absent, so cases written before it exists load unchanged. A --zero-ens flag turns it on for a single run without touching case data, following --threads: the flag sets OTEPES_ZERO_ENS and the variable wins over the option table. Screening many cases for adequacy otherwise means editing each one's option file.
erikfilias
force-pushed
the
feature/zero-ens-option
branch
from
August 30, 2026 12:47
1db58c3 to
e3305e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Adds an
IndHardZeroENSoption that fixesvENSat zero, so unserved energy is forbidden ratherthan penalised.
No existing case needs to change. The column is optional:
par.get('pIndHardZeroENS', 0)defaults it to off when absent,
oT_Data_Optionis declaredUNPIVOT_SINGLE_ROWin the schema andso carries no required-column list, and none of the ten shipped cases has the column. The full test
suite passes on this branch, including all 27 solve cases, every one of them reading an option table
written before this option existed.
Rationale
vENSis a free non-negative variable penalised atpENSCost, with no upper bound beyond demand.A system that cannot meet its demand therefore still returns a solution, and whether it was adequate
has to be judged afterwards by inspecting
vENS. That works for costing, but it cannot answerwhether a configuration is adequate at all: a small non-zero value and a genuinely infeasible system
look alike until someone reads the output and picks a threshold.
Fixing the variable at zero asks the question directly. The model is then infeasible exactly when
the demand cannot be served, which is what an adequacy screen wants to establish, and the answer
comes from the solver rather than from a post-hoc rule.
Placement
In the option table with the other modelling indicators rather than in the environment, since it
changes the feasible set rather than how the solver is driven.
If it would be more useful to toggle this per run without touching case data — an adequacy screen
over many cases is the obvious use — a
--zero-ensflag in the manner of--threadscould be addedon top, with the option table remaining the default. Happy to add that if preferred.
Effect
None by default.
+11across the configuration and variable set-up. Full test suite passes,including the solve cases.