Unable to find GDX File for input data from

Problems with syntax of GAMS
Post Reply
scsaxena
User
User
Posts: 18
Joined: 6 years ago

Unable to find GDX File for input data from

Post by scsaxena »

Hello Experts !
Need your help & guidance.
I am a new user of GAMS. I am trying to read in data from EXCEL and error I am getting is 510 (GDX file not found) and 502 (unable to load data). My code is given below:

------ CODE START -----
Sets
g generators
t time-steps /1*96/
r regions /W, N, E, S, NE/
;

alias (r,r1);

Parameter RegIndex(r)
/
W 1
N 2
E 3
S 4
NE 5
/;

Parameters GenData(g,*), ATC(r,r1,t), Schedule(g,t), ReserveRequirement(t,*);

$Call GDXXRW I=D:\SCS\My_GAMS\Programs\Learning_Folder\Despatch_96Blocks\InputData.xls O=InputData.gdx set=g RDim=1 rng=GenData!a2:a10000 par=GenData RDim=1 CDim=1 rng=GenData!a1:R10000 par=ATC RDim=2 CDim=1 rng=ATC!a3:XY10000 par=Schedule RDim=1 CDim=1 rng=Schedule!a4:XY10000
$GDXIN InputData
$LOAD g
$LOAD GenData
$LOAD ATC
$LOAD Schedule
$GDXIN

display gendata, ATC, Schedule;

$Call GDXXRW I=D:\SCS\My_GAMS\Programs\Learning_Folder\Despatch_96Blocks\InputData.xls O=InputData.gdx par=ReserveRequirement RDim=1 CDim=1 rng=Reserve!a3:d10000
$GDXIN InputData

$LOAD ReserveRequirement

$GDXIN

------------------ CODE END -------------------

The Error is as follows:

-------------- ERROR MESSAGE ---------------
GAMS 25.1.2 r67455 Released Aug 1, 2018 WEX-WEI x86 64bit/MS Windows 08/19/18 07:55:42 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n


1 * POSOCO Dispatch model with co-optimized ancillary services
2
3 Scalar Overload overload factor /0.05/ ;
4 Sets
5
6 g generators
7 t time-steps /1*96/
8 r regions /W, N, E, S, NE/
9 ;
10
11 alias (r,r1);
12
13 Parameter RegIndex(r)
14 /
15 W 1
16 N 2
17 E 3
18 S 4
19 NE 5
20 /;
21
22 Parameters GenData(g,*), ATC(r,r1,t), Schedule(g,t), ReserveRequirement(t,
*);
23
**** File: C:\Users\00006\Documents\gamsdir\InputData.gdx
**** Msg : No such file or directory
25 $GDXIN InputData
**** $510
26 $LOAD g
**** $502
27 $LOAD GenData
**** $502
28 $LOAD ATC
**** $502
29 $LOAD Schedule
**** $502
31
32 display gendata, ATC, Schedule;
**** $141 $141 $141
33
**** File: C:\Users\00006\Documents\gamsdir\InputData.gdx
**** Msg : No such file or directory
35 $GDXIN InputData
**** $510
36
37 $LOAD ReserveRequirement
**** $502
38
40
41

-------------------------------------
Fred
Posts: 372
Joined: 7 years ago

Re: Unable to find GDX File for input data from

Post by Fred »

Hi,

The GDX file InputData.gdx cannot be found. Probably because it is not there... I guess the previous GDXXRW call might have failed. The log should tell you more about it. You might also want to add trace=3 to the GDXXRW call to get more detailed Feedback.

If you share the log (or even better, the files to reproduce the issue) it should be possible to say more.

Best,
Fred
scsaxena
User
User
Posts: 18
Joined: 6 years ago

Re: Unable to find GDX File for input data from

Post by scsaxena »

Dear Fred,

Thank you very much for your response.
My understanding was that the GDX file gets created (if it does not already exist) automatically. Probably my understanding is wrong.
Secondly, while I am able to specify the input file directory for the GDXXRW command, I do not know how to specify the directory path for the GDX file.

As you advised, I have added "trace=3" to the GDXXRW command and relevant files are attached including log file.

Thanks a lot in advance for your help.

Best regards,
Attachments
POSOCO_Dispatch.log
(5.35 KiB) Downloaded 248 times
POSOCO_Dispatch.gms
(3.45 KiB) Downloaded 233 times
InputData.xlsx
(72.69 KiB) Downloaded 268 times
Fred
Posts: 372
Joined: 7 years ago

Re: Unable to find GDX File for input data from

Post by Fred »

Hi,

The gdx file gets created by GDXXRW if the tool is properly called. The log you get clearly indicates that this is not the case:

Code: Select all

--- call GDXXRW   I=D:\SCS\My_GAMS\Programs\Learning_Folder\Despatch_96Blocks\InputData.xls O=InputData.gdx set=g  RDim=1  rng=GenData!a2:a10000   par=GenData  RDim=1  CDim=1  rng=GenData!a1:R10000 par=ATC  RDim=2  CDim=1  rng=ATC!a3:XY10000  par=Schedule

GDXXRW           25.1.2 r67455 Released Aug  1, 2018 VS8 x86 32bit/MS Windows 
Excel version 16.0
**** Input file not found = D:\SCS\My_GAMS\Programs\Learning_Folder\Despatch_96Blocks\InputData.xls
Total time = 2000 Ms
Apparently, GDXXRW cannot find the Excel Input file (Assuming that you used the right location of the file, it seems that you are using the wrong file extension .xls while you file is .xlsx).
You might want to add some errorcheck to make sure to abort with a proper message if GDXXRW failed.

Code: Select all

call GDXXRW   I=D:\SCS\My_GAMS\Programs\Learning_Folder\Despatch_96Blocks\InputData.xls O=InputData.gdx set=g  RDim=1  rng=GenData!a2:a10000   par=GenData  RDim=1  CDim=1  rng=GenData!a1:R10000 par=ATC  RDim=2  CDim=1  rng=ATC!a3:XY10000  par=Schedule
$ife errorlevel<>0 $abort Problems running GDXXRW
By default, GDXXRW will create the GDX file in your current working directory (C:\Users\00006\Documents\gamsdir\). If you want to create it somewhere else, you can define a corresponding path when calling GDXXRW (O=/path/to/InputData.gdx).

I hope this helps!

Best,
Fred
scsaxena
User
User
Posts: 18
Joined: 6 years ago

Re: Unable to find GDX File for input data from

Post by scsaxena »

Dear Fred,

Thanks a lot. This was really helpful in solving both problems -
(a) reading the dat I wanted - You rightly pointed out that file extension was incorrect.
(b) creating the GDX file in a desired directory.

The final GAMS code file that I run successfully is attached.

Best regards,

Samir
scsaxena
User
User
Posts: 18
Joined: 6 years ago

Re: Unable to find GDX File for input data from

Post by scsaxena »

Further working on the program, I am getting "Exit Code 7" when I try to write the output to an Excel File. I understand this means that GDX file is not found.
I am attaching the Code and Error Log.
Shall be very thankful for your help.

Regards,
Attachments
POSOCO_Dispatch.gms
(3.49 KiB) Downloaded 237 times
POSOCO_Dispatch.log
(2.54 KiB) Downloaded 233 times
Fred
Posts: 372
Joined: 7 years ago

Re: Unable to find GDX File for input data from

Post by Fred »

Hi,

Actually, the error message indicates clearly that this is a licensing error:

Code: Select all

--- POSOCO_Dispatch.gms(101) 9 Mb
---   17,166 rows  13,633 columns  54,969 non-zeroes
*** Status: Terminated due to a licensing error
***         Inspect listing file for more information
--- Job POSOCO_Dispatch.gms Stop 08/21/18 22:48:41 elapsed 0:00:01.870
Exit code = 7
The license file you are using expired on Aug 04, 2017. Hence, the latest GAMS Version it will work with is GAMS 24.8.5 (https://www.gams.com/download-old/).
I just checked the license database and it shows that the license has been updated in the meantime. You might want to get in touch with the license admin to request access to the updated license file.

I hope this helps!

Fred
scsaxena
User
User
Posts: 18
Joined: 6 years ago

Re: Unable to find GDX File for input data from

Post by scsaxena »

Thanks a lot Fred.

I would get this updated.

Best regards,

Samir
Post Reply