AnyLogic - Is there a function like "Move by Transporter to seized resource"? - anylogic

In this model I want to transport MaterialBoxes (Agent) to the next available workstation by an AGV. I wanted to keep the model as simple as possible, but I did not find a solution to transport the MaterialBoxes to a seized resource (Workstation 1 or Workstation 2) by using the "Move by Transporter" or "Seize Transporter" blocks. Therefore I adapted the solution of the "job shop model" (https://anylogic.help/tutorials/job-shop/index.html) by using the "rack pick" block to transport the Materialboxes from the rack to the seized workstation. How can I adapt the model and avoid the process step going through the rack system with "rackStore" and "rackPick"? And I still have the problem to allocate an AGV to transport the MaterialBoxes from Workstation 1 and Workstation 2 to the Exit. Currently I'm just using the "moveTo" block to transport the boxes without a transport resource to the Exit. I am grateful for any advice. Thank you very much.
current Model

You need to add a custom variable to your agents where you can store the workstation that they seized and then in the move to block you can have them move to the station that they seized.
When the agent then seizes a workstation you save the work station it seized to the variable.
When it is time to move the agent you can move it to the location of the seized workstation.
You can also check out the solution in the example model Trauma Center https://cloud.anylogic.com/model/0c41592c-96d8-4824-b816-c89eccfd79db?mode=SETTINGS
Here agents move to the resource unit home, location of the unit that they seized

Related

Error in seizing crane after batch operation

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.

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

Keep resource seized after Rack Pick in AnyLogic

I can't seem to find a way to keep a resource seized after "rackPick". In the "rackPick" block I am choosing "Use resources to move". So I want a resource to move the agent from the pallet rack to a certain node. When reaching the node, I want the same resource to stay there to work on other activities (e.g. pick-up block). However, there is no option not to release the resource after picking. I also don't want to use a seize block before rack pick because I want the agent to move at the speed of the resource during picking. Any suggestions?
Thanks.
Additional details:
The exact process is as follows:
Rack Pick --> Pick-up --> Rack Store
I need the same resource to do the three steps.
what you have to do is reserve the resource. You can have a link to agents in the resource called agentLink... it will be connected if reserved and disconnected if not reserved.
in the resourcePool on seize unit action you can connect agent and resource through the agentLink (unit.agentLink.connectTo(agent))
You do also in the rackpick block custom choosing of a resource based on the condition !unit.agentLink.isConnected()
then in the rackstore you use the condition of the resource as unit.agent.equals(agent.resourceLink.getConnectedAgent())
And that's it :)

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.

Agent is not in a network at Rack Store and Rack Pick

i`m trying to take pallets from a conveyor to a Rack and after some time the Picker(Ressource) should take the Pallet out of the Rack to a conveyor again. But if i try to use the Rack Store, i get the error: The agent is not in a network. I think the problem is the Ressource(Picker), because without it the Rack Store is working.
Thanks for helping.
This might work, assuming you are using a conveyor from the material handling library, after the conveyor use a conveyorExit block.
The conveyorExit block allows your agents to move smoothly from a conveyor network to the normal network.
If you are using a conveyor from the process modeling library, then it means that you are not connecting your networks correctly and you should be sure you conveyor path is connected in the same network as the path in which your palletRack is located.
This might fix. In my case: I had 4 process flows of the same type of agent (ie. agent Type: product) coming into the RackPallet. Two is a to model processes before agent:product is stored in Rack, and the other two is to model the initial Stock of the Rack.
This solved my problme: I put the code
agent.setNetwork(network2);
before the RackStore of the initial Stock process flows, and it worked. I think this is because when we model initial Fill, the agent is not set on a on network yet.