Skills simpy
🔬

simpy

Safe ⚙️ External commands🌐 Network access📁 Filesystem access

Build Discrete-Event Simulations with SimPy

Also available from: davila7

SimPy enables you to model complex systems with processes, queues, and shared resources. Simulate manufacturing lines, service operations, network traffic, and logistics to optimize performance before implementation.

Supports: Claude Codex Code(CC)
🥈 77 Silver
1

Download the skill ZIP

2

Upload in Claude

Go to Settings → Capabilities → Skills → Upload skill

3

Toggle on and start using

Test it

Using "simpy". Create a SimPy simulation of customers arriving at a bank with 2 tellers. Customers arrive every 3-5 minutes and service takes 5-8 minutes. Run for 8 hours and show average wait time.

Expected outcome:

  • Simulation Results: 8-hour bank operation
  • Total customers served: 147
  • Average wait time: 4.2 minutes
  • Maximum wait time: 18.7 minutes
  • Teller utilization: 87%
  • Queue length peaked at 12 customers around hour 6

Using "simpy". Build a SimPy model of a 3-stage manufacturing line where parts go through cutting (10 min), assembly (15 min), and inspection (5 min). Each stage has 1 machine. Analyze throughput.

Expected outcome:

  • Manufacturing Line Analysis Results:
  • Parts completed: 23 over 8-hour shift
  • Stage utilization: Cutting 96%, Assembly 72%, Inspection 36%
  • Bottleneck identified: Cutting station
  • Average cycle time per part: 32 minutes
  • Suggestion: Add second cutting machine to increase throughput by 35%

Using "simpy". Model a cloud data center with 10 servers handling 3 types of jobs.

Expected outcome:

  • Resource Allocation Results:
  • Short jobs: 450 completed, avg wait 0.3 min, utilization 45%
  • Medium jobs: 180 completed, avg wait 2.1 min, utilization 78%
  • Long jobs: 45 completed, avg wait 8.4 min, utilization 92%
  • Optimal allocation: 3 servers short, 4 medium, 3 long jobs
  • Current over-provisioning: 2 servers

Security Audit

Safe
v4 • 1/17/2026

Static analysis flagged 260 potential security issues, but evaluation confirms all are false positives. The 'external_commands' findings are markdown backticks used for code formatting, not shell execution. The 'weak cryptographic algorithm' flags refer to random.seed() for simulation reproducibility. No actual security risks exist in this legitimate SimPy discrete-event simulation skill.

9
Files scanned
3,202
Lines analyzed
3
findings
4
Total audits
Audited by: claude View Audit History →

Quality Score

68
Architecture
100
Maintainability
87
Content
20
Community
100
Security
91
Spec Compliance

What You Can Build

Optimize Manufacturing Lines

Model production workflows to identify bottlenecks, balance capacity, and minimize cycle times.

Simulate Network Traffic

Analyze packet routing, bandwidth allocation, and latency under various load conditions.

Design Queue Systems

Simulate customer flow in banks, hospitals, or retail to determine optimal staffing levels.

Try These Prompts

Basic Queue Simulation
Create a SimPy simulation of customers arriving at a bank with 2 tellers. Customers arrive every 3-5 minutes and service takes 5-8 minutes. Run for 8 hours and show average wait time.
Manufacturing Line
Build a SimPy model of a 3-stage manufacturing line where parts go through cutting (10 min), assembly (15 min), and inspection (5 min). Each stage has 1 machine. Analyze throughput.
Network Packet Simulation
Simulate packets arriving at a router with 100 Mbps bandwidth. Packets are 1-5 KB and arrive at 50 packets per second. Show queue length and packet loss under peak load.
Resource Optimization
Model a cloud data center with 10 servers handling 3 types of jobs: short (1-5 min), medium (10-20 min), long (30-60 min). Jobs arrive randomly. Find optimal server allocation per job type.

Best Practices

  • Always use context managers (with statement) when requesting resources to ensure proper cleanup and prevent deadlocks
  • Set random.seed() for reproducible results when comparing different simulation scenarios
  • Monitor and collect data throughout the simulation, not just at the end, to capture transient behavior

Avoid

  • Forgetting yield statements in process functions will cause processes to run instantly without proper timing
  • Reusing events that have already been triggered will cause simulation errors or unexpected behavior
  • Using blocking Python operations like time.sleep() instead of env.timeout() breaks the simulation timing model

Frequently Asked Questions

What is the difference between Environment and RealtimeEnvironment?
Environment runs simulations as fast as possible, while RealtimeEnvironment synchronizes simulation time with wall-clock time for real-time or hardware-in-the-loop applications.
How do I choose the right resource type for my simulation?
Use Resource for basic capacity limits, PriorityResource for priority queuing, Container for bulk materials like fuel or water, and Store for object storage with FIFO or filtering.
Can I interrupt a running process in SimPy?
Yes, use process.interrupt() to forcefully resume a paused process. This is useful for modeling preemption, timeouts, or external cancellation events.
How do I collect custom statistics during a simulation?
Use the ResourceMonitor class from the provided scripts or create custom monitors by patching resource methods and tracking events during simulation execution.
What is the best way to model parallel processes that need synchronization?
Start multiple processes with env.process() and use the yield operator with & operator to wait for all processes to complete, or | for any process completion.
How can I export simulation results for external analysis?
Use the export_csv() method in ResourceMonitor to save collected data, or write custom export functions using the data dictionaries tracked during simulation.