Commit fda3ee31 authored by kdas's avatar kdas
Browse files

introducing wake - not working fully yet

parent c895f446
Pipeline #20702 failed with stages
in 29 seconds
WindSpeed,Power,ThrustCoEfficient
3.5,14000,0.8166
4.0,65000,0.7990
4.5,131000,0.7972
5.0,224000,0.7962
5.5,335000,0.7893
6.0,450000,0.7893
6.5,570000,0.7994
7.0,720000,0.8031
7.5,899000,0.7976
8.0,1074000,0.7822
8.5,1279000,0.7576
9.0,1475000,0.7241
9.5,1680000,0.6845
10.0,1844000,0.6351
10.5,1968000,0.5699
11.0,2042000,0.4945
11.5,2076000,0.4247
12.0,2092000,0.3656
12.5,2097000,0.3162
13.0,2100000,0.2760
13.5,2100000,0.2432
14.0,2100000,0.2159
14.5,2100000,0.1930
15.0,2100000,0.1734
15.5,2100000,0.1565
16.0,2100000,0.1419
16.5,2100000,0.1292
17.0,2100000,0.1180
17.5,2100000,0.1008
18.0,2100000,0.0994
18.5,2100000,0.0917
19.0,2100000,0.0848
19.5,2100000,0.0786
20.0,2100000,0.0730
20.5,2100000,0.0708
21.0,2100000,0.0660
21.5,2100000,0.0617
22.0,2100000,0.0578
22.5,2100000,0.0543
23.0,2100000,0.0510
23.5,2100000,0.0480
24.0,2100000,0.0452
24.5,2100000,0.0427
25.0,2100000,0.0404
WindSpeed,Power,ThrustCoEfficient
2.5,0.0,0.873
3.0,22000.0,0.873
3.5,78000.0,0.849
4.0,150000.0,0.835
4.5,237000.0,0.828
5.0,340000.0,0.827
5.5,466000.0,0.825
6.0,617000.0,0.820
6.5,796000.0,0.816
7.0,1006000.0,0.815
7.5,1247000.0,0.804
8.0,1522000.0,0.794
8.5,1830000.0,0.786
9.0,2176000.0,0.787
9.5,2541000.0,0.769
10.0,2903000.0,0.730
10.5,3209000.0,0.667
11.0,3418000.0,0.589
11.5,3543000.0,0.513
12.0,3589000.0,0.442
12.5,3599000.0,0.381
13.0,3600000.0,0.332
13.5,3600000.0,0.294
14.0,3600000.0,0.261
14.5,3600000.0,0.233
15.0,3600000.0,0.209
15.5,3600000.0,0.188
16.0,3600000.0,0.171
16.5,3600000.0,0.156
17.0,3600000.0,0.142
17.5,3600000.0,0.131
18.0,3600000.0,0.120
18.5,3600000.0,0.111
19.0,3600000.0,0.102
19.5,3600000.0,0.095
20.0,3600000.0,0.089
20.5,3600000.0,0.083
21.0,3600000.0,0.077
21.5,3600000.0,0.073
22.0,3600000.0,0.069
22.5,3600000.0,0.064
23.0,3600000.0,0.060
23.5,3600000.0,0.057
24.0,3600000.0,0.054
24.5,3600000.0,0.051
25.0,3600000.0,0.048
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
# %%
import glob
import os
# basic libraries
import numpy as np
from numpy import newaxis as na
from numpy import nan, inf
# Libraries-methods used in the layout sampler
from rbf.pde.nodes import min_energy_nodes, poisson_disc_nodes
from rbf.utils import assert_shape, KDTree
from shapely import geometry as geom
from scipy.spatial import ConvexHull
from scipy.interpolate import RegularGridInterpolator
# -------------------------------------------------------------
# Basic functions for layouts
# -------------------------------------------------------------
def sample_layout_in_circle(D,N,seed,
D_WT=1, return_borders=False):
'''
Parameters
----------
D: float
Cicular site diameter
N: int
Number of turbines
seed: int
Seed number to repeat output of random number generator behind the algorithm
D_WT: float
Wind turbine diameter
return_borders: str
Flag to retrun borders
Returns
-------
wt_x: array
Wind turbines x poisitions
wt_y: array
Wind turbines y poisitions
site_borders: array, optional, default = False
Site borders
'''
border = geom.Point(0,0).buffer(D/2)
site_borders = np.array([point for point in border.exterior.coords])
site_borders = site_borders[:-1, :]
if D_WT!=None:
# if D is the WT diamter, it removes one radius of distance from the
# site_borders to ensure the full rotor is whitin the site_borders
# If by doing so, it creates mutliple boundaries, then it leaves
# the site borders untouched
border = geom.Polygon(site_borders).buffer(-0.5*D_WT)
if border.type == 'MultiPolygon':
border = geom.Polygon(site_borders)
site_borders_out = np.copy(site_borders)
site_borders = np.array([point for point in border.exterior.coords])
vert = site_borders
N_vert = vert.shape[0]
smp = np.array([np.arange(N_vert), np.roll(np.arange(N_vert), -1)]).T
xi = np.linspace(-D,D,100)
yi = np.linspace(-D,D,100)
xmi, ymi = np.meshgrid(yi,xi)
Z = np.ones_like(xmi)
rho = RegularGridInterpolator((xi, yi), Z,
method='linear',
bounds_error=False, fill_value=0.)
nodes, dic_0, dic_1 = min_energy_nodes(
N, (vert, smp),
rho=rho,
start=seed,
neighbors=3,
iterations=5000,
dispersion_delta=0.01
)
wt_x = nodes[:,0]
wt_y = nodes[:,1]
if return_borders:
return wt_x, wt_y, site_borders_out
else:
return wt_x, wt_y
def sample_layout(site_borders, N, seed, D_WT=None):
'''
Function that generates an unstructured layout maximizing the spacing between turbines.
Parameters
----------
site_borders: array (N_points,2)
Site borders
N: int
Number of turbines
seed: int
Seed number to repeat output of random number generator behind the algorithm
D_WT: float
Wind turbine diameter
Returns
-------
wt_x: array
Wind turbines x poisitions
wt_y: array
Wind turbines y poisitions
'''
if D_WT!=None:
# if D is the WT diamter, it removes one radius of distance from the
# site_borders to ensure the full rotor is whitin the site_borders
# If by doing so, it creates mutliple boundaries, then it leaves
# the site borders untouched
border = geom.Polygon(site_borders).buffer(-0.5*D_WT)
if border.type == 'MultiPolygon':
border = geom.Polygon(site_borders)
site_borders = np.array([point for point in border.exterior.coords])
vert = site_borders
N_vert = vert.shape[0]
smp = np.array([np.arange(N_vert), np.roll(np.arange(N_vert), -1)]).T
x_sb = site_borders[:,0]
y_sb = site_borders[:,1]
xi = np.linspace(np.min(x_sb),np.max(x_sb),200)
yi = np.linspace(np.min(y_sb),np.max(y_sb),200)
xmi, ymi = np.meshgrid(yi,xi)
Z = np.ones_like(xmi)
rho = RegularGridInterpolator((xi, yi), Z,
method='linear',
bounds_error=False, fill_value=0.)
nodes, dic_0, dic_1 = min_energy_nodes(
N, (vert, smp),
rho=rho,
start=seed,
neighbors=3,
iterations=5000,
dispersion_delta=0.01
)
wt_x = nodes[:,0]
wt_y = nodes[:,1]
return wt_x, wt_y
def get_layout_based_on_spacing(site_borders, spacing, D_WT):
vert = site_borders
N_vert = vert.shape[0]
smp = np.array([np.arange(N_vert), np.roll(np.arange(N_vert), -1)]).T
nodes, dic_0, dic_1 = poisson_disc_nodes(
radius=spacing*D_WT,
domain=(vert, smp),
rmax_factor=1)
wt_x = nodes[:,0]
wt_y = nodes[:,1]
sp = get_spacing(wt_x,wt_y)/D_WT
iters=0
while (sp < spacing)&(iters<100):
nodes, dic_0, dic_1 = poisson_disc_nodes(
radius=spacing*D_WT*(1.01**iters),
domain=(vert, smp),
ntests=20,
rmax_factor=1)
wt_x = nodes[:,0]
wt_y = nodes[:,1]
sp = get_spacing(wt_x,wt_y)/D_WT
iters+=1
return wt_x, wt_y
def get_spacing(wt_x, wt_y):
if len(wt_x) > 1:
x = np.vstack([wt_x, wt_y]).T
m = 2
p = np.vstack([wt_x, wt_y]).T
dist, idx = KDTree(x).query(p, m)
spacing = np.min(dist[:,1])
else:
spacing = 0
return spacing
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment