Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sclopt patch, allows multiple subnetworks and pre-existing constraints #798

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TomAdamsHET
Copy link

Closes # (if applicable).

Changes proposed in this Pull Request

Allows naming of constraints for separate subnetworks, and allows existing constraints to carry through

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

Comment on lines +215 to +223
# Allow existing constraints to carry through
if "model" in dir(n):
m = n.model
else:
m = n.optimize.create_model(
snapshots=snapshots,
multi_investment_periods=multi_investment_periods,
**model_kwargs,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nice idea, but I would not handle it in this way by default. The risk is that components added between the first model creation and this function call may be ignored:

n.optimize()
n.add("Generator", "gen", ....)
n.optimize.optimize_security_constrained()

I would also replace:

if "model" in dir(n):

with

get(n, "model")

But I would consider adding this as an optional keyword argument of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants