[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6M0AGTR2EMZNMZJSESSFGEK":3,"skill-same:01M6M0AGTR2EMZNMZJSESSFGEK":106},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":46,"linkOnly":47,"markdownContent":48,"markdownBody":49,"frontMatter":50,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":13,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":59,"install":60,"resources":73},"01M6M0AGTR2EMZNMZJSESSFGEK","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.","endman100\u002Fskill-router-nexus","endman100","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F31997019?v=4","01M6KPDX17BYDWW4RRB0TNGGMX","01M6KPDX64Y2QBEWVFG5W5PWPF",0,"MIT","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[5,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"systems","Simulations","entities","when","queues","traffic","with","event","manufacturing","resources","events","as","python","service","shared","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":51,"metadata":52,"description":7},"MIT license",{"skill-author":53},"K-Dense Inc.","main","f19b254e8975d0bfddb394686706106930d7964d","Science\u002Fphysics-quantum-and-simulation\u002Fsimpy","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus","https:\u002F\u002Fgithub.com\u002Fendman100","2026-11-12 18:13:37",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add endman100\u002Fskill-router-nexus --skill simpy",{"tool":66,"command":67},"bunx","bunx skills add endman100\u002Fskill-router-nexus --skill simpy",{"tool":69,"command":70},"pnpm","pnpm dlx skills add endman100\u002Fskill-router-nexus --skill simpy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002FSKILL.md",true,[74,80,84,88,92,96,102],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fevents.md","REFERENCE","参考文档",8579,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Freferences\u002Fevents.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fmonitoring.md",12923,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Freferences\u002Fmonitoring.md",{"path":85,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fprocess-interaction.md",11525,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Freferences\u002Fprocess-interaction.md",{"path":89,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Freal-time.md",10728,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Freferences\u002Freal-time.md",{"path":93,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fresources.md",7327,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Freferences\u002Fresources.md",{"path":97,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fbasic_simulation_template.py","SCRIPT","脚本",5558,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Fscripts\u002Fbasic_simulation_template.py",{"path":103,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":104,"sourceHtmlUrl":105},"scripts\u002Fresource_monitor.py",11680,"https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FScience\u002Fphysics-quantum-and-simulation\u002Fsimpy\u002Fscripts\u002Fresource_monitor.py",[107,131,164,186,195,219],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":119,"publishedAt":46},"01M6MPCT5BXVER8HQZTW3QE9AS","create-master","基于佛教经典文献，生成特定高僧大德的 AI 教学角色","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FMetaphysics-and-Spirituality\u002FMaster-skill\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FMetaphysics-and-Spirituality\u002FMaster-skill\u002FSKILL.md",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000039","教师与教育","PROFESSION","适用职业",[120,121,122,123,124,125,126,127,128,129,130],"create master","master","create","生成","true","webfetch","edit","write","read","grep","Bash",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":135,"sourceHtmlUrl":136,"categories":137,"keywords":145,"publishedAt":46},"01M6M43AKE95Y64E1JRXEF5QQ3","writing-dna-skill","从至少 20 篇完整文章中蒸馏可复用的写作 DNA，分析语言、文章结构、选题逻辑、素材策略、认知框架和视觉风格，并生成 Writing-DNA.md；按该 DNA 写作时会读取全部蒸馏产物和 5 篇相关原文。用于中英文作者、账号、品牌或出版物的风格分析与一致性写作。 Distill reusable Writing DNA from at least 20 complete articles for Chinese or English authors, publications, brands, and accounts; use for language, structure, topic logic, source strategy, cognitive-frame, and visual-style analysis.","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fwriting-dna-skill\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fwriting-dna-skill\u002FSKILL.md",[138,141,142],{"categoryNo":139,"categoryName":140,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":143,"categoryName":144,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000036","内容创作者",[146,147,148,149,150,151,152,153,154,155,39,156,157,123,158,159,160,161,162,163],"writing dna skill","DNA","writing","strategy","english","logic","visual","structure","chinese","reusable","style","distill","analysis","frame","source","for","at","complete",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":168,"sourceHtmlUrl":169,"categories":170,"keywords":173,"publishedAt":46},"01M6M428TTCGQ4ME3KY99VN037","stop-slop","Remove AI writing patterns from prose. Use when drafting, editing, or reviewing text to eliminate predictable AI tells.","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fstop-slop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fstop-slop\u002FSKILL.md",[171,172],{"categoryNo":139,"categoryName":140,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":143,"categoryName":144,"taxonomyType":117,"taxonomyTypeDesc":118},[174,175,176,177,26,178,179,180,181,39,182,183,184,161,185,148],"slop","stop slop","stop","drafting","drafts","https","patterns","prose","remove","editing","text","content",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":190,"sourceHtmlUrl":191,"categories":192,"keywords":193,"publishedAt":46},"01M6M41X0B7EBX42TK435DMGGR","shuorenhua","检查和清理中英文文本里的 AI 套路，适用于“去 AI 味”“说人话”“自然一点”“别像模板”“先标问题”这类改写和审稿需求；按场景控制力度，同时保留事实、术语、语域和责任主体。","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fshuorenhua\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fshuorenhua\u002FSKILL.md",[],[188,194],"文本",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":199,"sourceHtmlUrl":200,"categories":201,"keywords":202,"publishedAt":46},"01M6M3ZD12WBEW5KXKDM4N6DFG","naming","Name products, SaaS, brands, open source projects, bots, and apps. Use when the user needs to name something, find a brand name, or pick a product name. Metaphor-driven process that produces memorable, meaningful names and avoids AI slop.","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fnaming-main\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fnaming-main\u002FSKILL.md",[],[197,203,204,205,206,207,39,208,128,160,209,210,211,212,130,213,214,215,216,26,217,218,174],"repo","websearch","product name","apps","bots","view","brand","pick","gh","projects","open","saas","open source","product","describe","ai slop",{"skillNo":220,"name":221,"nameZh":6,"description":222,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":223,"sourceHtmlUrl":224,"categories":225,"keywords":227,"publishedAt":46},"01M6M3YVXAFAAWJ7F6JMPFREYE","humanizer-zh","去除文本中的 AI 生成痕迹。适用于编辑或审阅文本，使其听起来更自然、更像人类书写。\n基于维基百科的\"AI 写作特征\"综合指南。检测并修复以下模式：夸大的象征意义、\n宣传性语言、以 -ing 结尾的肤浅分析、模糊的归因、破折号过度使用、三段式法则、\nAI 词汇、否定式排比、过多的连接性短语。","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fhumanizer-zh\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fendman100\u002Fskill-router-nexus\u002Fblob\u002Fmain\u002FWriting-and-Content\u002Fhumanizer-zh\u002FSKILL.md",[226],{"categoryNo":139,"categoryName":140,"taxonomyType":20,"taxonomyTypeDesc":21},[228,229,230,128,127,126,148,123,194,231,174,176],"humanizer","zh","humanizer zh","翻译"]