Skip to content

Commit

Permalink
Example improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
misi9170 committed Feb 7, 2024
1 parent 8e2d250 commit 6aac1ef
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions examples/40_test_derating.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
turbine_type["power_thrust_model"] = "simple-derating"

# Convert to a simple two turbine layout with derating turbines
fi.reinitialize(layout_x=[0, 500.0], layout_y=[0.0, 0.0], turbine_type=[turbine_type])
fi.reinitialize(layout_x=[0, 1000.0], layout_y=[0.0, 0.0], turbine_type=[turbine_type])

# Set the wind directions and speeds to be constant over n_findex = N time steps
N = 50
Expand All @@ -46,19 +46,42 @@
# Add derating
power_setpoints = np.tile(np.linspace(1, 6e6, N), 2).reshape(2, N).T
fi.calculate_wake(power_setpoints=power_setpoints)
turbine_powers_derated= fi.get_turbine_powers()
turbine_powers_derated = fi.get_turbine_powers()

# Compute available power at downstream turbine
power_setpoints_2 = np.array([np.linspace(1, 6e6, N), np.full(N, None)]).T
fi.calculate_wake(power_setpoints=power_setpoints_2)
turbine_powers_avail_ds = fi.get_turbine_powers()[:,1]

# Plot the results
fig, ax = plt.subplots(1, 1)
ax.plot(power_setpoints[:, 0]/1000, turbine_powers_derated[:, 0]/1000, color="C0", label="Upstream")
ax.plot(power_setpoints[:, 1]/1000, turbine_powers_derated[:, 1]/1000, color="C1",
label="Downstream")
ax.plot(power_setpoints[:, 0]/1000, turbine_powers_orig[:, 0]/1000, color="C0", linestyle="dotted",
label="Upstream available")
ax.plot(power_setpoints[:, 1]/1000, turbine_powers_orig[:, 1]/1000, color="C1", linestyle="dotted",
label="Downstream available")
ax.plot(power_setpoints[:, 1]/1000, np.ones(N)*np.max(turbine_type["power_thrust_table"]["power"]),
color="k", linestyle="dashed", label="Rated power")
ax.plot(
power_setpoints[:, 1]/1000,
turbine_powers_derated[:, 1]/1000,
color="C1",
label="Downstream"
)
ax.plot(
power_setpoints[:, 0]/1000,
turbine_powers_orig[:, 0]/1000,
color="C0",
linestyle="dotted",
label="Upstream available"
)
ax.plot(
power_setpoints[:, 1]/1000,
turbine_powers_avail_ds/1000,
color="C1",
linestyle="dotted", label="Downstream available"
)
ax.plot(
power_setpoints[:, 1]/1000,
np.ones(N)*np.max(turbine_type["power_thrust_table"]["power"]),
color="k",
linestyle="dashed",
label="Rated power"
)
ax.grid()
ax.legend()
ax.set_xlim([0, 6e3])
Expand Down

0 comments on commit 6aac1ef

Please sign in to comment.