-
Notifications
You must be signed in to change notification settings - Fork 5
/
plot_pwr_flex_rigid.py
139 lines (119 loc) · 4.68 KB
/
plot_pwr_flex_rigid.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 14 11:12:32 2021
@author: ozgo
Plot pwr files without wetb
"""
# ============================================================================
import numpy as np
from matplotlib import pyplot as plt
# ============================================================================
# INPUTS
# ============================================================================
f_name_1 = './V2/results/hawc2s/ind/rigid/V2_hs2.pwr'
f_name_2 = './V2/results/hawc2s/ind/flex/V2_hs2.pwr'
path_dtu_rigid = './DTU10MW/results/hawc2s/DTU_10MW_rigid_hawc2s.pwr'
path_dtu_flexible = './DTU10MW/results/hawc2s/DTU_10MW_flexible_hawc2s.pwr'
path_V1_rigid = './V1/results/hawc2s/DTU_10MW_redesign_rigid_hawc2s.pwr'
path_V1_flexible = './V1/results/hawc2s/DTU_10MW_redesign_flexible_hawc2s.pwr'
#
p_lab = ['Rigid','Flex']
ch_i = [1,2,8,10,11,12] #[10,11,8,6] #
# ============================================================================
df_1 = np.loadtxt(f_name_1, skiprows=1)
df_2 = np.loadtxt(f_name_2, skiprows=1)
with open(f_name_1) as f:
a = f.readline()
b = list(filter(None,a.split('#')[1].split(' ')))
col_name = [' '.join(i.split()[:-1]) for i in b]
# ============================================================================
# PLOTS
#============================================================================
px = np.zeros((df_1.shape[0],len(ch_i),2))
py = np.zeros((df_2.shape[0],len(ch_i),2))
#
for i in range(len(ch_i)):
px[:,i,0] = df_1[:,0].copy()
px[:,i,1] = df_2[:,0].copy()
py[:,i,0] = df_1[:,ch_i[i]].copy() #- a[i]
py[:,i,1] = df_2[:,ch_i[i]].copy() #- b[i]
#
ylab = []
xlab = []
for i in range(len(ch_i)):
ylab += ['%s' %col_name[ch_i[i]]]
xlab += ['Wind speed [m/s]']
p_clr = ['#C4000D','#000000','#1F3DFF','#C4000D','#C4000D','#1F3DFF',]
p_mrk = ['o','s','v','o','s','v']
p_mrk_f = ['full','full','full','none','none','none']
p_line = ['solid','solid','solid',(0, (5, 5)),(0, (5, 5)),(0, (5, 5))] #(0, (1, 10)),
p_mrk_s = [3.0, 3.0, 3.0, 4.0, 4.0, 4.0]
p_mrk_e = [1.0, 1.0, 1.0, 1.5, 1.5, 1.5]
p_mrk_every_t = [50, 50, 50, 50, 50, 50]
p_mrk_every_s = [1, 1, 1, 1, 1, 1]
p_line_t = [2, 2, 2, 2, 2, 2]
#
font_size = 10
p_size = [16,8]
p_adjust = [0.07,0.13,0.98,0.98]
#
fig, axs = plt.subplots(2,int(len(ch_i)/2))
fig.set_size_inches(p_size[0],p_size[1])
fig.subplots_adjust(left=p_adjust[0], bottom=p_adjust[1],
right=p_adjust[2], top=p_adjust[3],wspace = 0.17)
#
i_c = 0
for j_i in range(2):
for j in range(int(len(ch_i)/2)):
i = 0
axs[j_i,j].plot(px[:,i_c,0], py[:,i_c,0],marker=p_mrk[i],label=p_lab[i],
markersize=p_mrk_s[i],linestyle=p_line[i],
fillstyle=p_mrk_f[i],color=p_clr[i],
markeredgewidth=p_mrk_e[i],linewidth=p_line_t[i])
i = 1
axs[j_i,j].plot(px[:,i_c,1], py[:,i_c,1],marker=p_mrk[i],label=p_lab[i],
markersize=p_mrk_s[i],linestyle=p_line[i],
fillstyle=p_mrk_f[i],color=p_clr[i],
markeredgewidth=p_mrk_e[i],linewidth=p_line_t[i])
axs[j_i,j].set_ylabel(ylab[i_c], fontsize=font_size)
axs[j_i,j].legend(bbox_to_anchor=(0.0, 0.99),fontsize=font_size
,loc=2, ncol=1)
i_c = i_c +1
#
#
for i in range(int(len(ch_i)/2)):
axs[1,i].set_xlabel(xlab[i], fontsize=font_size)
#
for ax in fig.get_axes():
ax.tick_params(axis='both', labelsize=font_size)
ax.grid(which='major',axis='both', linestyle=':', linewidth=1)
#%% Defletions
df_dtu_rigid = np.loadtxt(path_dtu_rigid, skiprows=1)
df_dtu_flexible = np.loadtxt(path_dtu_flexible, skiprows=1)
df_V1_rigid = np.loadtxt(path_V1_rigid, skiprows=1)
df_V1_flexible = np.loadtxt(path_V1_flexible, skiprows=1)
plt.figure()
plt.plot(df_2[:,0], df_dtu_flexible[:,10]-df_dtu_rigid[:,10], 'k')
plt.plot(df_2[:,0], df_V1_flexible[:,10]-df_V1_rigid[:,10], 'r')
plt.plot(df_2[:,0], df_2[:,10]-df_1[:,10],'b')
plt.grid()
plt.xlabel('$U_{\infty}$ [m/s]')
plt.ylabel('$\Delta x$ [m]')
plt.legend(['DTU 10MW', 'Redesign V1', 'Redesign V2'])
plt.figure()
plt.plot(df_2[:,0], df_dtu_flexible[:,11]-df_dtu_rigid[:,11], 'k')
plt.plot(df_2[:,0], df_V1_flexible[:,11]-df_V1_rigid[:,11], 'r')
plt.plot(df_2[:,0], df_2[:,11]-df_1[:,11],'b')
plt.grid()
plt.xlabel('$U_{\infty}$ [m/s]')
plt.ylabel('$\Delta y$ [m]')
plt.legend(['DTU 10MW', 'Redesign V1', 'Redesign V2'])
plt.figure()
plt.plot(df_2[:,0], df_dtu_flexible[:,12]-df_dtu_rigid[:,12], 'k')
plt.plot(df_2[:,0], df_V1_flexible[:,12]-df_V1_rigid[:,12], 'r')
plt.plot(df_2[:,0], df_2[:,12]-df_1[:,12],'b')
plt.grid()
plt.xlabel('$U_{\infty}$ [m/s]')
plt.ylabel('$\Delta z$ [m]')
plt.legend(['DTU 10MW', 'Redesign V1', 'Redesign V2'])