Skip to content

Commit

Permalink
activate constraints tagged with the defining_state_var attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
alma-walmsley committed Dec 22, 2024
1 parent f92c750 commit d76667d
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit d76667d

Please sign in to comment.