26 lines
875 B
Python
26 lines
875 B
Python
import requests, json
|
|
base = 'http://127.0.0.1:8001'
|
|
print('Health ->', requests.get(base + '/api/v1/health').json())
|
|
|
|
body = {
|
|
'refrigerant': 'R290',
|
|
'evap_temperature': -10.0, # °C
|
|
'cond_temperature': 40.0, # °C
|
|
'superheat': 5.0,
|
|
'subcool': 2.0,
|
|
'mass_flow': 0.1
|
|
}
|
|
print('\nRequesting simple cycle (temperature mode)...')
|
|
r = requests.post(base + '/api/v1/cycles/simple', json=body, timeout=60)
|
|
print('Status', r.status_code)
|
|
try:
|
|
j = r.json()
|
|
print('Keys:', list(j.keys()))
|
|
if 'performance' in j:
|
|
print('COP:', j['performance'].get('cop'))
|
|
print('Compressor efficiency:', j['performance'].get('compressor_efficiency'))
|
|
if 'diagram_data' in j:
|
|
print('Diagram cycle points count:', len(j['diagram_data'].get('cycle_points', [])))
|
|
except Exception as e:
|
|
print('Failed to parse JSON:', e, r.text[:200])
|