Simul8 Tips, Technical Corner

Using Labels to determine the number of times a Work Item visits an Activity

Tom Stephenson  /   Aug 23, 2013

If a work item needs to go through the same activity more than once, we could model this by adding each individual Activity in a linear process. For example if a patient needs 12 treatments (one per month for a year) before moving on we could add each individual treatment as an Activity.


This may be simple to do and easy for others to see what is happening in the process, but it is quite a long way to simulate it and having lots of objects on screen can make your simulation cluttered.

An alternative way to model this process would be to have one activity which represents the process (in this case getting a treatment) and we can create a loop using a label, which forces all work items to go through that treatment cycle 12 times before finishing treatment.

An example of how to do this:
1. Create the model as shown below:
2. Make sure the activity “12 Treatments” is replicated allowing many work items to be there at once, say 1000. (If you do not replicate this you may have to set a priority for the “Queue for Another Treatment” to prevent work items getting stuck in this queue.)
3. There should be a minimum wait time of a month on the “queue for another treatment”
4. Create a Label “lbl_treatments”
5. On the Start Point Action the label to equal a fixed value of 13 (one more than the amount of treatments)
6. When the patient reaches the activity “12 Treatments” decrement this, so the value 13 will now move down to 12 signifying one treatment has been had. The next time the patient goes through this loop their label value will become 11 and this will continue to decrement.
7. Now all we need to do is tell the activity “12 Treatments” to route out to the end if the label value is 1, otherwise send the patients back to queue for another treatment. We do this using routing out by type.
8. Select the activity “12 Treatments and then select routing out by type using the label you have created and sending values 2-13 to queue for another treatment and 1 to Finish treatment.

About the author

Tom Stephenson

Tom is Director of Services and Strategic Partnerships at Simul8 and has worked on 100 simulation projects across multiple industries worldwide, for over 10 years.