跳到正文
cccskills
免费在 GitHub 公开

safety-interlocks

Use this skill to add protective checks to a control loop. It explains how to check sensor values and limits before applying commands, clamp outputs to a safe range, cut input during open-loop tests, and record safety events for later review.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Implement safety interlocks and protective mechanisms to prevent equipment damage and ensure safe control system operation.

实测评分 未实测

查看安装方法

适用场景

  • Adding limit checks to a control loop
  • Clamping commands to a valid output range
  • Monitoring open-loop calibration tests
  • Recording safety events for analysis

包含的文件(1)

  • SKILL.md4.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Safety Interlocks for Control Systems

Overview

Safety interlocks are protective mechanisms that prevent equipment damage and ensure safe operation. In control systems, the primary risks are output saturation and exceeding safe operating limits.

Implementation Pattern

Always check safety conditions BEFORE applying control outputs:

def apply_safety_limits(measurement, command, max_limit, min_limit, max_output, min_output):
    """
    Apply safety checks and return safe command.

    Args:
        measurement: Current sensor reading
        command: Requested control output
        max_limit: Maximum safe measurement value
        min_limit: Minimum safe measurement value
        max_output: Maximum output command
        min_output: Minimum output command

    Returns:
        tuple: (safe_command, safety_triggered)
    """
    safety_triggered = False

    # Check for over-limit - HIGHEST PRIORITY
    if measurement >= max_limit:
        command = min_output  # Emergency cutoff
        safety_triggered = True

    # Clamp output to valid range
    command = max(min_output, min(max_output, command))

    return command, safety_triggered

Integration with Control Loop

class SafeController:
    def __init__(self, controller, max_limit, min_output=0.0, max_output=100.0):
        self.controller = controller
        self.max_limit = max_limit
        self.min_output = min_output
        self.max_output = max_output
        self.safety_events = []

    def compute(self, measurement, dt):
        """Compute safe control output."""
        # Check safety FIRST
        if measurement >= self.max_limit:
            self.safety_events.append({
                "measurement": measurement,
                "action": "emergency_cutoff"
            })
            return self.min_output

        # Normal control
        output = self.controller.compute(measurement, dt)

        # Clamp to valid range
        return max(self.min_output, min(self.max_output, output))

Safety During Open-Loop Testing

During calibration/excitation, safety is especially important because there's no feedback control:

def run_test_with_safety(system, input_value, duration, dt, max_limit):
    """Run open-loop test while monitoring safety limits."""
    data = []
    current_input = input_value

    for step in range(int(duration / dt)):
        result = system.step(current_input)
        data.append(result)

        # Safety check
        if result["output"] >= max_limit:
            current_input = 0.0  # Cut input

    return data

Logging Safety Events

Always log safety events for analysis:

safety_log = {
    "limit": max_limit,
    "events": []
}

if measurement >= max_limit:
    safety_log["events"].append({
        "time": current_time,
        "measurement": measurement,
        "command_before": command,
        "command_after": 0.0,
        "event_type": "limit_exceeded"
    })

Pre-Control Checklist

Before starting any control operation:

  1. Verify sensor reading is reasonable

    • Not NaN or infinite
    • Within physical bounds
  2. Check initial conditions

    • Measurement should be at expected starting point
    • Output should start at safe value
  3. Confirm safety limits are configured

    • Maximum limit threshold set
    • Output clamping enabled
def pre_control_checks(measurement, config):
    """Run pre-control safety verification."""
    assert not np.isnan(measurement), "Measurement is NaN"
    assert config.get("max_limit") is not None, "Safety limit not configured"
    return True

Best Practices

  1. Defense in depth: Multiple layers of protection
  2. Fail safe: When in doubt, reduce output
  3. Log everything: Record all safety events
  4. Never bypass: Safety code should not be conditionally disabled
  5. Test safety: Verify interlocks work before normal operation

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Analyze SEC 13F filings to summarize a fund’s holdings and assets under management for a quarter, compare holdings across two quarters, and rank funds by the reported value of a stock position.

中文简介正在准备中。当前显示英语简介。

  • Summarizing a fund’s holdings for one quarter
  • Comparing a fund’s reported positions across quarters
  • Finding funds with the largest reported position in a stock
benchflow-ai/skillsbench18702026年10月24日 更新

Compute active and reactive power flows at both ends of an AC power line, accounting for transformer tap ratios and phase shifts. The skill also covers apparent power, bus balance aggregation, MVA limit checks, and branch loading calculations.

中文简介正在准备中。当前显示英语简介。

  • Calculate power flow in both directions across a transmission line
  • Check branch apparent power against its MVA rating
  • Calculate and report the most heavily loaded branches
benchflow-ai/skillsbench18702026年10月24日 更新

Prepare academic PDFs for blind review by removing matching identifying details before the References section. The skill focuses redaction on specific text matches, preserves references and self-citations, and checks that the saved document retains its pages and most of its text.

中文简介正在准备中。当前显示英语简介。

  • Anonymizing an academic paper for blind review
  • Removing author names and affiliations from a PDF
  • Checking a redacted paper for text loss
benchflow-ai/skillsbench18702026年10月24日 更新

Check bathroom floor plans against simplified ADA-derived geometric rules for turning space, door width and swing, toilet placement, grab bars, and lavatory knee or toe clearance. It reports rule-specific violations and suggests local, traceable layout repairs.

中文简介正在准备中。当前显示英语简介。

  • Check turning space in a bathroom plan
  • Review door width and swing clearances
  • Verify toilet and grab bar placement
benchflow-ai/skillsbench18702026年10月24日 更新

Reviews failed GitHub Actions job logs for a pull request or specific job URLs. It returns a concise summary of the likely root cause, error messages, test names, and relevant log excerpts, so you can see what needs attention.

中文简介正在准备中。当前显示英语简介。

  • Summarizing failed CI jobs for a pull request
  • Investigating an individual GitHub Actions job
  • Finding the error and related test in logs
benchflow-ai/skillsbench18702026年10月24日 更新

Extract plan-view geometry from architectural DXF files by interpreting CAD layers and geometric entities. Normalize rooms, doors, fixtures, clearances, and grab bars into consistent, machine-checkable JSON, and describe repaired geometry in a new DXF when needed.

中文简介正在准备中。当前显示英语简介。

  • Turning an architectural DXF plan into structured JSON
  • Checking room and door geometry for accessibility
  • Extracting fixture bounds and grab bar details
benchflow-ai/skillsbench18702026年10月24日 更新

查看 benchflow-ai 的全部技能

报告此技能的问题