Hello,
I’m having some difficulties with inputting tables from csv.
I believe it has something to do with the headers of the csv, which I could remove manually, but would like to maintain because that’s how they come out of R.
Whenever I try to read the table, I get the following error:
326 An empty table statement is not followed by a legal statement
Would appreciate any help.
My code:
$Title Debugging model
$OnEmpty OnMulti
* definitions
sets
y /2015,2020/
p /1*4/
sc /sc1,sc2/
g /Coal,NaturalGas,Nuclear,FuelOil/
nd /A,B/
parameters
pDemand (y,sc,nd,p)
pWindGen (y,sc,nd,p)
pGenCap (y, g,nd )
$ondelim
table
Hourly(y,sc,nd,h,*)
/
$include hourlyDataInput.csv
/
;
$offdelim
pDemand (y,sc,nd,p) = Hourly (y,sc,nd,p,'Demand') ;
pWindGen (y,sc,nd,p) = Hourly (y,sc,nd,p,'WindGen');
parameter pGenCap(y, g,nd) "Generation capacity per year and hub "
/
$ondelim
$include CapDataInput.csv
$offdelim
/
;
The CapDataInput.csv file:
y,g,nd,GenCap
2015,Coal,A,20
2020,Coal,A,22
2015,NaturalGas,A,30
2020,NaturalGas,A,40
2015,Nuclear,A,5
2020,Nuclear,A,5
2015,FuelOil,A,2
2020,FuelOil,A,2
2015,Coal,B,10
2020,Coal,B,10
2015,NaturalGas,B,35
2020,NaturalGas,B,48
2015,Nuclear,B,0
2020,Nuclear,B,0
2015,FuelOil,B,3
2020,FuelOil,B,3
The hourlyDataInput.csv file:
y,sc,nd,p,Demand,WindGen
2015,sc1,A,1,17.64,4.52
2015,sc1,A,2,21.13,3.33
2015,sc1,A,3,22.48,5.74
2015,sc1,A,4,22.01,4.81
2020,sc1,A,1,27.32,4.44
2020,sc1,A,2,19.94,2.5
2020,sc1,A,3,28.08,4.05
2020,sc1,A,4,19.77,4.2
2015,sc1,B,1,24.03,5.41
2015,sc1,B,2,15.89,3.03
2015,sc1,B,3,18.71,4.11
2015,sc1,B,4,23.36,3.67
2020,sc1,B,1,16.62,1.9
2020,sc1,B,2,24.22,4.91
2020,sc1,B,3,29.33,3.33
2020,sc1,B,4,27.38,2.89
2015,sc2,A,1,22.82,3.82
2015,sc2,A,2,25.19,3.2
2015,sc2,A,3,23.77,4.39
2015,sc2,A,4,20.67,4.21
2020,sc2,A,1,20.69,3.61
2020,sc2,A,2,23.15,2.35
2020,sc2,A,3,19.1,2.4
2020,sc2,A,4,25.26,3.19
2015,sc2,B,1,26.72,4.21
2015,sc2,B,2,28.73,3.18
2015,sc2,B,3,26.8,3.93
2015,sc2,B,4,23.23,4.05
2020,sc2,B,1,21.67,2.65
2020,sc2,B,2,27.35,5.91
2020,sc2,B,3,13.6,5.23
2020,sc2,B,4,17.97,3.87