Dimension different in GAMS error message

Problems with modeling
Post Reply
m_tanawat
User
User
Posts: 11
Joined: 2 months ago

Dimension different in GAMS error message

Post by m_tanawat » 3 weeks ago

Hi,

I tried to run acid model and found one error.
Error148 Dimension different - The symbol is referenced with more/less
indices as declared

This occurred only when I change the solve statement from minimizing C to minimizing Ccntry("NETHERL").
Could you please advise how to fix it?

Thank you in advance.


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

SETS
EMcntry emitting countries in analysis
/NETHERL, GERMANY/

AC acid related particles
/SO2 sulphur in MTON
NOx nitrogen oxides in MTON/;


ALIAS (EMcntry,REcntry);

PARAMETERS
REPORT Reporting the results of the scenarios
COEFACID(AC) kilo acid equivalents for 1 MTON equals
/SO2 31500000
NOx 21500000/
SQMETER(REcntry) hectares of country
/NETHERL 3551900
GERMANY 35706000/
INENDEM (EMcntry) initial energy demand 1990 in EJ in emitter cntry
/NETHERL 3.1
GERMANY 13.9/
PCONSERV(EMcntry) price per EJ energy conservation in Billion NLG in emmit cntry
/ NETHERL 16.05
GERMANY 15.85 /
PFUEL(EMcntry) price per EJ fossil fuel 1990 values in Billion NLG in emit cntry
/ NETHERL 16
GERMANY 16 /
PRENEW(EMcntry) price per EJ renewabl 1990 values in Billion NLG in emit cntry
/ NETHERL 20.4
GERMANY 20.4 /;

TABLE TRACID(EMcntry,REcntry,AC) transp coef (%) acid emit cntry to cntry
SO2 NOx
NETHERL.NETHERL 0.81 0.74
NETHERL.GERMANY 0.19 0.26
GERMANY.NETHERL 0.26 0.29
GERMANY.GERMANY 0.74 0.71;

TABLE EMISCOEF (EMcntry, AC) emis coeff acid (MTON per EJ) per enrgy type (EJ)
SO2 NOx
NETHERL 0.0661 0.1855
GERMANY 0.3835 0.2209;

TABLE PEMRED(EMcntry, AC) price emis reduction acid precu in BILL NLG per MTON
SO2 NOx
NETHERL 9 12
GERMANY 1.7 2;

TABLE EXPEMRED(EMcntry, AC) exponent in cost function emis red acid precu in BILL NLG per MTON
SO2 NOx
NETHERL 2.0 2.9
GERMANY 1.9 3.3;

POSITIVE VARIABLES
EMIS(EMcntry, AC) amount of emission acid precurs in MTON in emitting cntry
EMRED(EMcntry,AC) energy reduct acid precur in EJ in emit country (in energy not emission terms)
ACIDDEP(REcntry) amount of deposition in KILO acid equivalents per HECTARE receptor cntry
ACDEP (REcntry,AC) amount of deposition in SO2 and NOx in MTON in receptor cntry
CONSERV(EMcntry) energy conservation in EJ in emitter cntry
ENUSE(EMcntry) energy use in EJ after energy conservation in emitter cntry
FUEL(EMcntry) energy use in EJ total for fossil fuel after conservation
RENEW(EMcntry) energy use in EJ total for renewables after conservation
CENUSE(EMcntry) costs in Billion NLG for energy after conservation in emit cntry
CEMRED(EMcntry, AC) costs in Billion NLG of em reduc acid prec per emit type in emit cntry
TCEMRED(EMcntry) total costs in Billion NLG of em reduc acid prec in emit cntry;

EMIS.LO(EMcntry, AC) =1/10**10;
EMRED.LO(EMcntry,AC) =1/10**10;
ACDEP.LO(REcntry,AC) =1/10**10;
ACIDDEP.LO(REcntry) =1/10**10;
ENUSE.LO(EMcntry) = 1.10*INENDEM(EMcntry);
CONSERV.LO(EMcntry) = 1/10**6 ;
CONSERV.UP(EMcntry) = 0.40*(1.10*INENDEM(EMcntry));
RENEW.LO(EMcntry) = 1/10**6 ;
RENEW.UP(EMcntry) = 0.10*(1.10*INENDEM(EMcntry));
CENUSE.LO(EMcntry) =1/10**9 ;
CEMRED.LO(EMcntry, AC) =1/10**15;

FUEL.L(EMcntry) = 2;
RENEW.L(EMcntry) = 0.1;
EMIS.L(EMcntry, AC) = 1;


VARIABLES
C total cost in Billion NLG over all countries
Ccntry(EMcntry) total cost in Billion NLG in each emitting country ;

EQUATIONS
EENUSE(EMcntry) eq for energy use related to demand and conservation
EEMIS(EMcntry,AC) eq amount of emission acid precurs in MTON in emitting cntry
EEMRESTR(EMcntry,AC) eq for technical reduction restriction acid precursors
EACDEP(REcntry,AC) eq for acid depostion per pollutant in receptor cntry
EACIDDEP(REcntry) eq for acid deposition in acid equivalents in receptor cntry
ECENUSE(EMcntry) eq for costs in Billion NLG for energy aft cons in emit cntry
ECEMRED(EMcntry, AC) eq for costs em reduc ACIC prec for particle in em cntry
ECcntry(EMcntry) eq for cost energy use and emis red per country
EC eq for total cost for using energy and emission all cntr;


EENUSE(EMcntry).. ENUSE(EMcntry)=L= FUEL(EMcntry) + RENEW(EMcntry) + CONSERV(EMcntry);
ECENUSE(EMcntry).. CENUSE(EMcntry) =E= PFUEL(EMcntry)*FUEL(EMcntry) + PRENEW(EMcntry)*RENEW(EMcntry) + PCONSERV(EMcntry)*CONSERV(EMcntry);
EEMIS(EMcntry,AC).. EMIS(EMcntry,AC) =E= EMISCOEF(Emcntry, AC)*(FUEL(EMcntry)-EMRED(EMcntry,AC));
EEMRESTR(EMcntry,AC).. EMRED(EMcntry,AC)=L= 0.90*FUEL(EMcntry);
ECEMRED(EMcntry,AC).. CEMRED(EMcntry,AC) =E= PEMRED(EMcntry,AC)*EMRED(EMcntry,AC)** EXPEMRED(EMcntry, AC);
EACDEP(REcntry,AC).. ACDEP(REcntry,AC) =E= SUM(EMcntry, TRACID(EMcntry,REcntry,AC)*EMIS(EMcntry,AC));
EACIDDEP(REcntry).. ACIDDEP(REcntry) =E= (SUM(AC, ACDEP(REcntry, AC)* COEFACID(AC) ))/SQMETER(REcntry);
ECcntry(EMcntry).. Ccntry(EMcntry) =E= CENUSE(EMcntry) + SUM(AC,CEMRED(EMcntry,AC));
EC.. C =E= SUM(EMcntry,Ccntry(Emcntry));


MODEL ACIDMODEL /ALL/;

SOLVE ACIDMODEL USING DNLP MINIMIZING Ccntry("NETHERL");

m_tanawat
User
User
Posts: 11
Joined: 2 months ago

Re: Dimension different in GAMS error message

Post by m_tanawat » 3 weeks ago

1) Understand that GAMS can only maximize one dimension variable.
In my case, I try to do maximize one dimension varibale as well so I give syntax CCntry("NETHERL").
I want to confirm is this the correct syntax?
If not how can I handle this situation?


2) When I wan to maximize 2 variable in GAMS.
I used my example file.

Is it possible to use 2 below statement inside model?

solve test maximizing C using NLP.;
solve test maximizing CCntry("NETHERL") using NLP;

This means I have 2 maximization, with 2 different sets of variable result.

Thank you very much

chrispahm
User
User
Posts: 5
Joined: 2 months ago

Re: Dimension different in GAMS error message

Post by chrispahm » 2 weeks ago

You could add a variable where you sum over the countries, but just make it sum over the Netherlands. Then you minimize that variable. I attached a file where I made the appropriate changes to your model.
Attachments
test.gms
(4.61 KiB) Downloaded 6 times

Post Reply