The notebookModel 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.

  1. SimPy Performance Optimization: Making Simulations Faster

    Your simulation works. But it's slow. Here's how to fix that.

    Read
  2. SimPy Deadlock Explained: Why Your Simulation Hangs

    Your simulation starts. Then stops. No error. No output. Just... nothing.

    Read
  3. SimPy Process Not Running: Why Nothing Happens

    You wrote the code. You ran the simulation. Nothing happened.

    Read
  4. Debugging SimPy: Finding What's Wrong

    Something's broken. You need to find it. Here's how.

    Read
  5. Common SimPy Errors and How to Fix Them

    Every SimPy error message has a story. Here are the ones you'll meet.

    Read
  6. Optimisation with SimPy: Finding the Best Configuration

    Simulation tells you what happens. Optimisation tells you what's best.

    Read
  7. Animation in SimPy: Making Simulations Come Alive

    Static charts tell a story. Animation tells it better. Watch your simulation unfold in real time.

    Read
  8. 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.

    Read
  9. SimPy with matplotlib: Visualising Simulation Results

    Numbers tell the story. Visualisations make people believe it.

    Read
  10. SimPy with pandas: Powerful Data Analysis for Simulation Results

    SimPy generates data. pandas makes sense of it. Together, they're unstoppable.

    Read
  11. 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.

    Read
  12. Warehouse Simulation with SimPy: From Receiving to Shipping

    Warehouses are logistics engines. Goods flow in, get stored, get picked, and flow out. Simulation reveals the bottlenecks between receive and ship.

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

    Airports are complex systems under constant pressure. Passengers flow through multiple touchpoints. Delays cascade. Simulation helps you see where things go...

    Read
  14. 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?

    Read
  15. 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.

    Read
  16. Supply Chain Simulation with SimPy: From Supplier to Customer

    Supply chains are networks of queues, buffers, and delays. Orders flow one way. Goods flow the other. Simulation reveals where they get stuck.

    Read
  17. Bank Queue Simulation with SimPy: The Classic Example

    The bank queue is the "Hello World" of simulation. It's simple enough to understand, complex enough to be interesting, and applicable to dozens of other...

    Read
  18. 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.

    Read
  19. 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.

    Read
  20. Manufacturing Simulation with SimPy: Modelling the Factory Floor

    Manufacturing is where simulation proves its worth. Every minute of downtime costs money. Every bottleneck limits output. SimPy helps you find them before they...

    Read
  21. 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.

    Read
  22. 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.

    Read
  23. 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.

    Read
  24. 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.

    Read
  25. Logging in SimPy: Debugging and Tracing Your Simulations

    Print statements are fine for tiny simulations. Real simulations need proper logging.

    Read
  26. Visualising SimPy Results: Making Data Speak

    Numbers tell the story. Visualisations make people listen.

    Read
  27. 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.

    Read
  28. 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.

    Read
  29. Running Multiple Replications in SimPy: Statistical Confidence

    One simulation run proves nothing. Run it again—different results. Which is right? Both. Neither. You need replications.

    Read
  30. Collecting Statistics in SimPy: Measuring What Matters

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

    Read
  31. 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.

    Read
  32. Service Time Distributions in SimPy: Choosing the Right Randomness

    Service times—how long things take—are rarely fixed. Choosing the right distribution makes your simulation realistic or useless.

    Read
  33. 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.

    Read
  34. Modelling Servers in SimPy: From Single to Multiple

    Servers are the workhorses of simulation. Tills, machines, staff, computers—anything that processes entities and takes time.

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

    Queues are the bread and butter of discrete event simulation. Customers waiting. Jobs pending. Packets buffering. If you can model a queue, you can model...

    Read
  36. SimPy FilterStore Explained: Getting Exactly What You Need

    Store gives you the next item. FilterStore lets you be picky.

    Read
  37. SimPy Store Explained: Managing Distinct Objects

    Resources count slots. Containers track levels. Stores hold distinct items.

    Read
  38. SimPy Container Explained: Modelling Levels and Quantities

    Not everything is about counting slots. Sometimes you need to model levels—fuel in a tank, items in a buffer, water in a reservoir. That's what Container is...

    Read
  39. SimPy PreemptiveResource Explained: Interrupting for Priority

    PreemptiveResource is the aggressive sibling of PriorityResource. It doesn't just jump the queue—it kicks out whoever's currently using the resource.

    Read
  40. 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.

    Read
  41. SimPy Resource Explained: Modelling Limited Capacity

    Resources are where the interesting stuff happens. Queues form. Waiting occurs. Bottlenecks emerge.

    Read
  42. Python Generators Explained for SimPy Users

    SimPy is built on Python generators. If generators feel mysterious, SimPy will too. Let's fix that.

    Read
  43. The Yield Keyword in SimPy: Why It Matters

    If you've looked at any SimPy code, you've seen yield everywhere. It's not decoration—it's the mechanism that makes simulation work.

    Read
  44. SimPy Timeout Explained: Modelling Time Delays

    The timeout is the most frequently used event in SimPy. It's how you say "wait for X time units."

    Read
  45. SimPy Events Explained: How Things Happen in Simulation

    Events are the heartbeat of SimPy. Every time something happens—a timeout expires, a resource becomes available, a process completes—that's an event.

    Read
  46. SimPy Processes Explained: The Building Blocks of Simulation

    If the environment is the heart of SimPy, processes are the muscles. They do the actual work.

    Read
  47. SimPy Environment Explained: The Heart of Every Simulation

    The SimPy Environment is the least glamorous and most important part of every simulation. It's the clock, the scheduler, and the coordinator all in one.

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

    AnyLogic is the Swiss Army knife of simulation—it does agent-based, system dynamics, and discrete-event simulation in one package. SimPy does discrete-event...

    Read
  49. SimPy vs Arena: An Honest Comparison

    Arena is the Microsoft Office of simulation software—ubiquitous, expensive, and often used because it's what everyone else uses. SimPy is the open-source...

    Read
  50. When Should You Actually Use Simulation?

    Simulation is powerful. But it's not always the right tool.

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

    You don't need a week to learn SimPy. You need ten minutes and this guide.

    Read
  52. Your First SimPy Simulation (Hello World for Discrete Event Simulation)

    Every programming journey starts with "Hello World." Simulation is no different—except instead of printing text, we're modelling events over time.

    Read
  53. How to Install SimPy (It Takes 10 Seconds)

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

    Read
  54. What Is SimPy? A No-Nonsense Introduction

    If you've ever Googled "discrete event simulation Python," you've probably stumbled across SimPy. But what actually is it? And more importantly, should you...

    Read
  55. 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.

    Read
  56. How Good is Gemini CLI vs Claude Code at Writing Simulations in Python with SimPy?

    A head-to-head comparison of Gemini CLI and Claude Code (Opus) for writing SimPy simulations. Discover which AI tool comes out on top for conciseness, accuracy, and intelligence.

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

    Explore the new era of 'vibe modelling' as Claude 4 Opus excels in a complex simulation benchmark, delivering clean code and near-perfect results. Is this the future of simulation?

    Read
  58. How do you know the settings you use in your simulation are representative of the future real world?

    How can you be sure your simulation's settings reflect the future? Learn to build credible models through validation, sensitivity analysis and stakeholder engagement.

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

    Discover real-world examples of discrete-event simulation. See how it saved one firm $50M, cut hospital wait times by 30%, and optimized supply chains.

    Read
  60. 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.

    Read
  61. 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.

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

    Explore how close predictive models can get to reality. Understand the factors influencing model accuracy and their role in decision-making and systems thinking.

    Read
  63. What's the relationship between simulation and optimisation?

    Explore the distinct roles and synergistic relationship between simulation and optimisation. Learn how simulation models provide data to guide optimisation efforts.

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

    Transform your SimPy simulations from abstract logic into compelling visual stories. Learn static plots, animations, and professional visualisation techniques.

    Read