安全互锁
许可协议: MIT OR Apache-2.0
待 CI 核验
智能机房
加热与制冷跨设备互锁,杜绝同时通电;带对端数据新鲜度校验与看门狗安全值回落。
/templates/smart-server-room/iot.yaml (MIT OR Apache-2.0)
# SPDX-FileCopyrightText: IoT Platform contributors
# SPDX-License-Identifier: MIT OR Apache-2.0
schema_version: project-spec/v1
project_name: Smart server room
timezone: UTC
products:
- schema_version: tsl/v1
product_id: room_hvac
version: "1.0.0"
display_name: Room HVAC controller
worst_case_latency_ms: 250
properties:
- {id: temperature, data_type: fixed_i64, scale: 1, unit: "°C", access: r, min_scaled: -400, max_scaled: 1000}
- {id: heater, data_type: bool, access: rw, safe_value: false, on_boot: safe_value, lease_max_ms: 60000, max_continuous_ms: 600000}
- {id: cooler, data_type: bool, access: rw, safe_value: false, on_boot: safe_value, lease_max_ms: 60000, max_continuous_ms: 600000}
events: []
services:
- {id: heat, risk: normal, inputs: {}, physical_writes: {heater: {constant: true}, cooler: {constant: false}}}
- {id: cool, risk: normal, inputs: {}, physical_writes: {heater: {constant: false}, cooler: {constant: true}}}
- {id: idle, risk: normal, inputs: {}, physical_writes: {heater: {constant: false}, cooler: {constant: false}}}
safety_invariants:
device_local:
interlocks:
- id: heat_cool_exclusion
forbidden_when_all_true:
- {property_id: heater, op: eq, value: true}
- {property_id: cooler, op: eq, value: true}
dwell_and_slew:
- {property_id: heater, min_dwell_sec: 15}
- {property_id: cooler, min_dwell_sec: 45}
release_ranges:
properties: {heater: {values: [false, true]}, cooler: {values: [false, true]}}
services: {heat: {allowed: true, params: {}}, cool: {allowed: true, params: {}}, idle: {allowed: true, params: {}}}
slots:
- slot_id: rack_room
product_ref: room_hvac@1.0.0
cardinality: single
alert_ranges: {temperature: {min_scaled: 160, max_scaled: 295}}
automation:
rules:
- id: cool_warm_room
enabled: true
execution_mode: shadow
trigger: {slot_id: rack_room, property_id: temperature, op: gte, value: 275}
action: {target_slot_id: rack_room, service_id: cool, params: {}}
- id: heat_cold_room
enabled: true
execution_mode: shadow
trigger: {slot_id: rack_room, property_id: temperature, op: lt, value: 175}
action: {target_slot_id: rack_room, service_id: heat, params: {}}
alerts:
- {id: room_temperature, slot_id: rack_room, severity: warn, for_duration_sec: 30, cooldown_sec: 300}
ui_templates:
- id: room_panel
target: device_panel
widgets:
- {type: gauge, label: Room temperature, binding: temperature}
- {type: status, label: Heating contactor, binding: heater}
- {type: status, label: Cooling contactor, binding: cooler}