Heat Pump and Refrigeration
The Heat Pump and refrigeration stack is the most specialised part of the OpenPinch codebase. It combines preprocessing of background cascades, thermodynamic cycle models, and black-box optimisation to screen direct and indirect integration opportunities.
Where To Start
Most users should still begin with the higher-level surfaces documented in Core API:
problem.target.direct_heat_pump(...)problem.target.indirect_heat_pump(...)problem.target.direct_refrigeration(...)problem.target.indirect_refrigeration(...)
The modules on this page are the lower-level implementation layers behind those helpers.
Package Overview
Heat Pump and refrigeration targeting services.
Public HPR Entrypoints
Public entrypoint for heat pump and refrigeration targeting.
- OpenPinch.services.heat_pump_integration.heat_pump_and_refrigeration_entry.compute_direct_heat_pump_or_refrigeration_target(zone, is_heat_pumping, args=None)[source]
Solve an explicit direct Heat Pump or refrigeration target for one zone.
- Parameters:
- Return type:
Shared Preprocessing and Optimisation Helpers
Common helpers shared across heat pump targeting models.
Normalisation helpers for optimisation vectors used in HP targeting.
- OpenPinch.services.heat_pump_integration.common.encoding.map_x_arr_to_T_arr(x, T_0, T_1)[source]
Map cumulative optimisation fractions onto descending stage temperatures.
- OpenPinch.services.heat_pump_integration.common.encoding.map_T_arr_to_x_arr(T_arr, T_0, T_1)[source]
Encode descending stage temperatures as cumulative optimisation fractions.
- OpenPinch.services.heat_pump_integration.common.encoding.map_x_arr_to_DT_arr(x, T_arr, T_last)[source]
Scale optimisation fractions into temperature differences.
- OpenPinch.services.heat_pump_integration.common.encoding.map_DT_arr_to_x_arr(DT_arr, T_arr, T_last)[source]
Normalise temperature differences back into optimisation fractions.
- OpenPinch.services.heat_pump_integration.common.encoding.map_x_arr_to_Q_arr(x, Q_max)[source]
Scale optimisation fractions into heat duties.
- OpenPinch.services.heat_pump_integration.common.encoding.map_Q_arr_to_x_arr(Q_arr, Q_max)[source]
Normalise heat duties back into optimisation fractions.
- OpenPinch.services.heat_pump_integration.common.encoding.map_x_to_Q_amb(x, scale)[source]
Split one signed bounded ambient variable into hot and cold duties.
xis interpreted on the open interval(-1, 1)and decoded throughatanhso the mapping stays close to linear around zero while ambient duties remain unbounded.
- OpenPinch.services.heat_pump_integration.common.encoding.map_Q_amb_to_x(Q_amb_hot, Q_amb_cold, scale)[source]
Encode ambient duties back into one bounded signed decision variable.
Preprocessing helpers for heat pump and refrigeration targeting.
- OpenPinch.services.heat_pump_integration.common.preprocessing.construct_HPRTargetInputs(Q_hpr_target, T_vals, H_hot, H_cold, *, is_heat_pumping=True, zone_config, idx=0, debug=False)[source]
Prepare normalised background cascades and solver arguments for HPR targeting.
- Parameters:
- Return type:
Run the configured multistart optimiser and post-process the best result.
- Parameters:
f_obj (Callable)
bnds (list)
args (HeatPumpTargetInputs)
- Return type:
Convert a temperature-enthalpy profile into piecewise stream segments.
- Parameters:
- Return type:
Read stage duties from a background profile at proposed HPR temperatures.
Return the entropic mean temperature for a distributed heat load.
Compute a Carnot-based heating COP with a second-law efficiency factor.
Compute a Carnot-based heat-engine efficiency with a second-law factor.
Return one refrigerant name per vapour-compression stage.
- Parameters:
num_stages (int)
args (HeatPumpTargetInputs)
- Return type:
Build one combined HPR utility stream collection for Carnot-cycle summaries.
- Parameters:
T_cond (ndarray)
Q_cond (ndarray)
T_evap (ndarray)
Q_evap (ndarray)
args (HeatPumpTargetInputs)
- Return type:
Build ambient-air exchange streams implied by the solved HPR result.
- Parameters:
Q_amb_hot (float)
Q_amb_cold (float)
args (HeatPumpTargetInputs)
- Return type:
Return the scalar screening objective used by HPR placement solvers.
Shared Carnot-family accounting, plotting, and result assembly.
Shared simulated-vapour accounting, plotting, and result assembly.
- Parameters:
args (HeatPumpTargetInputs)
state (HPRParsedState)
work (float)
Q_heat (ndarray)
Q_cool (ndarray)
cop_h (float)
hpr_streams (StreamCollection)
model (Any)
penalty_terms (Any)
dT_subcool (ndarray | None)
dT_superheat (ndarray | None)
debug (bool)
- Return type:
Plot background source/sink profiles alongside solved HPR cycle streams.
- Parameters:
T_hot (ndarray)
H_hot (ndarray)
T_cold (ndarray)
H_cold (ndarray)
hpr_hot_streams (StreamCollection)
hpr_cold_streams (StreamCollection)
idx (int)
title (str)
- Return type:
plotly.graph_objects.Figure
Prepare, calculate, and analyse the problem table for given streams.
- Parameters:
hot_streams (StreamCollection)
cold_streams (StreamCollection)
all_streams (StreamCollection)
is_shifted (bool)
known_heat_recovery (float)
extra_T_intervals (list)
is_full_analysis (bool)
idx (int | None)
- Return type:
Prepare and calculate the utility heat cascade for a utility set.
- Parameters:
T_int_vals (ndarray)
hot_utilities (StreamCollection)
cold_utilities (StreamCollection)
is_shifted (bool)
idx (int | None)
- Return type:
ProblemTableUpdateKwargs
Cycle Optimisation Modules
Brayton HP targeting.
- OpenPinch.services.heat_pump_integration.cycles.brayton.optimise_brayton_heat_pump_placement(args)[source]
Optimise a single-stage Brayton Heat Pump placement against the background.
- Parameters:
args (HeatPumpTargetInputs)
- Return type:
None