I have a group of hospitals that must treat the wounded, but the care depends on how close they are to the wounded, that is, the closest hospital must care for them, but if it is full, the next closest hospital must care for them, and so on. .
For this, I created two sets of agents (injured and hospitals) and I gave the hospitals a property called nearby hospitals (which is a set of hospitals) so that the injured person eliminates from that set the hospitals that are close and are full.
Related
So, I have a case in anylogic where a drone needs to be transported via a bike from a certain place (namely, Depot) to a certain place (namely, Stopover Point). After that, the drone will be released from the bike and will do some mapping to a set of designated locations of Mapping Points. For this case, I used a process flow to make the bike (that I treat as a resource unit) to seize the agent (drone) at the Depot before the bike move to the Stopover Point and releasing the drone there.
At first, I used to make some kind of sandbox model where I only use one Depot and one Stopover Point
so that it is easier when I want to use my agent (drone) in a process flow via enter block (ex: I only have to write main.depot.enter.take(this); at my agent (drone) statechart to enter it to the process flow at Depot bacause the Depot is a single agent).
The problem occurs when I tried to use more than one Depot and make it as a population of agent. This makes me unable to use main.depot.enter.take(this); because of the property of the Depot for it is now a population of agent and not a single agent anymore.
The question is how should I do if I want my agent (drone) to enter the process flow of a certain/specific Depot (ex: only Depot[0])? I have used a paramater such as "name" with the value consists of texts like "Depot 1, Depot 2, and so on" and modify the commmand to filter(main.depots, a -> a.name == "Depot 1").enter.take(this); or main.depot[0].enter.take(this); but I think that's not the right way to code it because it didn't works. So, how is exactly the correct way to code or to do it if I want my agent to enter a process flow of a specific agent (ex: Depot[0]) from a population of agent (ex: Depots)? Thank you.
You should use () instead of [] to select one depot from the population.
So to select the one with index 0, you write: main.depot(0).enter.take(this).
To select a depot based on the name parameter, I would use the findFirst function which selects one of the depots. In your exitblock, you could write:
main.depot(findFirst(main.depot, a->a.name.equals("Depot1")).getIndex()).enter.take(this)
The getIndex()method returns the index of the selected agent.
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?
Here is the conceptual piece you are probably not aware of, and that should help you move in the right direction:
you can have "for loops" as part of your process flows. Below, you see an example where an agent keeps driving to places until it has no more parcels.
Obviously, the details of the blocks depend on your model but in each, you can access the truck's orders if you have them in your Truck agent type (which is needed, obviously).
During the creation of a generalized warehouse model, I ran into a problem when trying to create an order event that can be used by order pickers to retrieve the products from the storages racks. Currently, I am using a source block which creates "orders" of a single type of pallet (1 to 5). The pickers each travel to pick up a pallet from the rack and transports them to the next location.
Question: How can I create an order consisting out of several pallets consisting of different types.
Question: How can I use a single picker (resource) to pick multiple pallets in a single run through the warehouse before transporting all the pallets to the next location (process).
Kind regards,
Stefan
Question 1
normally i would create a class for the higher level order (say Pickwave class).
And when instantiating it you need to save a list of actual picking orders(pallets) into it (say collection of type ArrayList<Order>).
And to process your pickwave you can use a loop which will steer your resource/transporter/picker to the next Order location until all orders are picked. If everything is picked you exit your loop and move to your next location
Question 2
you don't really pick the orders as you would normally pick them using RackPick block in 1-to-1 scenario. But as you have a refence to all your orders inside you pickwave object you can still control their location/animation programmatically.
In Anylogic 8.5.1, I am doing a simulation for library evacuation, I have set and agent with Option-list that contains different types of users: students, organizers, graduates, and others. Also, I have set 'custom distribution' parameter to set the distribution values for each user. Until now, I have run the model and every thing is working well.
What I want is:
1. to use 'pedFlowStatistics' line in particular places (I can do this);
2. want to count the users that pass this line (I do not know how to do it);
3. then draw a chart to highlight the different number of users that passes that particular line space (I do not know how to do it).
I need help in the above situation, thanks in advance.
I do not have a Java background.
It's not possible to count based on conditions with pedFlowStatistics... you can only count the total pedestrians using:
pedFlowStatistics.countPeds(); // counts total number of pedestrians
pedFlowStatistics.traffic(); //shows the number of pedestrians per hour
You can use these functions directly in your chart.
But since you want to count based on conditions (the type of user they are), you will need to be smart about this and depending on your model, you will have to count pedestrians in a different place... or maybe use 2 ped go to blocks and count in between... it depends on your layout and model.
I am making simple distribution center in Anylogic.I did make truck agent and i am able to move it from one gis point to another gis point.
But I want to load some other agents(Let's say banana agent) into my truck agent and then trucks start their journey(if truck is full of banana).How can i do this?
I hope you have already solved your problem from almost a year ago. However, since there is no specific answer, I'll leave it here for anyone who might get stuck with the same problem.
Anylogic's Process Modelling Library (PML) has an element called Pickup and its opposite, Dropoff. This is used to do exactly what you asked: to load some element into a transporter (either a truck, a forklift, or even a person).
To use the block as you asked you would need a topology like in the picture:
The Queue elements are necessary to hold elements until the pickup occurs.
The Pickup element might pick elements in three modes:
While a given condition is True;
An exact amount (if available);
All available agents.
I'm assuming all trucks must be completely filled up to its maximum capacity. Hence, the chosen mode will be the second one where the exact amount will be TruckCapacity, a parameter of agent Truck.
The selected mode picks up agents (in this case Bananas) up to the desired amount. However, if nothing is available or the present amount is inferior to the desired, the native behavior of the Pickup block is to allow the container element to simply go through it and pick only what's available.
To prevent such behavior, I've created a restricted area where only 1 Truck can be at a time. Additionally, the Hold block WaitFullyLoaded (set to initially blocked) forces the container agent Truck to be fully loaded. Whenever a Banana enters the Queue waitTruck, a verification is performed to check if 1 Truck can be filled. If so, allows passage for that one truck:
if(self.size()/TruckCapacity>=1){
WaitFullyLoaded.unblock();
}
To block WaitFullyLoaded again, when the truck passes through the restrictedAreaEnd block, it performs WaitFullyLoaded.block();
The main idea is this. However, many features can be added and changed.
Hope this helps,
Luís