Anylogic, how to simulate a machine set up that runs every time that an entering agent A has a parameter that differs from the last agent B served? - anylogic

I have Agent B / Agent A / Agent A type of agents in a queue waiting for a service (delay). But I need that when it's time to change from Agent A to Agent B, ocurrs a machine set up. How do you usually handle this situation?
I tried, with no success, making variables and checking conditions On enter in the delay. I'm new to AnyLogic, so any help would be amazing.

The Downtime block allows to model changeovers for Service blocks. Read the help and explore all the tutorials and example models that use it to learn how it works.

Related

How to send agents to sink block if aging higher than threshold

I am building a model where at any point in time if any agent is in system beyond threshold it has to go to Sink block. Is it possible to do it based on Agent time in system ?
If agents spent 180 days and beyond I want to send it to write-off block
what you need to do first is to create an enter block that connects to your sink block
With that done, most of the blocks have a remove method associated, so you can do this, with any agent a:
a.currentBlock().remove(a);
enter.take(a);
Nevertheless, this is not good practice in my opinion, removing an agent from any block at any time will almost certainly mess up your flow logic in some way...

Anylogic: Delay in Transfer of Agent Between Enter and Exit Blocks

I am simulating a job-shop scheduling problem where an order is processed by multiple machines located across different manufacturers. Each manufacturer
and machine
is represented as an agent in separate populations. Part of the simulation is the transport of an order agent from a manufacturing agent to the relevant machine agent according to the production plan.
As part of another part of my program, I need to predict the times when the order is generated by the source block when each order should enter and exit the relevant machine agent.
I am running into an issue where the time when the order agent exits the exitToTransport block in the manufacturer, agent does not match with the time that the order agent enters the enterMachine block for the machine agent.
This issue seems to only appear after the order has undergone 2-3 of these transports. Additionally, there are no blocks that the order agent enters or leaves between the exitToTransport and enterMachine blocks. Is there a way to eliminate this gap between the exit and enter times? Thank you for your time.

Anylogic 'service block' one at a time

I'm new with anylogic so I'm not sure how to do this simple thing but is there a way for the service block to only do one agent at a time? I'm making a simulation but it seems that if one agent goes to the service block, it will be serviced even if there is still another agent being serviced? I don't know how to stop the new agent when there is still an agent being serviced. Please help me. Thanks
the problem is probably because you have not set any resources for service block. if you define a resource for your service block, only one agent can be processed at one time and other agents would wait in queue until the delay of first agent is finished.

Anylogic ResourcePoolName.idle() is not update real time?

I use the below command to check availability of ResourcePool:
ResourcePoolName.idle()
ResourcePoolName.busy()
I found that the idle unit (or busy unit) is slowly updated.
When the agent leave the Service block, ResourcePoolName.busy() is still busy and ResourcePoolName.idle() is sill not idle. I need to wait for the agent to enter the next 3rd block so that ResourcePoolName.busy() unit and ResourcePoolName.idle() are updated correctly.
How can we have the idle unit (or busy unit) of the ResourcePool update real time????
Someone recommend me this solution and it work well.
Instead of using A Services Block alone, I uses Services Block + Delay (with delay time = 0). Now when the agent leave the Delay Block, ResourcePoolName.idle() status did updated correctly.

Communication with two agents within a single block in Anylogic

As seen below in my flowchart I am trying to model jobs that are being sent to servers. In the service block, my resource pool is servers.
My current model has Agent 'Jobs' being created in the source. they are then sent to the Queue and to the Service block where the Service block will seize a server(Server Agent) from the resource pool.
I have set out my simulation so that servers are deleted at random times.
My trouble is: When a server that is currently working on a Job is deletes (at a random time), how is it possible to send the Job back to the queue.
I'm having an issue getting the service block/server pool accessing the Jobs agent
I'm not sure how you're deleting your servers but if you're doing so by reducing the capacity of the resource pool my answer will work as you desire.
For you to return the job back to queue, first you'll need some changes to your flowchart. (See Image)
Then, in your service block, change your settings to match mine:
And voilá, that's it. If you're using a different type of deletion and this approach doesn't work, let me know.
Cheers,
Luís Pereira