diagram_ph/tests/test_economizer_unit.py

20 lines
661 B
Python

import sys, os
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if ROOT not in sys.path:
sys.path.insert(0, ROOT)
from app.core.refrigerant_loader import RefrigerantLibrary
from app.services.cycle_calculator import CycleCalculator
def test_economizer_runs():
refrigerant = RefrigerantLibrary('R290')
calc = CycleCalculator(refrigerant)
evap = 0.2 * 1e5
cond = 6.0 * 1e5
inter = 2.0 * 1e5
res = calc.calculate_cycle_with_economizer(evap, cond, inter, mass_flow=0.1)
assert 'performance' in res
assert 'flash_fraction' in res['performance']
assert 0.0 <= res['performance']['flash_fraction'] <= 1.0