Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

discrete-event-simulator

БесплатноБез исполняемых скриптовНе проверен

Discrete event simulation skill for modeling and analyzing complex systems with stochastic processes.

a5c-aiот a5c-ai★ 1 947 звёзд на GitHub

Об этом скилле

discrete-event-simulator

You are discrete-event-simulator - a specialized skill for building and analyzing discrete event simulation models for complex systems with stochastic processes.

Overview

This skill enables AI-powered discrete event simulation including:

  • Process flow modeling with SimPy
  • Entity generation with statistical distributions
  • Resource capacity modeling
  • Queue discipline implementation (FIFO, priority, etc.)
  • Simulation warm-up period detection
  • Output statistics with confidence intervals
  • Animation and visualization generation

Prerequisites

  • Python 3.8+ with SimPy installed
  • Statistical libraries (scipy, numpy)
  • Visualization libraries (matplotlib, plotly)

Capabilities

1. Basic SimPy Model

import simpy
import numpy as np

def manufacturing_system(env, arrival_rate, service_rate, num_machines):
    """
    Simple manufacturing system simulation
    """
    machines = simpy.Resource(env, capacity=num_machines)

    # Statistics collection
    wait_times = []
    system_times = []

    def customer(env, name, machines):
        arrival_time = env.now

        with machines.request() as request:
            yield request
            wait_time = env.now - arrival_time
            wait_times.append(wait_time)

            # Service time
            service_time = np.random.exponential(1/service_rate)
            yield env.timeout(service_time)

            system_times.append(env.now - arrival_time)

    def customer_generator(env, arrival_rate, machines):
        customer_id = 0
        while True:
            yield env.timeout(np.random.exponential(1/arrival_rate))
            customer_id += 1
            env.process(customer(env, f"Customer_{customer_id}", machines))

    env.process(customer_generator(env, arrival_rate, machines))
    env.run(until=1000)

    return {
        "avg_wait_time": np.mean(wait_times),
        "avg_system_time": np.mean(system_times),
        "max_wait_time": np.max(wait_times),
        "customers_served": len(wait_times)
    }

2. Complex Process Flow

class ManufacturingLine:
    """
    Multi-stage manufacturing line with buffers
    """
    def __init__(self, env, config):
        self.env = env
        self.config = config

        # Create resources
        self.stations = {
            name: simpy.Resource(env, capacity=cap)
            for name, cap in config['stations'].items()
        }

        # Buffers between stations
        self.buffers = {
            name: simpy.Container(env, capacity=cap, init=0)
            for name, cap in config['buffers'].items()
        }

        # Statistics
        self.stats = {
            'throughput': 0,
            'wip': [],
            'utilization': {s: [] for s in self.stations}
        }

    def part_flow(self, part_id):
        """Process a part through all stations"""
        for station_name in self.config['routing']:
            station = self.stations[station_name]

            with station.request() as req:
                yield req

                # Record utilization
                self.stats['utilization'][station_name].append(
                    station.count / station.capacity
                )

                # Process time
                process_time = self.config['process_times'][station_name]()
                yield self.env.timeout(process_time)

        self.stats['throughput'] += 1

    def part_arrivals(self):
        """Generate arriving parts"""
        part_id = 0
        while True:
            yield self.env.timeout(self.config['interarrival_time']())
            part_id += 1
            self.env.process(self.part_flow(part_id))
            self.stats['wip'].append(sum(s.count for s in self.stations.values()))

3. Queue Disciplines

class PriorityQueue:
    """
    Priority queue resource for SimPy
    """
    def __init__(self, env, capacity):
        self.env = env
        self.capacity = capacity
        self.queue = []
        self.available = capacity

    def request(self, priority=0):
        return PriorityRequest(self, priority)

class PriorityRequest:
    def __init__(self, resource, priority):
        self.resource = resource
        self.priority = priority
        self.event = resource.env.event()

    def __enter__(self):
        if self.resource.available > 0:
            self.resource.available -= 1
            self.event.succeed()
        else:
            # Insert by priority (lower = higher priority)
            heapq.heappush(self.resource.queue,
                          (self.priority, self.event))
        return self.event

    def __exit__(self, *args):
        self.resource.available += 1
        if self.resource.queue:
            _, waiting_event = heapq.heappop(self.resource.queue)
            waiting_event.succeed()

4. Warm-up Detection

def welch_warmup_detection(data, window_size=50):
    """
    Welch's method for detecting warm-up period
    """
Полный SKILL.md на GitHub

Установить discrete-event-simulator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(*)
Read
Write
Edit
Glob
Grep
WebFetch

FAQ

Что делает скилл discrete-event-simulator?

Discrete event simulation skill for modeling and analyzing complex systems with stochastic processes.

Как установить скилл discrete-event-simulator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл discrete-event-simulator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить discrete-event-simulator с