I'm creating a model based on the product delivery example provided by AnyLogic. In my own model, I want a truck to deliver multiple orders in one trip instead of one. My process diagram is shown below. Here, an order enters via the enter block and several orders are accumulated in the batch block. Every order has a specified destination. How do I model the truck such that it combines two orders and move to the nearest delivery location first and then the second etc?
The main problem is that I don't know the code that accesses the parameter "Delivery location" in each order.
enter image description here enter image description here
Additional information:
- The orders agents are generated and the delivery location is stored in a parameter called "client"
- The batch block combines (lets say 2) orders into a batch of the type Order ( advanced settings set to population of agents)
- The service block pulls a truck from the resource poule and send the batch of orders to the truck agent using send(batch.unit)
- The truck agent stores the order/orders(?) in a variable called "order" Then, a moveTo function should deliver the order to the first destination
What would be the code to move to the first, second etc., destination?