# Simpy

Process-based discrete-event simulation framework in Python.

- Repository: https://github.com/zLanqing/codex-claude-academic-skills (5550 stars)
- Category: Engineering
- License: MIT license
- Last updated: 2026-05-14
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add zLanqing/codex-claude-academic-skills --skill simpy -g -a claude-code -y`
Codex: `npx skills add zLanqing/codex-claude-academic-skills --skill simpy -g -a codex -y`
Cursor: `npx skills add zLanqing/codex-claude-academic-skills --skill simpy -g -a cursor -y`
Gemini CLI: `npx skills add zLanqing/codex-claude-academic-skills --skill simpy -g -a gemini-cli -y`

## Description

Process-based discrete-event simulation framework in Python. Use this skill when building simulations of systems with processes, queues, resources, and time-based events such as manufacturing systems, service operations, network traffic, logistics, or any system where entities interact with shared resources over time.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# SimPy - Discrete-Event Simulation

## Overview

SimPy is a process-based discrete-event simulation framework based on standard Python. Use SimPy to model systems where entities (customers, vehicles, packets, etc.) interact with each other and compete for shared resources (servers, machines, bandwidth, etc.) over time.

**Core capabilities:**
- Process modeling using Python generator functions
- Shared resource management (servers, containers, stores)
- Event-driven scheduling and synchronization
- Real-time simulations synchronized with wall-clock time
- Comprehensive monitoring and data collection

## When to Use This Skill

Use the SimPy skill when:

1. **Modeling discrete-event systems** - Systems where events occur at irregular intervals
2. **Resource contention** - Entities compete for limited resources (servers, machines, staff)
3. **Queue analysis** - Studying waiting lines, service times, and throughput
4. **Process optimization** - Analyzing manufacturing, logistics, or service processes
5. **Network simulation** - Packet routing, bandwidth allocation, latency analysis
6. **Capacity planning** - Determining optimal resource levels for desired performance
7. **System validation** - Testing system behavior before implementation

**Not suitable for:**
- Continuous simulations with fixed time steps (consider SciPy ODE solvers)
- Independent processes without resource sharing
- Pure mathematical optimization (consider SciPy optimize)

## Quick Start

### Basic Simulation Structure

```python
import simpy

def process(env, name):
    """A simple process that waits and prints."""
    print(f'{name} starting at {env.now}')
    yield env.timeout(5)
    print(f'{name} finishing at {env.now}')

# Create environment
env = simpy.Environment()

# Start processes
env.process(process(env, 'Process 1'))
env.process(process(env, 'Process 2'))

# Run simulation
env.run(until=10)
```

### Resource Usage Pattern

```python
import simpy

The rest: https://github.com/zLanqing/codex-claude-academic-skills/blob/HEAD/scientific-toolkit-skill/references/scientific-skills/simpy/SKILL.md
