My goal is that all resources of a resourcePool perform an action at a specific time. How do I create this iteration? - anylogic

I am simulating a hospital stay with anylogic, on multiple levels. Each level has its own staff, represented by different ResourcePool (doctor, nurses, OSS) I created the flowchart of the actions concerning the patient. Now I would like, at a specific time (lunch and dinner), the OSS do tour the patients.
How do I set up that all OSS of a ResourcePool go to the rooms?
I would like to create a very small parallel flowchart, with sieze, moveTo, delay and release.
TNX

Easiest way is to use the "Downtime" element to prescribe your resources to do some action, see image below:
Under the "task type" selection, you can send them to a separate flow chart using a "ResourceTaskStart" element and they will do what you put downstream of that (moveto, delay...). Make sure to finish that with a ResourceTaskEnd block.
PS: The "Downtime" block can easily be triggered via a schedule. Make sure to read the help on that block (and the ResourceTaskStart/End blocks) and study the example models that use those.

Related

Different delay time for different agents in Anylogic

I'd like to know a very simple function of the software Anylogic: I have to set different delay times for different agents in a model, but the software let me see only one boxe and there's no possibilities to specificate what kind of delay time I prefer for every agents. How could I do? Thank you
I tried with some code of Java script but I think that scripture could be available only for the section "Actions" in the different boxes
This is one of the most basic functionalities so check the tutorials as well, but here goes:
Add a parameter 'myParameter' in your agent type of type double.
Give the agents different values for that parameter (cab be dine in the source or where ever you instantiate your agents)
In the delay block code section, use 'agent.myParameter' to access and apply that agent-specific duration.

Creating a dataset from queue size in service block

I am a newbie to anylogic simulations. In my project, I want to take out queue size at every time step from a service block and create a dataset. Similarly, I also want to take out the mean queue size from the same after every replication and create a dataset of that as well. Can anyone help me with how to do it?
Welcome to SOF and AnyLogic. Best post separate issues for separate questions, see this intro to SOF for AnyLogic users.
But for now:
I want to take out queue size at every time step from a service block and create a dataset.
Use a cyclic event that calls myDataSet.add(myServiceBlock.queue.size())
I also want to take out the mean queue size from the same after every replication and create a dataset of that as well.
In your experiment, add a DataSet myMeanResults. In the "On Simulation end" code box of your experiment, call myMeanResults.add(root.myDataSet.getYMean())
Make sure your Datasets can keep enough values!
Also, always check the AnyLogic help and example models. Very often, these basics are covered there already. Else, tell us what you already tried :)

Anylogic ‘how to’ questions

I am using Anylogic for a simulation-modeling class, and I am not anylogic or coding smart. My last and only coding class was MatLab based about 16 yrs ago. I have a few questions about how to implement modeling concepts in a discrete model with anylogic.
How can I add/inject agents directly into a queue downstream from a source? I have tried adding an additional source to use the “Calls of inject() function,” but I am not sure how to implement it after selecting it ( example: what do I do after selecting the Calls of inject() function). I have the new source feeding directly into the queue where I want the inject.
How can I set the release of an agent to a defined schedule instead of a rate? Currently, I have my working model set to interarrival time. But I would like to set the agent release to a defined schedule. (example: agent-1 released at 120 seconds, agent-2 released at 150 seconds, agent-3 released at 270 seconds)
Any help would be greatly appreciated, especially if it can be written in a “explain to me like I am 5yrs old” format.
Question 1:
If you have a source connected directly to a queue, then when you call source.inject() an agent will be created at the source block and go to the queue. If you have 1 source with multiple possible destinations, then you will have to use select output blocks and some criteria to go from the source to the desired queue.
Since you mentioned not being a strong programmer, this probably wouldn't be for you, but I often find myself creating agents via add_population and then just adding them to an ArrayList until I am ready to pull them into the DES flow. Really, there are near infinite ways to control agent flow within AnyLogic.
Question 2:
Option a: Arrivals by "Arrival Table in Database" You can link an AnyLogic database table to Excel, and then the source block will just have an agent arrive based on that table.
Option b: Arrival Schedule - you could set this up manually within the development environment or load your schedule from a database. I prefer option a over option b given your brief description.
Option c: Read in data to variable and then write code to release based on next arrival time. 1,000s of ways to do this, but one example could be a list of doubles (your arrival times), set an event to delay until next arrival, call inject function, remove that arrival from the list. I think option a would be best for you, but given that AnyLogic allows you to add java code, there are no limits to how sophisticated you could make your arrival logic.
For 2) You could also use an event or a dynamic event. The action could be source.inject(1); and you can schedule them to your preferences with variables. Just be vigilant that you re-start the events if necessary.
There is a demo-model from AnyLogic for dynamic events.

How can I use rackPick block to seize more than one item at once? - Anylogic

I'm developing a project with Anylogic and I have an AGV with a Kuka cobot on top of it (a sort of mechanical arm used to pick item from a shelf, in this case) which should pick some items from a rack store. I would like the cobot to pick more than one single item at once.
The blocks I already put are shown in the picture and I thought that specifying "seize whole set at once" in the rackPick block would have helped but it did not.
Could you help me, please?
Thank you in advance.
The RackPick logic is agent-centric, i.e. the items in the rack are the active entities. They, essentially "pick themselves", optionally using your robot as a help.
So if you want your robot to pick several, it is best to batch your agents together before putting them into a rack (using Batch) and then let your robot pick that batch agent. You can unbatch into the original agents afterwards.
PS: That "seize whole set at once" option is again from the agent perspective: if it would need several resources to be picked, then this option would have an effect. In your case, with only needing 1 robot, it is meaningless

Rackstore and rackpick multiple agents at a time in anylogic

I am trying to develop a model that essentially shows the movement of material in the warehouse.
I want the rackstore block to move multiple boxes at a time in the rack using crane. In the current model, crane takes one box at a time, stores it in the rack and comes back to take next box.
Not sure if RackStore supports that, but as always, you can find a solution in AnyLogic.
One simple fix: bundle your packages together into 1 agent using the batch object. Then, they stay together until being taken out by the crane at the end (via RackPick) and you can un-batch them to their original agents. Have a look at some example models using batching.
cheers
Depending on the details of your model, one option is to use batch as Benjamin stated, but I think I feel the pickup dropoff blocks would work better because with the dropoff you can drop the boxes one by one, while the batch forces you to separate all the boxes at once...
So with the rackstore you can't do this, but if you use the pickup and then dropoff, you will have to store somewhere in your model what rack positions are free though, because when you move the crane you will have to choose the rack position yourself, while the rackstore does it automatically...
Nevertheless, the batch may also work... it depends on the details of your model