Tools › Operations Research › Queueing and Simulation › Process Simulation › Method
Process Simulation: Method
Open the free Process Simulation (Discrete-Event)
Process Simulation: Discrete Events, Replications and What the Figures Mean
The tool simulates a process of up to ten steps: work arrives, waits in line at each step, is served by one of the step's servers and moves on, sometimes back to an earlier step. It returns the throughput, the time in system, the work in process, the utilization, line and wait at every step, and how sure the random numbers let it be of each figure.
The idea
A formula can give the average wait at a single line with random arrivals and a simple service time. Put three such lines in a row, let one step send a fifth of its work back, give one step a triangular service time, and no formula is left. A simulation does not need one: it plays the process forward with random numbers, as often as you ask, and measures what happened.
Nothing changes between two events, so the simulation does not tick through time. It keeps a list of future events (the next arrival and the end of every service in progress), jumps to the earliest, updates the state and draws any new times that event calls for:
- An arrival. The time to the next arrival is drawn and that arrival is put on the list. The new entity goes to Step 1: if a server is free it starts service (its service time is drawn and its end put on the list); if not, it joins the line.
- The end of a service. If the step sends a share of its work to another step, a random number decides where this entity goes. The freed server takes the first entity in line, if there is one. The finished entity enters its next step, or leaves.
The equations
Random times. With u a uniform random number between 0 and 1:
exponential with mean m: x = −m ln u
uniform from a to b: x = a + u (b − a)
triangular from a to b with most likely value c: x = a + √(u (b − a)(c − a)) if u < (c − a)/(b − a), otherwise x = b − √((1 − u)(b − a)(b − c))
lognormal with mean m and coefficient of variation v: σ² = ln(1 + v²), μ = ln m − σ²/2, x = exp(μ + σ z), with z = √(−2 ln u1) cos(2π u2) a standard normal number
The uniform numbers come from the Mersenne Twister generator, seeded with the entered seed for the first replication, seed + 1 for the second and so on, so a run can be repeated exactly.
What is measured, over the observed period from the warm-up time W to the run length T:
utilization of a step = time its servers spent serving ÷ (servers × (T − W))
mean number waiting = area under the line-length curve ÷ (T − W)
mean wait = total wait of the services that started ÷ number of those services
throughput = entities that left ÷ (T − W)
mean time in system = mean of (leaving time − arrival time) over the entities that left
work in process = area under the number-in-process curve ÷ (T − W)
Offered load is arithmetic, not simulation. The flow through each step follows from the routing: flowj = arrivals (for Step 1) + Σ flowi × share of step i's work sent to step j. A step that sends 15 % of its work back for rework is visited 1 ÷ (1 − 0.15) = 1.18 times per entity. Then offered load = flow × mean service time ÷ servers. At 1 or more the step cannot keep up and its line grows without limit.
Replications and intervals. One run is one sample of what could happen. The tool makes R independent runs; each gives one value xr of every measure. With x̄ their mean and s their standard deviation, the 95 % confidence interval is
x̄ ± t0.975, R−1 × s ÷ √R
where t is the percentile of Student's t distribution. Four times as many replications halve the interval.
Closed forms the tool compares itself with. For one step with random (Poisson) arrivals at rate λ, exponential service with mean s and c servers (M/M/c), with a = λs and ρ = a/c < 1, the probability of waiting is the Erlang C formula and
Lq = C(c, a) × ρ ÷ (1 − ρ), Wq = Lq ÷ λ, W = Wq + s
For one server and any service time with mean s and variance σ² (M/G/1), the Pollaczek-Khinchine formula gives Wq = λ (σ² + s²) ÷ (2 (1 − ρ)). For a process in which every step has exponential service and arrivals are random, Jackson's theorem says each step behaves in the long run as an M/M/c line fed at the flow the routing gives it, rework included. Whenever the entered process is one of these, the page prints the formula value beside the simulated one.
Little's law ties the measures together for any line: mean number waiting = rate of entry × mean wait. The page checks one step of one replication with it.
Shared pools and limited lines (Advanced)
A step set to a pool needs a free server of its own and a free unit of the pool to start a service; the unit is released when the service ends. When a unit frees, it goes to the pool step whose first entity in line has waited longest. A step with a limit on its line turns away an entity that arrives when the line is full: that entity leaves the process and is counted. (Blocking, in which the upstream server holds the finished entity until there is room, is not modeled.)
A schedule of rate multipliers stretches or squeezes the time between arrivals period by period: a multiplier of 2 doubles the arrival rate in that period, 0 stops arrivals.
What it assumes
- Lines are first come, first served, with no limit unless you enter one; nobody gives up waiting.
- A server is never idle while an entity it could serve is waiting; servers of a step are identical, take no breaks and never fail.
- Service times, gaps between arrivals and routing choices are independent of each other and of how busy the process is. An entity sent back for rework draws a fresh service time.
- Moving from one step to the next takes no time (add a step with many servers and a constant time for a walk or a conveyor).
- Every replication starts empty.
When it misleads
- The inputs matter more than the intervals. The interval reflects the random numbers only. At a step that is 90 % busy, a mean service time that is 5 % too low understates the line by roughly half; no number of replications repairs that.
- A short run from an empty start reads low. For a long-run average, use a warm-up and a run long enough that the line has gone up and down many times. For a process that really does start empty each day, use no warm-up and read the figures as one day's.
- An overloaded step has no average. If the offered load is 1 or more, the line grows for as long as the run lasts, and every figure depends on the run length. The page says so when it sees it.
- Time in system counts only those who left. In a run that ends with many entities still inside, the ones who left are the ones who got through early.
- Two scenarios do not share their random numbers. Change an input and the same seed produces different arrivals, because every draw comes from one stream. A difference between two scenarios is real only when it is large against both intervals.
- Real people are not independent draws. Staff speed up when the line is long, customers leave, work arrives in batches. None of that is in the model unless you put it in the inputs.
Common mistakes
- Entering a rate where a time between arrivals is asked: 12 arrivals an hour is a mean gap of 5 minutes, not 12.
- Mixing units: every time (gaps, service times, run length, warm-up, schedule period) is in the one unit you name.
- Judging a change from one replication, or from two runs with different seeds and overlapping intervals.
- Reading utilization as the whole story: at the same utilization a step with variable service times has a far longer line than a step with steady ones.
- Forgetting that rework raises the load on every step in the loop: 20 % sent back means 25 % more visits.
- Adding a server at the busiest step and expecting the whole wait to vanish: the work then reaches the next step faster and may queue there.
How it relates to the neighboring tools
Queueing and Capacity gives the exact long-run formulas for a single line; Capacity and Throughput finds the bottleneck of a line from rates alone, without waiting; Job Shop Scheduling and Sequencing orders a known set of jobs; Shift Scheduling covers a staffing requirement with shifts. This tool adds what none of them has: several steps with lines between them, any of five service-time distributions, rework and branching, and the variability of the result from run to run.
What was checked
An independent event simulation written separately in Python, with the same random-number generator, reproduces the tool's figures draw for draw on sixteen processes, among them shared pools, limited lines, an arrival schedule, rework and every distribution. The simulated long-run averages agree, inside their intervals, with the closed forms for M/M/1, M/M/c (Erlang C), M/D/1 and M/G/1 (Pollaczek-Khinchine), M/M/1/K, a two-step and a three-step Jackson network and its rework variant, and a one-unit shared pool that reduces to an M/G/1 line. The formulas are standard results stated from the definitions; the text by Law is cited as the general reference for the method and was not used for any number.