Anylogic: How do I converge 2 queues into one delay block? - anylogic

I'm new to Anylogic, and I was wondering if it's possible to have two queues go into one delay block. I'm trying to simulate products coming from 2 separate welding robots that then go into a sandblasting (delay block) installation. This installation can either blast 3 products from one robot or 1 from the other robot.
Maybe it's also possible to have one delay process be blocked as long as the other one is working, and then unblock it as soon as the other one is finished?
Here's a picture of the process.

So this is one way of doing it... I added hold blocks after each queue... one of the hold blocks is initially blocked.
I added a button to toggle the state of the hold block:
hold.toggleBlock();
hold1.toggleBlock();
This is the basic structure... of course the way you block/unblock the holds is up to you.

Related

Make pedestrians divert to another queue if QueueTime Exceeds a preselected Value

Edited Version:
I'm actually modelling an airport check-in terminal. It works fine so far, but additional I'm still trying to implement a function, that allows my pedestrians not to enter the service-queue if the queue time exceeds a preselected value (e.g. already 15 Passengers in the queue) and therefore walks to some kind of backup Service that opens during this busy times.
Here is my approach:
Variable QueueSize returns permanently the actual Number of Passengers in the Queue.
Every time a ped enters the pedservice block CheckInEco, the function waitingTime() starts:
QueueSize = CheckInEco.size();
if (QueueSize > 15) CheckInEco.cancel(ped)
So, as soon as there are more than 15 Agents in the queue, number 16 should bypass and move to an alternate ServiceBlock, which I would connect to the ccl Port of the CheckInEco Service. But when building the model, I get this message: ped cannot be resolved to a variable?
According to Anylogic Help, it should be possible to use this cancel - call, but I'm not really experienced with it.. Maybe, someone can help me out?
You can simply use a select output block to prevent pedestrians from going into the service block if there are more than 16 pedestrians already in.
Your original question had to do with waiting time, you should follow the exact same approach. But with waiting time it gets more complicated since you don't want to take the average waiting time from the start of the simulation.... so you need to decide if you want to take the last 10 minutes, 1 hour etc and do you want to include the current waiting time of agents in the queue. Since this is the the questions anymore I am not going to add it here, perhaps ask a new question if this is still the case.

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

seizeTransporter Block out port stop working

I am modelling earthmoving operation. Every trench agent seize two transporters, one excavator, and one truck. When truck is released it will do some other job before been seized again by the same trench. So this process repeat until the trench will be empty.
The process is occuring for two three times without any problem but after two three times the trench agent is not go out of the seizeTransporter block (the one that seize truck). I have a delay block after the seizeTransporter block and it use Maximum Capacity. So it should not be a problem and it should not prevent the seizeTransporter block out port to push the trench out.
I noticed this is hapenning when the truck stop to resolve a collision. It looks like the collision cannot be resolved and the truck stay where it is for ever. :))
I have tried so many things that could solve this problem but none of them works.
There is an option in the material-handling library TransporterControl element to override transporter conflicts after some time. Maybe reduce the default timeout of 10 model time units, see below:

How to store agents in a block untill a tronsporter can move them?

I'm a new AnyLogic user so hopefully this is a simple problem. I would like to use a block as to represent a storage area for items to be used in an assembly, I am using the delay block with delay time of 0, but maybe the queue block would be more appropriate? I have set up a model in which every X number of seconds a "truck" arrives and if the delay block contains less than a specified capacity of elements, the inject function is called to refill the block. This sort of works, but is seems that the agents are flowing through the delay block's out port and thus do not count toward its capacity (that makes sense to me...) resulting in my source blocks continuing to create agents when the system isn't ready for them. My delay block is followed by a "move by transporter" block which seems to be getting all of the delay blocks outputs immediately. There are only two transporters in my model and I am not sure why more than two agents can be accepted by the transporter block at a time. I set my transporter fleet to have a capacity of 2 but that did not solve the problem.
Any advice would be helpful! Perhaps a different approach is needed. My goal is to have an essentially unlimited pool of parts at the inlet of the factory, but only create agents when the downstream processes are able to pull them in. Thanks in advance!
Welcome to SOF :)
Best use a "Wait" block here:
Let your trucks dump stuff into "Wait" whenever they arrive. Your downstream block can now pull them when they are ready using myWaitBlock.free(someAgent for as many agents as they want to pull from it.
Similarly, you can use a Delay with infinite capacity and set its type to "Until stopDelay() is called". Then similarly as the "Wait" block, you call myDelayBlock.stopDelay(someAgent) when you want.
Another option: Use a hold-block in front of a normal (infinite) queue and unblock it when ready: myHoldBlock.unBlock(numToLetThrough) --> probably the easiest
PS: Please also check how to ask good questions here on SOF, yours is very long, much easier to understand with some screenshots :) --> https://stackoverflow.com/help/how-to-ask

How can I call for transporters earlier?

I have a model that generates a total of 5 loads, each load generated every 2 seconds. When the 5 loads are waiting to be transported, only 1 transporter is called. The transporter fleet has 9 vehicles here.
I have tried to use a seize transporter block before the convey block, but that only results in 5 transporters queuing at the conveyor for the loads to be generated and picked up.
How can I call a transporter for each of the loads? (In the solution, 5 transporters should be called when they enter the conveyor) Thanks for your help in advance, I am stuck.
EDIT 1
I tried out a suggested approach, but my method only generates new transporters with the agent name "Car". How can I call Cars from the existing transporter fleet?
As usual, many ways :-)
One could be to create a separate flowchart for your transporters. When a package enters the top conveyor, it can trigger 1 transporter to MoveTo the end of the conveyor location. For that, add a MoveTo block into the new, separate transporter flowchart.
This will make transporters waiting at the conveyor exit, ready to pick up stuff.
Be careful, though, to only summon transporters that are idle anyway.
cheers