节拍时间计算器Skill takt-time-calculator

节拍时间计算器是一款专业的精益生产分析工具,专门用于计算生产线节拍时间、分析周期时间、跟踪操作员效率、评估产能平衡。该工具支持需求变化调整、加班计算、效率因子分析等功能,帮助企业优化生产流程、提高产能利用率、实现精益制造目标。关键词:节拍时间计算、周期时间分析、生产线平衡、产能规划、精益生产、效率优化、制造业数据分析、工业工程工具。

精益生产 1 次安装 16 次浏览 更新于 2/25/2026

name: 节拍时间计算器 description: 用于生产线平衡和产能规划的节拍时间和周期时间分析技能。 allowed-tools: Bash(*) Read Write Edit Glob Grep WebFetch metadata: author: babysitter-sdk version: “1.0.0” category: 精益生产 backlog-id: SK-IE-010

节拍时间计算器

您是节拍时间计算器 - 专门用于计算节拍时间、周期时间及相关指标,以支持生产计划和产线平衡的专业技能。

概述

本技能支持AI驱动的节拍时间分析,包括:

  • 根据需求和可用时间计算节拍时间
  • 周期时间测量与分析
  • 操作员周期时间跟踪
  • 节拍时间达成率监控
  • 节奏化取料的节拍计算
  • 考虑效率因素的计划周期时间
  • 加班和班次调整计算

前提条件

  • 生产需求数据
  • 可用工作时间信息
  • 周期时间观测数据

功能

1. 节拍时间计算

def calculate_takt_time(customer_demand, available_time, time_unit='seconds'):
    """
    节拍时间 = 可用生产时间 / 客户需求

    参数:
        customer_demand: 每期所需单位数
        available_time: 期间内可用的生产时间
        time_unit: 输出单位 ('seconds', 'minutes', 'hours')

    返回:
        节拍时间及相关指标
    """
    if customer_demand <= 0:
        raise ValueError("客户需求必须为正数")

    takt_seconds = available_time / customer_demand

    conversions = {
        'seconds': takt_seconds,
        'minutes': takt_seconds / 60,
        'hours': takt_seconds / 3600
    }

    return {
        "takt_time": conversions[time_unit],
        "time_unit": time_unit,
        "customer_demand": customer_demand,
        "available_time_seconds": available_time,
        "interpretation": f"必须每 {takt_seconds:.1f} 秒完成1个单位"
    }

def calculate_available_time(shift_length_hours, breaks_minutes,
                            planned_downtime_minutes, shifts_per_day):
    """
    计算净可用生产时间
    """
    shift_seconds = shift_length_hours * 3600
    breaks_seconds = breaks_minutes * 60
    downtime_seconds = planned_downtime_minutes * 60

    net_per_shift = shift_seconds - breaks_seconds - downtime_seconds
    total_daily = net_per_shift * shifts_per_day

    return {
        "gross_time_per_shift": shift_seconds,
        "breaks_deduction": breaks_seconds,
        "planned_downtime": downtime_seconds,
        "net_available_per_shift": net_per_shift,
        "shifts_per_day": shifts_per_day,
        "total_daily_available": total_daily
    }

2. 周期时间分析

import numpy as np
from scipy import stats

def analyze_cycle_times(observations):
    """
    观测周期时间的统计分析
    """
    data = np.array(observations)

    analysis = {
        "count": len(data),
        "mean": np.mean(data),
        "median": np.median(data),
        "std": np.std(data, ddof=1),
        "min": np.min(data),
        "max": np.max(data),
        "range": np.max(data) - np.min(data),
        "cv": np.std(data, ddof=1) / np.mean(data) * 100  # 变异系数
    }

    # 百分位数
    analysis["p5"] = np.percentile(data, 5)
    analysis["p95"] = np.percentile(data, 95)

    # 均值置信区间
    ci = stats.t.interval(0.95, len(data)-1,
                         loc=np.mean(data),
                         scale=stats.sem(data))
    analysis["ci_95"] = {"lower": ci[0], "upper": ci[1]}

    # 异常值检测(IQR方法)
    q1, q3 = np.percentile(data, [25, 75])
    iqr = q3 - q1
    outliers = data[(data < q1 - 1.5*iqr) | (data > q3 + 1.5*iqr)]
    analysis["outliers"] = outliers.tolist()

    return analysis

def compare_to_takt(cycle_time_stats, takt_time):
    """
    比较观测周期时间与节拍时间
    """
    mean_ct = cycle_time_stats['mean']
    p95_ct = cycle_time_stats['p95']

    comparison = {
        "takt_time": takt_time,
        "mean_cycle_time": mean_ct,
        "takt_attainment": takt_time / mean_ct * 100 if mean_ct > 0 else 0,
        "at_risk": mean_ct > takt_time * 0.9,
        "exceeds_takt": mean_ct > takt_time,
        "p95_vs_takt": p95_ct / takt_time * 100,
        "buffer_available": takt_time - mean_ct
    }

    if comparison["exceeds_takt"]:
        comparison["recommendation"] = "周期时间超过节拍时间 - 需要立即改进"
    elif comparison["at_risk"]:
        comparison["recommendation"] = "周期时间接近节拍时间 - 应对变异的缓冲有限"
    else:
        comparison["recommendation"] = "存在健康的缓冲时间"

    return comparison

3. 操作员周期时间跟踪

class OperatorCycleTimeTracker:
    """
    跟踪和分析操作员周期时间
    """
    def __init__(self):
        self.observations = {}  # {操作员ID: [观测数据]}

    def record_observation(self, operator_id, cycle_time, timestamp=None):
        if operator_id not in self.observations:
            self.observations[operator_id] = []

        self.observations[operator_id].append({
            "cycle_time": cycle_time,
            "timestamp": timestamp or datetime.now()
        })

    def analyze_operator(self, operator_id):
        obs = [o['cycle_time'] for o in self.observations.get(operator_id, [])]
        return analyze_cycle_times(obs) if obs else None

    def compare_operators(self):
        """跨操作员性能比较"""
        comparison = {}

        for op_id in self.observations:
            stats = self.analyze_operator(op_id)
            if stats:
                comparison[op_id] = {
                    "mean": stats['mean'],
                    "cv": stats['cv'],
                    "count": stats['count']
                }

        # 按平均周期时间排序
        ranked = sorted(comparison.items(), key=lambda x: x[1]['mean'])

        return {
            "operator_stats": comparison,
            "ranked_by_speed": [op_id for op_id, _ in ranked],
            "best_performer": ranked[0][0] if ranked else None,
            "spread": ranked[-1][1]['mean'] - ranked[0][1]['mean'] if len(ranked) > 1 else 0
        }

4. 节拍计算

def calculate_pitch(takt_time, pack_quantity):
    """
    节拍 = 节拍时间 × 包装数量

    节拍是节奏化取料的时间间隔
    (多久移动一次容器)
    """
    pitch_seconds = takt_time * pack_quantity

    return {
        "pitch_seconds": pitch_seconds,
        "pitch_minutes": pitch_seconds / 60,
        "takt_time": takt_time,
        "pack_quantity": pack_quantity,
        "withdrawals_per_hour": 3600 / pitch_seconds,
        "interpretation": f"每 {pitch_seconds/60:.1f} 分钟移动 {pack_quantity} 个单位"
    }

5. 计划周期时间

def calculate_planned_cycle_time(takt_time, efficiency_factors):
    """
    计划周期时间考虑了预期的低效率因素

    efficiency_factors: 包含以下组件的字典:
        - oee: 整体设备效率 (0-1)
        - quality_rate: 首次通过率 (0-1)
        - availability: 机器可用性 (0-1)
    """
    total_efficiency = 1.0
    for factor, value in efficiency_factors.items():
        total_efficiency *= value

    planned_ct = takt_time * total_efficiency

    return {
        "takt_time": takt_time,
        "efficiency_factors": efficiency_factors,
        "combined_efficiency": total_efficiency,
        "planned_cycle_time": planned_ct,
        "buffer_percentage": (1 - total_efficiency) * 100,
        "interpretation": f"目标 {planned_ct:.1f}秒以达到 {takt_time:.1f}秒的节拍"
    }

6. 加班和班次调整

def adjust_for_demand_changes(base_takt, base_demand, new_demand,
                              base_available_time, options):
    """
    计算需求变化所需的调整

    options: 包含可用杠杆的字典:
        - overtime_available: 每班最大加班分钟数
        - additional_shifts: 布尔值,是否可以增加班次
        - weekends: 布尔值,是否可以周末工作
    """
    demand_ratio = new_demand / base_demand

    if demand_ratio <= 1:
        new_takt = base_takt / demand_ratio
        return {
            "action": "none_needed",
            "new_takt": new_takt,
            "demand_decrease": (1 - demand_ratio) * 100
        }

    # 需要更多产能
    additional_time_needed = base_available_time * (demand_ratio - 1)

    solutions = []

    # 加班选项
    if options.get('overtime_available'):
        overtime_per_shift = options['overtime_available'] * 60  # 转换为秒
        shifts_needed = additional_time_needed / overtime_per_shift
        if shifts_needed <= 5:  # 5天工作周
            solutions.append({
                "method": "overtime",
                "overtime_minutes_per_day": additional_time_needed / 60,
                "feasible": True
            })

    # 增加班次
    if options.get('additional_shifts'):
        solutions.append({
            "method": "additional_shift",
            "coverage_percentage": min(100, (base_available_time / additional_time_needed) * 100),
            "feasible": additional_time_needed <= base_available_time
        })

    # 周末工作
    if options.get('weekends'):
        solutions.append({
            "method": "weekend_work",
            "days_needed": additional_time_needed / base_available_time,
            "feasible": True
        })

    return {
        "demand_increase_percent": (demand_ratio - 1) * 100,
        "additional_time_needed_hours": additional_time_needed / 3600,
        "solutions": solutions,
        "new_takt_with_increase": base_available_time / new_demand
    }

流程集成

本技能与以下流程集成:

  • standard-work-development.js
  • line-balancing-analysis.js
  • value-stream-mapping-analysis.js

输出格式

{
  "takt_analysis": {
    "customer_demand": 460,
    "available_time_hours": 7.5,
    "takt_time_seconds": 58.7,
    "takt_time_formatted": "58.7 秒/单位"
  },
  "cycle_time_comparison": {
    "observed_mean": 52.3,
    "observed_std": 4.2,
    "takt_attainment_percent": 112.2,
    "buffer_seconds": 6.4
  },
  "status": "healthy",
  "recommendations": [
    "当前周期时间提供足够的缓冲",
    "监控变异性以维持性能"
  ]
}

最佳实践

  1. 使用净可用时间 - 减去休息、会议、维护时间
  2. 包含变异性 - 不要按精确节拍设计
  3. 定期更新 - 需求变化时重新计算
  4. 可视化显示 - 在工作站张贴节拍时间
  5. 多次观测 - 获取统计有效的周期时间
  6. 考虑所有产品 - 可能需要产品特定的节拍

约束

  • 节拍时间是目标,不是固定规则
  • 适用时考虑产品组合
  • 记录所有时间假设
  • 需求模式变化时重新评估