I have a model reading data from an excel file. Below is part of the model.
I use the below code to read data as below
tuple blockType {
string id;
int i;
int j;
int k;
};
{blockType} PitBlocksType = ...;
A snap shot of the data being read from excel is
Block Id Bench(i) Strip(j) Block(k)
P52 1 5 3
P135 2 5 3
P210 3 5 3
P374 8 5 3
P487 9 5 3
The above is a selection of data filtered in excel for j=5 and k=3. Hence the Block Id is seen an contiguous. The Bench or i varies from 1 to 9 in the data. i, j, k represent data like in a 3D space where i is the vertical axis or z axis, and j and k represent in the x and y direction. As you can see in the sequence above i is present for 1-3 and missing from 4-7, then again present for 8 and 9 instead of being present for all 1 to 9..this is creating me problem.
I am running a piece of code in my model which assumes that i is continuous and hence my model fails for this above data. I want my model to be able to tackle this type of data as well. I was trying to see would a for - next loop be of help here..but I don't think so. What is the best way to handle this.
{blockType} OntopPit[b1 in PitBlocksType] =
{b | b in PitBlocksType: b1.i == b.i +1 &&
((b1.k == b.k-1 ) ||
(b1.k == b.k+1 ) ||
(b1.k == b.k ) ) &&
((b1.j == b.j-1 ) ||
(b1.j == b.j+1 ) ||
(b1.j == b.j ) ) };
In the above part of the model I am using the b1.i == b.i +1 finds all i value, but sometimes the b.i +1 is not present in the data - as we saw in the above snapshot.
When a certain i is missing I want the code to consider the next i, say 4 is missing then look for 5, if 5 is also missing look for 6 and so on. I am not able to create this in the model.
Request for your suggestions please.