Reputation: 25
Is there a way to create an agent inside a delay/wait block? Basically at the start of the simulation I need to create a number of agents defined by a parameter in the middle of the model, and depending on the user's choices, the place where I need to insert these agents may change.
So what I would like to know, is there any way to simply create a certain number of agents within these delay/wait blocks, without having to place a source block before each station? (It's my last resource, but it would make the model very visually polluted).
I have found some function like:
delay.create();
or
delay.addAgentToContents(agent);
However, I don't know how to use, or even if it's what I'm looking for.
Upvotes: 1
Views: 48
Reputation: 1
No, not directly. You have 2 options:
For the 2nd option, your agent type would include a Enter/Exit blocks and a Delay in the middle. Also a paramter of type int
named something like numInitialAgents
.
In the flow of the agent, you have a Source that injects that many agents on start, which would immediately fill the Delay block.
Now replace all your normal Delay blocks with the custom agent type et voila.
PS: If you struggle with the Enter/Exit setup, see some advanced videos such as https://youtu.be/OWwjKqKUA1A?si=Ues0Hm6C1U5SlEFI
Upvotes: 1