diagram_ph/scripts/test_economizer.py

29 lines
879 B
Python

import os
import sys
# Ensure project root is on sys.path so 'app' package is importable when running scripts
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
# Create refrigerant and calculator
refrig = RefrigerantLibrary('R290')
calc = CycleCalculator(refrig)
# Typical pressures in Pa (convert from bar)
evap = 0.2 * 1e5
cond = 6.0 * 1e5
inter = 2.0 * 1e5
res = calc.calculate_cycle_with_economizer(evap, cond, inter, superheat=5.0, subcool=3.0, mass_flow=0.1)
print('Economizer result keys:', res.keys())
print('Flash fraction:', res['performance'].get('flash_fraction'))
print('COP:', res['performance'].get('cop'))
print('Points:')
for p in res['points']:
print(' -', p)