simpy

Build process-based discrete-event simulations in Python with SimPy.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/littlt-momo-c-yfc/skills --skill simpy-littlt-momo-c-yfc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: simpy
Source: https://github.com/littlt-momo-c-yfc/skills/tree/main/skills/scientific-toolkit-skill/references/scientific-skills/simpy
Command: npx skills add https://github.com/littlt-momo-c-yfc/skills --skill simpy-littlt-momo-c-yfc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires simpy, and includes scripts (resource) and references (resource) components.

What problem does it solve? Modeling systems where entities compete for shared resources over time—such as queues, servers, and production lines—is difficult to do analytically. This Skill provides structured guidance, templates, and monitoring utilities for building discrete-event simulations with SimPy. ## Core Features & Use Cases - Process and Resource Modeling: Define generator-based processes and shared resources including Resource, PriorityResource, PreemptiveResource, Container, Store, FilterStore, and PriorityStore. - Event Synchronization: Coordinate processes with timeouts, custom events, AllOf/AnyOf composites, interrupts, and barrier patterns. - Monitoring and Statistics: Use the included resource_monitor.py and basic_simulation_template.py scripts to track queue lengths, utilization, and wait times, then export results to CSV. - Real-Time Simulation: Synchronize simulations with wall-clock time using RealtimeEnvironment for hardware-in-the-loop or interactive demos. - Use Case: Simulate an emergency room to determine how many nurses are needed to keep average patient wait time under 15 minutes. ## Quick Start Ask the AI to build a SimPy simulation of a customer service queue with two servers and report average wait times and utilization.

Frequently Asked Questions about simpy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a discrete-event simulation in Python?

Use SimPy to define processes as Python generator functions that yield events such as env.timeout(). Create an Environment, register processes with env.process(), and run with env.run(until=time) to execute the simulation.

What is the difference between SimPy Resource, Container, and Store?

Resource models limited-capacity servers like machines, Container holds homogeneous bulk amounts like fuel with put and get by quantity, and Store queues discrete Python objects with FIFO, priority, or filtered retrieval variants.

How do I make one SimPy process wait for another to finish?

Processes are themselves events, so yield the process object returned by env.process() to wait for its completion. Combine multiple processes with the & operator for all-of or | for any-of semantics.

Can SimPy run simulations in real time?

Yes, simpy.rt.RealtimeEnvironment synchronizes simulation time with wall-clock time using a factor parameter, where factor=1.0 maps one simulation unit to one second. Use strict=False to tolerate computations that exceed the time budget.

Why does my SimPy process never resume after yielding?

Common causes include forgetting to yield an event, reusing an already-triggered event since events fire only once, or deadlocks where no process can acquire a resource. Ensure every pause yields a fresh event and resources are released.

When should I not use SimPy for simulation?

Avoid SimPy for continuous-time systems requiring fixed-step integration, where SciPy ODE solvers fit better, and for pure mathematical optimization, where SciPy optimize is appropriate. SimPy targets discrete events with resource contention.