'Limit how many resources can be used
I have to limit how many resources can be used by Agents. For example, I have to limit that one cashier can serve n amount of customers, then it is disabled. My cashiers are in a resource pool with a capacity of 3, so 3 cashiers can serve only n amount of clients each, then they get disabled. A Service block is using the resource pool of cashiers. Thank you in advance!
Solution 1:[1]
I'll assume that the cashier is a resource agent of type Cashier each cashier can have a variable in it, called "customersServed" of type int and a variable called "enabled" of type boolean initially true
then each time a resource is seized:
((Cashier)unit).customersServed++;
and when the resource is released:
if(((Cashier)unit).customersServed>n){
((Cashier)unit).enabled=false;
}
finally, in your resourcePool check the "customize resource" box and use this condition:
((Cashier)unit).enabled
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Felipe |
