tespy.components.displacementmachinery package

tespy.components.displacementmachinery.base module

Module of class DisplacementMachine.

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/displacementmachinery/base.py

SPDX-License-Identifier: MIT

class tespy.components.displacementmachinery.base.DisplacementMachine(label, **kwargs)[source]

Bases: Component

Parent class for displacement machines

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

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.

  • P (float, dict) – Power, \(P/\text{W}\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

Example

For an example please refer to:

bus_deriv(bus)[source]

Calculate partial derivatives of the bus function.

Parameters:

bus (tespy.connections.bus.Bus) – TESPy bus object.

Returns:

deriv (ndarray) – Matrix of partial derivatives.

bus_func(bus)[source]

Calculate the value of the bus function.

Parameters:

bus (tespy.connections.bus.Bus) – TESPy bus object.

Returns:

residual (float) – Value of energy transfer \(\dot{E}\). This value is passed to tespy.components.component.Component.calc_bus_value() for value manipulation according to the specified characteristic line of the bus.

\[\dot{E} = \dot{m}_{in} \cdot \left(h_{out} - h_{in} \right)\]

calc_parameters()[source]

Postprocessing parameter calculation.

energy_balance_dependents()[source]
energy_balance_func()[source]

Calculate energy balance of a turbomachine.

Returns:

residual (float) – Residual value of turbomachine energy balance

\[0=\dot{m}_{in}\cdot\left(h_{out}-h_{in}\right)-P\]

entropy_balance()[source]

Calculate entropy balance of turbomachine.

Note

The entropy balance makes the follwing parameter available:

\[\begin{split}\text{S\_irr}=\dot{m} \cdot \left(s_\mathrm{out}-s_\mathrm{in} \right)\\\end{split}\]
get_bypass_constraints()[source]
get_parameters()[source]
get_plotting_data()[source]

Generate a dictionary containing FluProDia plotting information.

Returns:

data (dict) – A nested dictionary containing the keywords required by the calc_individual_isoline method of the FluidPropertyDiagram class. First level keys are the connection index (‘in1’ -> ‘out1’, therefore 1 etc.).

static inlets()[source]
static outlets()[source]

tespy.components.displacementmachinery.polynomial_compressor module

Module of class PolynomialCompressor.

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/displacementmachinery/polynomial_compressor.py

SPDX-License-Identifier: MIT

class tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor(label, **kwargs)[source]

Bases: DisplacementMachine

Class for a compressor model following the EN12900 implementation of [24].

See the example for the intended use of the component.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional inlets

  • power

Image

flowsheet of the compressor flowsheet of the compressor
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.

  • P (float, dict) – Compressor power, \(P/\text{W}\)

  • dissipation_ratio (float, dict) – Relative heat loss of compressor, \(Q_\text{diss,rel}/1\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_\text{s}/1\)

  • eta_s_poly (array, dict) – Polynomial coefficients for isentropic efficiency

  • eta_vol (float, dict) – Volumetric efficiency, \(\eta_\text{vol}/1\)

  • eta_vol_poly (array, dict) – Polynomial coefficients for volumetric efficiency

  • reference_state (dict) – Reference state for the polynomial and displacement.

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

Example

The utilization of this component is intended to be done in two steps:

  1. Calculate the reference state isentropic and volumetric efficiency polynomials based on the provided manufacturer data.

  2. Set the resulting isentropic and volumetric efficiency polynomials. Under the assumption of isentropic and volumetric efficiency not being constant at variable compressor rpm, the outlet state will be determined with the volumetric flow at inlet. The volumetric flow at inlet scales linearly with the rpm of the compressor.

>>> from tespy.components import Source, Sink, PolynomialCompressor
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> import pandas as pd
>>> from CoolProp.CoolProp import PropsSI
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "temperature": "degC"
... })
>>> so = Source("from evaporator")
>>> si = Sink("to condenser")
>>> compressor = PolynomialCompressor("compressor")
>>> c1 = Connection(so, "out1", compressor, "in1", label="c1")
>>> c2 = Connection(compressor, "out1", si, "in1", label="c2")
>>> nw.add_conns(c1, c2)

Now, we can either provide

  • a 10-coefficient polynomial for power and cooling or

  • provide the respective power and cooling energy from a datasheet of a compressor manufacturer to generate such a polynomial

Then we can used a precalculation method, which transforms the polynomial or the data into two polynomials, one for the isentropic efficiency and one for the volumetric efficiency, both as a function of evaporation and condensation temperature. Additionally information on a reference state have to be provided, which include

  • superheating at suction

  • subcooling after the condensation

  • the rpm belonging to the original data

  • a displacement value (kg/h) with the respective rpm for this displacement

Tip

The compressor data or the 10-coefficient polynomials can be retrieved from manufacturers. For example, Bitzer provides such data, which can be used to retrieve a polynomial. The data for this example have been retrieved from [25].

>>> reference_state = {
...     "T_sh": 20,  # superheating
...     "T_sc": 0,  # subcooling
...     "rpm_poly": 50 * 60,  # rpm belonging to the polynomial data
...     "rpm_displacement": 20 * 60,  # rpm belonging to the displacement
...     "displacement": 214  # kg / h
... }
>>> power = pd.DataFrame(
...     columns=[10,7.5,5,0,-5,-10], index=[30, 40, 50], dtype=float
... )
>>> cooling = power.copy()
>>> cooling.loc[30] = [465600,424100,385500,316700,257900,208000]
>>> cooling.loc[40] = [418900,380400,344800,281400,227400,181600]
>>> cooling.loc[50] = [365900,331300,299200,242100,193700,152900]
>>> power.loc[30] = [62.0,61.8,61.8,61.8,61.7,61.3]
>>> power.loc[40] = [78.0,78.0,78.0,78.0,77.7,76.8]
>>> power.loc[50] = [99.2,99.2,99.2,98.9,98.1,96.5]
>>> power = power * 1000

Attention

The data or polynomial formulations must be in SI units!

We can now use the inbuilt method to determine the isentropic and volumetric efficiency polynomials. For that we need to import the respective method. Apart from this method, there is also the tespy.components.displacementmachinery.polynomial_compressor.generate_eta_polys_from_power_and_cooling_polys() method, that can do the same step provided a polynomial for power and one for the cooling.

>>> from tespy.components.displacementmachinery.polynomial_compressor import (
...     generate_eta_polys_from_data
... )
>>> eta_s_poly, eta_vol_poly = generate_eta_polys_from_data(
...     power, cooling, "R134a", reference_state
... )
>>> eta_s_poly
array([ 3.44223012e-03, -3.75139140e-02,  4.39204462e-02, -9.21644870e-04,
        1.68576190e-03, -8.97540501e-04, -7.54781107e-06,  1.61377008e-05,
       -1.53820046e-05,  5.04818089e-06])
>>> eta_vol_poly
array([ 5.81192914e-03, -7.18820053e-04,  7.41463587e-02,  2.84410052e-05,
        6.51372426e-05, -1.89872495e-03,  7.84206012e-07, -1.90585865e-06,
        4.52695494e-07,  1.51321175e-05])

We can take these polynomials and set them on the compressor instance together with the reference state and the assumption on heat dissipation.

>>> compressor.set_attr(
...     eta_s_poly=eta_s_poly, eta_vol_poly=eta_vol_poly, dissipation_ratio=0.05,
...     reference_state=reference_state
... )

First, we can impose the boundary conditions on “c1” that are equal to the displacement reference state. In that case, we should be able to get the same displacement value as inputted into the reference.

>>> c1.set_attr(fluid={"R134a": 1}, T=0, td_dew=10)  # T_evap=-10°C
>>> compressor.set_attr(rpm=1200)
>>> p_sat = PropsSI("P", "Q", 0, "T", 50 + 273.15, "R134a")  # T_cond=50°C
>>> c2.set_attr(p=p_sat / 1e5)
>>> nw.solve("design")
>>> round(c1.v.val * 3600 / compressor.eta_vol.val, 2)
214.0
>>> round(compressor.eta_s.val, 3)
0.5
>>> round(compressor.eta_vol.val, 3)
0.814

We can also double check our resulting isentropic and volumetric efficiency values with the evaluation of the polynomials.

>>> from tespy.components.displacementmachinery.polynomial_compressor import (
...     calc_EN12900
... )
>>> round(compressor.eta_s.val, 3) == round(calc_EN12900(eta_s_poly, -10, 50), 3)
np.True_
>>> round(compressor.eta_vol.val, 3) == round(calc_EN12900(eta_vol_poly, -10, 50), 3)
np.True_

Tip

You can also create polynomials for power and cooling from respective data. For that, import the tespy.components.displacementmachinery.polynomial_compressor.fit_EN12900() method and pass the respective data.

We can also check the compressor power. It is higher than the power of an adiabatic compressor due to the heat dissipation. The compressor power plus heat dissipation will give the actual power required for isentropic compression. The heat dissipation is negative due to the heat leaving the component.

>>> round(compressor.P.val)
38385
>>> round(compressor.Q_diss.val)
-1919
>>> round(compressor.P.val + compressor.Q_diss.val)
36466

Now, let’s see what happens, if evaporation or condensation temperature change:

>>> c1.set_attr(T=20, td_dew=10)  # T_evap=10°C
>>> p_sat = PropsSI("P", "Q", 0, "T", 40 + 273.15, "R134a")  # T_cond=40°C
>>> c2.set_attr(p=p_sat / 1e5)
>>> nw.solve("design")
>>> round(compressor.eta_s.val, 3)
0.665
>>> round(compressor.eta_vol.val, 3)
0.924

It is also possible, to make the rpm a variable. This is useful, in case mass flow through the compressor is governed from external. Usually, this could be the case, if a specific heat transfer is required to be provided by the condenser or from the evaporator. In this case, we just fix the displacement to mimic that.

>>> compressor.set_attr(rpm="var")
>>> c1.set_attr(v=400/3600)
>>> nw.solve("design")
>>> round(compressor.rpm.val)
2427

As final remarks: You can also set fixed isentropic and fixed volumetric efficiencies for these components.

calc_parameters()[source]

Postprocessing parameter calculation.

energy_balance_group_dependents()[source]
energy_balance_group_func()[source]

Equation for specified power and relative heat dissipation

\[0 = \dot m \cdot \frac{ h_\text{out} - h_\text{in}}{1 - \dot Q_\text{diss,rel}} - P\]
Returns:

float – residual

energy_connector_balance_func()[source]
energy_connector_dependents()[source]
eta_s_group_dependents()[source]
eta_s_group_func()[source]

Isentropic efficiency function with a heat loss term

\[0 = \eta_\text{s} \cdot \frac{ h_\text{out} - h_\text{in}}{1 - \dot Q_\text{diss,rel}} - \left( h_\text{out,s} - h_\text{in} \right)\]

Note

For this, the actual enthalpy increase is further increased by the relative heat loss to calculate the (virtual) compression outlet enthalpy. The compressor is first considered isentropic, then the relative heat loss (relative to compression power) is subtracted from the outlet enthalpy afterwards.

Returns:

float – residual value

eta_s_poly_group_func()[source]

Isentropic efficiency function with a heat loss term

\[0 = \eta_\text{s} \left(T_\text{evap}, T_\text{cond}\right)\cdot \frac{ h_\text{out} - h_\text{in}}{1 - \dot Q_\text{diss,rel}} - \left( h_\text{out,s} - h_\text{in} \right)\]

Note

For this, the actual enthalpy increase is further increased by the relative heat loss to calculate the (virtual) compression outlet enthalpy. The compressor is first considered isentropic, then the relative heat loss (relative to compression power) is subtracted from the outlet enthalpy afterwards.

Returns:

float – residual value

eta_vol_group_dependents()[source]
eta_vol_group_func()[source]

Volumetric efficiency function.

\[0 = \dot m_\text{in} - \eta_\text{vol} \cdot \frac{\dot V_\text{ref}}{3600} \cdot \frac{rpm}{rpm_\text{ref}} \cdot \frac{1}{v_\text{in}}\]
Returns:

float – residual value

eta_vol_poly_group_dependents()[source]
eta_vol_poly_group_func()[source]

Volumetric efficiency function.

\[0 = \dot m_\text{in} - \eta_\text{vol} \left(T_\text{evap}, T_\text{cond}\right) \cdot \frac{\dot V_\text{ref}}{3600} \cdot \frac{rpm}{rpm_\text{ref}} \cdot \frac{1}{v_\text{in}}\]
Returns:

float – residual value

get_mandatory_constraints()[source]
get_parameters()[source]
static powerinlets()[source]
tespy.components.displacementmachinery.polynomial_compressor.calc_EN12900(c: list, t_evap: float, t_cond: float) float[source]

Calculate the EN12900 polynomial

Parameters:
  • c (list) – Coefficients of the polynomial

  • t_evap (float) – Reference evaporation temperature

  • t_cond (float) – Reference condensation temperature

Returns:

float – Result of polynomial

tespy.components.displacementmachinery.polynomial_compressor.fit_EN12900(t_evap: array, t_cond: array, data: array) array[source]

Fit the polynome coefficients of EN12900 polynome based on evaporation and condensation temperature and respective measurements

Parameters:
  • t_evap (np.array) – 1-d array of evaporation temperatures

  • t_cond (np.array) – 1-d array of condensation temperatures

  • data (np.array) – datasheet information

Returns:

np.array – 1-d array of polynome coefficients

tespy.components.displacementmachinery.polynomial_compressor.generate_eta_polys_from_data(df_power, df_cooling, fluid: str, reference_state: dict) tuple[source]

Generate polynomials for calculation of isentropic and volumetric efficiency of a compressor

Parameters:
  • df_power (pd.DataFrame) – Power consumption data

  • df_cooling (pd.DataFrame) – Cooling data

  • fluid (str) – Name of fluid

  • reference_state (dict) – Dictionary with reference state information, i.e. - T_sh: superheating delta T (Kelvin) - T_sc: subcooling delta T (Kelvin) - rpm_poly: reference rpm of the polynomial - displancement: displacement in m3/h - rpm_displacement: reference rpm of the displacement

Returns:

tuple – Polynomial coefficients for isentropic and volumetric efficiency as function of evaporation and condensation temperature

tespy.components.displacementmachinery.polynomial_compressor.generate_eta_polys_from_power_and_cooling_polys(power_poly: list, cooling_poly: list, t_evap: array, t_cond: array, fluid: str, reference_state: dict) tuple[source]

Generate polynomials for calculation of isentropic and volumetric efficiency of a compressor

Parameters:
  • power_poly (list) – List of polynomial coefficients for power

  • cooling_poly (list) – List of polynomial coefficients for cooling

  • fluid (str) – Name of fluid

  • reference_state (dict) – Dictionary with reference state information, i.e. - T_sh: superheating delta T (Kelvin) - T_sc: subcooling delta T (Kelvin) - rpm_poly: reference rpm of the polynomial - displancement: displacement in m3/h - rpm_displacement: reference rpm of the displacement

Returns:

tuple – Polynomial coefficients for isentropic and volumetric efficiency as function of evaporation and condensation temperature

tespy.components.displacementmachinery.polynomial_compressor_with_cooling module

Module of class PolynomialCompressorWithCooling.

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/displacementmachinery/polynomial_compressor_with_cooling.py

SPDX-License-Identifier: MIT

class tespy.components.displacementmachinery.polynomial_compressor_with_cooling.PolynomialCompressorWithCooling(label, **kwargs)[source]

Bases: PolynomialCompressor

Class for a compressor model following the EN12900 implementation of [24] and adding an inflow and and outflow for a cooling fluid.

See the example for the intended use of the component.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1, in2 (cooling)

  • out1, out2 (cooling)

Optional inlets

  • power

Image

flowsheet of the compressor flowsheet of the compressor
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.

  • P (float, dict) – Compressor power, \(P/\text{W}\)

  • dissipation_ratio (float, dict) – Relative heat loss of compressor, \(Q_\text{diss,rel}/1\)

  • eta_recovery (float, dict) – Share of heat recovered in the cooling fluid of the heat loss of compressor, \(Q_\text{diss,rel}/1\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_\text{s}/1\)

  • eta_s_poly (array, dict) – Polynomial coefficients for isentropic efficiency

  • eta_vol (float, dict) – Volumetric efficiency, \(\eta_\text{vol}/1\)

  • eta_vol_poly (array, dict) – Polynomial coefficients for volumetric efficiency

  • reference_state (dict) – Reference state for the polynomial and displacement.

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • pr_cooling (float, dict) – Outlet to inlet pressure ratio for cooling, \(pr/1\)

  • dp_cooling (float, dict) – Inlet to outlet pressure difference for cooling, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

Example

The utilization of this component is intended to be done in two steps:

  1. Calculate the reference state isentropic and volumetric efficiency polynomials based on the provided manufacturer data.

  2. Set the resulting isentropic and volumetric efficiency polynomials. Under the assumption of isentropic and volumetric efficiency not being constant at variable compressor rpm, the outlet state will be determined with the volumetric flow at inlet. The volumetric flow at inlet scales linearly with the rpm of the compressor.

>>> from tespy.components import Source, Sink, PolynomialCompressorWithCooling
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> import pandas as pd
>>> from CoolProp.CoolProp import PropsSI
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "temperature": "degC"
... })
>>> so = Source("from evaporator")
>>> si = Sink("to condenser")
>>> compressor = PolynomialCompressorWithCooling("compressor")
>>> c1 = Connection(so, "out1", compressor, "in1", label="c1")
>>> c2 = Connection(compressor, "out1", si, "in1", label="c2")
>>> nw.add_conns(c1, c2)

Additionally, we add the cooling fluid connections.

>>> so_cool = Source("cooling water inlet")
>>> si_cool = Sink("cooling water outlet")
>>> b1 = Connection(so_cool, "out1", compressor, "in2", label="b1")
>>> b2 = Connection(compressor, "out2", si_cool, "in1", label="b2")
>>> nw.add_conns(b1, b2)

Now, we can either provide

  • a 10-coefficient polynomial for power and cooling or

  • provide the respective power and cooling energy from a datasheet of a compressor manufacturer to generate such a polynomial

Then we can used a precalculation method, which transforms the polynomial or the data into two polynomials, one for the isentropic efficiency and one for the volumetric efficiency, both as a function of evaporation and condensation temperature. Additionally information on a reference state have to be provided, which include

  • superheating at suction

  • subcooling after the condensation

  • the rpm belonging to the original data

  • a displacement value (kg/h) with the respective rpm for this displacement

Tip

The compressor data or the 10-coefficient polynomials can be retrieved from manufacturers. For example, Bitzer provides such data, which can be used to retrieve a polynomial. The data for this example have been retrieved from [25].

>>> reference_state = {
...     "T_sh": 20,  # superheating
...     "T_sc": 0,  # subcooling
...     "rpm_poly": 50 * 60,  # rpm belonging to the polynomial data
...     "rpm_displacement": 20 * 60,  # rpm belonging to the displacement
...     "displacement": 214  # kg / h
... }
>>> power = pd.DataFrame(
...     columns=[10,7.5,5,0,-5,-10], index=[30, 40, 50], dtype=float
... )
>>> cooling = power.copy()
>>> cooling.loc[30] = [465600,424100,385500,316700,257900,208000]
>>> cooling.loc[40] = [418900,380400,344800,281400,227400,181600]
>>> cooling.loc[50] = [365900,331300,299200,242100,193700,152900]
>>> power.loc[30] = [62.0,61.8,61.8,61.8,61.7,61.3]
>>> power.loc[40] = [78.0,78.0,78.0,78.0,77.7,76.8]
>>> power.loc[50] = [99.2,99.2,99.2,98.9,98.1,96.5]
>>> power = power * 1000

Attention

The data or polynomial formulations must be in SI units!

We can now use the inbuilt method to determine the isentropic and volumetric efficiency polynomials. For that we need to import the respective method. Apart from this method, there is also the tespy.components.displacementmachinery.polynomial_compressor.generate_eta_polys_from_power_and_cooling_polys() method, that can do the same step provided a polynomial for power and one for the cooling.

>>> from tespy.components.displacementmachinery.polynomial_compressor import (
...     generate_eta_polys_from_data
... )
>>> eta_s_poly, eta_vol_poly = generate_eta_polys_from_data(
...     power, cooling, "R134a", reference_state
... )
>>> eta_s_poly
array([ 3.44223012e-03, -3.75139140e-02,  4.39204462e-02, -9.21644870e-04,
        1.68576190e-03, -8.97540501e-04, -7.54781107e-06,  1.61377008e-05,
       -1.53820046e-05,  5.04818089e-06])
>>> eta_vol_poly
array([ 5.81192914e-03, -7.18820053e-04,  7.41463587e-02,  2.84410052e-05,
        6.51372426e-05, -1.89872495e-03,  7.84206012e-07, -1.90585865e-06,
        4.52695494e-07,  1.51321175e-05])

We can take these polynomials and set them on the compressor instance together with the reference state and the assumption on heat dissipation. On top we need to specify the share of dissipated heat, that can be utilized by the cooling fluid.

>>> compressor.set_attr(
...     eta_s_poly=eta_s_poly, eta_vol_poly=eta_vol_poly,
...     dissipation_ratio=0.05, eta_recovery=0.9,
...     reference_state=reference_state
... )

First, we can impose the boundary conditions on “c1” that are equal to the displacement reference state. In that case, we should be able to get the same displacement value as inputted into the reference.

>>> c1.set_attr(fluid={"R134a": 1}, T=0, td_dew=10)  # T_evap=-10°C
>>> compressor.set_attr(rpm=1200)
>>> c2.set_attr(T_dew=50)
>>> b1.set_attr(fluid={"water": 1}, T=20, p=1)
>>> b2.set_attr(T=40)
>>> compressor.set_attr(dp_cooling=0)
>>> nw.solve("design")
>>> round(c1.v.val * 3600 / compressor.eta_vol.val, 2)
214.0
>>> round(compressor.eta_s.val, 3)
0.5
>>> round(compressor.eta_vol.val, 3)
0.814

The mass flow of cooling water is a result of the dissipated heat:

>>> round(compressor.Q_diss.val_SI * compressor.eta_recovery.val_SI)
-1727
>>> round(b1.m.val, 3)
0.021

We can also double check our resulting isentropic and volumetric efficiency values with the evaluation of the polynomials.

>>> from tespy.components.displacementmachinery.polynomial_compressor import (
...     calc_EN12900
... )
>>> round(compressor.eta_s.val, 3) == round(calc_EN12900(eta_s_poly, -10, 50), 3)
np.True_
>>> round(compressor.eta_vol.val, 3) == round(calc_EN12900(eta_vol_poly, -10, 50), 3)
np.True_

Tip

You can also create polynomials for power and cooling from respective data. For that, import the tespy.components.displacementmachinery.polynomial_compressor.fit_EN12900() method and pass the respective data.

We can also check the compressor power. It is higher than the power of an adiabatic compressor due to the heat dissipation. The compressor power plus heat dissipation will give the actual power required for isentropic compression. The heat dissipation is negative due to the heat leaving the component.

>>> round(compressor.P.val)
38385
>>> round(compressor.Q_diss.val)
-1919
>>> round(compressor.P.val + compressor.Q_diss.val)
36466

Now, let’s see what happens, if evaporation or condensation temperature change:

>>> c1.set_attr(T=20, td_dew=10)  # T_evap=10°C
>>> c2.set_attr(T_dew=40)
>>> nw.solve("design")
>>> round(compressor.eta_s.val, 3)
0.665
>>> round(compressor.eta_vol.val, 3)
0.924

It is also possible, to make the rpm a variable. This is useful, in case mass flow through the compressor is governed from external. Usually, this could be the case, if a specific heat transfer is required to be provided by the condenser or from the evaporator. In this case, we just fix the displacement to mimic that.

>>> compressor.set_attr(rpm="var")
>>> c1.set_attr(v=400/3600)
>>> nw.solve("design")
>>> round(compressor.rpm.val)
2427

As final remarks: You can also set fixed isentropic and fixed volumetric efficiencies for these components.

calc_parameters()[source]

Postprocessing parameter calculation.

cooling_energy_balance_dependents()[source]
cooling_energy_balance_func()[source]

Energy balance equation for the cooling port

Returns:

float – residual of equation

\[0 = \dot m_\text{in,2} \cdot \left( h_\text{out,2} - h_\text{in,2}\right) + \dot m_\text{in,1} \cdot \left( h_\text{out,1} - \frac{h_\text{out,1}}{1 - \text{diss_ratio}} + \frac{h_\text{in,1}\cdot\text{diss_ratio}}{1 - \text{diss_ratio}} \right)\]

get_mandatory_constraints() dict[source]
get_parameters()[source]
static inlets()[source]
static outlets()[source]