# Generate performance data from heat pump model

This example demonstrates the use of the heat pump module to calculate the heat pump heating capacity and power input. For a given set of parameters, the heating capacity and power input is calculated for various combinations of inlet water temperatures and mass flow rates at the evaporator and condenser inlets.

Results from the heat pump model are saved into the file Buildings/Resources/src/fluid/heatpumps/calibration/Examples/somePerformanceData.txt.

The following script can be found in Buildings/Resources/src/fluid/heatpumps/calibration/Examples/example_calibration.py:

     1# -*- coding: utf-8 -*-
     2""" Example use of the heat pump model to generate performance data.
     3
     4This script demonstrates the use of the heat pump model to generate performance
     5data. Data is generated for a heat pump with a scroll compressor and some
     6combinations of inlet water temperatures and mass flow rates on the source
     7and load sides. The resulting performance data is written to a text file.
     8
     9"""
    10from __future__ import division, print_function, absolute_import
    11
    12import os
    13import sys
    14
    15
    16def main():
    17    # Add parent directory to system path
    18    parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    19    sys.path.insert(1, parent_dir)
    20    # Import Heat pump and calibration module
    21    import PythonModel as hp
    22    # Change working directory to current directory
    23    os.chdir(os.path.dirname(__file__))
    24    # Set to True if calibrating for cooling mode
    25    CoolingMode = False
    26    # File name for performance data
    27    tableFileName = 'somePerformanceData.txt'
    28
    29    # Initialize the heat pump model
    30    P_nominal = 17.5e3         # Nominal heat pump power input (W).
    31    COP_nominal = 4.0          # Nominal COP of the heat pump (-)
    32    Q_nominal = P_nominal*COP_nominal  # Nominal heat pump capacity (W).
    33
    34    # Model parameters
    35    volRat = 2.365             # Volume ratio (-).
    36    V_flow_nominal = 0.00288   # Nominal refrigerant volume flow rate (kg/s).
    37    leaCoe = 0.0041            # Leakage coefficient (kg/s)
    38    etaEle = 0.924             # Elctro-mechanical efficiency (-).
    39    PLos = 396.1               # Constant part of the power losses (W).
    40    dTSup = 6.84               # Degree of superheating (K).
    41    UACon = 7007.7             # Condenser heat transfer coefficient (W/K).
    42    UAEva = 29990.9            # Evaporator heat transfer coefficient (W/K).
    43
    44    # Boundary conditions
    45    # Source-side water mass flow rates (L/s)
    46    mSou_flow = [0.6, 0.9, 1.2]
    47    # Load-side water mass flow rates (L/s)
    48    mLoa_flow = [0.6, 0.9, 1.2]
    49    # Source-side entering water temperatures (K)
    50    TSou = [273.15, 278.15, 283.15, 288.15, 293.15, 298.15]
    51    # Load-side entering water temperatures (K)
    52    TLoa = [288.15, 298.15, 308.15, 318.15]
    53
    54    # -------------------------------------------------------------------------
    55    # Initialize all models using given parameters values.
    56    # -------------------------------------------------------------------------
    57    # Compressor model (Scroll)
    58    com = hp.compressors.ScrollCompressor([volRat,
    59                                           V_flow_nominal,
    60                                           leaCoe,
    61                                           etaEle,
    62                                           PLos,
    63                                           dTSup])
    64    # Condenser model
    65    con = hp.heatexchangers.EvaporatorCondenser([UACon])
    66    # Evaporator model
    67    eva = hp.heatexchangers.EvaporatorCondenser([UAEva])
    68    # Refrigerant model
    69    ref = hp.refrigerants.R410A()
    70    # Fluid model on condenser side
    71    fluCon = hp.fluids.ConstantPropertyWater()
    72    # Fluid model on evaporator side
    73    fluEva = hp.fluids.ConstantPropertyWater()
    74    # Heat pump model
    75    heaPum = hp.heatpumps.SingleStageHeatPump(
    76        com, con, eva, ref, fluCon, fluEva, Q_nominal, P_nominal, CoolingMode)
    77
    78    # -------------------------------------------------------------------------
    79    # Evaluate heat pump peformance at all combinations of boundary conditions.
    80    # -------------------------------------------------------------------------
    81    with open(tableFileName, 'w') as f:
    82        for TS in TSou:
    83            for mS in mSou_flow:
    84                for TL in TLoa:
    85                    for mL in mLoa_flow:
    86                        # Evaluate capacity, source-side heat transfer rate and
    87                        # power input.
    88                        Cap = heaPum.get_Capacity(TS, TL, mS, mL)/1e3
    89                        HR = heaPum.get_SourceSideTransferRate(TS, TL, mS, mL)/1e3
    90                        Power = heaPum.get_Power(TS, TL, mS, mL)/1e3
    91                        # Write to text file.
    92                        f.write('{}\t{}\t{}\t{}\t{}\t{}\t{}\n'.format(
    93                                TS, TL, mS, mL, Cap, HR, Power))
    94    return
    95
    96# Main function
    97if __name__ == '__main__':
    98    main()