PaNDax ObEx
PaNDax ObEx

Reputation: 1

how to remove agents from a given anylogic storage

in the following code I would like to add a command that after retStroage=orangeStorage which makes me delete the agents inside the orange storage how can I do?

int nRetrieved = nForRetrieve.getIntValue();
int storageSize = 0; 
int b=orangeStorageSize; 
int a=0;
Storage retStorage =  null;
if (b == a) {
switch (retrieveRadio.getValue()) {
case 0:
retStorage = greenStorage;
break;
case 1:
retStorage = blueStorage;
break;
case 2:
retStorage = redStorage;
break;
}
}
else  {
       retStorage= orangeStorage;
       v
}
storageSize = retStorage.size();
if (nRetrieved > storageSize)
nRetrieved = storageSize;
for (int i = storageSize; i > storageSize - nRetrieved; i--)
enter.take((SKU)retStorage.getAgents().get(i-1));

Upvotes: 0

Views: 92

Answers (1)

Benjamin
Benjamin

Reputation: 12795

To remove agents from a storage, use the Retrieve block, avoid using code (unless you know what you are doing), see https://anylogic.help/library-reference-guides/material-handling-library/retrieve.html#retrieve

Upvotes: 0

Related Questions