Skip to content
Snippets Groups Projects
Commit f73327e3 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

fixed small issues

parent b77a0f75
No related branches found
No related tags found
No related merge requests found
......@@ -6,23 +6,23 @@ from topfarm.cost_models.fuga.py_fuga import PyFuga
from topfarm.cost_models.fused_wake_wrappers import FusedWakeGCLWakeModel
from topfarm.cost_models.utils.aep_calculator import AEPCalculator
from topfarm.cost_models.utils.wind_resource import WindResource
from topfarm.cost_models.fuga.lib_reader import read_lib
fuga_path = os.path.abspath(os.path.dirname(py_fuga.__file__)) + '/Colonel/'
def HornsrevAEP_FUSEDWake_GCL():
# wind parameters from "Horns Rev 1\hornsrev2.lib
wdir_freq = [0.035972, 0.039487, 0.051674, 0.070002, 0.083645, 0.064348, 0.086432, 0.117705, 0.151576, 0.147379, 0.10012, 0.05166]
weibull_A = [9.176929, 9.782334, 9.531809, 9.909545, 10.04269, 9.593921, 9.584007, 10.51499, 11.39895, 11.68746, 11.63732, 10.08803]
weibull_k = [2.392578, 2.447266, 2.412109, 2.591797, 2.755859, 2.595703, 2.583984, 2.548828, 2.470703, 2.607422, 2.626953, 2.326172]
wdir_freq, weibull_A, weibull_k = read_lib(fuga_path + 'LUT/Farms/Horns Rev 1\hornsrev2.lib')
ti = np.zeros_like(wdir_freq) + .1
wr = WindResource(wdir_freq, weibull_A, weibull_k, ti)
hornsrev_yml = os.path.dirname(fusedwake.__file__) + "/../examples/hornsrev.yml"
wm = FusedWakeGCLWakeModel(hornsrev_yml)
aep_calc = AEPCalculator(wr, wm)
return aep_calc(wm.windFarm.pos)
return aep_calc(wm.windFarm.pos.T)
def HornsrevAEP_Fuga():
fuga_path = os.path.abspath(os.path.dirname(py_fuga.__file__)) + '/Colonel/'
hornsrev_yml = os.path.dirname(fusedwake.__file__) + "/../examples/hornsrev.yml"
wm = FusedWakeGCLWakeModel(hornsrev_yml)
tb_x, tb_y = wm.windFarm.pos
......@@ -31,9 +31,9 @@ def HornsrevAEP_Fuga():
tb_x=tb_x, tb_y=tb_y,
mast_position=(0, 0, 70), z0=0.0001, zi=400, zeta0=0,
farms_dir=fuga_path + 'LUT/Farms/', wind_atlas_path='Horns Rev 1\hornsrev2.lib')
return pyFuga.get_aep(tb_x, tb_x)[0]
return pyFuga.get_aep(wm.windFarm.pos.T)[0]
if __name__ == '__main__':
print(HornsrevAEP_FUSEDWake_GCL())
print(HornsrevAEP_Fuga())
print(HornsrevAEP_FUSEDWake_GCL())
......@@ -26,7 +26,8 @@ def optimize_AEP_FusedWake_GCL():
aep_calc = AEPCalculator(wr, wm)
init_pos = initial_position.copy()
init_pos[:, 0] += [-20, 0, 20]
tf = TopFarm(init_pos, aep_calc.get_TopFarm_cost_component(), minSpacing * D, boundary=boundary, plot_comp=plot_comp)
tf = TopFarm(init_pos, aep_calc.get_TopFarm_cost_component(), minSpacing * D, boundary=boundary, plot_comp=plot_comp,
driver_options={'optimizer': 'SLSQP'})
tf.evaluate()
print(tf.get_cost())
tf.optimize()
......@@ -46,8 +47,9 @@ def optimize_AEP_Fuga():
init_pos = initial_position.copy()
init_pos[:, 0] += [-20, 0, 20]
tf = TopFarm(init_pos, pyFuga.get_TopFarm_cost_component(), minSpacing * D, boundary=boundary, plot_comp=plot_comp)
tf = TopFarm(init_pos, pyFuga.get_TopFarm_cost_component(), minSpacing * D, boundary=boundary, plot_comp=plot_comp,
driver_options={'optimizer': 'SLSQP'})
print (pyFuga.get_aep_gradients())
save_plot('initial.png', tf, True)
tf.evaluate()
print(tf.get_cost())
......@@ -58,6 +60,7 @@ def optimize_AEP_Fuga():
def save_plot(filename, tf, initial=False):
return
import matplotlib.pyplot as plt
plt.figure(figsize=(3, 3))
plt.axis('equal')
......
Subproject commit 0f0015c52e0a30dbef8d2674df8dd69b1ee521e3
Subproject commit 63f215a900395ad7d8880d7783e57c0835e45c9b
......@@ -107,7 +107,7 @@ class PyFuga(object):
if turbine_positions is not None:
self.move_turbines(turbine_positions[:,0], turbine_positions[:,1])
n_wt = turbine_positions.shape[0]
n_wt = self.get_no_tubines()
dAEPdxyz = np.zeros(n_wt), np.zeros(n_wt), np.zeros(n_wt)
dAEPdxyz_ctype = [dAEP.ctypes for dAEP in dAEPdxyz]
self.lib.GetAEPGradients(*[dAEP_ctype.data_as(c_double_p) for dAEP_ctype in dAEPdxyz_ctype])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment