I have RackStore block to store agents where the cells are chosen explicitly with the help of a function. I am getting this error when I run the simulation. Here,cells were assigned to all four agents that entered the block, but I think it throws this error when resources arrive for an agent.
I can't understand the reason for this error as all the agents that entered the block were already assigned to cells and it's not trying to put anything again. I have tried the simulation with various no. of agents (5-150 agents), the error always appears after all the agents arrive at rackStore block and an agent is trying to exit.
My rackStore properties are: rackStore property_part_1, rackStore property_part_2 The getCell(double weight, Carrier carrier) function is defined below. It returns an integer array of size 3.
//Iterate through rows
int lev=0;
int row=0;
for (int r=0; r<=1; ++r) {
// Iterate through positions
for(int p=0; p<=9; ++p){
//Check which level it belongs to as per weight
lev=getLevel(weight);
//Check if cell is free
if(carrier==Truck){
if (palletRack4.isFree(r,p,lev)== true ){
int[] arr={r,p,lev};
//traceln("truck pos: "+ arr);
if(arr==null){traceln("truckPos NULL");}
return arr; }
else {continue;}}
else{
if (palletRack5.isFree(r,p,lev)== true ){
int[] arr={r,p,lev};
//traceln("train pos: "+ arr);
if(arr==null){traceln("trainPos NULL");}
return arr; }
else {continue;}}
}
}
if(carrier==Truck){
PalletRackLocation ploc=palletRack4.getFreeCell(true);
//traceln("Carrier: " + carrier);
//traceln("Free cell from P4: "+ ploc);
int[] arr1={ploc.row,ploc.position,ploc.level};
if(arr1==null){traceln("randTruckPos NULL");}
return arr1;}
else{
PalletRackLocation ploc=palletRack5.getFreeCell(true);
//traceln("Carrier: " + carrier);
//traceln("Free cell from P5: "+ ploc);
int[] arr1={ploc.row,ploc.position,ploc.level};
if(arr1==null){traceln("randTrainPos NULL");}
return arr1;}