I have an Excel file GAMS2.xlsx with a spreadsheet GAMS, which contains data as shown at the picture
In GAMS I wrote such code:
Set t /t1*t5/;
Parameters
W(t);
$call gdxxrw GAMS2.xlsx par=W rng=GAMS!A3:B7 rdim=1 dset=t rng=GAMS!A3:A7 rdim=1
$gdxin GAMS2.gdx
$load W
$gdxin
Display W;
Then I get good gdx file
So, I have no errors after RUN, but all values of parameter W are zeros. In the lst file I see:
---- 6 PARAMETER W
( ALL 0.000 )
What's my mistake? Any help would be much appreciated, thank you!
Looks like your set
t
in the Excel file is1 to 5
while your sett
in the GAMS model ist1 to t5
. So you don't have a matching domain and thus no values loaded. If you use$loadDC
(DC for Domain Checked) instead of$load
GAMS would have stopped and notified you about this right away.BTW: You could also use implicit set definition to populate the set t from GDX as well easily. That would look like this: