본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트33k · #9030

simpy

하는 일

이 스킬은 에이전트에게 Python 프레임워크 SimPy로 이산 사건 시뮬레이션을 만드는 방법을 가르칩니다. 자원을 두고 경쟁하는 개체를 모델링합니다. 공정이나 생산 능력을 계획하는 분석가와 엔지니어를 위한 스킬입니다.

사용하는 경우

  • ✓제한된 직원을 기다리는 고객 대기열을 모델링하고 싶을 때.
  • ✓기계를 더 많이 또는 더 적게 두었을 때 공장 라인이 어떻게 움직일지 시험해야 할 때.
  • ✓물류나 네트워크 시스템의 생산 능력을 계획할 때.

스킬 링크

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/simpy/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/simpy/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“직원 3명이 있는 진료소에 환자가 무작위로 도착하는 상황을 시뮬레이션하고, 평균 대기 시간을 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 프로세스를 Python 제너레이터 함수로 쓰고, 공유 자원을 설정하며, 시뮬레이션 시계를 실행합니다. 그다음 시간 데이터를 모아 결과를 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

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

import simpy

def customer(env, name, resource):
    """Customer requests resource, uses it, then releases."""
    with resource.request() as req:
        yield req  # Wait for resource
        print(f'{name} got resource at {env.now}')
        yield env.timeout(3)  # Use resource
        print(f'{name} released resource at {env.now}')

env = simpy.Environment()
server = simpy.Resource(env, capacity=1)

env.process(customer(env, 'Customer 1', server))
env.process(customer(env, 'Customer 2', server))
env.run()

Core Concepts

1. Environment

The simulation environment manages time and schedules events.

import simpy

# Standard environment (runs as fast as possible)
env = simpy.Environment(initial_time=0)

# Real-time environment (synchronized with wall-clock)
import simpy.rt
env_rt = simpy.rt.RealtimeEnvironment(factor=1.0)

# Run simulation
env.run(until=100)  # Run until time 100
env.run()  # Run until no events remain

2. Processes

Processes are defined using Python generator functions (functions with yield statements).

def my_process(env, param1, param2):
    """Process that yields events to pause execution."""
    print(f'Starting at {env.now}')

    # Wait for time to pass
    yield env.timeout(5)

    print(f'Resumed at {env.now}')

    # Wait for another event
    yield env.timeout(3)

    print(f'Done at {env.now}')
    return 'result'

# Start the process
env.process(my_process(env, 'value1', 'value2'))

3. Events

Events are the fundamental mechanism for process synchronization. Processes yield events and resume when those events are triggered.

Common event types:

  • env.timeout(delay) - Wait for time to pass
  • resource.request() - Request a resource
  • env.event() - Create a custom event
  • env.process(func()) - Process as an event
  • event1 & event2 - Wait for all events (AllOf)
  • event1 | event2 - Wait for any event (AnyOf)

Resources

SimPy provides several resource types for different scenarios. For comprehensive details, see references/resources.md.

Resource Types Summary

Resource Type Use Case
Resource Limited capacity (servers, machines)
PriorityResource Priority-based queuing
PreemptiveResource High-priority can interrupt low-priority
Container Bulk materials (fuel, water)
Store Python object storage (FIFO)
FilterStore Selective item retrieval
PriorityStore Priority-ordered items

Quick Reference

import simpy

env = simpy.En
자주 묻는 질문

이산 사건 시뮬레이션이란 무엇인가요?

도착이나 완료처럼 특정 시점에 사건이 일어나는 모델로, 연속적으로 변하는 모델과 다릅니다.

실시간으로 실행할 수 있나요?

네. 스킬은 시계와 동기화된 실시간 시뮬레이션을 언급합니다.

생산 능력 계획에 좋나요?

네. 스킬은 적절한 자원 수준을 찾기 위해 시뮬레이션을 쓰는 것을 언급합니다.

상세 정보

작성자의 원본 설명

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.

repo: davila7/claude-code-templates

인기도

GitHub 스타
33k
순위
#9030
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬