simpy
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.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
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
SafeStatic 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.
Risk Factors
⚙️ External commands (6)
🌐 Network access (3)
📁 Filesystem access (2)
Quality Score
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
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.
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.
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.
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