Use $ondelim and $offdelim to include a csv file cont multi-dimensional (dimension >2) table Topic is solved

Problems with syntax of GAMS
Post Reply
ManT
User
User
Posts: 12
Joined: 5 years ago

Use $ondelim and $offdelim to include a csv file cont multi-dimensional (dimension >2) table

Post by ManT »

HI,
Whenever I try to use $ondelim and $offdelim to include a CSV file containing a multi-dimensional (dimension >2) table I get into trouble (error 445).
I have read that the trick is to delay $ondelim in the following code: I need some help in imposing this trick on my problem. I still have errors. My GAMS code and table is attached.



SETS
n nodes /n1*n24/
g generating units /g1*g10/
d demands /d1*d24/
l transmission lines /l1*l11/;
Alias(n,np);


Table branch(l,n,np,*)
$ondelim
Linenew24bus.csv
(1.39 KiB) Downloaded 194 times
$include Linenew24bus.csv
$offdelim
;


** Sample data set
*Table branch(l,n,np,*) branch characteristics
* R X B rate exist Line Number
*L1.n1.n2 0.0026 0.0139 0.4611 175 1 1
*L2.n1.n3 0.0546 0.2112 0.0572 175 1 2
*L3.n1.n5 0.0218 0.0845 0.0229 175 1 3
*L4.n2.n4 0.0328 0.1267 0.0343 175 1 4
*L5.n2.n6 0.0497 0.192 0.052 175 1 5
*L6.n3.n9 0.0308 0.119 0.0322 175 1 6
*L7.n3.n24 0.0023 0.0839 0 400 1 7
*L8.n4.n9 0.0268 0.1037 0.0281 175 1 8
*L9.n5.n10 0.0228 0.0883 0.0239 175 1 9
*L10.n6.n10 0.0139 0.0605 2.459 175 1 10
*L11.n7.n8 0.0159 0.0614 0.0166 175 1 11
test44.gms
(1.28 KiB) Downloaded 208 times
ManT
User
User
Posts: 12
Joined: 5 years ago

Re: Use $ondelim and $offdelim to include a csv file cont multi-dimensional (dimension >2) table

Post by ManT »

A solution has been provided for this problem:

It reads:

With ondelim, the entire data statement has to be comma separated, i.e. also the domain of the symbol.

Thank you, Fred
Post Reply