Hello,
I am new, I am looking for a solution for my code. I need your help please.
My code sends me error 119. Despite all my efforts I cannot solve the problem.
Here is :
sets
i kinds of energy technologies /bb, ngb, hp, ec, eb /
k number of commercial buildings / 5 /
l number of residential buildings / 29 /
h hours /h1, h2, h3, h4/
s seasons / summer, winter/;
Parameters
*-------------ANNUALIZED CAPITAL COST------------------------
cap(i) installed capacity of technology in MW
/ bb 5
ngb 5
hp 0.25
ec 0.25
eb 0.25/
ccap(i) unit capital cost of technologies in $
/ bb 1149000
ngb 166250
hp 279000
ec 1
eb 1/
db distance between buildings k and l
/ commercialresidential 350
residentialcommercial 350 /
n life of year of technologies
/bb 40
ngb 40
hp 20
ec 20
eb 20/
v values to limit the charge and discharge rates
/ v1 20
v2 20
v3 20
v4 30
v5 20
v6 20
v7 20 /;
*-------------MODEL VARIABLES---------------------------------
Variable
*-------------FC------------------------
sngbheat(k,h,s) heating supply from natural gas boiler
sbbheat(k,h,s) heating supply from biomass boiler
*-------------GC------------------------
epur(k,h,s) quantity of electricity purchased
*-------------MC------------------------
ebb(k,h,s) biomass boiler’s power consumption
eeb(k,h,s) electric boiler’s power consumption
engb(k,h,s) natural gas boiler’s power consumption
seccool(k,h,s) cooling supply from energy electric chillers
*-------------Capacity constraints------------------------
eeccool(k,h,s) electric chillers’s power consumption
shp(k,h,s) heating supply energy provided by heat pump
*-------------Operation constraints------------------------
seccool(k,h,s) cooling supply energy from electric chillers
sebheat(k,h,s) heating supply energy from electric boiler
sbbheat(k,h,s) heating supply energy from biomass boiler
sngbheat(k,h,s) heating supply energy from natural gas boiler
*-------------Electrical balance------------------------
eDdelectric(k,h,s) electrical demand of buildings
ehp(k,h,s) heat pump’s power consumption
eec(k,h,s) electric chiller’s power consumption
*-------------Heating balance------------------------
sDdheat(k,h,s) heating demand
sheatflow(k,l,h,s) heating energy flowing from the building k to l
sheatflow(k,l,h,s) heating energy flowing from the building l to k
srecoheat(k,h,s) recovered heat from onsite generation
*-------------Cooling balance------------------------
sDdcool(k,h,s) heating demand
scoolflow(k,l,h,s) cooling energy flowing from the building k to l
scoolflow(k,l,h,s) cooling energy flowing from the building l to k
scalar
*-------------FC----------------------------------
ngc unit cost of natural gas /0.053/
wpc wood pellets cost /1.35/
deltangbheat natural gas boiler efficiency /0.8/
deltabbheat biomass boiler efficiency /0.7/
*-------------GC----------------------------------
ppur unit price of electricity purchase /0.45/
*-------------MC----------------------------------
cmaint maintenance cost of each technology /0.75/
*-------------ANNUALIZED CAPITAL COST------------------------
ccappipe unit capital cost /75/
r interest rate of each technology /0.06/
*-------------ANNUALIZED CARBON EMISSIONS--------------------
betang natural gas emission factors /0.0731/
betabiomass biomass emission factors /1/
betagrid electricity grid emission factors /0.0865/
*-------------OPERATIONAL CONSTRAINTS-------------------------
deltaec electricity cooling efficiency /0.08/
deltahp heat pump efficiency /0.03/
deltabb biomass boiler efficiency /0.03/
deltangb natural gas boiler efficiency /0.03/
*-------------FOREST BIOMASS BOILER---------------------------
*-------------HEATING BALANCE---------------------------------
hlrheatpipe heating loss rate /0.07/
*-------------COOLING BALANCE---------------------------------
clrcoolpipe cooling loss rate /0/;
*Positive Variable ;
*Binary Variables
*-------------MODEL EQUATION------------------------------------------------------------------------
*constraints:con1,…conN
*objective function: obj
Equations
fc,mc,gc,opec,capc,ace,con1,con2,con3,con4,con5,con6,con7,con8,con9,con10,con11,con12,obj;
fc…=e=sum((k,h,s),engb(k,h,s)*ngc/deltangbheat)+sum((k,h,s),sbbheat(k,h,s)*wpc/deltabbheat);
mc…=e=sum((k,h,s),ebb(k,h,s)*cmaint)+sum((k,h,s),eeb(k,h,s)*cmaint)+sum((k,h,s),engb(k,h,s)*cmaint)+sum((k,h,s),seccool(k,h,s)*cmaint);
gc…=e=sum((k,h,s),epur(k,h,s)*ppur);
opec…=e=sum((k,h,s),(fc,mc,gc));
capc…=e=sum ((i,k,l),cap(i)ccap(i)[[r*(1+r)^n]/[(1+r)^n]-1])+sum((i,k,l),db(k,l)ccappipe[[r*(1+r)^n]/[(1+r)^n]-1])+sum((l,k),db(l,k)ccappipe[[r*(1+r)^n]/[(1+r)^n]-1]);
ace…=e=sum ((k,h,s),betang*[sngbheat(k,h,s)/ deltangbheat])+sum([betabiomasss*[sbbheat(k,h,s)/deltabbheat]])+sum([betagrid*epur(k,h,s)]);
*-------------CAPACITY CONSTRAINTS: energy supplied by each device does not exceed
*the installed capacity of the device----------------------------------
con1… eeccool(k,h,s) =l=(i,cap(i));
con2… eeb(k,h,s) =l= (i,cap(i));
con3… engb(k,h,s) =l= (i,cap(i));
con4… ebb(k,h,s) =l= (i,cap(i));
con5… shp(k,h,s) =l= (i,cap(i));
*-------------OPERATIONAL CONSTRAINTS----------------------------------
con6… seccool(k,h,s) =e= deltaeceec(k,h,s);
con7… sebheat(k,h,s) =e= deltaebeebheat(k.h.s);
con8… sbbheat(k,h,s) =e= deltabbebbheat(k,h,s);
con9… sngb(k,h,s) =e= deltangbengb(k,h,s);