Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "wait" in anylogic?

Tags:

anylogic

I have a stock agent which is created in the end of my production line. My products are characterized by their model. I'm trying to create a logic to take out the products from this stock agent when they are to be delivered to the client. This delivery is controlled by an excel sheet and I'm taking the information through a SQL code. However, I was not able to find the right code to take out the products which are to be delivered. My agent population is called ProdutoStock and it's located in my main screen.

I have tried: Main.remove_ProdutoStock() but i couldn't figure out the arguments that i need for this function, since i have to take out of the agent a specific number of agents and also of a specific model.

So, I decided to create a wait block and use the free function to free the specific agents i wanted main.waiting_delivery.free() but i also can't figure out the necessary arguments for this function.

Would someone have any idea how I can take out of my agent/line the products that I need to deliver for my client (considering quality and also model)? This code is not being typed into my main screen.

like image 940
Renata mariani Avatar asked Dec 18 '25 06:12

Renata mariani


1 Answers

the argument of the free method is the agent itself.

So you have to do main.waiting_delivery.free(yourAgent);

If you want to free the last agent that entered the wait block:

if(main.waiting_delivery.size()>0)
    main.waiting_delivery.free(main.waiting_delivery.get(0));

If you want to free agents following a certain condition

List <YourAgent> theAgents=findAll(main.yourAgentPopulation,a->a.condition==true);
for(YourAgent a : theAgents){
    main.waiting_delivery.free(a);
}
like image 198
Felipe Avatar answered Dec 23 '25 06:12

Felipe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!