Stacking agents in nodes/end of a path - anylogic

Agent Comparison/ Priority for queue
I'm building a model in Anylogic I have a question about visualization.
I have a model that looks like this: Source -> delay -> queue (with preemption option that goes into a delay2) -> seize -> delay3 -> release -> sink.
What I would like to do is make the agents enter the queue but visually keep moving along a circled path while waiting. In my model, I put the queue to a capacity of 1 and then added a preemption option which goes into a delay where the agents move along a circled path. I am able to make them take a lap along the path this way, but since the capacity of the queue can't be less than 1 there is always 1 agent standing still (not going in the preemption option). I would like for all of them to keep moving on the circled path while in the queue. How can I fix this?
Also, since the seize block has an embedded queue, and it starts where the queue before ends, there are actually two agents standing still at the same place.

Related

seize and release transporters in any logic

[Model]
https://i.stack.imgur.com/xRIhB.jpg
I am trying to model a batches loaded by 2 cranes (service block) on a transporters fleet. then transporters move to unloading area by another 2 cranes (for now represented in flow chat as a delay2 block ).
the problem i am facing with transporters i want them to have a first stop (delay 1) before they(loaded) carried the batch and move according to the path. i tried to model the first stop by a seize transporter ( destination to delay node), delay , after they stop, they carry on to their agent location ( batch) to be loaded i represent that by another seize( destination is agent) , move by and release transporter after second delay.
i got a miss behavior after transporters been delayed and released in first delay ,as they didn't see the agents and carry on on their path ( some times they go to load and some time they don't).

How agents will wait in the queue for there turn to go to the Delay section?

I used seize-move-release in order to move the agent with the resource. shown in the figure below.
Problem
Now the only problem is, how agents will wait in the queue (capacity 2) for there turn to go to the Delay section using resource. Explanation is in the image below.
What i am trying to achieve:
I mean agents wait in the queue (capacity 2). Once the delay(machine) gets empty, only then resource transfer the agent from the queue to the delay.
Note:
I try to use service because Service block have queue too but I need the queue before the resource pool.
I hope I explain my problem well let me know if I miss some thing.
I used Wait Block for the agents to Wait but when wait capacity equals to 2 . Agents stop moving forward.
Use a "Wait" object ahead of moveTo.
Whenever the delay capacity decreases to zero ("on exit" code box of delay you can check it using delay.size()==0?), you can tell an agent in the "Wait" object to advance now, using wait.free(agentToFree).
If you want to free the oldest agent, use wait.free(wait.get(wait.size()-1))

Truck (Agent) Hitbox in process modeling library

im creating some paths with the process modeling library. The trucks shall stop in series when waiting for the "go" signal to go on.
At the moment the trucks are waiting "within" each other.
How to tell the trucks to recognize not the stopnode only but also the hitbox of the truck which arrived before him?
Thanks in advance
Chris
The trucks shall stop in series when waiting for the "go" signal to go on.
At the moment the trucks are waiting "within" each other. [...]
How to tell the trucks to recognize not the stopnode only but also the
hitbox of the truck which arrived before him?
AnyLogic allows for agents to queue along a path (from an animation perspective) whilst in a Queue block. So don't make them move to the stop-node (which I assume you are doing explicitly): make them (from a process point-of-view) go into a Queue which is animated via the path from the stop node 'backwards'. (This is the "Agent location" setting of the Queue block.) How you hold them in the queue and release them when they need to depends on the nature of your model; e.g.,
Use a Hold block following the Queue (if it makes sense to release them all at once)
Use a 'dangling' Queue block which you pull agents out of programmatically (e.g., via its removeFirst function) and then add them somewhere else in the process via an Enter block.
Use a Seize block (which has a built-in Queue you can set the location of) with the resource seized representing the 'token' you need to proceed.
NB: From the process perspective, they are in a Queue which happens to be animated as queueing along a path. This isn't exactly the same as modelling the 'spatial reality' of being in a queue: see this question.
Simple solution is to turn your truck agents into Transporters from the Material-handling library. They have build-in collision avoidance.
However, this can slow large models so you may want to convert them only when you need collision avoidance and then convert back to "simple" Truck agents again.
Else, you need to build your own additional stop-nodes and code spatial queuing manually. Possible but not straight forward

Assign priorities for multiple Seize Blocks for the same resource in AnyLogic

I have a not so typical scenario for which I am not sure how to proceed:
There are two stations located at two different locations.
Both stations require the same resource.
The resource moves from station to station once released. So it keeps going from station 1 to station 2 to station 1, etc. until it is seized again. This is modeled by adding a link from the resource process port of the release block. So it is not completely released unless a condition applies. The condition is that there are agents waiting in the queue of the seize block of that same resource. So it should keep moving until it is needed again. The tricky part is that there are two seize blocks for that resource, one for each station. It is possible that agents are ready and waiting in the resource's seize element at both stations. I am adding an image of the resource's process at release. So at "selectOuput4" it checks whether station 1's seize element has agents waiting, if so, the resource is released and can be seized. Otherwise, it moves to station 2 and checks the same but for station 2.
My concern is that there might be a situation where both stations have agents waiting in their respective seize blocks. How can I make sure the resource will be seized by station 1's seize element and not station 2's, and vice versa. Is there a way to control where the resource is going in a case where two seize elements are waiting for it? Or is it always random?
I apologize for the long post, and I hope I managed to deliver my idea properly.
First, I think your design is a bit weird because you keep the resource always seized.
What I would do is first have a statechart in the resource that controls the resource movement from one place to the next so you have more control over it. The statechart would be used to move your resource ONLY when it's not seized. This will allow a case in which your resource is moving from station 1 to station 2 but something comes to station 1 queue and the resource can immediately react and come back to station 1 before it reaches station 2 (if you think it would be a good idea to do that)
The second is that the seize block defines the priority for a task when the agent arrives to the seize block, and your situation requires changing that priority dynamically, which can't be done as far as I know, so the wait block before the seize block is unfortunately a good option.

Preventing source blocks to generate agents if destination is occupied

I'm trying to create a packaging cell for 5 items into 1 package; the 5 items are picked up from a resource (worker) and placed into a packaging machine which generate the package; a conveyor moves the packages from the machine to a buffer and every once in a while (say every 20 packages) the worker stops picking the items and goes to the buffer the put all the packages in a box, ideally ready to be shipped. Once the worker has completed the box he has to go back to his pick&place task.
Now, my issues are:
When the worker stops picking the items from the rackSystem and goes to the buffer, the source blocks have to stop generating agents, otherwise the simulation will stop saying that there are no available cells in the rack;
When the worker gets back to his picking task the source blocks have to start generating agents again.
With the hold blocks in the picture I managed to stop the source blocks when the worker stops picking from the rack, anyway I could not make the process start again when the box is complete. How can i do this?
Everything works fine except from the fact that once the worker returns to the picking location and take the last 5 items from the rack, no more agents are allowed to enter the rack.
Actually from this setup, I think you should do this:
Let your sources create agents continuously. In reality (I suppose) things also do not stop coming in just because the worker is doing something else.
Gather all agents in an infinite queue, as you do
remove the hold blocks
instead, make your RackStore and RackPick objects utilize the worker resource pool (tick the box as below and select your resource pool)
You may need to play with the "customize resource choice" selection as well to ensure that your worker only tries to store items when the RackSystem has a space, though, something like below: