.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/equipment/plot_recycle_valve_power_loss.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_equipment_plot_recycle_valve_power_loss.py: Pump recycle valve power loss ============================= This example demonstrates how to calculate the recirculation line power loss if you have the following information: * Pump suction pressure * Pump discharge pressure * Recycle valve outlet pressure * Recycle valve flow coefficient (:math:`Cv`) curve * Density of the fluid Note that if the flow rate through the recycle valve is known, the calculation can be simplified and the recycle valve outlet pressure and :math:`Cv` curve are not required. .. GENERATED FROM PYTHON SOURCE LINES 18-20 We start by making some example dummy data. We ensure that the pump discharge pressure is higher than the suction pressure, and that the feed pressure is not constant to get more interesting results. .. GENERATED FROM PYTHON SOURCE LINES 20-40 .. code-block:: default import pandas as pd from indsl.equipment.pump_parameters import recycle_valve_power_loss, total_head from indsl.equipment.valve_parameters import flow_through_valve from indsl.signals.generator import line, sine_wave start_date = pd.Timestamp("2022-1-1") end_date = pd.Timestamp("2022-1-2") mean_disch_P = 10 # bar wave_period_disch_P = pd.Timedelta("10min") wave_period_valve_out_P = pd.Timedelta("5hour") suction_pressure = sine_wave(start_date, end_date) # bar discharge_pressure = sine_wave(start_date, end_date, wave_period=wave_period_disch_P, wave_mean=mean_disch_P) # bar valve_outlet_P = sine_wave(start_date, end_date, wave_period=wave_period_valve_out_P) # bar SG = 1 slope = pd.Timedelta("1s") / (end_date - start_date) valve_opening = line(start_date, end_date, slope=slope, intercept=0) .. GENERATED FROM PYTHON SOURCE LINES 41-43 To specify the valve :math:`Cv` curve, the type of curve has to be given and two points on the curve, the :math:`Cv` at min adn max flow rates. .. GENERATED FROM PYTHON SOURCE LINES 43-50 .. code-block:: default type = "EQ" min_opening = 0.1 max_opening = 0.9 min_Cv = 10 max_Cv = 90 .. GENERATED FROM PYTHON SOURCE LINES 51-53 The first step step is to calculate the flow through the recycle valve. We assume the pump discharge pressure is equal to the recycle valve inlet pressure. .. GENERATED FROM PYTHON SOURCE LINES 53-57 .. code-block:: default Q_valve = flow_through_valve( discharge_pressure, valve_outlet_P, valve_opening, SG, min_opening, max_opening, min_Cv, max_Cv, type, True ) # m3/h .. GENERATED FROM PYTHON SOURCE LINES 58-59 The second step is to calcualte the total head of the pump. .. GENERATED FROM PYTHON SOURCE LINES 59-65 .. code-block:: default den = 1000 * SG # kg/m3 den = line(start_date, end_date, intercept=den) # kg/m3 discharge_pressure *= 100000 # Pa suction_pressure *= 100000 # Pa head = total_head(discharge_pressure, suction_pressure, den, True) # m .. GENERATED FROM PYTHON SOURCE LINES 66-67 The last step is to calculate the recycle valve power loss. .. GENERATED FROM PYTHON SOURCE LINES 67-73 .. code-block:: default power_loss = recycle_valve_power_loss(Q_valve, head, den, True) # W ax = power_loss.plot() ax.set_title("Recycle valve power loss") ax.set_xlabel("Time") _ = ax.set_ylabel("Power (W)") .. image-sg:: /auto_examples/equipment/images/sphx_glr_plot_recycle_valve_power_loss_001.png :alt: Recycle valve power loss :srcset: /auto_examples/equipment/images/sphx_glr_plot_recycle_valve_power_loss_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 74-76 As a simple sanity check, the increasing power loss with increasing valve opening makes sense, as this means more fluid flows through the recirculation line. .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 28.393 seconds) .. _sphx_glr_download_auto_examples_equipment_plot_recycle_valve_power_loss.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_recycle_valve_power_loss.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_recycle_valve_power_loss.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_