The libraryFree book

The SimPy Handbook

A practical guide to discrete-event simulation in Python: the patterns behind queues, factories and service desks, explained in plain English beside code you can run tonight. Free, in exchange for nothing grander than an email address.

Cover of Simulation in Python with SimPy by Harry Munro
fig. 1 · the cover, paperback edition
Simulation in Python with SimPy: Discover how to make practical simulations in Python
Harry Munro, CEng MIMechE
PDF eBook with runnable companion code
2,000+ engineers and analysts
New chapters and examples, sent to readers at no charge
Paperback, via Amazon
One email address

01 The problem

Written for the gap the tutorials leave

Teaching yourself SimPy from the public internet is a curious experience. The documentation tells you precisely what every class does and almost nothing about what to build with it; the tutorials escort you politely as far as a car wash and then wave you off; the forum threads have a habit of ending one reply before the answer. None of it is wrong. It is simply not a method.

This handbook is the missing middle. It collects the patterns a working simulationist actually reaches for, queues that misbehave, resources that fail, processes that interrupt one another, and sets each beside code you can run as written, adapt to your own system and put to work the same afternoon. More than a decade of professional modelling, reduced to the parts you will use.

02 The contents

Five threads, each ending in code

The handbook is short on theory and long on patterns. These are the five it teaches.

  1. The fundamentals

    Environments, processes, events and resources: the small vocabulary from which every discrete-event model is built.

  2. Real systems

    Queues, production lines and service desks, modelled as they actually behave; arrival by arrival, breakdown by breakdown.

  3. Code that lasts

    Structure that keeps a model clean, maintainable and fit for production, rather than trapped forever in a notebook.

  4. What-if experiments

    Questions answered in simulation before they cost anything in reality; which is, after all, the entire point of the exercise.

  5. Debugging and validation

    The practitioner habits for finding out whether a model deserves the trust you are about to place in it.

03 The notices

What readers say

Harry consistently impressed me with his mastery of both the technical side of simulation modelling and coding as well as the nuanced aspects of simulation project management. He possesses a rare combination of modelling expertise and a keen understanding of how to translate complex business needs into effective simulation models. His leadership, focus on results and exceptional communication skills make him an ideal person to learn from.

Rory Greig Research Engineer at Google DeepMind

Harry is the ultimate professional when it comes to simulation. I had the privilege of working alongside him at Anglo American, where he led the creation of a cutting-edge simulation product from scratch. Harry's ability to bridge simulation, software and systems engineering while keeping everything practical and results-focused is unmatched. If you're considering learning simulation from Harry, you couldn't be in better hands.

Chris Samiullah Technical Programme Manager at Pydantic

Harry's expertise spans the entire simulation lifecycle; from engaging with stakeholders to gather clear requirements, to modelling, designing and developing SimPy simulations, as well as analysis and communication of results. If you wish to master every aspect of applying simulation to improve business decisions, then Harry is an expert guide.

Dr Peter Malkin Principal Operations Researcher at CloudNC

Working with Harry was an incredible learning experience. His technical mastery of simulation is impressive, but what really sets him apart is his ability to align simulation projects with real-world business challenges. He's also a brilliant teacher; patient, enthusiastic and genuinely invested in helping others succeed.

Dr Alastair Heggie Senior Modelling and Simulation Engineer

04 The author

About Harry Munro

Harry Munro, Chartered Engineer and simulation specialist

Harry Munro is a Chartered Engineer and simulation specialist with more than a decade of professional practice across transport, mining, defence and energy. The handbook collects the patterns he uses on real projects; the courses on this site teach the rest of the craft.

More about Harry and the school →

05 The signup

Where shall we send it?

The book and the code are free, and they remain yours whether or not you stay on the list.

Your details are handled as described in the privacy policy. Prefer a bound copy? The paperback is on Amazon. And when you are ready for more than a book, the Simulation Bootcamp is the next step.