Linear Regression Plot

Wind Turbine Power Curve

Renewable energy sigmoid response with operational zones

Output
Wind Turbine Power Curve
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(3333)

# Wind power data
wind_speed = np.random.uniform(2, 25, 60)
# Sigmoid-like power curve
cut_in, rated, cut_out = 3, 12, 25
power = np.zeros_like(wind_speed)
mask1 = (wind_speed >= cut_in) & (wind_speed < rated)
mask2 = (wind_speed >= rated) & (wind_speed < cut_out)
power[mask1] = 2000 * ((wind_speed[mask1] - cut_in) / (rated - cut_in))**3
power[mask2] = 2000
power += np.random.normal(0, 80, 60)
power = np.clip(power, 0, 2100)

# Theoretical curve
ws_smooth = np.linspace(2, 25, 200)
p_smooth = np.zeros_like(ws_smooth)
m1 = (ws_smooth >= cut_in) & (ws_smooth < rated)
m2 = (ws_smooth >= rated) & (ws_smooth < cut_out)
p_smooth[m1] = 2000 * ((ws_smooth[m1] - cut_in) / (rated - cut_in))**3
p_smooth[m2] = 2000

fig, ax = plt.subplots(figsize=(10, 7), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

ax.yaxis.grid(True, color='#f0f0f0', linewidth=1, zorder=1)
ax.xaxis.grid(True, color='#f0f0f0', linewidth=1, zorder=1)

# Operational zones
ax.axvspan(cut_in, rated, alpha=0.05, color='#6CF527', zorder=1)
ax.axvspan(rated, cut_out, alpha=0.05, color='#27D3F5', zorder=1)

ax.fill_between(ws_smooth, p_smooth * 0.9, p_smooth * 1.1, 
                where=p_smooth > 0, color='#27D3F5', alpha=0.12, linewidth=0, zorder=2)
ax.plot(ws_smooth, p_smooth, color='#27D3F5', linewidth=2.5, zorder=3)
ax.scatter(wind_speed, power, c='#F54927', s=50, alpha=0.8, edgecolors='white', linewidths=0.5, zorder=4)

# Key points
ax.axvline(x=cut_in, color='#666666', linestyle=':', linewidth=1)
ax.axvline(x=rated, color='#666666', linestyle=':', linewidth=1)
ax.text(cut_in, -120, 'cut-in', fontsize=9, color='#666666', ha='center')
ax.text(rated, -120, 'rated', fontsize=9, color='#666666', ha='center')

for spine in ['top', 'right']:
    ax.spines[spine].set_visible(False)
for spine in ['bottom', 'left']:
    ax.spines[spine].set_color('#cccccc')

ax.set_xlabel('Wind Speed (m/s)', fontsize=12, color='#333333', fontweight='500', labelpad=10)
ax.set_ylabel('Power Output (kW)', fontsize=12, color='#333333', fontweight='500', labelpad=10)
ax.set_title('Turbine Power Characteristic', fontsize=15, color='#1a1a1a', fontweight='bold', pad=20, loc='left')
ax.tick_params(colors='#666666', labelsize=10, length=0)
ax.set_ylim(-50, 2300)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Pairwise Data

Did this help you?

Support PyLucid to keep it free & growing

Support