name: 时间研究分析器 description: 具备秒表方法、绩效评级和标准时间计算功能的时间研究分析技能。 allowed-tools: Bash(*) Read Write Edit Glob Grep WebFetch metadata: author: babysitter-sdk version: “1.0.0” category: 工作测量 backlog-id: SK-IE-034
时间研究分析器
您是 时间研究分析器 - 一个专门用于时间研究分析的技能,包括秒表方法、绩效评级和标准时间计算。
概述
此技能支持AI驱动的时间研究分析,包括:
- 秒表时间研究
- 要素分解与计时
- 绩效评级应用
- 宽放率计算
- 标准时间制定
- 样本量确定
- 观测数据的统计分析
- 预定时间系统(MTM)
能力
1. 时间研究数据收集
import numpy as np
import pandas as pd
from scipy import stats
def analyze_time_study(observations: pd.DataFrame):
"""
分析时间研究观测数据
observations: 包含列 ['element', 'cycle', 'time', 'rating'] 的DataFrame
"""
results = {}
for element in observations['element'].unique():
element_data = observations[observations['element'] == element]
# 基本统计
times = element_data['time'].values
ratings = element_data['rating'].values
# 使用IQR方法识别异常值
q1, q3 = np.percentile(times, [25, 75])
iqr = q3 - q1
lower_bound = q1 - 1.5 * iqr
upper_bound = q3 + 1.5 * iqr
valid_mask = (times >= lower_bound) & (times <= upper_bound)
valid_times = times[valid_mask]
valid_ratings = ratings[valid_mask]
# 计算观测时间
observed_time = np.mean(valid_times)
# 计算平均绩效评级
avg_rating = np.mean(valid_ratings) / 100 # 转换为小数
# 正常时间 = 观测时间 × 评级
normal_time = observed_time * avg_rating
results[element] = {
'observations': len(times),
'outliers_removed': len(times) - len(valid_times),
'observed_time': round(observed_time, 3),
'std_dev': round(np.std(valid_times), 3),
'avg_rating': round(avg_rating * 100, 1),
'normal_time': round(normal_time, 3)
}
return {
"elements": results,
"total_normal_time": sum(e['normal_time'] for e in results.values())
}
2. 绩效评级
def apply_performance_rating(observed_time: float, rating_method: str,
rating_factors: dict = None):
"""
对观测时间应用绩效评级
rating_method: 'pace', 'westinghouse', 'synthetic', 'objective'
rating_factors: 方法特定的因子
"""
if rating_method == 'pace':
# 简单速度评级(100 = 正常)
rating = rating_factors.get('pace', 100) / 100
normal_time = observed_time * rating
elif rating_method == 'westinghouse':
# 西屋系统,包含四个因子
skill = rating_factors.get('skill', 0) # -0.22 到 +0.15
effort = rating_factors.get('effort', 0) # -0.17 到 +0.13
conditions = rating_factors.get('conditions', 0) # -0.07 到 +0.06
consistency = rating_factors.get('consistency', 0) # -0.04 到 +0.04
total_adjustment = skill + effort + conditions + consistency
rating = 1 + total_adjustment
normal_time = observed_time * rating
elif rating_method == 'synthetic':
# 基于预定时间比较
benchmark_time = rating_factors.get('benchmark_time', observed_time)
rating = benchmark_time / observed_time
normal_time = benchmark_time # 使用基准作为正常时间
elif rating_method == 'objective':
# 基于速度和难度
pace = rating_factors.get('pace', 100) / 100
difficulty = rating_factors.get('difficulty', 1.0)
rating = pace * difficulty
normal_time = observed_time * rating
else:
rating = 1.0
normal_time = observed_time
return {
"method": rating_method,
"observed_time": observed_time,
"rating": round(rating * 100, 1),
"normal_time": round(normal_time, 3),
"factors_applied": rating_factors
}
def westinghouse_lookup():
"""返回西屋评级表"""
return {
"skill": {
"A1 - 超常技能": 0.15, "A2 - 超常技能": 0.13,
"B1 - 优秀": 0.11, "B2 - 优秀": 0.08,
"C1 - 良好": 0.06, "C2 - 良好": 0.03,
"D - 平均": 0.00,
"E1 - 一般": -0.05, "E2 - 一般": -0.10,
"F1 - 较差": -0.16, "F2 - 较差": -0.22
},
"effort": {
"A1 - 过度": 0.13, "A2 - 过度": 0.12,
"B1 - 优秀": 0.10, "B2 - 优秀": 0.08,
"C1 - 良好": 0.05, "C2 - 良好": 0.02,
"D - 平均": 0.00,
"E1 - 一般": -0.04, "E2 - 一般": -0.08,
"F1 - 较差": -0.12, "F2 - 较差": -0.17
},
"conditions": {
"A - 理想": 0.06, "B - 优秀": 0.04,
"C - 良好": 0.02, "D - 平均": 0.00,
"E - 一般": -0.03, "F - 较差": -0.07
},
"consistency": {
"A - 完美": 0.04, "B - 优秀": 0.03,
"C - 良好": 0.01, "D - 平均": 0.00,
"E - 一般": -0.02, "F - 较差": -0.04
}
}
3. 宽放率计算
def calculate_allowances(normal_time: float, allowance_factors: dict):
"""
计算宽放率和标准时间
allowance_factors:
- personal: 百分比(通常为5%)
- fatigue: 百分比(因工作而异)
- delay: 百分比(不可避免的延误)
- special: 任何特殊宽放
"""
personal = allowance_factors.get('personal', 5)
fatigue = allowance_factors.get('fatigue', 4)
delay = allowance_factors.get('delay', 5)
special = allowance_factors.get('special', 0)
# 总宽放百分比
total_allowance_pct = personal + fatigue + delay + special
# 计算标准时间
# 方法1:加到正常时间上
allowance_time = normal_time * (total_allowance_pct / 100)
standard_time_add = normal_time + allowance_time
# 方法2:除以(1 - 宽放因子)- 更常见
pfd_factor = total_allowance_pct / 100
standard_time_mult = normal_time / (1 - pfd_factor) if pfd_factor < 1 else normal_time * 2
return {
"normal_time": round(normal_time, 3),
"allowances": {
"personal": personal,
"fatigue": fatigue,
"delay": delay,
"special": special,
"total_percent": total_allowance_pct
},
"standard_time": round(standard_time_mult, 3),
"method": "multiplicative",
"pieces_per_hour": round(60 / standard_time_mult, 1) if standard_time_mult > 0 else 0
}
4. 样本量确定
def determine_sample_size(pilot_data: list, confidence: float = 0.95,
accuracy: float = 0.05):
"""
确定时间研究所需的样本量
pilot_data: 初始观测数据
confidence: 置信水平(通常为0.95或0.99)
accuracy: 期望的准确度,作为均值的比例(例如,0.05 = ±5%)
"""
n_pilot = len(pilot_data)
mean = np.mean(pilot_data)
std_dev = np.std(pilot_data, ddof=1)
cv = std_dev / mean # 变异系数
# 置信水平的Z分数
z = stats.norm.ppf(1 - (1 - confidence) / 2)
# 所需样本量
# n = (z * s / (A * x̄))²
# 其中A是期望的准确度比例
required_n = (z * std_dev / (accuracy * mean)) ** 2
# 使用t分布调整小样本
if required_n < 30:
t_value = stats.t.ppf(1 - (1 - confidence) / 2, df=max(n_pilot - 1, 1))
required_n = (t_value * std_dev / (accuracy * mean)) ** 2
return {
"pilot_observations": n_pilot,
"pilot_mean": round(mean, 3),
"pilot_std_dev": round(std_dev, 3),
"coefficient_of_variation": round(cv, 3),
"confidence_level": confidence,
"desired_accuracy": accuracy,
"required_sample_size": int(np.ceil(required_n)),
"additional_observations_needed": max(0, int(np.ceil(required_n)) - n_pilot)
}
5. 要素分解
def create_element_breakdown(task_description: str, elements: list):
"""
为时间研究记录要素分解
elements: 包含 {'name': str, 'description': str, 'type': str, 'breakpoint': str} 的列表
"""
breakdown = []
for i, elem in enumerate(elements):
breakdown.append({
'element_number': i + 1,
'name': elem['name'],
'description': elem['description'],
'type': elem.get('type', 'regular'), # regular, occasional, foreign
'breakpoint': elem.get('breakpoint', ''), # 端点描述
'machine_controlled': elem.get('machine_controlled', False),
'frequency': elem.get('frequency', 1.0) # 每周期次数
})
return {
"task": task_description,
"element_count": len(breakdown),
"elements": breakdown,
"element_types": {
"regular": sum(1 for e in breakdown if e['type'] == 'regular'),
"occasional": sum(1 for e in breakdown if e['type'] == 'occasional'),
"foreign": sum(1 for e in breakdown if e['type'] == 'foreign')
}
}
6. 标准时间汇总
def create_standard_time_summary(elements: list, allowances: dict,
frequency_adjustments: dict = None):
"""
创建全面的标准时间汇总
"""
total_normal_time = 0
element_details = []
for elem in elements:
frequency = frequency_adjustments.get(elem['name'], 1.0) if frequency_adjustments else 1.0
adjusted_time = elem['normal_time'] * frequency
element_details.append({
'element': elem['name'],
'normal_time': elem['normal_time'],
'frequency': frequency,
'adjusted_time': round(adjusted_time, 3)
})
total_normal_time += adjusted_time
# 应用宽放率
allowance_result = calculate_allowances(total_normal_time, allowances)
return {
"elements": element_details,
"total_normal_time": round(total_normal_time, 3),
"standard_time": allowance_result['standard_time'],
"allowances": allowance_result['allowances'],
"production_standards": {
"pieces_per_hour": round(60 / allowance_result['standard_time'], 1),
"pieces_per_shift_8hr": round(480 / allowance_result['standard_time'], 0),
"hours_per_100": round(100 * allowance_result['standard_time'] / 60, 2)
}
}
流程集成
此技能与以下流程集成:
work-measurement-analysis.jsstandard-work-development.jslabor-cost-estimation.js
输出格式
{
"time_study": {
"task": "装配操作A",
"elements": [
{"element": "获取零件", "observed": 0.15, "rating": 95, "normal": 0.143},
{"element": "定位", "observed": 0.22, "rating": 100, "normal": 0.220}
],
"total_normal_time": 1.45
},
"standard_time": {
"normal_time": 1.45,
"allowance_percent": 15,
"standard_time": 1.71
},
"production_standards": {
"pieces_per_hour": 35.1,
"hours_per_100": 2.85
},
"sample_analysis": {
"required_observations": 25,
"confidence": 95,
"accuracy": "±5%"
}
}
最佳实践
- 明确界定要素 - 一致的断点
- 训练有素的观察员 - 一致的评级至关重要
- 多个周期 - 统计显著性
- 记录条件 - 工作场所、工具、材料
- 工人合作 - 解释目的
- 与工人核实 - 他们应同意这是可实现的
约束
- 评级是主观的,需要培训
- 工人可能不会以正常速度工作
- 要素变异增加样本需求
- 机器控制的要素不需要评级