目录
1 主要内容
该程序复现《基于氢储能的热电联供型微电网优化调度方法》,针对质子交换膜燃料电池和电解槽的热电联供特性,为避免氢能系统的热能浪费并进一步提高氢能系统的效率,搭建了一种考虑氢能系统的热电联供型光伏/风机/燃料电池/蓄电池/电锅炉/燃气锅炉微电网系统,提出一种包括日前调度与实时优化的两阶段优化调度方法。所建系统考虑了电氢转换时的余热回收,将氢能系统作为热电氢耦合设备,实现了电、热、氢能的协调利用与相互转换,有效提高了能量利用率。在第一阶段调度中,根据日前的风光发电出力及负荷需求预测,以微电网整体运行成本最小为目标,采用混合整数线性规划方法实现日前最优全局调度;在第二阶段调度中,根据超短期预测结果,使用模型预测控制嵌入混合整数二次规划算法,减小预测误差带来的经济性影响。程序采用matlab+yalmip(cplex作为求解器)进行求解,注释清晰,运行稳定,方便学习!
-
模型求解流程
2 部分程序
%% 各变量及常量定义 Pwind=sdpvar(1,4,'full'); %风机出力 Ppv=sdpvar(1,4,'full');%光伏出力 Pbat=sdpvar(1,4,'full');%蓄电池出力 Temp_cha=binvar(1,4,'full'); %充电标志 Temp_dis=binvar(1,4,'full'); %放电标志 Temp_static=binvar(1,4,'full'); %电池静置标志 Pcha=sdpvar(1,4,'full'); Pdis=sdpvar(1,4,'full'); Phss=sdpvar(1,4,'full');%氢储能系统净功率 Pfc=sdpvar(1,4,'full'); Pel=sdpvar(1,4,'full'); Psto=sdpvar(1,4,'full'); Temp_fc=binvar(1,4,'full');%燃料电池工作标志 Temp_el=binvar(1,4,'full');%电解槽工作标志 Temp_Hstatic=binvar(1,4,'full'); %氢储能系统静置标志 Peb=sdpvar(1,4,'full');%电锅炉电功率 Qeb=Peb*0.9;%电锅炉热功率 Pbl=sdpvar(1,4,'full');%燃气锅炉电功率 Qbl=Pbl*0.73;%燃气锅炉热功率 Qtst=sdpvar(1,4,'full');%蓄热槽热功率 Qcha=sdpvar(1,4,'full'); Qdis=sdpvar(1,4,'full'); Temp_Qcha=binvar(1,4,'full'); %蓄热标志 Temp_Qdis=binvar(1,4,'full'); %放热标志 Temp_Qstatic=binvar(1,4,'full'); %蓄热槽静置标志 Hel=sdpvar(1,4,'full'); Hfc=sdpvar(1,4,'full'); S=sdpvar(1,4,'full'); E=sdpvar(1,4,'full'); H=sdpvar(1,4,'full'); Constraints = []; for k=1:4 Constraints =[Constraints,Pwindr(1,k)+Ppvr(1,k)-Pfc(1,k)==Ploadr(1,k)+Pel(1,k)+Pbat(1,k)+Peb(1,k)]; %----------------------HSS约束--------------------% Constraints = [Constraints, -100<=Phss(1,k)<=100]; Constraints = [Constraints, implies(Temp_fc(1,k),[Phss(1,k)<=0,Pfc(1,k)==Phss(1,k),Pel(1,k)==0])];%燃料电池约束 Constraints = [Constraints, implies(Temp_el(1,k),[Phss(1,k)>=0,Pel(1,k)==Phss(1,k),Pfc(1,k)==0])];%电解槽约束 Constraints = [Constraints, implies(Temp_Hstatic(1,k),[Pfc(1,k)==0,Pel(1,k)==0,Phss(1,k)==0])];%静置情况约束 Constraints = [Constraints, Temp_fc(1,k)+Temp_el(1,k)+Temp_Hstatic(1,k)==1]; %----------------------热约束--------------------% Constraints = [Constraints, 0.73*Pbl(1,k)+0.9*Peb(1,k)-Qtst(1,k)+0.25*Pel(1,k)-0.9*Pfc(1,k)==Qloadr(1,k)]; %热平衡约束0.73*Pbl(1,k)+0.9*Peb(1,k)-Qtst(1,k)+0.25*Pel(1,k)-0.9*Pfc(1,k)==Qload(1,k) Constraints = [Constraints, 0<=Qeb(1,k)<=54]; %电锅炉热功率约束 Constraints = [Constraints, 10.95<=Qbl(1,k)<=51.1]; %燃气锅炉功率约束 Constraints = [Constraints, -100<=Qtst(1,k)<=100];%蓄放热约束 Constraints = [Constraints, implies(Temp_Qcha(1,k),[Qtst(1,k)>=0,Qcha(1,k)==Qtst(1,k),Qdis(1,k)==0])];%蓄热情况约束 Constraints = [Constraints, implies(Temp_Qdis(1,k),[Qtst(1,k)<=0,Qdis(1,k)==Qtst(1,k),Qcha(1,k)==0])];%放热情况约束 Constraints = [Constraints, implies(Temp_Qstatic(1,k),[Qtst(1,k)==0,Qdis(1,k)==0,Qcha(1,k)==0])];%静置情况约束 Constraints = [Constraints, Temp_Qcha(1,k)+Temp_Qdis(1,k)+Temp_Qstatic(1,k)==1]; %----------------------蓄电池约束--------------------% Constraints = [Constraints, -100<=Pbat(1,k)<=100];%电池充放电约束 Constraints = [Constraints, implies(Temp_cha(1,k),[Pbat(1,k)>=0,Pcha(1,k)==Pbat(1,k),Pdis(1,k)==0])];%充电情况约束 Constraints = [Constraints, implies(Temp_dis(1,k),[Pbat(1,k)<=0,Pdis(1,k)==Pbat(1,k),Pcha(1,k)==0])];%放电情况约束 Constraints = [Constraints, implies(Temp_static(1,k),[Pbat(1,k)==0,Pdis(1,k)==0,Pcha(1,k)==0])];%静置情况约束 Constraints = [Constraints,Temp_cha(1,k)+Temp_dis(1,k)+Temp_static(1,k)==1]; Constraints=[Constraints,0.2<=S(1,k)<=0.8]; Constraints=[Constraints,0.2<=E(1,k)<=0.8]; Constraints=[Constraints,0.2<=H(1,k)<=0.8]; end
3 程序结果
-
日前调度
-
日内调度