text file or excel file imported to GAMS as parameter

467 views
Skip to first unread message

Ornella Forte

unread,
Jan 26, 2016, 9:54:44 AM1/26/16
to gamsworld
Hi everyone,

I'm struggling to import a datasheet from excel or notepad (it does't actually matter which one, i created both) but i keep on getting error 492 "Symbol not in GDX" in the case i try to import from excel.
Can anyone help me? 

Thanks a lot in advance!

Ornella

*******The part of script that is giving me problems*************

$call gdxxrw DTD.xlsx par=Sheet1 rng=A1:B8761

PARAMETER DTD(t) Digester thermal load;

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN

What I need to import is a vector (DTD) of one column and 8760 rows.
t is a set for hours per year 
t /t1*t24/ (I am currently using a reduced set to test the code).

I placed the xlxs file into the projdir directory, but still it doesn't work.
I bag someone's help.
DTD.xlsx
Optimization modelSG.gms

Renger van Nieuwkoop

unread,
Jan 26, 2016, 10:45:02 AM1/26/16
to gams...@googlegroups.com
Hi on ella
Take a close look at your call. You are trying to get parameter par=sheet1. ..and DtD in sheet. 
Cheese
Renger
Ps sorry, but Gams is not running on my cellphone (yet), so I don't know if this will solve your issue



Sent from my Samsung Note 4
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Ornella Forte

unread,
Jan 26, 2016, 11:22:48 AM1/26/16
to gamsworld
Hi Renger,

thanks for your answer.
Actually I don't know how that part of script came like that (maybe an old wrong version).
This is actually what I'm running and doesn't work.

$CALL GDXXRW.EXE DTD.xls par=DTD rng=sheet1!A1:B8760

Parameter DTD(t);

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN


Renger van Nieuwkoop

unread,
Jan 26, 2016, 11:53:07 AM1/26/16
to gams...@googlegroups.com

HI Ornella

 

Two things:

-          The ending of the file you sent is “xlsx” and not “xls”

-          The parameter you are reading has two dimensions (t in column A, and the heading of column B), so either you define DTD as DTD(t,*) or you define DTD as DTD(t) and let the range start at the second row  and you set the RDIM to 1  ($call GDXXRW.EXE DTD.xlsx par=DTD rdim=1 rng=sheet1!A2:B8760)

 

Cheers

Renger

Reply all
Reply to author
Forward
0 new messages