# I need MATLAB code that plots the aerodynamic power generated by a wind turbine vs the generator rotation speed for different wind speeds

12 views (last 30 days)
itouchene on 6 Jul 2023
Commented: Image Analyst on 7 Jul 2023
I need a new MATLAB code or patch for the following code that draws the aerodynamic power generated by the wind turbine versus the generator's rotation speed for different wind speeds:
clear; clc; close all;
% Define constants
rho = 1.225; % Air density [kg/m^3]
R = 35.25; % Radius of wind turbine [m]
% Define wind speeds
wind_speeds = [5 10 15 20]; % Wind speeds [m/s]
% Define generator rotation speeds
rotation_speeds = 0:1000:2000; % Rotation speeds [rpm]
% Calculate aerodynamic power for each wind speed and rotation speed
power = zeros(length(rotation_speeds), length(wind_speeds));
for i = 1:length(wind_speeds)
for j = 1:length(rotation_speeds)
wind_speed = wind_speeds(i);
rotation_speed = rotation_speeds(j) * (2*pi/60); % Convert rpm to rad/s
% Calculate aerodynamic power
power(j, i) = 0.5 * rho * pi * R^2 * (wind_speed^3) * rotation_speed;
end
end
% Plot the aerodynamic power
figure;
hold on;
colors = {'b', 'g', 'r', 'm'};
for i = 1:length(wind_speeds)
plot(rotation_speeds, power(:, i), colors{i});
end
hold off;
% Set plot properties
title('Aerodynamic Power vs. Generator Rotation Speed');
xlabel('Generator Rotation Speed [rpm]');
ylabel('Aerodynamic Power [W]');
legend(cellstr(num2str(wind_speeds', 'Wind Speed = %d m/s')));
% Adjust plot limits, if needed
% xlim([0 max(rotation_speeds)]);
% ylim([0 max(power(:))]);
% Save the plot as an image, if desired
% saveas(gcf, 'aerodynamic_power_plot.png');
itouchene on 6 Jul 2023
I want to give results like the attached image in the comment, but I don't know where the error is
Alan Stevens on 6 Jul 2023
Your expression for power is linearly proportional to rotation speed, so you are only ever going to get straight line outputs from it!

Image Analyst on 6 Jul 2023
Looks like you're not plotting out far enough on the x axis to see the parabolic shape. You're only going out on the relatively flat upward sloping side of the parabola. Try increasing the range of the rotation speeds so that you can see the full parabola shape.
David Goodmanson on 7 Jul 2023
Edited: David Goodmanson on 7 Jul 2023
His code is well annotated and is an obvious straight line.
Image Analyst on 7 Jul 2023
Yes we know he's getting straight lines but what he wants is curvy lines like
so that's why I suggested he may have the wrong equation. It looks like Sam did some research and perhaps has found the proper equation to use.

Sam Chak on 6 Jul 2023
You can clearly identify the relationship here:
If the aerodynamic power is y, the rotation speed is x, and this term is a constant, then mathematically, you are plotting , which is a straigh line.
After checking the facts in the Variable speed wind turbine, the correct formula should be
where the coefficient of power, is a nonlinear function of lambda (λ), given by
with ω is the tip rotational speed.