本程序参考论文《考虑源荷不确定性的含风电-电力系统低碳调度》,程序中考虑了源荷的不确定性,引入模糊机会约束规划来求解不确定性模型,对做相关研究方向的小伙伴非常有帮助,程序算例丰富、注释清晰、干货满满,下面对文章和程序做简要介绍。
大规模风电并网是实现电力低碳环保发展的必然趋势,而风电与负荷的随机波动性对系统的影响不容忽视。提出一种考虑模糊机会约束的低碳型经济调度模型,同时计及源荷两侧不确定性对含风电电力系统低碳调度的影响。将阶梯型的碳交易成本引入目标函数中,旨在降低系统碳排放量,提高系统风电消纳量。针对风电并网后系统的不确定因素,引入模糊机会约束,将确定性约束松弛为含有模糊变量的系统约束,利用梯形模糊参数将其清晰化处理,并通过CPLEX对模型进行求解。算例分析表明所提模型可有效提高风电消纳水平以及降低碳排放。
程序结果:
图2中可以看出,机组1出力的结果和线性化出力结果相同。程序中有非线性算例,供感兴趣的小伙伴参考学习。
部分程序:
%% 决策变量
PG = sdpvar(ngen, Horizon,'full');%火电
PH = sdpvar(1, Horizon);%水电
x_P_ch = sdpvar(1, Horizon);%充电
x_P_dis = sdpvar(1, Horizon);%放电
x_P_w = sdpvar(1, Horizon);%风电
x_P_v = sdpvar(1, Horizon);%水电
x_u_ch = binvar(1, Horizon);%充电状态
x_u_dis = binvar(1, Horizon);%放电状态
OnOff = binvar(ngen,Horizon,'full');%火电机组状态
lin = sdpvar(1, Horizon);%目标3中间变量
%P的平方线性化参数
gn=5;
x_pf=sdpvar(ngen, Horizon);
gw1=sdpvar(gn+1,Horizon);
gw2=sdpvar(gn+1,Horizon);
gw3=sdpvar(gn+1,Horizon);
gw4=sdpvar(gn+1,Horizon);
gw5=sdpvar(gn+1,Horizon);
gz1=binvar(gn, Horizon);gz2=binvar(gn, Horizon);gz3=binvar(gn, Horizon);gz4=binvar(gn, Horizon);gz5=binvar(gn, Horizon);
%模型构建
%% 约束条件生成
cons = [];
%火电机组
cons_gen = getConsGen1(PG,Pgmax,Pgmin,rud, Horizon,OnOff,On_min,Off_min);
cons = [cons, cons_gen];
%水电机组
cons = [cons, repmat(Phmin,1,Horizon)<=PH<=repmat(Phmax,1,Horizon)];
%储能约束
cons_ees = getConsEES(x_P_ch, x_P_dis, x_u_ch, x_u_dis, EESmax, EESmin, capmax, Horizon,theta);
cons = [cons, cons_ees];
%新能源出力约束
cons = [cons,0 <= x_P_w <=pw, 0 <= x_P_v <=pv];% ,0<= x_P_w+x_P_v+PH <=pload - sum(Pgmin)];
%功率平衡约束
ww=[0.6 1 1.4];
wv=[0.5 1 1.5];
wl=[0.9 1 1.1];
Pwb=((1-alfa)*ww(1)/2+ww(2)/2+ww(3)*alfa/2).*pw;
Pvb=((1-alfa)*wv(1)/2+wv(2)/2+wv(3)*alfa/2).*pv;
Plb=((1-alfa)*wl(1)/2+wl(2)/2+wl(3)*alfa/2).*pload;
%onoff*pg线性化出处理
yg = sdpvar(ngen,Horizon);
cons = [cons, yg <= PG, yg >= PG-repmat(Pgmax,1,Horizon).*(1-OnOff), repmat(Pgmin,1,Horizon).*OnOff <= yg <= repmat(Pgmax,1,Horizon).*OnOff];
%cons = [cons, (wl(2).*pload-ww(2).*x_P_w-wv(2).*x_P_v)+x_P_ch+x_P_dis-PH-sum(OnOff.*PG,1) == 0];
cons = [cons, (2-2*alfa).*(wl(2).*pload-ww(2).*x_P_w-wv(2).*x_P_v)+(2*alfa-1).*(wl(3).*pload-ww(1).*x_P_w-wv(1).*x_P_v)+x_P_ch+x_P_dis-PH-sum(yg) == 0];
%旋转备用约束
cons = [cons, (2-2*alfa).*(wl(2).*pload-ww(2).*x_P_w-wv(2).*x_P_v)+(2*alfa-1).*(wl(3).*pload-ww(1).*x_P_w-wv(1).*x_P_v)+x_P_ch+x_P_dis-PH-sum(OnOff.*repmat(Pgmax,1,Horizon))<=0];
%目标
%分段线性化
gn=5;
gl1=(Pgmax-Pgmin)./gn;
gl2=zeros(5,gn+1);
for i=1:5
gl2(i,:)=Pgmin(i):gl1(i):Pgmax(i);
end
cons = [cons, x_pf(1,:)==gl2(1,:).^2*gw1];
cons = [cons, x_pf(2,:)==gl2(2,:).^2*gw2];
cons = [cons, x_pf(3,:)==gl2(3,:).^2*gw3];
cons = [cons, x_pf(4,:)==gl2(4,:).^2*gw4];
cons = [cons, x_pf(5,:)==gl2(5,:).^2*gw5];
cons = [cons, gw1(1,:)<=gz1(1,:)];
for i=2:gn
cons = [cons, gw1(i,:)<=gz1(i-1,:)+gz1(i,:)];
end
cons = [cons, gw1(gn+1,:)<=gz1(gn,:)];
cons = [cons, sum(gz1)==ones(1,Horizon)];
cons = [cons, sum(gw1)==ones(1,Horizon)];
cons = [cons, gw2(1,:)<=gz2(1,:)];
for i=2:gn
cons = [cons, gw2(i,:)<=gz2(i-1,:)+gz2(i,:)];
end
cons = [cons, gw2(gn+1,:)<=gz2(gn,:)];
cons = [cons, sum(gz2)==ones(1,Horizon)];
cons = [cons, sum(gw2)==ones(1,Horizon)];
cons = [cons, gw3(1,:)<=gz3(1,:)];
for i=2:gn
cons = [cons, gw3(i,:)<=gz3(i-1,:)+gz3(i,:)];
end
cons = [cons, gw3(gn+1,:)<=gz3(gn,:)];
cons = [cons, sum(gz3)==ones(1,Horizon)];
cons = [cons, sum(gw3)==ones(1,Horizon)];
cons = [cons, gw4(1,:)<=gz4(1,:)];
for i=2:gn
cons = [cons, gw4(i,:)<=gz4(i-1,:)+gz4(i,:)];
end
cons = [cons, gw4(gn+1,:)<=gz4(gn,:)];
cons = [cons, sum(gz4)==ones(1,Horizon)];
cons = [cons, sum(gw4)==ones(1,Horizon)];
cons = [cons, gw5(1,:)<=gz5(1,:)];
for i=2:gn
cons = [cons, gw5(i,:)<=gz5(i-1,:)+gz5(i,:)];
end
cons = [cons, gw5(gn+1,:)<=gz5(gn,:)];
cons = [cons, sum(gz5)==ones(1,Horizon)];
cons = [cons, sum(gw5)==ones(1,Horizon)];
cons = [cons, PG(1,:)==gl2(1,:)*gw1];
cons = [cons, PG(2,:)==gl2(2,:)*gw2];
cons = [cons, PG(3,:)==gl2(3,:)*gw3];
cons = [cons, PG(4,:)==gl2(4,:)*gw4];
cons = [cons, PG(5,:)==gl2(5,:)*gw5];
cons = [cons, gw1 >= 0,gw2 >= 0,gw3 >= 0,gw4 >= 0,gw5 >= 0];
欢迎感兴趣的小伙伴关注下方公众号获取完整版代码,小编会继续推送更有质量的学习资料、文章和程序代码,为您的科研加油助力!