Error in seizing crane after batch operation - anylogic

In Any Logic i have batched segments to rings (both are agents) if i want to move rings using move by crane it is giving error:
As i am pretty new to this software i have very less idea how the agents are seized and assigned to any block.
Can anyone please tell me how to sort this issue i tried to use restrict block OR delay before move by crane but still it did not work. Please find details here
Thank you in advance.

The error you're getting has to do with the space of the agents (both the crane's space and the destination agent's space).
Specifically, in order for the crane to pick up the agent and the move it, they both have to be in the same space.
To ensure that they're both in the same space, try adding code "On Exit" of the queue right before the moveByCrane block.
It should look something like this:
On exit queue:
agent.setSpace(overheadCrane.getSpace());

Did you define the location of the batch? If not, this might be the cause of the error.
AnyLogic creates a new agent when you use the batch flowchart block. Unless explicitly specified, this agent will not belong to any space. That's why you need to define the location of the batch first as seen here:
Batch location
Another thing that I've noticed is that you entered node1 as destination of the MoveByCrane block. Based on your attached screenshot, you want the crane to move the agent from node1 to node2. In this case, you should enter node2 as destination of the MoveByCrane block instead.

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

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

How to have a condition simulating an error after a rackPick in Anylogic?

I have a problem with anylogic because I am not able to simulate an error happening to the moving resource (I have only one moving resource) of the rackPick block.
I tried to increase the delay (but I think this is not possible to do at runtime, because once the item has been picked from the rack store, I can find no way to restore the old delay)
I tried to reduce the speed of the moving resource (accessing to the correspondent resource pool), but I have the same problem described in point 1.
How can I do that?
I just need the moving resource to pause its job and resume programmatically.
Thanks a lot in advance.
Tricky one, here is one possible way:
make your RackRick/Store use a ResourcePool with custom agents
make the ResourcePool use a Downtime block
Setup the downtime block to resemble your failures. Easiest if you have stochastic failure rates.
Alternatively, you can experiment with priorities: have a very high-prior task that can preempt your RackPick/Store task. Set the RackPick "Task preemption policy" to "Wait for original resource".
(Will need some trial'n'error on your end :) )

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

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: