Simplify arc creation through connect_to method on port#3921
Simplify arc creation through connect_to method on port#3921avdudchenko wants to merge 3 commits intoPyomo:mainfrom
Conversation
|
At the dev call we discussed splitting this PR in half, keeping the We tossed around an idea of exploring an alternate implementation of get_connections by creating a utility (class) that would take a model and interrogate all the Arcs to collect the full port/arc connectivity graph. That object could then support the get_connections() (and potentially other logic like stream tearing), We are adopting a new review process where we convert PRs that are "waiting on the author" back to "draft" (to signal the PR state to both the author and the dev team). Please use the "Ready for review" button to signal the developers when it is time to get the PR back into the review queue. |
Fixes # .
connect_tomethod to port to simplify arc creation in modelsSummary/Motivation:
Currently in many models we use Arcs to connect multiple units/blocks together. In most IDAES/WaterTAP flowsheets or models this becomes very tedious as user must create, name, and track arcs as well as manually propagate them.
For example below shows an example, but one key thing to remember is in real flowsheets. the location of arc names and definitions would be separated by a hundreds of lines of code between arc creation and actual propagation occurs (example here:
arc creation and arc propagation by which point user probably forgot what the actual arcs are for and where they are connected (especially new users or developers)
The
connect_tomethod is intended to simplify arc creation and management work flow where user can simply connect two ports with simpleconnect_tocall. This is not intended to replace Arc method, but be a parallel approach to connecting ports.New approach
Example of this workflow can be seen here
The objective of this PR is start a discussion on this workflow and get feedback on issues that might need to be addressed before implementation.
Some known concerns:
ArcimportPortmethod, to circumvent this, connect_to import Arc at call. This is not ideal but impossible to address with out major reorganization of Arc or Port methods. I also do not wish to create a new "Port" object so we do not have to rebuild upstream models to access this method.Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: