-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcomplex_example_results.py
More file actions
37 lines (30 loc) · 1.32 KB
/
complex_example_results.py
File metadata and controls
37 lines (30 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
This script shows how load results of a prior calcualtion and how to analyze them.
"""
import flixopt as fx
if __name__ == '__main__':
fx.CONFIG.exploring()
# --- Load Results ---
try:
results = fx.results.Results.from_file('results', 'complex example')
except FileNotFoundError as e:
raise FileNotFoundError(
f"Results file not found in the specified directory ('results'). "
f"Please ensure that the file is generated by running 'complex_example.py'. "
f'Original error: {e}'
) from e
# --- Basic overview ---
results.plot_network()
results['Fernwärme'].plot_node_balance()
# --- Detailed Plots ---
# In depth plot for individual flow rates ('__' is used as the delimiter between Component and Flow
results.plot_heatmap('Wärmelast(Q_th_Last)|flow_rate')
for bus in results.buses.values():
bus.plot_node_balance_pie(show=False, save=f'results/{bus.label}--pie.html')
bus.plot_node_balance(show=False, save=f'results/{bus.label}--balance.html')
# --- Plotting internal variables manually ---
results.plot_heatmap('BHKW2(Q_th)|on')
results.plot_heatmap('Kessel(Q_th)|on')
# Dataframes from results:
fw_bus = results['Fernwärme'].node_balance().to_dataframe()
all = results.solution.to_dataframe()