《风力发电机功率曲线统计MATLAB代码实现.docx》由会员分享,可在线阅读,更多相关《风力发电机功率曲线统计MATLAB代码实现.docx(6页珍藏版)》请在课桌文档上搜索。
1、风力发电机功率曲线统计MATLAB代码实现functionwindspeed_avractive_power_devwindspeed_fin_avractive_power_fin_avrCP=Powercurve-caLv03(filenamelzfilename2Jilename3zfilename4)%读取excel的xls文件%B列为功率C列为风速datal=xlsread(filenamelzlz,B2C52000);data2=xlsread(filename2zlz,B2C52000);data3=xlsread(filename3zlB2C52000);data4=xlsre
2、ad(filename4zlB2C52000,);%将四个Excel表合成一个表格data=datal;data2;data3;data4;%对数据进行筛选风速=3&data(j,l)=ldata-opt(jzl)=data(jz2);data_opt(j,2)=data(j,l);endend%对风速和功率进行排序并返回索引%求0.5ms的时间间隔的平均风速和相对应的平均功率,标准差m=length(ind);k=O;u=0;h=0;windspeed_sum=O;active_power_sum=0;windspeed_avr=O;active_power_avr=0;active_pow
3、er_error_sum=0;windspeed_fin_sum=O;active_power_fin_sum=0;P=1.062;A=pi*(882)2;forwindspeed_num=3:0.5:19.5fori=l:l:m%初步计算平均风速和平均功率active_power(i)=data_opt(ind(i),2);ifwindspeed(i)=windspeed-num&windspeed(i)=windspeed-num&windspeed(i)=windspeed-num&windspeed(i)windspeed-num+O.5e=abs(active_power(i)-ac
4、tive_power_avr(q)/active_power_dev(q);ife=4u=u+l;windspeed_fin_sum=windspeed_fin_sum+windspeed(i);active_power_fin_sum=active_power_fin_sum+active_power(i);endendwindspeed_fin_avr(q)=windspeed_fin_sum/u;active_power_fin_avr(q)=active_power_fin_sum/u;%计算发电机功率系数CP(q)=1000*active_power_fin_avr(q)/(0.5*
5、P*A*(windspeed_fin_avr(q)A3);endwindspeed_sum=O;active_power_sum=0;active_power_error_sum=0;windspeed_fin_sum=O;active_power_fin_sum=0;k=0;h=O;u=O;end%画出初步平均风速和平均功率的曲线figureplot(windspeed_avr,active_power_avr,rset(gca,xtick,0:1:20)set(gca/ytick0:100:1600)gridonxlabel(,windspeed-avrms)ylabel(active_p
6、ower_avr(kW)title(,powercurve)%画出标准差的曲线figureplot(windspeed_avrzactive_power_dev/g%bar(2*windspeed_num+0.5)/2,active_power_dev);set(gcaxtick,0lr20)set(gca/ytick0:20:200)gridonlabel(windspeed-avrms,)ylabel(active_power_dev)title(powerstandarddeviation)%画出最终的平均风速和平均功率曲线figureplot(windspeed_fin_avr,act
7、ive_power_fin_avr/kset(gca/xtick,O:l:2O)set(gca/ytick0:100:1600)gridonxlabel(windspeed_fin_avrms,)ylabel(active_power_fin_avr(kW)title(finalpowercurve)%画出最终的发电机功率系数figureplot(windspeed-fin-avrzCPmset(gca/xtick,O:l:2O)set(gca,ytick,0:0.1:0.6)gridonxlabel(windspeed_fin_avrms,)ylabel(active_power_dev)title(CP系数)%画出采集的散点图figureplot(data(rz2)zdata(:,1)/.);set(gcazxtick,0:1:22)set(gcaz,ytick,0:100:1600)gridonlabel(,windspeedms)ylabel(,active-power,)title(powerpoint)