Model Musings

Notes from the modelling desk.

Short, practical pieces on discrete-event simulation in Python with SimPy: the patterns worth learning, the errors worth avoiding and the questions a model is actually fit to answer. Written between projects; read in minutes.

Articles 64
Latest entry 04 Mar 2026
First entry 10 Jan 2025

March 2026 4 articles

  1. SimPy Performance Optimisation: Making Simulations Faster

    Your SimPy model works, but it crawls. Profile first, then cut object churn, batch the work, run replications in parallel and simplify where it counts.

    10 min

  2. SimPy Deadlock Explained: Why Your Simulation Hangs

    Your simulation starts, then stops: no error, no output, nothing. Why SimPy models deadlock, how to spot it and four reliable ways to prevent it.

    3 min

  3. SimPy Process Not Running: Why Nothing Happens

    You wrote the code and ran the simulation, and nothing happened. Ten reasons a SimPy process never runs, with a checklist to find yours quickly.

    3 min

  4. Debugging SimPy: Finding What's Wrong

    When a SimPy model misbehaves, guesswork is slow. Print tracing, logging, event tracers, breakpoints and assertions will find the fault faster.

    4 min

February 2026 28 articles

  1. Common SimPy Errors and How to Fix Them

    Fifteen SimPy errors you will meet sooner or later, from a forgotten yield to an unset seed, with what each one means and how to fix it.

    4 min

  2. Optimisation with SimPy: Finding the Best Configuration

    Simulation tells you what happens; optimisation tells you what is best. Grid search, scipy.optimize and genetic algorithms for tuning a SimPy model.

    4 min

  3. Animation in SimPy: Making Simulations Come Alive

    Static charts tell a story; animation tells it better. Bring a SimPy model to life with matplotlib, Pygame, Plotly, GIF export and a live Dash app.

    3 min

  4. SimPy with NumPy: Better Randomness and Faster Analysis

    Python's random module is fine. NumPy's random is better. More distributions. Better seeding. Faster analysis.

    4 min

  5. SimPy with matplotlib: Visualising Simulation Results

    Numbers tell the story; matplotlib makes people believe it. Queue traces, wait distributions, utilisation charts and dashboards for SimPy results.

    4 min

  6. SimPy with pandas: Powerful Data Analysis for Simulation Results

    SimPy generates the data; pandas makes sense of it. Collect results in DataFrames, then slice, resample, pivot and compare scenarios in a few lines.

    4 min

  7. Production Line Simulation with SimPy: Flow, Buffers and Bottlenecks

    Production lines are sequences of stations connected by buffers. Material flows from start to finish. Bottlenecks determine throughput. Simulation finds them.

    4 min

  8. Warehouse Simulation with SimPy: From Receiving to Shipping

    Warehouses are logistics engines: goods flow in, get stored, get picked and flow out. Simulate zones, waves and conveyors to find the bottlenecks.

    5 min

  9. Airport Simulation with SimPy: From Check-In to Takeoff

    Passengers flow through check-in, security and boarding while delays cascade. Model an airport in SimPy and see where things go wrong before they do.

    4 min

  10. Machine Shop Simulation with SimPy: Jobs, Machines and Breakdowns

    The machine shop is a classic simulation problem. Jobs arrive. Machines process them. Breakdowns happen. The question: can you meet your deadlines?

    4 min

  11. Restaurant Simulation with SimPy: From Seating to Serving

    Restaurants are fascinating systems. Multiple resources. Parallel processes. Variable service times. Customer behaviour. All in one simulation.

    4 min

  12. Supply Chain Simulation with SimPy: From Supplier to Customer

    Supply chains are networks of queues, buffers and delays. Orders flow one way and goods the other. Simulate them in SimPy to find where they stick.

    4 min

  13. Bank Queue Simulation with SimPy: The Classic Example

    The bank queue is the Hello World of simulation: simple enough to grasp, rich enough to matter. Tellers, express lanes, balking and VIPs in SimPy.

    4 min

  14. Call Centre Simulation with SimPy: Optimising Customer Service

    Call centres live and die by their metrics. Average wait time. Abandonment rate. Service level. Simulation helps you hit your targets without overstaffing.

    9 min

  15. Hospital Simulation with SimPy: Modelling Patient Flow

    Hospitals are complex systems. Patients arrive unpredictably. Resources are constrained. Lives depend on getting it right. Simulation helps.

    4 min

  16. Manufacturing Simulation with SimPy: Modelling the Factory Floor

    Manufacturing is where simulation proves its worth. Model breakdowns, kanban, batches, quality checks and shifts in SimPy to find bottlenecks early.

    5 min

  17. Running Multiple Processes in SimPy: Concurrency Made Simple

    Real systems have many things happening at once. Customers shopping. Machines running. Trucks delivering. SimPy handles them all.

    4 min

  18. Running SimPy Until a Condition: Flexible Termination

    Sometimes you don't know when to stop. Run until the queue is empty. Until 1000 customers are served. Until something interesting happens.

    3 min

  19. Real-Time Simulation with SimPy: Syncing with the Real World

    Normal SimPy runs as fast as possible. Simulation years pass in seconds. But sometimes you need simulation time to match real time.

    3 min

  20. SimPy Interrupts Explained: Handling the Unexpected

    Real systems have interruptions. Machines break. Priorities change. Shifts end. SimPy lets you model all of this with interrupts.

    4 min

  21. Logging in SimPy: Debugging and Tracing Your Simulations

    Print statements are fine for tiny simulations; real ones need proper logging. Log levels, simulation-time loggers, event tracing and JSON output.

    3 min

  22. Visualising SimPy Results: Making Data Speak

    Numbers tell the story; charts make people listen. The plots every SimPy study needs, from queue lengths and wait histograms to CDFs and Plotly.

    3 min

  23. Confidence Intervals in SimPy: Quantifying Uncertainty

    A point estimate without a confidence interval is a guess with false precision. Here's how to do it properly.

    6 min

  24. Warm-Up Period in SimPy: Avoiding Initialisation Bias

    Your simulation starts empty. Reality doesn't. This mismatch corrupts your results unless you handle it properly.

    3 min

  25. Running Multiple Replications in SimPy: Statistical Confidence

    One simulation run proves nothing; run it again and the answer changes. How many replications you need, and how to run and compare them in SimPy.

    6 min

  26. Collecting Statistics in SimPy: Measuring What Matters

    A simulation without statistics is just an animation. You need numbers. Trends. Distributions. Evidence.

    3 min

  27. Random Numbers in SimPy: Seeds, Streams and Reproducibility

    Randomness is the soul of simulation. But uncontrolled randomness is chaos. Here's how to do it right.

    4 min

  28. Service Time Distributions in SimPy: Choosing the Right Randomness

    Service times are rarely fixed, and the distribution you choose makes a model realistic or useless. How to choose, fit and sample the right one in SimPy.

    4 min

January 2026 23 articles

  1. Modelling Arrivals in SimPy: From Poisson to Custom Patterns

    Every simulation needs entities entering the system. Customers arrive. Jobs appear. Packets flow. How you model arrivals shapes your entire simulation.

    3 min

  2. Modelling Servers in SimPy: From Single to Multiple

    Servers are the workhorses of simulation: tills, machines, staff and computers. Model single, parallel, batch and setup-time servers in SimPy.

    6 min

  3. How to Model a Queue in SimPy: The Complete Guide

    Queues are the bread and butter of discrete event simulation; model one well and you can model most systems. Servers, priorities, balking and statistics.

    4 min

  4. SimPy FilterStore Explained: Getting Exactly What You Need

    Store hands you the next item; FilterStore lets you be picky. How to fetch exactly the item you need, with a parts bin and taxi dispatch as examples.

    5 min

  5. SimPy Store Explained: Managing Distinct Objects

    Resources count slots, containers track levels and stores hold distinct items. How to pass real objects between SimPy processes with Store.

    5 min

  6. SimPy Container Explained: Modelling Levels and Quantities

    Not everything is about counting slots. SimPy's Container models levels, such as fuel in a tank, stock in a buffer or water in a reservoir.

    4 min

  7. SimPy PreemptiveResource Explained: Interrupting for Priority

    PreemptiveResource doesn't just jump the queue; it evicts whoever is using the resource. How preemption works in SimPy and how to handle it safely.

    4 min

  8. SimPy PriorityResource Explained: When Some Requests Matter More

    Not all customers are equal. Not all jobs are equally urgent. PriorityResource lets important requests jump the queue.

    5 min

  9. SimPy Resource Explained: Modelling Limited Capacity

    Resources are where queues form, waiting occurs and bottlenecks emerge. How SimPy's Resource works, from request and release to balking and reneging.

    5 min

  10. Python Generators Explained for SimPy Users

    SimPy is built on Python generators; if they feel mysterious, SimPy will too. What yield does, how a generator keeps its state and why SimPy needs it.

    3 min

  11. The Yield Keyword in SimPy: Why It Matters

    You will see yield everywhere in SimPy code. It is not decoration; it is the mechanism that makes simulation work. What it does and why it matters.

    3 min

  12. SimPy Timeout Explained: Modelling Time Delays

    The timeout is the most used event in SimPy; it is how you say 'wait this long'. Random delays, time units, zero timeouts and running in real time.

    3 min

  13. SimPy Events Explained: How Things Happen in Simulation

    Events are the heartbeat of SimPy: a timeout expires, a resource frees up, a process ends. How events work, from AnyOf and AllOf to custom events.

    3 min

  14. SimPy Processes Explained: The Building Blocks of Simulation

    If the environment is the heart of SimPy, processes are the muscles. How to write, start, parameterise, interrupt and connect the processes in a model.

    3 min

  15. SimPy Environment Explained: The Heart of Every Simulation

    The SimPy Environment is the least glamorous and most important part of every model: the clock, the scheduler and the coordinator all in one.

    3 min

  16. SimPy vs AnyLogic: Which Simulation Tool Should You Use?

    AnyLogic does agent-based, system dynamics and discrete-event simulation in one package. SimPy does one of them, in Python. Which should you choose?

    3 min

  17. SimPy vs Arena: An Honest Comparison

    Arena is the Microsoft Office of simulation software: ubiquitous, expensive and entrenched. An honest comparison with SimPy, its open-source rival.

    3 min

  18. When Should You Actually Use Simulation?

    Simulation is powerful, but it is not always the right tool. When it earns its place, when simple maths will do and a rule of thumb for deciding.

    3 min

  19. SimPy in 10 Minutes: Everything You Need to Get Started

    You don't need a week to learn SimPy; you need ten minutes. The mental model, the core building blocks and a complete coffee shop example to start.

    3 min

  20. Your First SimPy Simulation: Hello World for Discrete Event Simulation

    Every programming journey starts with 'Hello World', and simulation is no different. Build your first SimPy model and watch events unfold over time.

    2 min

  21. How to Install SimPy (It Takes 10 Seconds)

    The installation process for SimPy is not exactly complicated. Open a terminal. Run one command. Done.

    2 min

  22. What Is SimPy? A No-Nonsense Introduction

    SimPy is the process-based discrete-event simulation library for Python. What it is, why it exists, what makes it different and whether you need it.

    2 min

  23. What Is Discrete Event Simulation? (And Why Should You Care?)

    Discrete event simulation sounds academic. It's not. It's one of the most practical tools an engineer can learn.

    3 min

July 2025 3 articles

  1. How Good Is Gemini CLI vs Claude Code at Writing SimPy Simulations?

    Gemini CLI and Claude Code (Opus) take on the same SimPy benchmark. Which writes the more concise, accurate simulation? The result surprised me.

    2 min

  2. The Dawn of Vibe Modelling: Claude Opus Nails Simulation Benchmark

    Claude 4 Opus takes on a hydrogen production simulation benchmark and returns clean code and a near-perfect answer. Is this the dawn of vibe modelling?

    2 min

  3. How do you know your simulation's settings represent the future?

    How can you be sure your simulation's settings reflect the future? Build credible models with validation, sensitivity analysis and stakeholder input.

    4 min

June 2025 3 articles

  1. Can you give some real world examples of discrete-event simulation?

    Real-world examples of discrete-event simulation: a $50M machine purchase avoided, hospital waits cut by 30% and supply chains made leaner.

    4 min

  2. SimPy and Salabim: A Tale of Two Simulations

    Compare Python's SimPy and salabim simulation libraries. We build an assembly line model in both to see how they tackle the same problem, side-by-side.

    11 min

  3. What Exactly Does SimPy Do That I Can't Do Without It?

    Discover why SimPy is essential for discrete-event simulation in Python, even if you're proficient in coding. Learn about SimPy's core mechanisms.

    4 min

May 2025 2 articles

  1. Can You Get Very Close to Reality with Predictions from Models?

    How close can a model's predictions get to reality? Closer than you might think, with sound assumptions, good data, honest validation and the right question.

    5 min

  2. What's the relationship between simulation and optimisation?

    Simulation shows how a system behaves; optimisation searches for the best way to run it. How the two work together, with simulation feeding the search.

    4 min

January 2025 1 article

  1. Breathing Life into Logic: A Guide to Visualising SimPy Simulations

    Turn SimPy simulations from abstract logic into compelling visual stories, with static plots, animations and professional visualisation techniques.

    4 min