Skip to content

Commit

Permalink
Remove components and connections from removed parts and fix branch m…
Browse files Browse the repository at this point in the history
…erging
  • Loading branch information
fwitte committed Jan 21, 2024
1 parent bd58717 commit d67e72e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tespy/networks/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def del_conns(self, *args):
comps = list({cp for c in args for cp in [c.source, c.target]})
for c in args:
self.conns.drop(c.label, inplace=True)
self.results["Connection"].drop(c.label, inplace=True)
msg = ('Deleted connection ' + c.label + ' from network.')
logger.debug(msg)

Expand Down Expand Up @@ -554,6 +555,9 @@ def _del_comps(self, comps):
comp not in self.conns["target"].values
):
self.comps.drop(comp.label, inplace=True)
self.results[comp.__class__.__name__].drop(
comp.label, inplace=True, errors="ignore"
)
msg = f"Deleted component {comp.label} from network."
logger.debug(msg)

Expand Down Expand Up @@ -741,7 +745,7 @@ def create_fluid_wrapper_branches(self):
set(branch_data["connections"])
& set(ob_data["connections"])
)
if len(common_connections) > 0:
if len(common_connections) > 0 and ob_name in merged:
merged[branch_name]["connections"] = list(
set(branch_data["connections"] + ob_data["connections"])
)
Expand Down

0 comments on commit d67e72e

Please sign in to comment.