Changing distribution parameters depending on days of the week
Jessica Aiani / Aug 9, 2022
Distributions let you add variation to your simulation model. For timing especially they’re key. You don’t always want to use the same distribution for the whole simulation day though. For example, patients arrive at an ER at very different rates depending on the time of day and the day of the week. A Time Dependent Distribution is a really easy way to capture this in your simulation.
If it gets more complex than that, you can use Visual Logic Time Check.
Let’s say we’re simulating a factory where a machine operates at slower speeds on Thursdays and Fridays to allow maintenance to be carried out without disrupting the workflow.
First we’re going to create a distribution called distOperationTime which we will apply to the Assembly Activity’s Timing. Just add dummy values when creating this distribution as it’s going to be updated through Visual Logic.
Now go to Visual Logic > Time Check VL > Time Check Properties.
We want Simul8 to trigger the code every 8-hour day, which corresponds to 480 minutes.
Click on the On Time Check Logic button and write the IF/ELSE statement using the Set Distribution Parameters command:
Now our Assembly Activity will take an average of 15 minutes to operate on Thursdays and Fridays, and an average of 8 minutes during the other weekdays.
You can find more help on Visual Logic here. We also run monthly classes to help you become a Simul8 pro – more details can be found on this link.
Happy Simul8ing!
Do you have any applications/scenarios you would like to see in our Simul8 Tips section?
Share them with us at support@simul8.com