简体   繁体   中英

Anylogic-Releasing agents matching certain condition from Wait object

I have a facility producing certain products, and in the facility, there are basically 3 kinds of distinguished products. I am trying to code an action chart so that if there is an incoming order of a certain product with a certain quantity, the product is released from a "Wait" object and the released product then goes into the Delay object, which represents production.

The product is an agent with a name parameter and there are three products A, B, C. Is there a way to implement this?
Summarizing, there are three kinds of products which are all saved in one Wait object. I want to implement such that if there is an order of product A of quantity 3, then 3 of product A are released from Wait object.

I simplified the model here I have 2 types of products, A and B. So in the distribution center, products are stored until it is released. Product agent is used in the Distribution center flow with a string parameter "type". Order agent is used in the order flow with a string parameter "ProductType" and an integer parameter "Quantity". That is, order contains information about which product is ordered and how many of the product is ordered.

This is where I would like to code such that only certain products ordered by an order is released with the quantity specified by the order Currently, I coded like this but of course it is not able to find for example only A product in "pool".. If I do this way, I need to have a separate Wait object for each product but I would like to avoid it..

You need to create an order agent that specifies the information of your order... this order will have a parameter called for instance numProductA which states how many products A the order has.

Then you can do for your order agent.

List <Product> productsA=findAll(waitBlock,w->w.product.type.equals("A")).subList(0,agent.numProductsA);
for(Product p : productsA){
     p.order=agent;//You will probably need to associate that product to that order so you can know later in the flow.
     waitBlock.free(p);
}

Here I'm assuming that you will ALWAYS have enough prodcutsA on your wait block... if that's not the case, you need to implement additional logic that might be more or less complicated depending on the case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM