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

Generic property package: Using constraints to define state variables #1554

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,11 @@ def initialization_routine(
# constraint at this stage.
if "flow_mol_phase_comp" not in b.define_state_vars():
c.activate()
elif getattr(c, "defining_state_var", False):
# Allow using a constraint to define a state var
# (rather than fixing it directly) by setting
# c.defining_state_var = True.
c.activate()

for pp in b.params._pe_pairs:
# Activate formulation specific constraints
Expand Down Expand Up @@ -1938,6 +1943,12 @@ def initialize(
# constraint at this stage.
if "flow_mol_phase_comp" not in b.define_state_vars():
c.activate()
elif getattr(c, "defining_state_var", False):
# Allow using a constraint to define a state var
# (rather than fixing it directly) by setting
# c.defining_state_var = True. This can be used in
# conjunction with setting state_vars_fixed = True
c.activate()

for pp in b.params._pe_pairs:
# Activate formulation specific constraints
Expand Down