Simulación de todas las direcciones

main
Sebastián Santisi 12 months ago
parent 6e39ba2bf9
commit 89c34931ad

@ -11,82 +11,60 @@ import xarray as xr
D = 126 #Diametro del wT
h = 90 #Altura del WT
U_ref = 8
ws = 8
initial_position = np.array([[1, 1]])
initial_position = np.array([[ 1 , 1],
[ 2. , 2],
[ 4 , 4],
[ 1 , 4],
[ 2 , 4],
[ 3 , 4],
[ 1 , 5],
[ 2 , 5],
[ 5 , 5]])
def py_wake_Initial_Cong(D,name,h,U_ref,initial_position=initial_position):
#Curvas del WT
def py_wake_Initial_Conf(D, name, h):
power_curve = np.array([
[ 0.1, 1.000],
[ 4.5, 267.7],
[ 5.0, 387.6],
[ 5.5, 534.0],
[ 6.0, 707.4],
[ 6.5, 910.0],
[ 7.0, 1142.7],
[ 7.5, 1407.5],
[ 8.0, 1707.1],
[ 8.5, 2047.3],
[ 9.0, 2430.6]]) * [1, 1000]
[ 0.1, 1.000],
[ 4.5, 267.7],
[ 5.0, 387.6],
[ 5.5, 534.0],
[ 6.0, 707.4],
[ 6.5, 910.0],
[ 7.0, 1142.7],
[ 7.5, 1407.5],
[ 8.0, 1707.1],
[ 8.5, 2047.3],
[ 9.0, 2430.6]]) * [1, 1000]
ct_curve = np.array([
[ 0.1, 0.100],
[ 4.5, 0.928],
[ 5.0, 0.892],
[ 5.5, 0.861],
[ 6.0, 0.835],
[ 6.5, 0.812],
[ 7.0, 0.792],
[ 7.5, 0.776],
[ 8.0, 0.7702530978349217],
[ 8.5, 0.762],
[ 9.0, 0.763]])
return WindTurbine(name=name,
diameter=D,
hub_height=h,
powerCtFunction=PowerCtTabular(power_curve[:, 0],
power_curve[:, 1],
'w',ct_curve[:, 1],
method='linear'))
[ 0.1, 0.100],
[ 4.5, 0.928],
[ 5.0, 0.892],
[ 5.5, 0.861],
[ 6.0, 0.835],
[ 6.5, 0.812],
[ 7.0, 0.792],
[ 7.5, 0.776],
[ 8.0, 0.7702530978349217],
[ 8.5, 0.762],
[ 9.0, 0.763]])
powerct = PowerCtTabular(power_curve[:, 0], power_curve[:, 1], 'w',ct_curve[:, 1], method='linear')
return WindTurbine(name=name, diameter=D, hub_height=h, powerCtFunction=powerct)
windTurbines = py_wake_Initial_Cong(D, 'NREL_5MW', h, U_ref)
windTurbines = py_wake_Initial_Conf(D, 'NREL_5MW', h)
grid = XYGrid(x=np.arange(0, 10.01, 0.1)*D, y=np.arange(0, 10.01, 0.1)*D)
def run(direction=0, initial_position=initial_position, U_ref=U_ref):
def run(direction=0, initial_position=initial_position, ws=ws):
initial_position = np.array(initial_position);
p_wd = [0] * 360
#p_wd[direction * n // 360] = 1
p_wd[direction] = 1
site = UniformSite(p_wd=p_wd,
ws=U_ref,
initial_position=initial_position*D)
p_wd[0] = p_wd[225] = p_wd[270] = p_wd[315] = 1
site = UniformSite(p_wd=p_wd, ws=ws, initial_position=initial_position*D)
#ds = xr.Dataset(
# data_vars={'P': ('wd', [1, 1, 1, 1])},
# coords={'wd': [0, 90, 180, 270]})
#ds['TI'] = 0.1
#site = XRSite(ds, interp_method='nearest', initial_position=initial_position*D, default_ws=np.atleast_1d(U_ref))
#site = XRSite(ds, interp_method='nearest', initial_position=initial_position*D, default_ws=np.atleast_1d(ws))
wt_x, wt_y = site.initial_position.T/D
wt_x, wt_y = site.initial_position.T
wfm = PropagateDownwind(site, windTurbines, wake_deficitModel=TurboGaussianDeficit())
xa = wfm(x=wt_x*D, y=wt_y*D, wd=direction, yaw=0).flow_map(grid)
xa = wfm(x=wt_x, y=wt_y, wd=direction, yaw=0).flow_map(grid)
ws = xa.WS_eff
aep = wfm(x=wt_x*D, y=wt_y*D).aep()
aep = wfm(x=wt_x, y=wt_y).aep()
return ws[:,:,0,0].values[:,:,0].tolist(), [sum(aep.values[i,:,0]) for i in aep.wt.values]
#return ws[:,:,0,0].values[:,:,0].tolist(), list(aep.values[:,direction,0])
return ws[:,:,0,0].values[:,:,0].tolist(), {dir: list(aep.values[:,dir,0]) for dir in (0, 225, 270, 315)}

Loading…
Cancel
Save