学习GAMS 一段时间编写了基于能源枢纽的程序,四节点,九节点的综合能源系统优化程序。本文先介绍一下能源枢纽的编程思路。

综合能源的相关论文有很多,自行查就可以了。

***************************************************************************************************

*先建立了时间T集合,后输入负荷和能源输入参数,

***************************************************************************************************

set t  period of time /1*24/
    tfirst(t);

tfirst(t)=yes$(ord(t) eq 1);

Parameters p_wind(t) mei xiao shi lai feng liang (KW) /1  3600 ,2  3500,
            3 3100 , 4   2900,  5  2900 ,6  2800 ,
            7 2500 ,8   2200 , 9  2300 , 10  2400 ,
            11 2400 ,12  2400 ,  13 2300 ,14  2200 ,
            15 2100 ,16   2200 , 17 2000 ,18  1900 ,
            19 2000 ,20  2300 , 21 2600 ,22  2800 ,
            23 3200 ,24  3600 /
          Le(t)   load of electric (kw)    /1  1600,  2  1700,
            3  1800,   4  1800,  5  1800,   6   1950,
            7  2100,   8  2200,  9  2300,   10  2300,
            11  2350,  12  2350, 13  2350,  14  2300,
            15  2300,  16  2250, 17  2250,  18  2300,
            19  2350,  20  2450, 21  2400,  22  2100,
            23  1700,  24 1550   /
          Le_1(t)   load of 可平移负荷 (kw)    /1  400,  2  400,
            3  400,   4  400,  5  400,   6   400,
            7  400,   8  400,  9  400,   10  400,
            11  400,  12  400, 13 400,  14  400,
            15  400,  16  400, 17  400,  18  400,
            19  400,  20  400, 21  400,  22  400,
            23  400,  24 400   /
          Lh(t)   load of hot (kw)    /1  1400,  2  1400,
            3  1400,   4  1400,  5  1400,   6   1400,
            7  1100,   8  1100,  9  800,   10  800,
            11  1400,  12  1400, 13  1400,  14  800,
            15  800,  16  800, 17  1100,  18  1100,
            19  1100,  20  1100, 21  1250,  22  1250,
            23  1100,  24 1100   /
           Lg(t)   load of gas (kw)    /1  200,  2  200,
            3  200,   4  300,  5  250,   6   400,
            7  400,   8  450,  9  600,   10  700,
            11  700,  12  700, 13  650,  14  650,
            15  600,  16  700, 17  600,  18  600,
            19  700,  20  750, 21  900,  22  900,
            23  700,  24 650   /
           e(t)   price of electric (kw)    /1  10,  2  10,
            3    8,   4    9,  5   10,   6    13,
            7   18,   8   20,  9   21,   10   21,
            11  21,  12   20,  13  18,   14   17,
            15  16,  16   17,  17  19,   18   23,
            19  26,  20   24,  21  22,   22   20,
            23  17,  24   16   /
           g(t)   price of gas (kw)    /1  8.5,  2  8.5,
            3    8.5,   4    8.5,  5   8.5,   6    8.5,
            7    8.5,   8    8.5,  9   8.5,   10   8.5,
            11   8.5,   12   8.5,  13  8.5,   14   8.5,
            15   8.5,   16   8.5,  17  8.5,   18   8.5,
            19   8.5,   20   8.5,  21  8.5,   22   8.5,

23   8.5,   24   8.5   /;

*************************************************************************************************************************

*接下来结束输入各种设备的参数,能源间的转化效率,等等

*EB电锅炉;GB气锅炉;MT微燃机,P2G设备;GS,HS,ES 分别是储气,储热,储电

*************************************************************************************************************************

scalar      elta_p2g  The efficiency of power to gas  /0.5/;
scalar      elta_MTe  Micro-gas turbine power generation efficiency /0.26/;
scalar      elta_MTh  Micro-gas turbine heat  efficiency /0.3/;
scalar      elta_EB   Electric boiler thermal efficiency /0.9/;

scalar      elta_GB   Gas boiler thermal efficiency      /0.85/;

scalar      Ebcmax       Electric boiler rated operating                      /1500/;
scalar      Ebcmin       minimum operating power of Electric boiler            /0/;
scalar      Ebc_ratemax     Electric boiler input power change rate              /1000/;
scalar      Ebc_ratemin     Electric boiler input power change rate              /-1000/;

scalar      Gbcmax       Gas boiler ratated operating                       /1000/;
scalar      Gbcmin       minimum operating power of Gas boiler               /0/;
scalar      Gbc_ratemax     Gas boiler input power change rate             /1000/;
scalar      Gbc_ratemin     Gas boiler input power change rate             /-500/;

scalar      MTcmax      micro gas turbine rated operating                     /800/;
scalar      MTcmin      minimum operating power of MT          /0/;
scalar      MT_ratemax     MT input power change rate             /200/;
scalar      MT_ratemin     MT input power change rate             /-200/;

scalar      P2Gcmax         P2G rated operating                     /0/;
scalar      P2Gcmin         minimum operating power of P2G          /0/;
scalar      P2G_ratemax     P2G input power change rate             /0/;
scalar      P2G_ratemin     P2G input power change rate             /0/;

scalar     pemax                     /4000/;
scalar     pemin                     /800/;

scalar     pgmax                     /4000/;
scalar     pgmin                     /0/;

scalar      GSmax       Natural gas tank capacity           /0/;
scalar      GSmin                   /0/ ;
scalar      GS_ratemax              /0/;
scalar      GS_0                    /0/;

scalar      HSmax       Thermal energy storage capacity        /0/;
scalar      HSmin                   /0/ ;
scalar      HS_ratemax              /0/;
scalar      HS_0                    /0/;

scalar      ESmax       Thermal energy storage capacity        /0/;
scalar      ESmin                   /0/ ;
scalar      ES_ratemax              /0/;

scalar      ES_0                    /0/;

*********************************************************************************************************************

*后边就是优化变量,方程求解了

*********************************************************************************************************************

positive variables

pe(t)        Purchase power
           pg(t)        The amount of purchased natural gas
           pw(t)        Wind power generation

pe2g(t)      power to gas
           pEB(t)       Electricity consumed by electric boilers
           pMT(t)       GAS consumed by micro gas turbine
           pGB(t)       GAS consumed by gas boiler

WG(t)        GAS storage  xian you liang
           WH(t)        GAS storage  xian you liang
           WE(t)

Free variable
           pgs(t)       "Gas storage capacity"
           phs(t)
           pes(t)
           qifengliang
           Z  objective ;

*binary variable
*          U(t);

Equations p_e(t)           Electric load balancing
          p_h(t)           Heat load balance
          p_g(t)           Natural gas load balance
*shuru ce yue shu
          pwind_conmax(t)     Wind power generation constraints
          pe_conmax(t)
          pe_conmin(t)
          pg_conmax(t)
          pg_conmin(t)
* she bei yun xing yue shu
          Ebc_conmax(t)
          Ebc_conmin(t)
          dEbc_conmax(t)
          dEbc_conmin(t)
          Gbc_conmax(t)
          Gbc_conmin(t)
          dGbc_conmax(t)
          dGbc_conmin(t)
          MTc_conmax(t)
          MTc_conmin(t)
          dMTc_conmax(t)
          dMTc_conmin(t)
          P2Gc_conmax(t)
*         P2Gc_conmin(t)
*         dP2Gc_conmax(t)
* chu neng yue shu
         elc_storage
         ES_conmax(t)
         ES_conmin(t)
         WWE(t)
         WWE_conmax(t)
         WWE_conmin(t)

gas_storage
         GS_conmax(t)
         GS_conmin(t)
         WWG(t)
         WWG_conmax(t)
         WWG_conmin(t)

hot_storage
         HS_conmax(t)
         HS_conmin(t)
         WWH(t)
         WWH_conmax(t)
         WWH_conmin(t)

qifeng
* mu biao han shu
          ff               Objective function    ;

*这几句是能源枢纽模型的主要函数
 p_e(t)..   pe(t)+pw(t)-pe2g(t)-PEB(t)+ elta_MTe*pMT(t)+pes(t)  =e= (Le(t)+Le_1(t));
 p_h(t)..   elta_MTh*pMT(t)+ pEB(t)*elta_EB+elta_GB*pGB(t)+phs(t) =e= Lh(t);
 p_g(t)..   pg(t)+elta_p2g*pe2g(t)- pMT(t)-pGB(t)+pgs(t) =e= Lg(t);

pwind_conmax(t).. pw(t) =l= p_wind(t);
 pe_conmax(t)..   pe(t)=l= pemax;
 pe_conmin(t)..   pe(t)=g= pemin;
 pg_conmax(t)..   pg(t)=l= pgmax;
 pg_conmin(t)..   pg(t)=g= pgmin;

Ebc_conmax(t)..  pEB(t) =l= Ebcmax;
 Ebc_conmin(t)..  pEB(t) =g= Ebcmin;
 dEbc_conmax(t)..(PEB(t+1)-PEB(t)) =l= Ebc_ratemax;
 dEbc_conmin(t)..(PEB(t+1)-PEB(t)) =g= Ebc_ratemin;
 Gbc_conmax(t).. pGB(t) =l= Gbcmax;
 Gbc_conmin(t).. pGB(t) =g= Gbcmin;
 dGbc_conmax(t)..(PGB(t+1)-PGB(t)) =l= GBc_ratemax;
 dGbc_conmin(t)..(PGB(t+1)-PGB(t)) =g= GBc_ratemin;
 MTc_conmax(t).. pMT(t) =l= MTcmax;
 MTc_conmin(t).. pMT(t) =g= MTcmin;
 dMTc_conmax(t)..(PMT(t+1)-PMT(t)) =l= MT_ratemax;
 dMTc_conmin(t)..(PMT(t+1)-PMT(t)) =g= MT_ratemin;
 P2Gc_conmax(t).. pe2g(t) =l= P2Gcmax;

elc_storage.. sum(t,pes(t)) =e= 0;
ES_conmax(t)..pes(t) =l= ES_ratemax;
ES_conmin(t)..pes(t) =g= -ES_ratemax;
WWE(t+1)..WE(t+1) =e= WE(t)-pes(t);
WWE_conmax(t).. WE(t) =l= ESmax;
WWE_conmin(t).. WE(t) =g= 0;

gas_storage.. sum(t,pgs(t)) =e= 0;
GS_conmax(t)..pgs(t) =l= GS_ratemax;
GS_conmin(t)..pgs(t) =g= -GS_ratemax;
WWG(t+1)..WG(t+1) =e= WG(t)-pgs(t);
WWG_conmax(t).. WG(t) =l= GSmax;
WWG_conmin(t).. WG(t) =g= 0;

hot_storage.. sum(t,phs(t)) =e= 0;
HS_conmax(t)..phs(t) =l= HS_ratemax;
HS_conmin(t)..phs(t) =g= -HS_ratemax;
WWH(t+1)..WH(t+1) =e= WH(t)-phs(t);
WWH_conmax(t).. WH(t) =l= HSmax;
WWH_conmin(t).. WH(t) =g= 0;

qifeng.. qifengliang =e=sum(t,(P_wind(t)-pw(t))) ;
ff..    z =e= sum(t,(e(t)*pe(t)+ g(t)* pg(t)) )   ;

model P2g /all/;
*---------------------------------------------------------
WG.fx(tfirst) = GS_0;
WH.fx(tfirst) = HS_0;
*---------------------------------------------------------
Solve p2g using LP minimizing z ;

display z.l,pe.l,pg.l,pw.l,p_wind,pe2g.l,PgB.l,PEB.l,Pmt.l,pgs.l,WG.L,qifengliang.l;

这个能源枢纽的程序写的很简陋,也很简单。当初初学的时候编写的程序,但是运行应该没问题。

上面是自己摸索的时候学的,没有太好的编程逻辑。

如果想较系统的学一下,我最近也有分享此类的内容

搜索“GAMS系列分享”,查看GAMS在电力系统(综合能源)中的应用!!!

搜索“GAMS系列分享”,查看GAMS在电力系统(综合能源)中的应用!!!

搜索“GAMS系列分享”,查看GAMS在电力系统(综合能源)中的应用!!!

GAMS编写综合能源程序相关推荐

  1. Matlab程序代码,智能微电网PSO优化算法,多目标调度,粒子群算法,综合能源系统优化,机组最优组合,光伏出力预测

    Matlab程序代码,智能微电网PSO优化算法,多目标调度,粒子群算法,综合能源系统优化,机组最优组合,光伏出力预测,神经网络简单应用,多目标优化,冷热电联供型综合能源系统优化调度模型,求解采用的是M ...

  2. 综合能源系统优化调度(冷热电联产)的程序matlab、微网优化调度基础学习 综合能源系统

    综合能源系统优化调度(冷热电联产)的程序matlab.微网优化调度基础学习 综合能源系统 采用多目标粒子群算法,求解优化调度模型. 适合刚入门综合能源研究方向(冷热电联供)并想在前人的基础上进行创新的 ...

  3. MATLAB程序:综合能源系统优化调度,考虑了阶梯型碳交易机制和氢能,具有一定的创新。

    MATLAB程序:综合能源系统优化调度,考虑了阶梯型碳交易机制和氢能,具有一定的创新. 采用CPLEX+Yalmip求解,基本复现. ID:6990667995938854

  4. matlab程序,基于广义benders分解法的综合能源系统优化规划,关键词,综合能源系统规划,Benders分解

    matlab程序,基于广义benders分解法的综合能源系统优化规划,关键词,综合能源系统规划,Benders分解,机会约束规划. ID:5999661483864996小陈代码店

  5. 研究考虑CSP电站和ORC的综合能源系统优化规划 程序包含新能源消纳、光热电站、ORC有机郎肯循环、

    研究考虑CSP电站和ORC的综合能源系统优化规划 程序包含新能源消纳.光热电站.ORC有机郎肯循环.热电联产.燃气锅炉.P2G等综合元素,实现系统总运行成本最小 包括购电.购气成本.弃风光成本.设备运 ...

  6. 采用matlab编制含电气热的综合能源优化程序,采用yalmip和cplex求解,通过二阶锥模型实现相关约束限制

    电气热 综合能源 二阶锥 采用matlab编制含电气热的综合能源优化程序,采用yalmip和cplex求解,通过二阶锥模型实现相关约束限制,综合能源系统考虑39节点电网+6节点气网+热网模型,程序注释 ...

  7. 11基于主从博弈理论的共享储能与综合能源微网优化运行研究(MATLAB程序)

    资源地址: 11基于主从博弈理论的共享储能与综合能源微网优化运行研究MATLAB复现程序_冷热电联供系统cplex-电子商务文档类资源-CSDN文库 参考文献: 基于主从博弈理论的共享储能与综合能源微 ...

  8. MATLAB程序:基于主从博弈理论的共享储能与综合能源微网优化运行研究

    MATLAB程序:基于主从博弈理论的共享储能与综合能源微网优化运行研究. 提出共享储能背景下微网运营商与用户聚合商间的主从博弈模型,并证明Stackelberg 均衡解的存在性与唯一性. 最后,在 M ...

  9. 综合能源服务认证技术规范编写有哪些单位参与?

    ​综合能源服务认证技术规范参编单位有郑州大学.国网山东综合能源服务有限公司.浙江正泰能效科技有限公司.中国大唐集团科技工程有限公司.远大能源利用管理有限公司.国网江苏综合能源服务有限公司.江苏林洋能源 ...

  10. python编写的程序可以在任何平台中执行-在Windows平台上编写的Python程序无法在Unix平台运行。...

    [单选题]在中华人民共和国境内飞行的民用航空器必须具有: ( ) [单选题]属于发热激活物的是: [单选题]年满( )周岁可以独立实施民事法律行为视为完全民事行为能力人 [单选题]在DIC的原发病中, ...

最新文章

  1. 天之痕java版不能捉妖_〖天之痕游戏常见问题汇总(更新版)〗
  2. 那个脑袋生锈的我写的东西
  3. c语言文件可用代码存放,C语言 文件(示例代码)
  4. 生成工具-CodeSmith-享受编程的乐趣(三)(转载)
  5. python语言能干什么-python语言能做什么
  6. MongoDB 一个基于分布式文件存储的数据库
  7. 性能瓶颈分析整体思路
  8. .NET6 新功能和新生态
  9. MySQL(基础技能)
  10. 2017 秦皇岛CCPC Balloon Robot (ZOJ 3981)
  11. 性能测试指标(重要)
  12. Spring 4 Security MVC登录注销示例
  13. mongodb 常用操作(转)
  14. labview技巧——自定义 5位数码管字体 显示控件
  15. 手写原笔迹输入_原笔迹手写软件
  16. B-spline Surfaces
  17. 红米3 android 版本升级失败,疑似官方推送错误固件 红米Note3全网通升级后变砖...
  18. 图形驱动程序和显卡驱动什么区别_电脑游戏显卡和专业图形显卡存在的区别
  19. 如果VxRail要发朋友圈
  20. windows自带截图键(shift+ win + s)没有反应,一招教你快速解决!

热门文章

  1. 家用千兆路由器排行榜前十名_家庭用哪款路由器好 2017最适合家用路由器排行榜...
  2. 明争暗斗 京东阿里智能家居大战一触即发
  3. 【华为OD机试真题 JAVA】勾股数元组【2022 Q4 | 100分】
  4. COOC软件一款用于文献计量和知识图谱绘制的新软件
  5. Vue项目中Router路由中meta字段的妙用-案例
  6. OTA分类 OTA升级方式(乒乓、压缩、差分)
  7. openwrt修改默认网关地址_修改宇视摄像机IP地址的方法
  8. android流光字体实现,CSS实现字体流光/高光滑动
  9. html文字效果简书,css3实现动态流光文字效果
  10. Jackie Chan Comments Spark Online Backlash