How to change the animation of agents when using same ResourcePool in two services - simulation

I have a ResourcePool that contains 5 agents. Now I am using 2 agents in the first service and 3 agents in the second service.
Properties section of First service
Properties section of Second service
However, the animation of agents is always set to 3. Shown in image below.
What I want is when first service is in use I see only 2 agents and when second service is in use I see 3 agents.

Use different nodes to animate the different service blocks. You currently use the same node and all 5 are likely drawn on top of each other...

Related

Can a transporter follow an 'material' agent into another agent?

I have an material agent that is moved from the Main agent to inside another agent (simulating a room). I can send the material agent using the Exit and Enter blocks. The 'room' agent contains a network that the material agent is being sent to.
The material agent is initially being moved in Main using a Transporter. However I'm not able to get this Transporter to follow the material agent into the room agent. The main questions is - is it possible to send a Transporter into another agent? Or does it need to remain in the agent that the Transporter Fleet is located?
Thank you.
I will correct benjamin by saying that with setEnvironment you can't do it since that's a function that is called on the agent initialization.
Instead of setEnvironment,something you do normally is to send the agent to a new population (which is the way you dynamically change environment), but it doesn't work with transporters
My answer would be that you can't do it since transporters who follow paths are defined as strict AGVs and can only move on their initial network and you can't change the network, unlike other agents.
But i'm always a bit suspicious of myself when i say something is not possible...
This should be possible with some setEnvironment() calls.
However, it is not a good setup. Think of reality: your rooms are spatially all part of the same environment: your flat (or factory or whatever). Moving from 1 room to the next does not mean you change your flat. You stay in the same environment.
You should setup your room agents like that as well: their spatial representation should reside in Main (or whatever agent they are embedded in).
Use a parameter of type ShapeRectangle or similar in your Room agent to define which rectangle (or else) represents the spatial aspect of the room.
Then, the flow chart blocks in the Room agent simply refer to that parameter for their spatial needs.

Anylogic: Agent movement within another agents diagram and main diagram

I created an agent 1 and an agent 2 both existing in main. On startup I place agent 2 in a node which is located whithin agent 1 (main.agent1.node). But now when I want to move agent 2 to another node existing on main, the agent moves to an entirely different location, which seems to be dependent on the relative position of agent 1. Can someone explain the mechanism at work to me? Is agent 2 living in the continuous space of agent 1? How can I transfer it to main, so that it would move to the right position in relation to the main diagram? Thanks for taking the time.
Yes, spacing is always relative to the agent that "owns" you.
To transfer agent1 back to main alongside agent2, best use a flowchart "enter" block on main, push agent1 through it and use its "New location" setting to select some node on Main.
You can also call setEnvironment(main.getEnvironment()) to do it programmatically. More info in the help: https://anylogic.help/anylogic/agentbased/continuous-space.html#agent-animation

Batching multiple agents based on location of agent

In my model I only want to batch agent which are at the same location. So my source block generates the agents according to a database to a specific node (which is sometimes different for agents), now I want the agents that occur at the same node to batch in sizes of 2 and the one that are left over need to be batched alone.
How can I model this, I know that I can use the selectoutput (which says for example if location=node1 use this output etc) option, but do I than have to add for example manually 100 outputs if I've 100 different locations where the agents start or is there a more simple solution for this problem?
Added later:
Or is there another way to model my idea:
So I'm simulating an hospital environment, where logistic employees (in this case the transporter) based on predefined times collects the thrash on certain areas for example the databaserow I show in the picture below:
At 9:50, the thrash at thrash collection point at LAB_Office_2_H_T_N can be collected by the logistic employee.
So in my model I create this 2 agents (which are 2 containers, last column) based on this time and seize a transporter to collect this thrash. Since a logistic employee is able to collect 2 thrash in one time I want to batch it and let the logistic employee collect 2 thrash containers at once.
After that he transports it to the thrash dump area and is released.
The colors changed after the added information. You can use pickup and dropoff blocks instead. You can define your node requirements in the condition cell. You can use local variables like container and agent to code whatever you want. Or use "Quantity (if available)" option. There you can programmatically define how many units will be picked up by using your own function.

A question about seizing more than one ressource in Anylogic

I'm working on a supply chain project with AnyLogic. In my model which is similar to product delivery example in AnyLogic examples, there are two agents which are Retailer and Fulfillment center. Both have their own vehicles. What I'm trying to do is to share vehicles so retailers and Fulfillment centers use the vehicles of each others. What I did is to create two Ressource Pool in each agent. So in the seize block as it shown below in picture, I added two ressource sets . In each statechart of each vehicle as it shown below and after delievering products, I informed my vehicle to go back to his initial location and in this case it can be Retailer or Fulfillment center. However after simulation, I got an error message in console that tells me that my agent which is the vehicle is trying to move to unknown source
If you put 2 ResourcePools into 2 agents, you have 4 pools in total. But you only want 1 shared pool, right?
Only add 1 ResourcePool to Main and use that from both agent's Seize elements. You will not be able to select the pool in the usual dropdown list (as there is no pool in either agent) but you can easily use the dynamic code to specify it. Note that the code below assumes both agents are embedded in Main:

service block based on agent size in anylogic

My shop floor is divided into 4 quadrants, each occupied by a welder. For the small products it could occupy 1 quadrant but for large products, it will occupy 2 quadrants with 2 welders working on it. How can I translate that in anylogic using service building block? I already have my product size determined at the source.
Create a ResourceType "Quadrant".
Create a ResourcePool with 4 resources of type "Quadrant"
Set up your Service block such that each bit of work needs 1 welder
before that, create a seize block that seizes "quadrant" resources based on the product type. See pic below where I assume this is stored in Product.type as a String:
don't forget to create a release block as well downstream of the Service.