《风力发电机功率曲线统计MATLAB代码实现.docx》由会员分享,可在线阅读,更多相关《风力发电机功率曲线统计MATLAB代码实现.docx(6页珍藏版)》请在第一文库网上搜索。
1、风力发电机功率曲线统计MAT1AB代码实现functionwindspeed_avractive_power_devwindspeed_fin_avractive_power_fin_avrCP=Powercurve-ca1v03(fi1ename1zfi1ename2Ji1ename3zfi1ename4)%读取exce1的x1s文件%B列为功率C列为风速data1=x1sread(fi1ename1z1z,B2C52000);data2=x1sread(fi1ename2z1z,B2C52000);data3=x1sread(fi1ename3z1B2C52000);data4=x1sre
2、ad(fi1ename4z1B2C52000,);%将四个Exce1表合成一个表格data=data1;data2;data3;data4;%对数据进行筛选风速=3&data(j,1)=1data-opt(jz1)=data(jz2);data_opt(j,2)=data(j,1);endend%对风速和功率进行排序并返回索引%求0.5ms的时间间隔的平均风速和相对应的平均功率,标准差m=1ength(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=1:1: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+1;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%画出初步平均风速和平均功率的曲线figurep1ot(windspeed_avr,active_power_avr,rset(gca,xtick,0:1:20)set(gca/ytick0:100:1600)gridonx1abe1(,windspeed-avrms)y1abe1(active_p
6、ower_avr(kW)tit1e(,powercurve)%画出标准差的曲线figurep1ot(windspeed_avrzactive_power_dev/g%bar(2*windspeed_num+0.5)/2,active_power_dev);set(gcaxtick,01r20)set(gca/ytick0:20:200)gridon1abe1(windspeed-avrms,)y1abe1(active_power_dev)tit1e(powerstandarddeviation)%画出最终的平均风速和平均功率曲线figurep1ot(windspeed_fin_avr,act
7、ive_power_fin_avr/kset(gca/xtick,O:1:2O)set(gca/ytick0:100:1600)gridonx1abe1(windspeed_fin_avrms,)y1abe1(active_power_fin_avr(kW)tit1e(fina1powercurve)%画出最终的发电机功率系数figurep1ot(windspeed-fin-avrzCPmset(gca/xtick,O:1:2O)set(gca,ytick,0:0.1:0.6)gridonx1abe1(windspeed_fin_avrms,)y1abe1(active_power_dev)tit1e(CP系数)%画出采集的散点图figurep1ot(data(rz2)zdata(:,1)/.);set(gcazxtick,0:1:22)set(gcaz,ytick,0:100:1600)gridon1abe1(,windspeedms)y1abe1(,active-power,)tit1e(powerpoint)