diff --git a/dynamics.py b/dynamics.py index cdce0e9c0277503166e2ace8dd7fc17ead23a309..862cd1a9265ec8c899ba4e5737e4b14f7f96e8dd 100644 --- a/dynamics.py +++ b/dynamics.py @@ -1611,7 +1611,9 @@ class Profile: if dynamic == self.dynamic: return self if self.is_bool and not is_view_resample(self.dynamic, dynamic): - raise ValueError(f"A bool profile can only be resampled with a view resampling!") + raise ValueError( + f"A bool profile can only be resampled with a view resampling!" + ) return Profile( resample(np.expand_dims(self.values, axis=0), self.dynamic, dynamic)[0], dynamic, diff --git a/topology.py b/topology.py index 7b985e9f6a06e8c4c80f07019046bfa3bde13f33..d19298c3e3ba8e606c38a1d3f02186424993cdf4 100644 --- a/topology.py +++ b/topology.py @@ -441,12 +441,12 @@ class Topology: for logic_name, logic in self._additional_model_logic.items(): if logic["type"] == "ConnectorEnable": - enable = logic["enable"] + enable = logic["enable"].resample(o_block.dynamic).values for i, connector in enumerate(logic["connectors"]): connector_var = o_block.component_dict[connector] def rule(m, t): - if enable[t] == 0: + if not enable[t]: return connector_var[t] == 0 else: return pyo.Constraint.Skip @@ -457,7 +457,7 @@ class Topology: ) if logic["type"] == "ConnectionEnable": - enable = logic["enable"] + enable = logic["enable"].resample(o_block.dynamic).values for i, connection in enumerate(logic["connections"]): flow_from = connection["from"] flow_to = connection["to"] @@ -470,7 +470,7 @@ class Topology: flow_var = o_block.component_dict[connection.in_flows[0]] def rule(m, t): - if enable[t] == 0: + if not enable[t]: return flow_var[t] == 0 else: return pyo.Constraint.Skip