enex_analysis.tmhp.refrigerant¶
Refrigerant cycle calculations and optimization.
Functions
|
Compute the four thermodynamic state points of the refrigerant cycle. |
Create LMTD-based constraint functions for cycle optimization. |
|
|
Find the optimal operation point for the refrigerant loop. |
- enex_analysis.tmhp.refrigerant.calc_ref_state(T_evap_K, T_cond_K, refrigerant, eta_cmp_isen, mode='heating', dT_superheat=0.0, dT_subcool=0.0, is_active=True, rps=None)[source]¶
Compute the four thermodynamic state points of the refrigerant cycle.
The vapour-compression cycle has four canonical state points:
State 1 (
cmp_in): compressor inlet — low-pressure superheated vapour at the evaporator outlet.State 2 (
cmp_out): compressor outlet — high-pressure superheated vapour at the condenser inlet.State 3 (
exp_in): expansion-valve inlet — high-pressure subcooled liquid at the condenser outlet.State 4 (
exp_out): expansion-valve outlet — low-pressure two-phase mixture at the evaporator inlet.
Keys in the returned dict are always assigned by the physical compressor / expander ports; the
modeargument is preserved verbatim under the"mode"key but does not change the key naming.Note
Whether a given heat exchanger acts as the evaporator or the condenser in heating versus cooling mode is decided by the caller (
_calc_state), which choosesT_evap_KandT_cond_Kaccordingly before calling this function.- Parameters:
T_evap_K (
float)T_cond_K (
float)refrigerant (
str)eta_cmp_isen (
float|Callable)mode (
str)dT_superheat (
float)dT_subcool (
float)is_active (
bool)rps (
float|None)
- Return type:
dict[str,Any]
- enex_analysis.tmhp.refrigerant.create_lmtd_constraints()[source]¶
Create LMTD-based constraint functions for cycle optimization.
Optimization requires that the heat transfer calculated by LMTD matches the heat transferred by the refrigerant cycle.
- Returns:
Tuple of constraint functions (constraint_tank, constraint_hx).
- Return type:
tuple[Any, Any]
- enex_analysis.tmhp.refrigerant.find_ref_loop_optimal_operation(simulator_func, refrigerant, load_W, initial_guess, bounds, constraint_funcs=None)[source]¶
Find the optimal operation point for the refrigerant loop.
Minimizes compressor power while satisfying target load and LMTD constraints.
- Parameters:
simulator_func (callable) – Function that takes [dT_ref_HX, dT_ref_tank] and returns a perf dict.
refrigerant (str) – Refrigerant name.
load_W (float) – Target heat load [W].
initial_guess (list[float]) – Initial guess for [dT_evap, dT_cond].
bounds (list[tuple[float, float]]) – Bounds for [dT_evap, dT_cond].
constraint_funcs (list[callable], optional) – List of constraint functions. Each takes perf and returns a value that should be 0.
- Returns:
Optimal performance dictionary, or None if optimization fails.
- Return type:
dict[str, Any] | None