I want to simulate a call center where the customers' arrival rate is different depending on the time slot. For example:
from 8am to 8:30am the rate is 50
from 8:30am to 9am the rate is 60
May I ask how I can set this in Anylogic?
First you create a schedule with the rate that you want:
this example has a default value rate of 10/hour and has the values you suggested for 8:00-9am.
And in the source you define your agent arrivals based on the schedule you created:
Related
I have learned from my previous question “Get the same arrival rate across models” that for two models with the same arrival rate input, I can get the exact same arrivals generated in both models by setting the source block in both to “Interarrival time” and in the code, use exponential(lambda, 0, rand) where rand is a user-defined random number generator (RNG), for example, Random rand = new Random(1234). If prior to setting the source block to “Interarrival time” I had it set to “Rate Schedule” in which the schedule is of type rate that is provided from the database and in my case the rate (lambda) is not constant, it depends on the time of the day, how can I overcome this when setting the source block to “Interarrival time”?
Since it is not possible to set a seed for the arrival rate, you'll need to use interarrival times instead in your source.
However, since you also need to vary the interarrival time based on the time of day, you should write a function that returns different exponential random variables depending on the time of day and use that as your interarrival times.
Here is how I did that in AnyLogic:
And I made a quick plot of how many injections were occurring per hour just to verify that the rates are actually changing.
Perhaps I'm understanding the question wrong, but interarrival times can these not be transformed to arrival rate, so for example if interarrival time = 2minutes, the arrival rate is 0.5 per minute. If this is the case for your model, you can use in the source block arrivals defined by: a rate schedule (as shown in the figure below.)
After that in the schedule you can change the different arrival rates, so for example between 00:00 and 01:00 the arrival rate should be 1 as shown in the figure below:
My arrival rate for my source is in hours, and I am using events to set it's rate to a distribution at different times, sourceShoppers.set_rate(triangular(1, 5, 2));. However, the source is producing roughly 3 per second, as opposed to an average of 2 an hour.
do this:
self.set_rate(triangular(1,5,2), PER_HOUR);
Nevertheless, when you do that, notice that you will get a random sample for the triangular distribution, which will set the rate to be for instance 1.2 per hour in which case the arrivals will follow a poisson distribution with an average of 1.2 per hour always unless you change the rate again...
If you want some advice, you have to say what you want to achieve...
I need to simulate a simple M/M/1 problem in Anylogic. So far, I created the model and calculated all performance measures like the average time in queue and system and the average number in queue and system. Now I need to calculate the Total Costs. The painting time for a car would be 6 hours and costs $70 per hour. The cost of idle time per car is $100 per hour. The cars arrive according to a Poisson process with a mean rate of 1 every 5 hours. Can someone help me how I can calculate the total costs in this model in annylogic?
enter image description here
Refer to this question about measuring time:
Method the measure the time an agent is not in use during a simulation
You need to create an agent type that has variables for time and cost. Then on the On Enter and On Exit fields, record time and cost for individual agents. Once you have measured time, cost is simply time multiplied by the hourly cost.
If you want to measure total cost, you can create variables in main such as totalCost and the code of the sink's On Enter would be:
totalCost += agent.totalCost
Where the second totalCost variable would be the variable inside the agent type.
Anyway, the above should give you a good idea on how to proceed...
I would like to get the mean waiting time of each unit spending in my queue of every hour. (so betweeen 7-8 am for example 4 minutes, 8-9 10 minutes and so on). Thats my current queue with my timemeasure Is there a way to do so?
]
Create a normal dataset and call it datasetHourly. Deactivate the option Use time as horizontal value. This is where we will store your hourly data.
Creat a cyclic event and set the trigger to cyclic, once every hour.
This cyclic event will get the current mean of your time measurement ( waiting time + service time in your example) and save this single value in the extra dataset.
Also we have to clear the dataset that is integrated into the timeMeasurementEnd, in order to get clean statistics again for the next hour interval.
datasetHourly.add(time(HOUR),timeMeasureEnd.dataset.getYMean());
timeMeasureEnd.dataset.reset();
You can now visualise the hourly development by adding the hourlyDataset to a normal plot.
I'm trying to simulate a pedestrian flow in the entrance of an hospital.
We are installing check-in platforms and I want to know how many platforms we should get according to the patient flow.
I'm using Anylogic personal learning edition and when I put an arrival rate of 5 per hour during the simulation only 3 appears.
I'm trying to understand how anylogic works and distribute the pedestrians according to the rate we put.
For the personnal learning edition 1h equal 1min in real.
enter image description here
if you choose rate=5, the pedSource block will generate pedestrians with an exponentially distributed interarrival time with mean = 1/rate = 1/5.
Which means that the average of arrivals on the long term will be 5, but you won't get 5 every hour since it's a stochastic variable.
If you change the seed, you will have different arrivals... click on Simulation: Main and you can change the seed or use a random seed:
Now if you really want exactly 5 per hour in a deterministic way, you need to change the arrival from rate to inject function:
Then you can create an event that runs cyclically 5 times per hour.. or 1 time every 12 minutes:
and you do pedSource.inject(1);