为了减小电动汽车规模化充电给配电网安全稳定运行带来的不利影响,提出一种基于遗传算法的电动汽车有序充电策略。考虑用户出行规律及保证配电网的安全稳定运行,以 降低负荷曲线峰谷差与充电成本最小为目标,建立峰值不超过变压器容量和电池电量充满为约束 的优化模型。
1 、目标函数的建立
编辑
2、求解及其算法流程
3、部分代码
clc clear all warning off %% 不同车辆数结果对比 load EV200.mat load EV300.mat load zpe2.mat load zpe3.mat dianjia=[0.500000000000000,0.650000000000000,0.650000000000000,0.650000000000000,0.500000000000000,0.500000000000000,0.500000000000000,0.500000000000000,0.500000000000000,0.350000000000000,0.350000000000000,0.350000000000000,0.350000000000000,0.350000000000000,0.350000000000000,0.350000000000000,0.500000000000000,0.500000000000000,0.650000000000000,0.650000000000000,0.650000000000000,0.650000000000000,0.500000000000000,0.650000000000000]; Residential_load=[1393.85 1097.4 742.992 392.3 289.767 300.912 418.305 653.833 1010.47 1243.03 1482.27 1832.22 1880.51 1901.32 1888.69 1863.42 1883.49 1968.93 2067.75 2113.07 2086.32 1969.67 1829.25 1665.05]; fengdian=[236,210,198,182,240,180,168,96,48,30,96,108,84,132,150,132,108,72,96,110,136,192,192,180]; guangfu=[0 0 0 0 0 20 65 110 180 249.9 260 275 270 265 245 230 175 120 30 0 0 0 0 0]; xinnengyuan=fengdian+guangfu; figure plot(EV200,'k*-','LineWidth',1.5) hold on plot(EV300,'r*-','LineWidth',1.5) hold off xlabel('时间/h') ylabel('充电负荷(kw)') title('电动车充电负荷曲线') legend('200辆车','300辆车') xlim([0,24]) set(gca,'xtick',[0:4:24]) figure plot(Residential_load,'ko-','LineWidth',1.5); xlabel('时间/h') ylabel('总负荷(kw)') title('基础负荷曲线') xlim([1,24]) set(gca,'xtick',[0:4:24]) figure plot(zpe2,'bo-','LineWidth',1.5); hold on plot(zpe3,'r*-','LineWidth',1.5); hold off xlabel('时间/h') ylabel('总负荷(kw)') title('无序充电负荷曲线') legend('200辆车无序','300辆车无序') xlim([1,24]) set(gca,'xtick',[0:4:24]) figure plot(zpe2+Residential_load,'b-o','LineWidth',1.5); hold on plot(zpe3+Residential_load,'r-*','LineWidth',1.5); hold off xlabel('时间/h') ylabel('总负荷(kw)') title('考虑无序充电的总负荷曲线') legend('200辆车无序','300辆车无序') xlim([1,24]) set(gca,'xtick',[0:4:24]) figure plot(Residential_load,'ko-','LineWidth',1.5); hold on plot(EV200+Residential_load,'bo-','LineWidth',1.5); hold on plot(EV300+Residential_load,'ro-','LineWidth',1.5); hold on plot(zpe2+Residential_load,'b--','LineWidth',1.5); hold on plot(zpe3+Residential_load,'r--','LineWidth',1.5); hold on zzz=ones(1,24)*2800; plot(zzz,'k--','LineWidth',1.5') xlabel('时间/h') ylabel('总负荷(kw)') title('考虑电动车充电的总负荷曲线') legend('基础负荷','200辆车有序','300辆车有序','200辆车无序','300辆车无序') xlim([1,24]) set(gca,'xtick',[0:4:24]) figure plot(Residential_load,'ko-','LineWidth',1.5); hold on plot(EV200+Residential_load,'bo-','LineWidth',1.5); hold on plot(zpe2+Residential_load,'b--','LineWidth',1.5); xlabel('时间/h') ylabel('总负荷(kw)') title('200辆车有序与无序总负荷曲线') legend('基础负荷','200辆车有序','200辆车无序') xlim([1,24]) set(gca,'xtick',[0:4:24]) figure plot(Residential_load,'ko-','LineWidth',1.5); hold on plot(EV300+Residential_load,'ro-','LineWidth',1.5); hold on plot(zpe3+Residential_load,'r--','LineWidth',1.5); xlabel('时间/h') ylabel('总负荷(kw)') title('300辆车有序与无序总负荷曲线') legend('基础负荷','300辆车有序','300辆车无序') xlim([1,24]) set(gca,'xtick',[0:4:24]) %电价曲线 figure DJ=[]; T=[]; for i=1:24 T0=i-1:0.01:i; DJ=[DJ dianjia(i)*square(T0/(2*pi))]; T=[T,T0]; end plot(T,abs(DJ),'r-','LineWidth',1.5); xlabel('时间/h') ylabel('电价/元') title('电价曲线') xlim([1,24]) ylim([0 1]) set(gca,'xtick',[0:4:24]) %风电出力曲线 figure plot(fengdian,'r-','LineWidth',1.5); xlabel('时间/h') ylabel('功率/kw') title('风电出力曲线') xlim([1,24]) set(gca,'xtick',[0:4:24]) %光伏出力曲线 figure plot(guangfu,'r-','LineWidth',1.5); xlabel('时间/h') ylabel('功率/kw') title('光伏出力曲线') xlim([1,24]) set(gca,'xtick',[0:4:24]) %新能源出力曲线 figure m_x=mean(xinnengyuan); max_x=1.25*m_x*ones(24,1); min_x=0.75*m_x*ones(24,1); plot(xinnengyuan,'b-','LineWidth',1.5); hold on plot(max_x,'r--','LineWidth',1.5); hold on plot(min_x,'k--','LineWidth',1.5); xlabel('时间/h') ylabel('功率/kw') title('新能源出力曲线') legend('新能源出力曲线','高出力临界值','低出力临界值') xlim([1,24]) ylim([0 500]) set(gca,'xtick',[0:4:24]) %% 利用量曲线 figure %计算有序充电的新能源消纳率 st1=find(EV200-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st2=find(EV200-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st1))+sum(EV200(st2)))/sum(xinnengyuan); XL200(st1)=xinnengyuan(st1); XL200(st2)=EV200(st2); st3=find(EV300-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st5=find(EV300-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st3))+sum(EV300(st5)))/sum(xinnengyuan); XL300(st3)=xinnengyuan(st3); XL300(st5)=EV300(st5); st11=find(zpe2-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st22=find(zpe2-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st11))+sum(zpe2(st22)))/sum(xinnengyuan); WL200(st11)=xinnengyuan(st11); WL200(st22)=zpe2(st22); st33=find(zpe3-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st55=find(zpe3-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st33))+sum(zpe3(st55)))/sum(xinnengyuan); WL300(st33)=xinnengyuan(st33); WL300(st55)=zpe3(st55); plot(XL200, 'r-pentagram','LineWidth',1.5); hold on plot(WL200, 'c-o','LineWidth',1.5); xlabel('时间/h') ylabel('新能源利用量/kw') title('200辆车有序与无序充电新能源利用量曲线') legend('有序充电','无序充电') xlim([1,24]) set(gca,'xtick',[0:4:24]) %% 计算有序无序充电的参数 %计算有序充电的峰谷差率 fh1=zpe2+Residential_load; fgc=(max(fh1)-min(fh1))/max(fh1)*100; disp('无序充电的峰谷差率') fgc %计算有序充电的电费 disp('无序充电的电费') P=sum(0.8.*zpe2) %计算有序充电的新能源消纳率 st1=find(zpe2-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st2=find(zpe2-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st1))+sum(zpe2(st2)))/sum(xinnengyuan); XL200(st1)=xinnengyuan(st1); XL200(st2)=zpe2(st2); disp('新能源消纳率') xiaonalv %计算有序充电的峰谷差率 fh1=zpe3+Residential_load; fgc=(max(fh1)-min(fh1))/max(fh1)*100; disp('无序充电的峰谷差率') fgc %计算有序充电的电费 disp('无序充电的电费') P=sum(0.8.*zpe3) st1=find(zpe3-xinnengyuan>=0);%新能源发电全部用于汽车充电的时间段 st2=find(zpe3-xinnengyuan<0);%新能源发电有剩余的时间段 xiaonalv=(sum(xinnengyuan(st1))+sum(zpe2(st2)))/sum(xinnengyuan); XL200(st1)=xinnengyuan(st1); XL200(st2)=zpe2(st2); disp('新能源消纳率') xiaonalv
4、结果展示
标签:24,1.5,hold,充放电,plot,load,源码,matlab,LineWidth From: https://www.cnblogs.com/lovematlab/p/16892994.html