Anylogic 'service block' one at a time - service

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.

Related

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))

Anylogic: avoid unwanted execution of process in seize block

I am trying to simulate manufacturing process by using statechart. And i have created agents for particular machines by statecharts and connecting those agents according to manufacturing process with help of resource pool, seize block and release block
My agent is passing through the resource pool and seize block. And I am expecting to run the model one after another seize blocks. However, when I run the model my all three statcharts are active at a same time, which I do not want. can anybody suggest me a possible way to avoid simultaneous process?
I'm assuming your manufacturing processes don't take 0 time. You're missing Delay blocks, causing all your blocks to execute at the same, instantaneous moment.
On a side note, what you're showing us isn't a statechart, but a flowchart.

Implementing a downtime on a resource that waits for the resource to finish its task before delaying it

I'm trying to represent a machine that works for a x amount of time before warning the operator that the oil tank needs to be refilled. Have in mind that the machine doesn't stop as soon as it send the warning message out. That way, the operator will wait until the machine stops any activity it had already started, and once it's done, he'll stop the machine and fill the tank.
In order to represent this process I'm using a Station block from the Material Handling library, that seizes a resource from a resource pool block, to which a downtime block is applied.
Is there a way to make the downtime block wait until the machine stops before performing the maintenance?
I also want to associate a resource pool representative of the operator to the downtime block, so that the operator is busy during the downtime, since he's the responsible for filling the tank. Can I do that?
Thank you in advance!
Is there a way to make the downtime block wait until the machine stops before performing the maintenance?
Yes, explore how Priorities work. Give your machine task a higher priority than the downtime task and ensure that the downtime block does not preempt other tasks:
I also want to associate a resource pool representative of the operator to the downtime block, so that the operator is busy during the downtime, since he's the responsible for filling the tank. Can I do that?
Yes, set the task type to "go to flowchart" and use a custom flow chart to seize from a resource pool (again, check the help on how to set this up in detail):
PS: Please only ask 1 question per issue always. See https://stackoverflow.com/help/how-to-ask and for AnyLogic https://www.benjamin-schumann.com/blog/2021/4/1/how-to-win-at-anylogic-on-stackoverflow

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?

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.

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