-
Notifications
You must be signed in to change notification settings - Fork 1
/
8_analyze_RBC_v2.py
52 lines (42 loc) · 1.79 KB
/
8_analyze_RBC_v2.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
# this script is used to plot temperature and CO2 evolution under rule based control
# figures are saved in fig_rbc
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#read constraints and optimization period
constr=pd.read_csv(os.path.join('new_results','mpc_ideal_occ_v2','240_qr_200','20-601b-2','constr.csv'))
tindex = pd.read_csv(os.path.join('new_results','mpc_ideal_occ_v2','240_qr_200','20-601b-2','tindex.csv'))
tindex['datetime'] = pd.to_datetime(tindex['datetime'])
tindex['time'] /= 3600.
t = tindex['time'].values
zones=['20-601b-2']
for zone in zones:
res=os.path.join('new_results','rbc_Tc_Th_v2',zone)
out_dir=os.path.join('new_results','figs_rbc_Tc_Th_v2',zone)
if not os.path.exists(out_dir):
os.makedirs(out_dir)
ydf=pd.read_csv(os.path.join(res,'ydf.csv'))
q_total=(ydf['qr'].abs()/1000.).sum()
Q=pd.DataFrame({'Q':[q_total]})
Q.to_csv(os.path.join(out_dir,'Q.csv'))
#plotting indoor temperature vs. constraints
plt.figure(figsize=(10,4),dpi=150)
plt.plot(constr['Tair_lo'], color='black', ls='--', lw=1.0)
plt.plot(constr['Tair_hi'], color='black', ls='--', lw=1.0)
plt.plot(ydf['T'],color='r' )
plt.title('Indoor temperature vs. constraints')
plt.xticks(np.arange(0,t[-1],24))
plt.ylabel('T[K]')
plt.xlabel('t[h]')
plt.savefig(os.path.join(out_dir,'T.png'))
# Plot indoor CO2 vs. constraints
plt.figure(figsize=(10,4),dpi=150)
plt.plot(constr['CO2_lo'], color='black', ls='--', lw=1.0)
plt.plot(constr['CO2_hi'], color='black', ls='--', lw=1.0)
plt.plot(ydf['CO2'],color='b')
plt.title('CO2 concentration vs. constraints')
plt.xticks(np.arange(0,t[-1],24))
plt.ylabel('C[ppm]')
plt.xlabel('t[h]')
plt.savefig(os.path.join(out_dir,'CO2.png'))