I am trying to read a tuple from excel. The tuple has integers, strings and sets. I have tried the following but am getting error as : Data element "Pbd" of type {Path} not supported for sheets. And the Processing fails.
This is part of my .mod file
tuple Path {
int id;
string source;
string dest;
{string} pitblockSet;
{string} roadPoints; // not used
{string} dumpblockSet;
{string} others;
float dist;
};
{Path} Pbd=...;
The corresponding part in the dat file is :
Pbd from SheetRead(sheet,"all_paths!A2:C30910");
In the Excel File on sheet all_paths I have the following. There are several other variables being read from the same excel in this model.
Part of the excel data being read to this tuple is below :
PathId Source Dest pitblockSet RoadPoints dumpblockSet others dist
1 P1 D1 P1 R8 D45 D42 D39 D14 D1 581.3956
2 P1 D1 P1 R8 D40 D14 D1 587.1185
3 P1 D1 P1 R8 D43 D16 D2 D1 588.7774
4 P2 D1 P2 R8 D45 D42 D39 D14 D1 539.7307
5 P2 D1 P2 R8 D40 D14 D1 545.4535
6 P2 D1 P2 R8 D43 D16 D2 D1 547.1124
7 P3 D1 P3 R8 D45 D42 D39 D14 D1 500.0794
I have also tried by changing the data to comma separated sets like below
PathId Source Dest pitblockSet RoadPoints dumpblockSet Others Distance
1 P1 D1 P1, R8, D45,D42,D39,D14,D1, 581.3956
2 P1 D1 P1, R8, D40,D14,D1, 587.1185
3 P1 D1 P1, R8, D43,D16,D2,D1, 588.7774
4 P2 D1 P2, R8, D45,D42,D39,D14,D1, 539.7307
5 P2 D1 P2, R8, D40,D14,D1, 545.4535
6 P2 D1 P2, R8, D43,D16,D2,D1, 547.1124
7 P3 D1 P3, R8, D45,D42,D39,D14,D1, 500.0794
8 P3 D1 P3, R8, D40,D14,D1, 505.8023
But I keep getting the same error.
The purpose why I want these is, I am using them in the .mod file as below :
float hc[Pathid][TimePeriods]; //PathId is another int variable read seperately
//determine haulage cost for each path
execute {
//distances to plant
for (var i in Pbm.id) {
for (var t in TimePeriods){
hc[i][t] = Pbm.dist*HaulageCost[t];
}
}
}
And finally want to use it in a constraint as
forall( i in Pbd.pitblockSet , t in TimePeriods) {
// blockabove exposed Pbd:
sum(j in BlockBelow[i]) schedulePit[j.id][t] * totalVolume[j.id] <=
(sum(j in BlockBelow[i],r in TimePeriods : r <= t,d in DumpBlocks)(Xbdt[j.id][d][r])
+ sum(j in BlockBelow[i],r in TimePeriods : r <= t, s in Stockpiles)(Xbst[j.id][s][r]/density[j.id])
+sum(j in BlockBelow[i],r in TimePeriods : r <= t, m in Plants)(Xbmt[j.id][m][r]/density[j.id])) ;
}
What is the best way to read the tuple named Path, not sure why I am getting the error.