Spaces:
Running
Running
| import requests | |
| payload = { | |
| "project_notes": "Test", | |
| "pinch_notes": "Test", | |
| "map_snapshots_encoded": {"OpenStreetMap": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="}, | |
| "map_center": [47.5, 8.5], | |
| "map_zoom": 17.5, | |
| "current_base": "OpenStreetMap", | |
| "processes": [{"name": "Proc1", "streams": [{"name": "S1", "stream_values": {"Tin": 100, "Tout": 50, "CP": 1, "Q": 50}, "type": "Hot"}]}], | |
| "proc_groups": [[0]], | |
| "proc_group_names": ["Group1"], | |
| "proc_group_coordinates": {"0": {"lat": 47.5, "lon": 8.5, "box_scale": 1}}, | |
| "selected_streams": [{"name": "Proc1 - S1", "Tin": 100, "Tout": 50, "CP": 1, "Q": 50, "type": "Hot"}, | |
| {"name": "Proc2 - S1", "Tin": 20, "Tout": 80, "CP": 1, "Q": 60, "type": "Cold"}], | |
| "t_min": 10.0, | |
| "pinch_result": { | |
| "pinch_temperature": 75.0, | |
| "hot_utility": 0.0, | |
| "cold_utility": 50.0, | |
| "T_min": 10.0, | |
| "temperatures": [100, 50], | |
| "problem_table": [], | |
| "heat_cascade": [{"deltaH": 0}], | |
| "unfeasible_heat_cascade": [], | |
| "shifted_composite_diagram": {"hot": {"H": [0, 50], "T": [100, 50]}, "cold": {"H": [], "T": []}}, | |
| "composite_diagram": {"hot": {"H": [0, 50], "T": [100, 50]}, "cold": {"H": [0, 60], "T": [20, 80]}}, | |
| "grand_composite_curve": {"H": [0, 50], "T": [100, 50]}, | |
| "streams_data": [{"ss": 0, "st": 50, "type": "HOT"}] | |
| }, | |
| "heat_pumps": [], | |
| "energy_demands": [] | |
| } | |
| try: | |
| res = requests.post("http://localhost:8000/api/analysis/report", json=payload) | |
| with open("report_test.html", "w") as f: | |
| f.write(res.text) | |
| print("Status:", res.status_code) | |
| except Exception as e: | |
| print(e) | |