[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EZWZX8G2B7RJGD4B8DKY1J":3,"skill-same:01M6EZWZX8G2B7RJGD4B8DKY1J":105},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":14,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M6EZWZX8G2B7RJGD4B8DKY1J","simpy",null,"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.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"shared","with","event","processes","manufacturing","resources","events","as","systems","service","python","time","use","process","operations","system","simulation","network","framework","2026-11-10 10:12:30",false,"---\nname: simpy\ndescription: 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.\nlicense: MIT license\nmetadata:\n    skill-author: K-Dense Inc.\n---\n\n# SimPy - Discrete-Event Simulation\n\n## Overview\n\nSimPy 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.\n\n**Core capabilities:**\n- Process modeling using Python generator functions\n- Shared resource management (servers, containers, stores)\n- Event-driven scheduling and synchronization\n- Real-time simulations synchronized with wall-clock time\n- Comprehensive monitoring and data collection\n\n## When to Use This Skill\n\nUse the SimPy skill when:\n\n1. **Modeling discrete-event systems** - Systems where events occur at irregular intervals\n2. **Resource contention** - Entities compete for limited resources (servers, machines, staff)\n3. **Queue analysis** - Studying waiting lines, service times, and throughput\n4. **Process optimization** - Analyzing manufacturing, logistics, or service processes\n5. **Network simulation** - Packet routing, bandwidth allocation, latency analysis\n6. **Capacity planning** - Determining optimal resource levels for desired performance\n7. **System validation** - Testing system behavior before implementation\n\n**Not suitable for:**\n- Continuous simulations with fixed time steps (consider SciPy ODE solvers)\n- Independent processes without resource sharing\n- Pure mathematical optimization (consider SciPy optimize)\n\n## Quick Start\n\n### Basic Simulation Structure\n\n```python\nimport simpy\n\ndef process(env, name):\n    \"\"\"A simple process that waits and prints.\"\"\"\n    print(f'{name} starting at {env.now}')\n    yield env.timeout(5)\n    print(f'{name} finishing at {env.now}')\n\n# Create environment\nenv = simpy.Environment()\n\n# Start processes\nenv.process(process(env, 'Process 1'))\nenv.process(process(env, 'Process 2'))\n\n# Run simulation\nenv.run(until=10)\n```\n\n### Resource Usage Pattern\n\n```python\nimport simpy\n\ndef customer(env, name, resource):\n    \"\"\"Customer requests resource, uses it, then releases.\"\"\"\n    with resource.request() as req:\n        yield req  # Wait for resource\n        print(f'{name} got resource at {env.now}')\n        yield env.timeout(3)  # Use resource\n        print(f'{name} released resource at {env.now}')\n\nenv = simpy.Environment()\nserver = simpy.Resource(env, capacity=1)\n\nenv.process(customer(env, 'Customer 1', server))\nenv.process(customer(env, 'Customer 2', server))\nenv.run()\n```\n\n## Core Concepts\n\n### 1. Environment\n\nThe simulation environment manages time and schedules events.\n\n```python\nimport simpy\n\n# Standard environment (runs as fast as possible)\nenv = simpy.Environment(initial_time=0)\n\n# Real-time environment (synchronized with wall-clock)\nimport simpy.rt\nenv_rt = simpy.rt.RealtimeEnvironment(factor=1.0)\n\n# Run simulation\nenv.run(until=100)  # Run until time 100\nenv.run()  # Run until no events remain\n```\n\n### 2. Processes\n\nProcesses are defined using Python generator functions (functions with `yield` statements).\n\n```python\ndef my_process(env, param1, param2):\n    \"\"\"Process that yields events to pause execution.\"\"\"\n    print(f'Starting at {env.now}')\n\n    # Wait for time to pass\n    yield env.timeout(5)\n\n    print(f'Resumed at {env.now}')\n\n    # Wait for another event\n    yield env.timeout(3)\n\n    print(f'Done at {env.now}')\n    return 'result'\n\n# Start the process\nenv.process(my_process(env, 'value1', 'value2'))\n```\n\n### 3. Events\n\nEvents are the fundamental mechanism for process synchronization. Processes yield events and resume when those events are triggered.\n\n**Common event types:**\n- `env.timeout(delay)` - Wait for time to pass\n- `resource.request()` - Request a resource\n- `env.event()` - Create a custom event\n- `env.process(func())` - Process as an event\n- `event1 & event2` - Wait for all events (AllOf)\n- `event1 | event2` - Wait for any event (AnyOf)\n\n## Resources\n\nSimPy provides several resource types for different scenarios. For comprehensive details, see `references\u002Fresources.md`.\n\n### Resource Types Summary\n\n| Resource Type | Use Case |\n|---------------|----------|\n| Resource | Limited capacity (servers, machines) |\n| PriorityResource | Priority-based queuing |\n| PreemptiveResource | High-priority can interrupt low-priority |\n| Container | Bulk materials (fuel, water) |\n| Store | Python object storage (FIFO) |\n| FilterStore | Selective item retrieval |\n| PriorityStore | Priority-ordered items |\n\n### Quick Reference\n\n```python\nimport simpy\n\nenv = simpy.Environment()\n\n# Basic resource (e.g., servers)\nresource = simpy.Resource(env, capacity=2)\n\n# Priority resource\npriority_resource = simpy.PriorityResource(env, capacity=1)\n\n# Container (e.g., fuel tank)\nfuel_tank = simpy.Container(env, capacity=100, init=50)\n\n# Store (e.g., warehouse)\nwarehouse = simpy.Store(env, capacity=10)\n```\n\n## Common Simulation Patterns\n\n### Pattern 1: Customer-Server Queue\n\n```python\nimport simpy\nimport random\n\ndef customer(env, name, server):\n    arrival = env.now\n    with server.request() as req:\n        yield req\n        wait = env.now - arrival\n        print(f'{name} waited {wait:.2f}, served at {env.now}')\n        yield env.timeout(random.uniform(2, 4))\n\ndef customer_generator(env, server):\n    i = 0\n    while True:\n        yield env.timeout(random.uniform(1, 3))\n        i += 1\n        env.process(customer(env, f'Customer {i}', server))\n\nenv = simpy.Environment()\nserver = simpy.Resource(env, capacity=2)\nenv.process(customer_generator(env, server))\nenv.run(until=20)\n```\n\n### Pattern 2: Producer-Consumer\n\n```python\nimport simpy\n\ndef producer(env, store):\n    item_id = 0\n    while True:\n        yield env.timeout(2)\n        item = f'Item {item_id}'\n        yield store.put(item)\n        print(f'Produced {item} at {env.now}')\n        item_id += 1\n\ndef consumer(env, store):\n    while True:\n        item = yield store.get()\n        print(f'Consumed {item} at {env.now}')\n        yield env.timeout(3)\n\nenv = simpy.Environment()\nstore = simpy.Store(env, capacity=10)\nenv.process(producer(env, store))\nenv.process(consumer(env, store))\nenv.run(until=20)\n```\n\n### Pattern 3: Parallel Task Execution\n\n```python\nimport simpy\n\ndef task(env, name, duration):\n    print(f'{name} starting at {env.now}')\n    yield env.timeout(duration)\n    print(f'{name} done at {env.now}')\n    return f'{name} result'\n\ndef coordinator(env):\n    # Start tasks in parallel\n    task1 = env.process(task(env, 'Task 1', 5))\n    task2 = env.process(task(env, 'Task 2', 3))\n    task3 = env.process(task(env, 'Task 3', 4))\n\n    # Wait for all to complete\n    results = yield task1 & task2 & task3\n    print(f'All done at {env.now}')\n\nenv = simpy.Environment()\nenv.process(coordinator(env))\nenv.run()\n```\n\n## Workflow Guide\n\n### Step 1: Define the System\n\nIdentify:\n- **Entities**: What moves through the system? (customers, parts, packets)\n- **Resources**: What are the constraints? (servers, machines, bandwidth)\n- **Processes**: What are the activities? (arrival, service, departure)\n- **Metrics**: What to measure? (wait times, utilization, throughput)\n\n### Step 2: Implement Process Functions\n\nCreate generator functions for each process type:\n\n```python\ndef entity_process(env, name, resources, parameters):\n    # Arrival logic\n    arrival_time = env.now\n\n    # Request resources\n    with resource.request() as req:\n        yield req\n\n        # Service logic\n        service_time = calculate_service_time(parameters)\n        yield env.timeout(service_time)\n\n    # Departure logic\n    collect_statistics(env.now - arrival_time)\n```\n\n### Step 3: Set Up Monitoring\n\nUse monitoring utilities to collect data. See `references\u002Fmonitoring.md` for comprehensive techniques.\n\n```python\nfrom scripts.resource_monitor import ResourceMonitor\n\n# Create and monitor resource\nresource = simpy.Resource(env, capacity=2)\nmonitor = ResourceMonitor(env, resource, \"Server\")\n\n# After simulation\nmonitor.report()\n```\n\n### Step 4: Run and Analyze\n\n```python\n# Run simulation\nenv.run(until=simulation_time)\n\n# Generate reports\nmonitor.report()\nstats.report()\n\n# Export data for further analysis\nmonitor.export_csv('results.csv')\n```\n\n## Advanced Features\n\n### Process Interaction\n\nProcesses can interact through events, process yields, and interrupts. See `references\u002Fprocess-interaction.md` for detailed patterns.\n\n**Key mechanisms:**\n- **Event signaling**: Shared events for coordination\n- **Process yields**: Wait for other processes to complete\n- **Interrupts**: Forcefully resume processes for preemption\n\n### Real-Time Simulations\n\nSynchronize simulation with wall-clock time for hardware-in-the-loop or interactive applications. See `references\u002Freal-time.md`.\n\n```python\nimport simpy.rt\n\nenv = simpy.rt.RealtimeEnvironment(factor=1.0)  # 1:1 time mapping\n# factor=0.5 means 1 sim unit = 0.5 seconds (2x faster)\n```\n\n### Comprehensive Monitoring\n\nMonitor processes, resources, and events. See `references\u002Fmonitoring.md` for techniques including:\n- State variable tracking\n- Resource monkey-patching\n- Event tracing\n- Statistical collection\n\n## Scripts and Templates\n\n### basic_simulation_template.py\n\nComplete template for building queue simulations with:\n- Configurable parameters\n- Statistics collection\n- Customer generation\n- Resource usage\n- Report generation\n\n**Usage:**\n```python\nfrom scripts.basic_simulation_template import SimulationConfig, run_simulation\n\nconfig = SimulationConfig()\nconfig.num_resources = 2\nconfig.sim_time = 100\nstats = run_simulation(config)\nstats.report()\n```\n\n### resource_monitor.py\n\nReusable monitoring utilities:\n- `ResourceMonitor` - Track single resource\n- `MultiResourceMonitor` - Monitor multiple resources\n- `ContainerMonitor` - Track container levels\n- Automatic statistics calculation\n- CSV export functionality\n\n**Usage:**\n```python\nfrom scripts.resource_monitor import ResourceMonitor\n\nmonitor = ResourceMonitor(env, resource, \"My Resource\")\n# ... run simulation ...\nmonitor.report()\nmonitor.export_csv('data.csv')\n```\n\n## Reference Documentation\n\nDetailed guides for specific topics:\n\n- **`references\u002Fresources.md`** - All resource types with examples\n- **`references\u002Fevents.md`** - Event system and patterns\n- **`references\u002Fprocess-interaction.md`** - Process synchronization\n- **`references\u002Fmonitoring.md`** - Data collection techniques\n- **`references\u002Freal-time.md`** - Real-time simulation setup\n\n## Best Practices\n\n1. **Generator functions**: Always use `yield` in process functions\n2. **Resource context managers**: Use `with resource.request() as req:` for automatic cleanup\n3. **Reproducibility**: Set `random.seed()` for consistent results\n4. **Monitoring**: Collect data throughout simulation, not just at the end\n5. **Validation**: Compare simple cases with analytical solutions\n6. **Documentation**: Comment process logic and parameter choices\n7. **Modular design**: Separate process logic, statistics, and configuration\n\n## Common Pitfalls\n\n1. **Forgetting yield**: Processes must yield events to pause\n2. **Event reuse**: Events can only be triggered once\n3. **Resource leaks**: Use context managers or ensure release\n4. **Blocking operations**: Avoid Python blocking calls in processes\n5. **Time units**: Stay consistent with time unit interpretation\n6. **Deadlocks**: Ensure at least one process can make progress\n\n## Example Use Cases\n\n- **Manufacturing**: Machine scheduling, production lines, inventory management\n- **Healthcare**: Emergency room simulation, patient flow, staff allocation\n- **Telecommunications**: Network traffic, packet routing, bandwidth allocation\n- **Transportation**: Traffic flow, logistics, vehicle routing\n- **Service operations**: Call centers, retail checkout, appointment scheduling\n- **Computer systems**: CPU scheduling, memory management, I\u002FO operations\n\n","# SimPy - Discrete-Event Simulation\n\n## Overview\n\nSimPy 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.\n\n**Core capabilities:**\n- Process modeling using Python generator functions\n- Shared resource management (servers, containers, stores)\n- Event-driven scheduling and synchronization\n- Real-time simulations synchronized with wall-clock time\n- Comprehensive monitoring and data collection\n\n## When to Use This Skill\n\nUse the SimPy skill when:\n\n1. **Modeling discrete-event systems** - Systems where events occur at irregular intervals\n2. **Resource contention** - Entities compete for limited resources (servers, machines, staff)\n3. **Queue analysis** - Studying waiting lines, service times, and throughput\n4. **Process optimization** - Analyzing manufacturing, logistics, or service processes\n5. **Network simulation** - Packet routing, bandwidth allocation, latency analysis\n6. **Capacity planning** - Determining optimal resource levels for desired performance\n7. **System validation** - Testing system behavior before implementation\n\n**Not suitable for:**\n- Continuous simulations with fixed time steps (consider SciPy ODE solvers)\n- Independent processes without resource sharing\n- Pure mathematical optimization (consider SciPy optimize)\n\n## Quick Start\n\n### Basic Simulation Structure\n\n```python\nimport simpy\n\ndef process(env, name):\n    \"\"\"A simple process that waits and prints.\"\"\"\n    print(f'{name} starting at {env.now}')\n    yield env.timeout(5)\n    print(f'{name} finishing at {env.now}')\n\n# Create environment\nenv = simpy.Environment()\n\n# Start processes\nenv.process(process(env, 'Process 1'))\nenv.process(process(env, 'Process 2'))\n\n# Run simulation\nenv.run(until=10)\n```\n\n### Resource Usage Pattern\n\n```python\nimport simpy\n\ndef customer(env, name, resource):\n    \"\"\"Customer requests resource, uses it, then releases.\"\"\"\n    with resource.request() as req:\n        yield req  # Wait for resource\n        print(f'{name} got resource at {env.now}')\n        yield env.timeout(3)  # Use resource\n        print(f'{name} released resource at {env.now}')\n\nenv = simpy.Environment()\nserver = simpy.Resource(env, capacity=1)\n\nenv.process(customer(env, 'Customer 1', server))\nenv.process(customer(env, 'Customer 2', server))\nenv.run()\n```\n\n## Core Concepts\n\n### 1. Environment\n\nThe simulation environment manages time and schedules events.\n\n```python\nimport simpy\n\n# Standard environment (runs as fast as possible)\nenv = simpy.Environment(initial_time=0)\n\n# Real-time environment (synchronized with wall-clock)\nimport simpy.rt\nenv_rt = simpy.rt.RealtimeEnvironment(factor=1.0)\n\n# Run simulation\nenv.run(until=100)  # Run until time 100\nenv.run()  # Run until no events remain\n```\n\n### 2. Processes\n\nProcesses are defined using Python generator functions (functions with `yield` statements).\n\n```python\ndef my_process(env, param1, param2):\n    \"\"\"Process that yields events to pause execution.\"\"\"\n    print(f'Starting at {env.now}')\n\n    # Wait for time to pass\n    yield env.timeout(5)\n\n    print(f'Resumed at {env.now}')\n\n    # Wait for another event\n    yield env.timeout(3)\n\n    print(f'Done at {env.now}')\n    return 'result'\n\n# Start the process\nenv.process(my_process(env, 'value1', 'value2'))\n```\n\n### 3. Events\n\nEvents are the fundamental mechanism for process synchronization. Processes yield events and resume when those events are triggered.\n\n**Common event types:**\n- `env.timeout(delay)` - Wait for time to pass\n- `resource.request()` - Request a resource\n- `env.event()` - Create a custom event\n- `env.process(func())` - Process as an event\n- `event1 & event2` - Wait for all events (AllOf)\n- `event1 | event2` - Wait for any event (AnyOf)\n\n## Resources\n\nSimPy provides several resource types for different scenarios. For comprehensive details, see `references\u002Fresources.md`.\n\n### Resource Types Summary\n\n| Resource Type | Use Case |\n|---------------|----------|\n| Resource | Limited capacity (servers, machines) |\n| PriorityResource | Priority-based queuing |\n| PreemptiveResource | High-priority can interrupt low-priority |\n| Container | Bulk materials (fuel, water) |\n| Store | Python object storage (FIFO) |\n| FilterStore | Selective item retrieval |\n| PriorityStore | Priority-ordered items |\n\n### Quick Reference\n\n```python\nimport simpy\n\nenv = simpy.Environment()\n\n# Basic resource (e.g., servers)\nresource = simpy.Resource(env, capacity=2)\n\n# Priority resource\npriority_resource = simpy.PriorityResource(env, capacity=1)\n\n# Container (e.g., fuel tank)\nfuel_tank = simpy.Container(env, capacity=100, init=50)\n\n# Store (e.g., warehouse)\nwarehouse = simpy.Store(env, capacity=10)\n```\n\n## Common Simulation Patterns\n\n### Pattern 1: Customer-Server Queue\n\n```python\nimport simpy\nimport random\n\ndef customer(env, name, server):\n    arrival = env.now\n    with server.request() as req:\n        yield req\n        wait = env.now - arrival\n        print(f'{name} waited {wait:.2f}, served at {env.now}')\n        yield env.timeout(random.uniform(2, 4))\n\ndef customer_generator(env, server):\n    i = 0\n    while True:\n        yield env.timeout(random.uniform(1, 3))\n        i += 1\n        env.process(customer(env, f'Customer {i}', server))\n\nenv = simpy.Environment()\nserver = simpy.Resource(env, capacity=2)\nenv.process(customer_generator(env, server))\nenv.run(until=20)\n```\n\n### Pattern 2: Producer-Consumer\n\n```python\nimport simpy\n\ndef producer(env, store):\n    item_id = 0\n    while True:\n        yield env.timeout(2)\n        item = f'Item {item_id}'\n        yield store.put(item)\n        print(f'Produced {item} at {env.now}')\n        item_id += 1\n\ndef consumer(env, store):\n    while True:\n        item = yield store.get()\n        print(f'Consumed {item} at {env.now}')\n        yield env.timeout(3)\n\nenv = simpy.Environment()\nstore = simpy.Store(env, capacity=10)\nenv.process(producer(env, store))\nenv.process(consumer(env, store))\nenv.run(until=20)\n```\n\n### Pattern 3: Parallel Task Execution\n\n```python\nimport simpy\n\ndef task(env, name, duration):\n    print(f'{name} starting at {env.now}')\n    yield env.timeout(duration)\n    print(f'{name} done at {env.now}')\n    return f'{name} result'\n\ndef coordinator(env):\n    # Start tasks in parallel\n    task1 = env.process(task(env, 'Task 1', 5))\n    task2 = env.process(task(env, 'Task 2', 3))\n    task3 = env.process(task(env, 'Task 3', 4))\n\n    # Wait for all to complete\n    results = yield task1 & task2 & task3\n    print(f'All done at {env.now}')\n\nenv = simpy.Environment()\nenv.process(coordinator(env))\nenv.run()\n```\n\n## Workflow Guide\n\n### Step 1: Define the System\n\nIdentify:\n- **Entities**: What moves through the system? (customers, parts, packets)\n- **Resources**: What are the constraints? (servers, machines, bandwidth)\n- **Processes**: What are the activities? (arrival, service, departure)\n- **Metrics**: What to measure? (wait times, utilization, throughput)\n\n### Step 2: Implement Process Functions\n\nCreate generator functions for each process type:\n\n```python\ndef entity_process(env, name, resources, parameters):\n    # Arrival logic\n    arrival_time = env.now\n\n    # Request resources\n    with resource.request() as req:\n        yield req\n\n        # Service logic\n        service_time = calculate_service_time(parameters)\n        yield env.timeout(service_time)\n\n    # Departure logic\n    collect_statistics(env.now - arrival_time)\n```\n\n### Step 3: Set Up Monitoring\n\nUse monitoring utilities to collect data. See `references\u002Fmonitoring.md` for comprehensive techniques.\n\n```python\nfrom scripts.resource_monitor import ResourceMonitor\n\n# Create and monitor resource\nresource = simpy.Resource(env, capacity=2)\nmonitor = ResourceMonitor(env, resource, \"Server\")\n\n# After simulation\nmonitor.report()\n```\n\n### Step 4: Run and Analyze\n\n```python\n# Run simulation\nenv.run(until=simulation_time)\n\n# Generate reports\nmonitor.report()\nstats.report()\n\n# Export data for further analysis\nmonitor.export_csv('results.csv')\n```\n\n## Advanced Features\n\n### Process Interaction\n\nProcesses can interact through events, process yields, and interrupts. See `references\u002Fprocess-interaction.md` for detailed patterns.\n\n**Key mechanisms:**\n- **Event signaling**: Shared events for coordination\n- **Process yields**: Wait for other processes to complete\n- **Interrupts**: Forcefully resume processes for preemption\n\n### Real-Time Simulations\n\nSynchronize simulation with wall-clock time for hardware-in-the-loop or interactive applications. See `references\u002Freal-time.md`.\n\n```python\nimport simpy.rt\n\nenv = simpy.rt.RealtimeEnvironment(factor=1.0)  # 1:1 time mapping\n# factor=0.5 means 1 sim unit = 0.5 seconds (2x faster)\n```\n\n### Comprehensive Monitoring\n\nMonitor processes, resources, and events. See `references\u002Fmonitoring.md` for techniques including:\n- State variable tracking\n- Resource monkey-patching\n- Event tracing\n- Statistical collection\n\n## Scripts and Templates\n\n### basic_simulation_template.py\n\nComplete template for building queue simulations with:\n- Configurable parameters\n- Statistics collection\n- Customer generation\n- Resource usage\n- Report generation\n\n**Usage:**\n```python\nfrom scripts.basic_simulation_template import SimulationConfig, run_simulation\n\nconfig = SimulationConfig()\nconfig.num_resources = 2\nconfig.sim_time = 100\nstats = run_simulation(config)\nstats.report()\n```\n\n### resource_monitor.py\n\nReusable monitoring utilities:\n- `ResourceMonitor` - Track single resource\n- `MultiResourceMonitor` - Monitor multiple resources\n- `ContainerMonitor` - Track container levels\n- Automatic statistics calculation\n- CSV export functionality\n\n**Usage:**\n```python\nfrom scripts.resource_monitor import ResourceMonitor\n\nmonitor = ResourceMonitor(env, resource, \"My Resource\")\n# ... run simulation ...\nmonitor.report()\nmonitor.export_csv('data.csv')\n```\n\n## Reference Documentation\n\nDetailed guides for specific topics:\n\n- **`references\u002Fresources.md`** - All resource types with examples\n- **`references\u002Fevents.md`** - Event system and patterns\n- **`references\u002Fprocess-interaction.md`** - Process synchronization\n- **`references\u002Fmonitoring.md`** - Data collection techniques\n- **`references\u002Freal-time.md`** - Real-time simulation setup\n\n## Best Practices\n\n1. **Generator functions**: Always use `yield` in process functions\n2. **Resource context managers**: Use `with resource.request() as req:` for automatic cleanup\n3. **Reproducibility**: Set `random.seed()` for consistent results\n4. **Monitoring**: Collect data throughout simulation, not just at the end\n5. **Validation**: Compare simple cases with analytical solutions\n6. **Documentation**: Comment process logic and parameter choices\n7. **Modular design**: Separate process logic, statistics, and configuration\n\n## Common Pitfalls\n\n1. **Forgetting yield**: Processes must yield events to pause\n2. **Event reuse**: Events can only be triggered once\n3. **Resource leaks**: Use context managers or ensure release\n4. **Blocking operations**: Avoid Python blocking calls in processes\n5. **Time units**: Stay consistent with time unit interpretation\n6. **Deadlocks**: Ensure at least one process can make progress\n\n## Example Use Cases\n\n- **Manufacturing**: Machine scheduling, production lines, inventory management\n- **Healthcare**: Emergency room simulation, patient flow, staff allocation\n- **Telecommunications**: Network traffic, packet routing, bandwidth allocation\n- **Transportation**: Traffic flow, logistics, vehicle routing\n- **Service operations**: Call centers, retail checkout, appointment scheduling\n- **Computer systems**: CPU scheduling, memory management, I\u002FO operations\n\n",{"name":5,"license":48,"metadata":49,"description":7},"MIT license",{"skill-author":50},"K-Dense Inc.","main","7925716f065257435fdb12e97f7e52842147d5ad",".codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill simpy",{"tool":65,"command":66},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill simpy",{"tool":68,"command":69},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill simpy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002FSKILL.md",true,[73,79,83,87,91,95,101],{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fevents.md","REFERENCE","参考文档",8579,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Freferences\u002Fevents.md",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fmonitoring.md",12923,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Freferences\u002Fmonitoring.md",{"path":84,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fprocess-interaction.md",11525,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Freferences\u002Fprocess-interaction.md",{"path":88,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Freal-time.md",10728,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Freferences\u002Freal-time.md",{"path":92,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fresources.md",7327,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Freferences\u002Fresources.md",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"scripts\u002Fbasic_simulation_template.py","SCRIPT","脚本",5558,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Fscripts\u002Fbasic_simulation_template.py",{"path":102,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":103,"sourceHtmlUrl":104},"scripts\u002Fresource_monitor.py",11680,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fsimpy\u002Fscripts\u002Fresource_monitor.py",[106,145,154,163,184,210],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":126,"publishedAt":43},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[112,115,118,121],{"categoryNo":113,"categoryName":114,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":116,"categoryName":117,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":122,"categoryName":123,"taxonomyType":124,"taxonomyTypeDesc":125},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[108,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,25],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube",{"skillNo":146,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":153,"publishedAt":43},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[149,150,151,152],{"categoryNo":113,"categoryName":114,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":116,"categoryName":117,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":122,"categoryName":123,"taxonomyType":124,"taxonomyTypeDesc":125},[108,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,25],{"skillNo":155,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":162,"publishedAt":43},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[158,159,160,161],{"categoryNo":113,"categoryName":114,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":116,"categoryName":117,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":119,"categoryName":120,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":122,"categoryName":123,"taxonomyType":124,"taxonomyTypeDesc":125},[108,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,25],{"skillNo":164,"name":165,"nameZh":6,"description":166,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":169,"publishedAt":43},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[34,170,171,172,173,174,175,176,177,178,179,180,181,182,183],"zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":185,"name":186,"nameZh":6,"description":187,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":188,"categories":189,"keywords":191,"publishedAt":43},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[190],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[192,193,194,195,196,197,198,199,200,201,202,138,139,203,204,205,206,207,208,209],"oracle","what if oracle","go","run","ux","futures","analysis","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":211,"name":212,"nameZh":6,"description":213,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":214,"categories":215,"keywords":226,"publishedAt":43},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[216,219,222,223],{"categoryNo":217,"categoryName":218,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":220,"categoryName":221,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":224,"categoryName":225,"taxonomyType":124,"taxonomyTypeDesc":125},"01JBSEEDCAT000000000000036","内容创作者",[227,228,229,230,231,232,233,234,135,235,138,139,140,236,237,238,239,240,183,241],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]