Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
boundaries = [[0., 0.], [0., 1000.], [1000., 1000.], [1000., 0.]]
# wd = np.arange(0., 360., 60.)
wd = [270]
np.random.seed(1)
ws = 8.0 + np.random.randn(len(wd))*0.5
freq = np.abs(np.sort(np.random.randn(len(wd))))
freq = freq/freq.sum()
model = opt.layout.Layout(fi, boundaries, wdir=wd,
wspd=ws,
wfreq=freq)
tmp = opt.optimization.Optimization(model=model, solver='SLSQP')
sol = tmp.optimize()
print(sol)
model.plot_layout_opt_results(sol)
plt.show()
boundaries = [[0., 0.], [0., 1000.], [1000., 1000.], [1000., 0.]]
# wd = np.arange(0., 360., 60.)
# wd = [0, 90, 180, 270]
wd = [270]
np.random.seed(1)
ws = 8.0 + np.random.randn(len(wd))*0.5
freq = np.abs(np.sort(np.random.randn(len(wd))))
freq = freq/freq.sum()
model = opt.power_density.PowerDensity(fi, boundaries, wdir=wd,
wspd=ws,
wfreq=freq)
tmp = opt.optimization.Optimization(model=model, solver='SLSQP')
sol = tmp.optimize()
print(sol)
model.plot_layout_opt_results(sol)
plt.show()
D = fi.floris.farm.turbines[0].rotor_diameter
layout_x = [0, 0, 6 * D, 6 * D]
layout_y = [0, 5 * D, 0, 5 * D]
fi.reinitialize_flow_field(layout_array=(layout_x, layout_y))
# wd = np.arange(0., 360., 60.)
# wd = [0, 90, 180, 270]
wd = [270]
np.random.seed(1)
ws = 8.0 + np.random.randn(len(wd)) * 0.5
freq = np.abs(np.sort(np.random.randn(len(wd))))
freq = freq / freq.sum()
model = opt.power_density.PowerDensity(fi, boundaries, wdir=wd, wspd=ws, wfreq=freq)
tmp = opt.optimization.Optimization(model=model, solver="SLSQP")
sol = tmp.optimize()
print(sol)
model.plot_layout_opt_results(sol)
plt.show()
D = fi.floris.farm.turbines[0].rotor_diameter
layout_x = [0, 0, 6 * D, 6 * D]
layout_y = [0, 5 * D, 0, 5 * D]
fi.reinitialize_flow_field(layout_array=(layout_x, layout_y))
# Define wind speed and direction
ws = [8]
wd = [270]
# Set bounds on yaw offsets
minimum_yaw_angle = 0.0
maximum_yaw_angle = 30.0
model = opt.yaw.Yaw(fi, minimum_yaw_angle, maximum_yaw_angle, wdir=wd, wspd=ws)
tmp = opt.optimization.Optimization(model=model, solver="SLSQP")
sol = tmp.optimize()
# Display results
print(sol)
model.print_power_gain(sol)
model.plot_yaw_opt_results(sol)
fi = wfct.floris_interface.FlorisInterface(
os.path.join(file_dir, '../../example_input.json')
)
# Define wind speed and direction
ws = [8]
wd = [270]
# Set bounds on yaw offsets
minimum_yaw_angle = 0.
maximum_yaw_angle = 30.
model = opt.yaw.Yaw(fi, minimum_yaw_angle, maximum_yaw_angle, wdir=wd,
wspd=ws)
tmp = opt.optimization.Optimization(model=model, solver='SLSQP')
sol = tmp.optimize()
# Display results
print(sol)
model.print_power_gain(sol)
model.plot_yaw_opt_results(sol)
# Set turbine locations to 4 turbines in a rectangle
D = fi.floris.farm.turbines[0].rotor_diameter
layout_x = [0, 0, 6 * D, 6 * D]
layout_y = [0, 5 * D, 0, 5 * D]
fi.reinitialize_flow_field(layout_array=(layout_x, layout_y))
wd = [270]
np.random.seed(1)
ws = 8.0 + np.random.randn(len(wd)) * 0.5
freq = np.abs(np.sort(np.random.randn(len(wd))))
freq = freq / freq.sum()
model = opt.layout.Layout(fi, boundaries, wdir=wd, wspd=ws, wfreq=freq)
tmp = opt.optimization.Optimization(model=model, solver="SLSQP")
sol = tmp.optimize()
print(sol)
model.plot_layout_opt_results(sol)
plt.show()