-
Notifications
You must be signed in to change notification settings - Fork 1
/
EE.py.bak
66 lines (56 loc) · 2.54 KB
/
EE.py.bak
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
import numpy as np
import os
import shutil
from distutils.dir_util import copy_tree
import pandas as pd
from sobol_seq import i4_sobol,i4_sobol_generate
from turbsimInputs_8ms import write_input_file
from Velocity_spectrum_8ms import turb_specs
from Wind_profile_8ms import write_wind
from FAST_Files.fast_file_generator import write_fast_files
# Python Script for turbsim wind file generation
lowers_BIN1 = np.array([-1.5,-25, 5, 2, 2, 0.05,0.02,0.03,1.5,1.7, 2, 0.00, 0, 0,0,-3.5,-4.5,-2.7])
uppers_BIN1 = np.array([ 3.3, 50,1000,1000, 650, 7.2,7.4, 4.5, 26, 18, 17, 0.08,4.5e-3,0.011,1, 0.5, 6.0, 1.0])
lowers_BIN2 = np.array([-0.4,-10, 8, 2, 2, 0.2,0.05,0.05,1.5,1.7, 2, 0, 0, 0, 0,-3.5,-4.5,-2.7])
uppers_BIN2 = np.array([ 0.9, 50,1400,1300, 450, 7.3,8.1, 4.3, 26, 18, 17, 0.08,3.0e-3,6.0e-3, 1, 0.5, 6.0, 1.0])
lowers_BIN3 = np.array([-0.4,-10, 25, 2, 2, 0.2,0.18, 0.15,1.5,1.7, 2, 0, 0, 0, 0,-3.5,-4.5,-2.7])
uppers_BIN3 = np.array([ 0.7, 25,1600,1500, 650, 7.4,7.3, 4.2, 26, 18, 18, 0.05,2.5e-3,6.5e-3, 1, 0.5, 6.0, 1.0])
#sobols = i4_sobol_generate(19, 20)
sobols=(pd.read_csv('Sobol_set.csv', sep=r'\s+', header=None))
sobols=sobols.values
descaled_sobols_BIN1 = sobols.copy()
descaled_sobols_BIN2 = sobols.copy()
descaled_sobols_BIN3 = sobols.copy()
for i in range(len(sobols[0,:])):
descaled_sobols_BIN1[i,:] = lowers_BIN1 + (uppers_BIN1 - lowers_BIN1) * descaled_sobols_BIN1[i,:]
descaled_sobols_BIN2[i,:] = lowers_BIN2 + (uppers_BIN2 - lowers_BIN2) * descaled_sobols_BIN2[i,:]
descaled_sobols_BIN3[i,:] = lowers_BIN3 + (uppers_BIN3 - lowers_BIN3) * descaled_sobols_BIN3[i,:]
source='5MW_reference'
dest = str(os.getcwd())
copy_tree(source,dest)
name3='Random_seeds'
os.makedirs(name3)
for m in range (0,6):
for b in range(1,4):
name1='Random_seeds'+'/'+'Row_'+str(m)+'_BIN_'+str(b) +'/'+'Turbsim_inputs'
name2='Random_seeds'+'/'+'Row_'+str(m)+'_BIN_'+str(b) +'/'+'FAST'
print 'Generating Turbsim and FAST input files for BIN:'+str(b)+' and Row:'+str(m)
s="descaled_sobols_BIN"+str(b)
Matrix=eval(s)
if not os.path.exists(name1):
os.makedirs(name1)
os.makedirs(name2)
write_input_file(Matrix[m], m, m,b)
turb_specs(Matrix[m], m, m,b)
write_wind(Matrix[m], m, m,b)
write_fast_files(Matrix[m], m, m,b)
else:
shutil.rmtree(name1)
shutil.rmtree(name2)
os.makedirs(name1)
os.makedirs(name2)
write_input_file(Matrix[m], m, m,b)
turb_specs(Matrix[m], m, m,b)
write_wind(Matrix[m], m, m,b)
write_fast_files(Matrix[m], m, m,b)
print 'File generation complete'