Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wind_rose.plot_wind_rose()
# =============================================================================
print("Finding power with and without wakes in FLORIS...")
# =============================================================================
# Instantiate the Optimization object
# Note that the optimization is not performed in this example.
yaw_opt = YawOptimizationWindRose(fi, df.wd, df.ws, minimum_ws=minimum_ws)
# Determine baseline power with and without wakes
df_base = yaw_opt.calc_baseline_power()
# Initialize power rose
case_name = "Example " + str(N_row) + " x " + str(N_row) + " Wind Farm"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name, df, df_base["power_no_wake"], df_base["power_baseline"]
)
# Display AEP analysis
fig, axarr = plt.subplots(2, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
power_dict[i] = {
"ws": df.ws[i],
"wd": df.wd[i],
"power_baseline": np.sum(power_base),
"turbine_power_baseline": power_base,
"power_no_wake": np.sum(power_no_wake),
"turbine_power_no_wake": power_no_wake,
}
df_base = pd.DataFrame.from_dict(power_dict, "index")
df_base.reset_index(drop=True, inplace=True)
# Initialize power rose
case_name = "Example " + str(N_row) + " x " + str(N_row) + " Wind Farm"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name, df, df_base["power_no_wake"], df_base["power_baseline"]
)
# Display AEP analysis
fig, axarr = plt.subplots(2, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
maximum_yaw_angle=max_yaw,
minimum_ws=minimum_ws,
maximum_ws=maximum_ws,
include_unc=include_unc,
unc_options=unc_options,
)
# Determine baseline power
df_base = yaw_opt.calc_baseline_power()
# Perform optimization
df_opt = yaw_opt.optimize()
# Initialize power rose
case_name = "Example " + str(N_row) + " x " + str(N_row) + " Wind Farm"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name,
df,
df_base["power_no_wake"],
df_base["power_baseline"],
df_opt["power_opt"],
)
# Summarize using the power rose module
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df_yaw = pd.DataFrame([list(row) for row in df_opt['yaw_angles']],columns=[str(i) for i in range(1,N_turb+1)])
df_yaw['ws'] = df.ws
df_yaw['wd'] = df.wd
df_turbine_power_no_wake = pd.DataFrame([list(row) for row in df_base['turbine_power_no_wake']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_no_wake['ws'] = df.ws
df_turbine_power_no_wake['wd'] = df.wd
df_turbine_power_baseline = pd.DataFrame([list(row) for row in df_base['turbine_power_baseline']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_baseline['ws'] = df.ws
df_turbine_power_baseline['wd'] = df.wd
df_turbine_power_opt = pd.DataFrame([list(row) for row in df_opt['turbine_power_opt']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_opt['ws'] = df.ws
df_turbine_power_opt['wd'] = df.wd
# Summarize using the power rose module
case_name = 'Example '+str(N_row)+' x '+str(N_row)+ ' Wind Farm'
power_rose = pr.PowerRose(case_name, df_power, df_turbine_power_no_wake, df_turbine_power_baseline,df_yaw, df_turbine_power_opt)
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df.ws,
minimum_yaw_angle=min_yaw,
maximum_yaw_angle=max_yaw,
minimum_ws=minimum_ws,
maximum_ws=maximum_ws,
)
# Determine baseline power with and without wakes
df_base = yaw_opt.calc_baseline_power()
# Perform optimization
df_opt = yaw_opt.optimize()
# Initialize power rose
case_name = "Example " + str(N_row) + " x " + str(N_row) + " Wind Farm"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name,
df,
df_base["power_no_wake"],
df_base["power_baseline"],
df_opt["power_opt"],
)
# Summarize using the power rose module
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df_base["power_no_wake"],
df_base["power_baseline"],
df_opt["power_opt"],
)
# Summarize using the power rose module
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
# Summarize AEP gains with uncertainty
# Initialize power rose
case_name = "Example 2 Turbine Wind Farm With Uncertainty and Robust Yaw Angles"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name,
df,
df_base_unc["power_no_wake"],
df_base_unc["power_baseline"],
df_opt_unc["power_opt"],
)
# Summarize using the power rose module
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df_yaw = pd.DataFrame([list(row) for row in df_opt_unc['yaw_angles']],columns=[str(i) for i in range(1,N_turb+1)])
df_yaw['ws'] = df.ws
df_yaw['wd'] = df.wd
df_turbine_power_no_wake = pd.DataFrame([list(row) for row in df_base_unc['turbine_power_no_wake']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_no_wake['ws'] = df.ws
df_turbine_power_no_wake['wd'] = df.wd
df_turbine_power_baseline = pd.DataFrame([list(row) for row in df_base_unc['turbine_power_baseline']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_baseline['ws'] = df.ws
df_turbine_power_baseline['wd'] = df.wd
df_turbine_power_opt = pd.DataFrame([list(row) for row in df_opt_unc['turbine_power_opt']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_opt['ws'] = df.ws
df_turbine_power_opt['wd'] = df.wd
# Summarize using the power rose module
case_name = 'Example 2 Turbine Wind Farm With Uncertainty and Robust Yaw Angles'
power_rose = pr.PowerRose(case_name, df_power, df_turbine_power_no_wake, df_turbine_power_baseline,df_yaw, df_turbine_power_opt)
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df_yaw = pd.DataFrame([list(row) for row in df_opt['yaw_angles']],columns=[str(i) for i in range(1,N_turb+1)])
df_yaw['ws'] = df.ws
df_yaw['wd'] = df.wd
df_turbine_power_no_wake = pd.DataFrame([list(row) for row in df_base['turbine_power_no_wake']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_no_wake['ws'] = df.ws
df_turbine_power_no_wake['wd'] = df.wd
df_turbine_power_baseline = pd.DataFrame([list(row) for row in df_base['turbine_power_baseline']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_baseline['ws'] = df.ws
df_turbine_power_baseline['wd'] = df.wd
df_turbine_power_opt = pd.DataFrame([list(row) for row in df_opt['turbine_power_opt']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_opt['ws'] = df.ws
df_turbine_power_opt['wd'] = df.wd
# Summarize using the power rose module
case_name = 'Example '+str(N_row)+' x '+str(N_row)+ ' Wind Farm'
power_rose = pr.PowerRose(case_name, df_power, df_turbine_power_no_wake, df_turbine_power_baseline,df_yaw, df_turbine_power_opt)
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
df_yaw = pd.DataFrame([list(row) for row in df_opt['yaw_angles']],columns=[str(i) for i in range(1,N_turb+1)])
df_yaw['ws'] = df.ws
df_yaw['wd'] = df.wd
df_turbine_power_no_wake = pd.DataFrame([list(row) for row in df_base['turbine_power_no_wake']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_no_wake['ws'] = df.ws
df_turbine_power_no_wake['wd'] = df.wd
df_turbine_power_baseline = pd.DataFrame([list(row) for row in df_base['turbine_power_baseline']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_baseline['ws'] = df.ws
df_turbine_power_baseline['wd'] = df.wd
df_turbine_power_opt = pd.DataFrame([list(row) for row in df_opt['turbine_power_opt']],columns=[str(i) for i in range(1,N_turb+1)])
df_turbine_power_opt['ws'] = df.ws
df_turbine_power_opt['wd'] = df.wd
# Summarize using the power rose module
case_name = 'Example 2 Turbine Wind Farm Without Uncertainty'
power_rose = pr.PowerRose(case_name, df_power, df_turbine_power_no_wake, df_turbine_power_baseline,df_yaw, df_turbine_power_opt)
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
# Summarize AEP gains with uncertainty
# combine wind farm-level power into one dataframe
df_power = pd.DataFrame({'ws':df.ws,'wd':df.wd, \
'freq_val':df.freq_val,'power_no_wake':df_base_unc.power_no_wake, \
'power_baseline':df_base_unc.power_baseline,'power_opt':df_opt_unc.power_opt})
# initialize power rose
df_yaw = pd.DataFrame([list(row) for row in df_opt_unc['yaw_angles']],columns=[str(i) for i in range(1,N_turb+1)])
df_yaw['ws'] = df.ws
df_yaw['wd'] = df.wd
minimum_ws=minimum_ws,
maximum_ws=maximum_ws,
include_unc=True,
unc_options=unc_options,
)
# Determine baseline power with and without wakes
df_base_unc = yaw_opt.calc_baseline_power()
# Perform optimization
df_opt_unc = yaw_opt.optimize()
# Summarize AEP gains without uncertainty
# Initialize power rose
case_name = "Example 2 Turbine Wind Farm Without Uncertainty"
power_rose = pr.PowerRose()
power_rose.make_power_rose_from_user_data(
case_name,
df,
df_base["power_no_wake"],
df_base["power_baseline"],
df_opt["power_opt"],
)
# Summarize using the power rose module
fig, axarr = plt.subplots(3, 1, sharex=True, figsize=(6.4, 6.5))
power_rose.plot_by_direction(axarr)
power_rose.report()
plt.show()
# Summarize AEP gains with uncertainty