目录
主要内容
内容研究
1.模型简介
2 程序释义
部分代码
运行结果
下载链接
主要内容
该程序实现一个综合能源系统的优化调度双层模型,上下层分别采用差分进化算法和规划算法进行求解。模型考虑了多种能源设备,包括燃气轮机、燃气锅炉、风电、光伏、储能设备等的协同运行,同时兼顾了能源供应商和用户的利益,需满足各种约束条件,包括设备出力约束、储能约束、负荷平衡约束等,以供应商和用户的收益、成本等为目标进行求解,同时考虑到负荷需求响应,通过分层模型将非线性求解模型转化为线性求解模型,实现了系统的经济和性能优化。程序采用matlab+cplex进行求解,注释清楚,有对应的文档说明,方便学习研究!
内容研究
1.模型简介
上层模型目标函数为:
为了便于理解,分块分析如下:
I3代表运营商售电收入,I4代表运营商售热收入,C_CCHP代表CCHP的运行成本,C_grid代表购电成本,FD代表储能的售电收益,FH代表售热能收益。
下层目标函数为:
逐项分析如下:
FU代表用户满意度,F5代表用户的购电,F6代表用户购热成本。
该目标的意思是用户满意度最高,用户购电和购热成本最低。
下层模型是采用规划算法结合cplex优化主体出力结果和目标值。
涉及到的约束主要有:
- 设备出力约束
- 设备爬坡约束
- 热电功率平衡约束
- 与电网交互约束
- 用户侧热电储能约束
- 用户侧负荷转移和削减约束
2 程序释义
程序包括的子程序较多,相互间的调用关系可参考下图:
具体每部分代码含义详见下载文件夹中说明文档。
部分代码
%基础热负荷 dh=[1000,1010,1043,1155,1172,1197,1158,1060,923,880,910,830,785,730,700,730,810,820,810,910,950,1010,1030,1020]; %基础电负荷 de=[540,528,504,516,524,520,612,652,696,856,956,968,992,864,720,676,680,668,708,976,968,960,572,532]; de1=[408,404,372,392,396,388,448,448,460,524,620,780,764,768,612,628,620,632,660,868,864,848,448,404]; %风电出力 Pwt=[203,277,264,331,137,81,72,141,43,12,20,12,5,48,86,346,287,530,491,448,603,601,403,380]; %光伏出力 Ppv=[0,0,0,0,0,0,97,220,336,410,486,444,453,445,442,325,202,140,29,0,0,0,0,0]; %电网分时电价、上网电价 grid_fs=[0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.8,0.8,0.8,1.2,1.2,1.2,1.2,0.8,0.8,0.8,0.8,1.2,1.2,1.2,0.8]; grid_sw=[0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35,0.35]; ch_min=[0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15,0.15];%热价下限 ch_max=[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5];%热价上限 Pice=sdpvar(1,24,'full');%电输出功率 Qgb=sdpvar(1,24,'full');%热输出功率 Pbuy=sdpvar(1,24,'full');%从电网购电电量 Psell=sdpvar(1,24,'full');%向电网售电电量 Pnet=sdpvar(1,24,'full');%交换功率 Temp_net=binvar(1,24,'full'); % 购|售电标志 le=sdpvar(1,24,'full');%可转移电负荷 lh=sdpvar(1,24,'full');%可转移热负荷 Pcharge=sdpvar(1,24,'full');UPcharge=binvar(1,24,'full');% 充电 Pdischarge=sdpvar(1,24,'full');UPdischarge=binvar(1,24,'full');% 放电 Hti=sdpvar(1,24,'full');UHti=binvar(1,24,'full');%充热 Hto=sdpvar(1,24,'full');UHto=binvar(1,24,'full');%放热 %用户偏好常系数 ve=1.5; a_e=0.0009; vh=1.1; a_h=0.0011; %燃气发电机、锅炉常数 ae=0.0013; be=0.16; ce=0; ah=0.0005; bh=0.11; ch=0; ce_ave=0.7;%平均电价约束 ch_ave=0.45;%平均热价约束 n_c=0.8;%热交换效率 n_ex=0.83; %余热回收效率 n_ice=0.35; %内燃机发电效率 %热储能 H_storage_max=1500; h_n=0.98;h_charge=0.98;h_discharge=1;%热储能容量/自损/充热/放热; %电储能 E_storage_max=2000; e_n=1;e_charge=0.95;e_discharge=0.95;%电储能容量/自损/充电/放电; bggin=1000;%%电储能