# -*- coding: utf-8
"""Module of class Pipe.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location tespy/components/piping/pipe.py
SPDX-License-Identifier: MIT
"""
from tespy.components.component import component_registry
from tespy.components.heat_exchangers.simple import SimpleHeatExchanger
[docs]
@component_registry
class Pipe(SimpleHeatExchanger):
r"""
The Pipe is a subclass of a SimpleHeatExchanger.
**Mandatory Equations**
- :py:meth:`tespy.components.component.Component.fluid_func`
- :py:meth:`tespy.components.component.Component.mass_flow_func`
**Optional Equations**
- :py:meth:`tespy.components.component.Component.pr_func`
- :py:meth:`tespy.components.component.Component.zeta_func`
- :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.energy_balance_func`
- :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.darcy_group_func`
- :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.hw_group_func`
- :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_group_func`
- :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_char_group_func`
Inlets/Outlets
- in1
- out1
Image
.. image:: /api/_images/Pipe.svg
:alt: flowsheet of the pipe
:align: center
:class: only-light
.. image:: /api/_images/Pipe_darkmode.svg
:alt: flowsheet of the pipe
:align: center
:class: only-dark
Parameters
----------
label : str
The label of the component.
design : list
List containing design parameters (stated as String).
offdesign : list
List containing offdesign parameters (stated as String).
design_path : str
Path to the components design case.
local_offdesign : boolean
Treat this component in offdesign mode in a design calculation.
local_design : boolean
Treat this component in design mode in an offdesign calculation.
char_warnings : boolean
Ignore warnings on default characteristics usage for this component.
printout : boolean
Include this component in the network's results printout.
Q : float, dict, :code:`"var"`
Heat transfer, :math:`Q/\text{W}`.
pr : float, dict, :code:`"var"`
Outlet to inlet pressure ratio, :math:`pr/1`.
zeta : float, dict, :code:`"var"`
Geometry independent friction coefficient,
:math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
D : float, dict, :code:`"var"`
Diameter of the pipes, :math:`D/\text{m}`.
L : float, dict, :code:`"var"`
Length of the pipes, :math:`L/\text{m}`.
ks : float, dict, :code:`"var"`
Pipe's roughness, :math:`ks/\text{m}`.
darcy_group : str, dict
Parametergroup for pressure drop calculation based on pipes dimensions
using darcy weissbach equation.
ks_HW : float, dict, :code:`"var"`
Pipe's roughness, :math:`ks/\text{1}`.
hw_group : str, dict
Parametergroup for pressure drop calculation based on pipes dimensions
using hazen williams equation.
kA : float, dict, :code:`"var"`
Area independent heat transfer coefficient,
:math:`kA/\frac{\text{W}}{\text{K}}`.
kA_char : tespy.tools.characteristics.CharLine, dict
Characteristic line for heat transfer coefficient.
Tamb : float, dict
Ambient temperature, provide parameter in network's temperature
unit.
kA_group : str, dict
Parametergroup for heat transfer calculation from ambient temperature
and area independent heat transfer coefficient kA.
Example
-------
A mass flow of 10 kg/s ethanol is transported in a pipeline. The pipe is
considered adiabatic and has a length of 500 meters. We can calculate the
diameter required at a given pressure loss of 2.5 %. After we determined
the required diameter, we can predict pressure loss at a different mass
flow through the pipeline.
>>> from tespy.components import Sink, Source, Pipe
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> import shutil
>>> nw = Network()
>>> nw.set_attr(p_unit='bar', T_unit='C', h_unit='kJ / kg', iterinfo=False)
>>> so = Source('source 1')
>>> si = Sink('sink 1')
>>> pi = Pipe('pipeline')
>>> pi.component()
'pipe'
>>> pi.set_attr(pr=0.975, Q=0, design=['pr'], L=100, D='var', ks=5e-5)
>>> inc = Connection(so, 'out1', pi, 'in1')
>>> outg = Connection(pi, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)
>>> inc.set_attr(fluid={'ethanol': 1}, m=10, T=30, p=3)
>>> nw.solve('design')
>>> nw.save('tmp')
>>> round(pi.D.val, 3)
0.119
>>> outg.p.val / inc.p.val == pi.pr.val
True
>>> inc.set_attr(m=15)
>>> pi.set_attr(D=pi.D.val)
>>> nw.solve('offdesign', design_path='tmp')
>>> round(pi.pr.val, 2)
0.94
>>> shutil.rmtree('./tmp', ignore_errors=True)
"""
[docs]
@staticmethod
def component():
return 'pipe'