How to use the floris.tools.optimization.pyoptsparse.optimization.Optimization function in FLORIS

To help you get started, we’ve selected a few FLORIS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NREL / floris / examples / optimization / pyoptsparse / example_layout_optimization.py View on Github external
)

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()
github NREL / floris / examples / optimization / pyoptsparse / example_power_density_optimization.py View on Github external
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()
github NREL / floris / examples / optimization / pyoptsparse / co-design_optimization / optimize_power_density.py View on Github external
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()
github NREL / floris / examples / optimization / pyoptsparse / controls_optimization / optimize_yaw.py View on Github external
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)
github NREL / floris / examples / optimization / pyoptsparse / example_yaw_optimization.py View on Github external
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)
github NREL / floris / examples / optimization / pyoptsparse / plant_optimization / optimize_layout.py View on Github external
# 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()