Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow control model #413

Merged
merged 39 commits into from
Jan 4, 2023
Merged

Flow control model #413

merged 39 commits into from
Jan 4, 2023

Conversation

dlohmeier
Copy link
Collaborator

@dlohmeier dlohmeier commented Oct 15, 2022

The flow controller is a branch component that controls the flow through itself. It means that the pressure drop is adapted to reflect the desired flow situation. This is especially helpful for heating grids, where otherwise the flow through heat exchangers needs to be controlled through the loss coefficient.
As the flow controller is a new component, it must be reflected in many parts of pandapipes:

  • There is a new FlowControl component class (all other component models did not really change).
  • There are new create-functions (single and bulk) in the create.py module.
  • The flow controller was added to the plotting library (i.e. there is a new collection and a new patch function, and it was added to the simple_plot function call) as well as a "deafult" component to networkx graphs and toolbox functions.
  • New tests were implemented to test the flow control behavior and other aspects like graph searches or plotting collections.

@codecov
Copy link

codecov bot commented Oct 15, 2022

Codecov Report

Base: 87.90% // Head: 88.34% // Increases project coverage by +0.43% 🎉

Coverage data is based on head (68a2dd1) compared to base (888de82).
Patch coverage: 95.65% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #413      +/-   ##
===========================================
+ Coverage    87.90%   88.34%   +0.43%     
===========================================
  Files           80       81       +1     
  Lines         4753     4863     +110     
===========================================
+ Hits          4178     4296     +118     
+ Misses         575      567       -8     
Impacted Files Coverage Δ
pandapipes/component_models/component_toolbox.py 87.80% <ø> (ø)
pandapipes/io/file_io.py 82.14% <ø> (ø)
pandapipes/pf/pipeflow_setup.py 88.55% <ø> (ø)
pandapipes/plotting/plotting_toolbox.py 100.00% <ø> (ø)
pandapipes/toolbox.py 85.14% <ø> (ø)
pandapipes/topology/create_graph.py 85.29% <ø> (ø)
...pes/component_models/pressure_control_component.py 94.66% <50.00%> (ø)
pandapipes/plotting/simple_plot.py 82.79% <88.00%> (+9.32%) ⬆️
pandapipes/plotting/collections.py 83.33% <89.65%> (+1.21%) ⬆️
...dapipes/component_models/flow_control_component.py 98.24% <98.24%> (ø)
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jkisse
Copy link
Collaborator

jkisse commented Oct 17, 2022

This might solve #361

@jkisse
Copy link
Collaborator

jkisse commented Oct 21, 2022

I think this will be very helpful in heating networks. But does this actually work with gas grids? If the velocity is fixed, the mass flow still depends on the density (but the user will assume that it is enforced, since it is an input parameter). I'd propose that an Error or Warning should be raised if fluid.is_gas

@dlohmeier
Copy link
Collaborator Author

I think there is a misunderstanding here. We fix the velocity internally, that is true. But we have to keep in mind that this is the velocity at norm state, so in order to derive the mass flow from it, we will always multiply it with the norm density. The velocity itself will change indeed inside this component, depending on the pressure / compressibility.

@dlohmeier
Copy link
Collaborator Author

I added a test for the flow control model and also added it to the toolbox functions and nx-graph creation. What is still missing is plotting. I would like to draw a valve patch with a T above to show that the valve is regulated.

dlohmeier and others added 2 commits October 21, 2022 17:40
* basically a valve with a T on top
* not yet fully tested (filled/ not filled, to be discussed)
* for robustness, the call of create_simple_collections in simple_plot was changed to kwargs instead of positional arguments
@dlohmeier
Copy link
Collaborator Author

dlohmeier commented Oct 21, 2022

Thanks for the great addition! Something that just crossed my mind is that we might need a keyword like "control_active" as in the pressure regulator component. If it is set to false, the flow control acts like an open valve. For plotting I thought of something fancy:

  • if not "in_service": make it white
  • if "in_service" but not "control_active": fill
  • if "in_service" and "control_active": fill half (i.e. split the drawn triangles and make one filled and one white triangle out of them)

dlohmeier and others added 2 commits October 25, 2022 13:41
… in plotting (control_active adds / removes fancy arrow, wrong color for heat exchangers used)
@dlohmeier
Copy link
Collaborator Author

Thanks for the hint, I did that.

@jkisse
Copy link
Collaborator

jkisse commented Nov 7, 2022

Heat exchanger and valve have a loss_coefficient - would it make sense to add a loss coefficent for the flow control as well?

@dlohmeier
Copy link
Collaborator Author

dlohmeier commented Nov 14, 2022

I am not too sure about that because the flow controller models an ideal control valve. In case of active control (which should be the normal behavior), the loss coefficient would have no effect on the model. It could only come into play when the flow controller acts as an open valve.

pandapipes/create.py Outdated Show resolved Hide resolved
pandapipes/create.py Show resolved Hide resolved
pandapipes/create.py Show resolved Hide resolved
pandapipes/create.py Outdated Show resolved Hide resolved
pandapipes/plotting/simple_plot.py Outdated Show resolved Hide resolved
pandapipes/plotting/patch_makers.py Show resolved Hide resolved
@jkisse
Copy link
Collaborator

jkisse commented Jan 3, 2023

I've added a chapter in the documentation. Please check & update it if required, @dlohmeier

@dlohmeier
Copy link
Collaborator Author

Looks good, thanks!

@SimonRubenDrauz SimonRubenDrauz merged commit 13945cb into e2nIEE:develop Jan 4, 2023
@dlohmeier dlohmeier deleted the flow_control branch January 12, 2023 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants