# Heat pump models

class PythonModel.heatpumps.SingleStageHeatPump(com, con, eva, ref, fluCon, fluEva, Q_nominal, P_nominal, CoolingMode=False)

  Bases: `object`

  Object for heat pump model based on Jin (2002):

    H. Jin. Parameter estimation based models of water source heat pumps. PhD Thesis. Oklahoma State University. Stillwater, Oklahoma, USA. 2002.

  Parameters

    - eva – Evaporator model.

    - con – Condenser model.

    - ref – Refrigerant model.

    - fluCon – Fluid model for fluid on the condenser side.

    - fluEva – Fluid model for fluid on the evaporator side.

    - Q_nominal – Nominal heat pump capacity (W).

    - P_nominal – Nominal heat pump power input (W).

    - CoolingMode – Boolean, True if heat pump is in cooling mode.

  get_Capacity(EWT_Source, EWT_Load, flowSource, flowLoad)

    Return heat pump capacity.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

    Returns

      Heat pump capacity (W).

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> '%.2f' % heaPum.get_Capacity(298.8, 311.0, 0.71, 0.71)
          '24124.81'

  get_CondenserHeatTransferRate(EWT_Source, EWT_Load, flowSource, flowLoad)

    Evaluate condenser heat transfer rate.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

    Returns

      condenser heat transfer rate (W).

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> '%.2f' % heaPum.get_CondenserHeatTransferRate(298.8, 311.0, 0.71, 0.71)
          '24124.81'

  get_EvaporatorHeatTransferRate(EWT_Source, EWT_Load, flowSource, flowLoad)

    Evaluate evaporator heat transfer rate.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

    Returns

      Evaporator heat transfer rate (W).

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> '%.2f' % heaPum.get_EvaporatorHeatTransferRate(298.8, 311.0, 0.71, 0.71)
          '-19413.08'

  get_Power(EWT_Source, EWT_Load, flowSource, flowLoad)

    Evaluate heat pump power input.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

    Returns

      Heat pump power input (W).

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> '%.2f' % heaPum.get_Power(298.8, 311.0, 0.71, 0.71)
          '4711.73'

  get_SourceSideTransferRate(EWT_Source, EWT_Load, flowSource, flowLoad)

    Return heat pump source side heat transfer rate.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

    Returns

      Heat pump source side heat transfer rate (W).

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> '%.2f' % heaPum.get_SourceSideTransferRate(298.8, 311.0, 0.71, 0.71)
          '19413.08'

  initialGuessParameters(data)

    Initialize guess parameters for calibration of the heat pump model.

    Parameters

      data – Heat pump performance data.

    Returns

      A list of parameters to the compressor model, a list of tuples of the bounds of the parameters (min, max) for the calibration routine.

  modelicaCalibrationModelPath()
    Returns the full path to the heat pump model for calibration in the

      IBPSA library.

    Returns

      Full path to the compressor model in the IBPSA library.

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> heaPum.modelicaCalibrationModelPath()
          'IBPSA.Fluid.HeatPumps.Calibration.ScrollWaterToWater'

  modelicaModelName()
    Returns the name of the heat pump model for calibration in the

      IBPSA library.

    Returns

      Full path to the compressor model in the IBPSA library.

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> heaPum.modelicaModelName()
          'ScrollWaterToWater'

  modelicaModelPath()

    Returns the full path to the heat pump model in the Buildings library.

    Returns

      Full path to the compressor model in the IBPSA library.

    Usage: Type

          >>> import compressors
          >>> import heatexchangers
          >>> import fluids
          >>> import refrigerants
          >>> com = compressors.ScrollCompressor([2.362, 0.00287, 0.0041, 0.922, 398.7, 6.49])
          >>> eva = heatexchangers.EvaporatorCondenser([21523])
          >>> con = heatexchangers.EvaporatorCondenser([2840.4])
          >>> flu = fluids.ConstantPropertyWater()
          >>> ref = refrigerants.R410A()
          >>> heaPum = SingleStageHeatPump(com, con, eva, ref, flu, flu, 19300.0, 4289.0)
          >>> heaPum.modelicaModelPath()
          'IBPSA.Fluid.HeatPumps.ScrollWaterToWater'

  printParameters()

    Prints the value of the model parameters.

  reinitializeParameters(parameters)

    Reinitializes the heat pump using new parameters.

    Parameters

      parameters – Heat pump parameters.

  set_ModelicaParameters(simulator)

    Set parameter values for simulation in dymola.

    Parameters

      simulator – Simulator object (BuildingsPy)

    Returns

      Simulator object (BuildingsPy)

  set_State(EWT_Source, EWT_Load, flowSource, flowLoad, tol=1e-06, relax=0.7)

    Evaluates the current state of the heat pump.

    Parameters

      - EWT_Source – Entering water temperature on the source side (K).

      - EWT_Load – Entering water temperature on the load side (K).

      - flowSource – Fluid mass flow rate on the source side (kg/s).

      - flowLoad – Fluid mass flow rate on the load side (kg/s).

      - tol – Relative tolerance on the evaluation of the capacity and heat pump power input (-).

      - relax – Relaxation factor for the iteration procedure (-).