image thumbnail
from Wind Turbine System Identification by Sumit Tripathi
Use system Identification techniques to predict power generation from wind turbine.

[kwh wind]=minute_data(Tdata,count,N1,N2,w_filter1,w_filter2)
%Sumit Tripathi
function [kwh wind]=minute_data(Tdata,count,N1,N2,w_filter1,w_filter2)

wind_e=Tdata(:,10);% Extract wind speed
kwh_e=Tdata(:,8);% Extract Power output
time_e=Tdata(:,4:6);
wind1=wind_e(N1:N2);
kwh1=kwh_e(N1:N2);
time1=time_e(N1:N2,:);
p=1;
k=1;
% Filter wind speed between w_filter1 and w_filter2
while p<count

    if ((wind1(k)>=w_filter1)&(wind1(k)<=w_filter2))
        wind(p)=wind1(k);
        kwh(p)=kwh1(k);
        time(p,:)=time1(k,:);
        p=p+1;
    else
                p=p;
    end
    k=k+1;
end
wind=wind';
kwh=kwh';
time;
clear wind1 kwh1 time1
kwh_minute=[];
wind_minute=[];
m=0;
L=length(time);
m=1;
while m<=L
    %pause 
    t=time(m,2);
    temp_kwh=0;
    temp_wind=0;
    k=0;
    
while time(m,2)==t % While Minute remains same, calculate average output througth a minute

    temp_kwh=temp_kwh+kwh(m);
    temp_wind=temp_wind+wind(m);
    m=m+1;
     k=k+1;
    if m>length(time)
        break
    end
   
end
temp_kwh=temp_kwh/k;
kwh_minute=[kwh_minute;temp_kwh];
temp_wind=temp_wind/k;
wind_minute=[wind_minute;temp_wind];
%pause
end
clear wind kwh
kwh=kwh_minute;
wind=wind_minute;

return

Contact us at files@mathworks.com