enex_analysis.refrigerant

Refrigerant cycle calculations and optimization.

Functions

calc_ref_state(T_evap_K, T_cond_K, ...[, ...])

냉매 사이클의 State 1-4 열역학 물성치를 계산하는 공통 함수.

create_lmtd_constraints()

Create LMTD-based constraint functions for cycle optimization.

find_ref_loop_optimal_operation(...[, ...])

Find the optimal operation point for the refrigerant loop.

enex_analysis.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)[source]

냉매 사이클의 State 1-4 열역학 물성치를 계산하는 공통 함수.

증기압축 사이클의 4개 주요 상태점을 계산합니다:

  • State 1 (cmp_in): 압축기 입구 (증발기 출구, 저압 과열 증기)

  • State 2 (cmp_out): 압축기 출구 (응축기 입구, 고압 과열 증기)

  • State 3 (exp_in): 팽창밸브 입구 (응축기 출구, 고압 과냉 액체)

  • State 4 (exp_out): 팽창밸브 출구 (증발기 입구, 저압 2상 혼합물)

키 배정은 항상 물리적 압축기 입출구 기준이며, mode 값은 결과 dict의 "mode" 키에만 기록됩니다.

Note

냉방/난방 모드에서 어느 HX가 증발기/응축기인지는 호출측 (_calc_state)에서 T_evap_K, T_cond_K를 결정하여 전달합니다.

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)

Return type:

dict[str, Any]

enex_analysis.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.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