Skip to content
Snippets Groups Projects
Commit 6bb636ea authored by Christoph von Oy's avatar Christoph von Oy
Browse files

Enable logics use boolean profiles now

parent 1aabf395
Branches
Tags
No related merge requests found
...@@ -1611,7 +1611,9 @@ class Profile: ...@@ -1611,7 +1611,9 @@ class Profile:
if dynamic == self.dynamic: if dynamic == self.dynamic:
return self return self
if self.is_bool and not is_view_resample(self.dynamic, dynamic): 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( return Profile(
resample(np.expand_dims(self.values, axis=0), self.dynamic, dynamic)[0], resample(np.expand_dims(self.values, axis=0), self.dynamic, dynamic)[0],
dynamic, dynamic,
......
...@@ -441,12 +441,12 @@ class Topology: ...@@ -441,12 +441,12 @@ class Topology:
for logic_name, logic in self._additional_model_logic.items(): for logic_name, logic in self._additional_model_logic.items():
if logic["type"] == "ConnectorEnable": if logic["type"] == "ConnectorEnable":
enable = logic["enable"] enable = logic["enable"].resample(o_block.dynamic).values
for i, connector in enumerate(logic["connectors"]): for i, connector in enumerate(logic["connectors"]):
connector_var = o_block.component_dict[connector] connector_var = o_block.component_dict[connector]
def rule(m, t): def rule(m, t):
if enable[t] == 0: if not enable[t]:
return connector_var[t] == 0 return connector_var[t] == 0
else: else:
return pyo.Constraint.Skip return pyo.Constraint.Skip
...@@ -457,7 +457,7 @@ class Topology: ...@@ -457,7 +457,7 @@ class Topology:
) )
if logic["type"] == "ConnectionEnable": if logic["type"] == "ConnectionEnable":
enable = logic["enable"] enable = logic["enable"].resample(o_block.dynamic).values
for i, connection in enumerate(logic["connections"]): for i, connection in enumerate(logic["connections"]):
flow_from = connection["from"] flow_from = connection["from"]
flow_to = connection["to"] flow_to = connection["to"]
...@@ -470,7 +470,7 @@ class Topology: ...@@ -470,7 +470,7 @@ class Topology:
flow_var = o_block.component_dict[connection.in_flows[0]] flow_var = o_block.component_dict[connection.in_flows[0]]
def rule(m, t): def rule(m, t):
if enable[t] == 0: if not enable[t]:
return flow_var[t] == 0 return flow_var[t] == 0
else: else:
return pyo.Constraint.Skip return pyo.Constraint.Skip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment