跳到主要内容

SECS/GEM HSMS 驱动

概述

半导体 fab 设备通信标准 (SEMI E5/E30/E37)。HSMS = SECS-II over TCP。通过 equipment ↔ host 之间的 S/F (Stream/Function) 消息交换来采集设备状态 / alarm / event report。

项目
opc_typeSECSGEM
实现类plantpulse.driver.protocol.secsgem.SECSGEMDriver
自研 Java 实现(无外部依赖)
read⚠️ 一期(Select handshake + S1F1/S1F2 等 fixture-level)
write⚠️ 一期(仅 S2F41 Host Command Send)
安全
默认端口5000 (TCP)
一期实现

已验证 HSMS Select.req/rsp 握手 + 后台 Linktest + SECS-II item codec (List/Binary/Boolean/ASCII/I1-8/U1-8/F4/F8) + 标准消息构建器 (S1F1/S1F2/S2F41/S5F1/S6F11)。 Read/Write 分发可正常工作,但完整的 fab tool 集成(SECS-I serial 变体、GEM state model、SVID/ECID/CEID 协商、S2F23 trace、S5/S6 事件异步接收)将在后续 phase 实现。


类结构

作用
SECSGEMDriverTCP / Select handshake / read·write 分发 / 后台 Linktest
HsmsHeader14-byte 帧头 (length BE 32 + sessionId 16 + W-bit·stream + function + pType + sType + sysbytes BE 32)
HsmsMessageencode/decode + select_req(1) / select_rsp(2) / linktest_req(5) / data(0) helper
SecsItemSECS-II item 编码器/解码器 — format byte (6-bit code + 2-bit length-byte count) + length + value
SecsCommon标准消息构建器 — S1F1, S1F2, S2F41, S5F1, S6F11
SecsAddressS<n>F<m>[W] 地址解析器 (W = reply expected)

Wire 格式

HSMS frame (총 length = 4 + 10 + payload):
byte 0..3 Length (BE 32) — 10 + payload
byte 4..5 Session ID (BE 16) — 컨트롤 메시지는 0xFFFF
byte 6 W-bit | Stream (7-bit)
byte 7 Function (8-bit)
byte 8 pType — 항상 0
byte 9 sType — 0=Data, 1=Select.req, 2=Select.rsp, 5=Linktest.req, 6=Linktest.rsp, ...
byte 10..13 System bytes (BE 32) — transaction id
byte 14.. SECS-II payload

SECS-II item:
Format byte (6-bit code + 2-bit length-bytes-count) + length(1..3) + value
code: L=0x00, B=0x08, Bool=0x09, A=0x10, F8=0x14, F4=0x15,
I8=0x18 I1=0x19 I2=0x1A I4=0x1B,
U8=0x1C U1=0x1D U2=0x1E U4=0x1F (모두 BE)

握手 (connect()):Select.req(sysbytes) → 校验 Select.rsp 的 sType=2 + status=0。 之后按选项 linktest-interval(默认 30 秒)周期发送 Linktest.req。


OPC 注册选项

字段含义默认值
opc_agent_ip / opc_agent_port设备 IP / 端口port 为 0 时使用 5000
options.connect-timeoutTCP connect 超时 (ms)5000
options.read-timeoutread SO 超时 (ms)10000
options.linktest-intervalLinktest 周期 (ms, 0=off)30000

标签 plc_address 格式

表示法含义
S1F1"Are You There" — empty body, reply expected
S1F2:0reply List 的第 0 个子项(例:MDLN)
S1F2:1第 1 个子项(例:SOFTREV)
S1F13Establish Communications Request
S2F41Host Command Send(仅 write)
S5F1 / S6F11Alarm Report / Event Report(接收侧)

W 后缀 (S1F1W) 表示期待 reply。read 分发仅对 S1F1 自动构建 body,其余以 empty body + W-bit=true 发送。

write 仅支持 S2F41:将 address.value 作为 HCS command 字符串,parameter 为空 list。


未支持范围

  • SECS-I (RS-232 binary) 变体 — 仅支持 HSMS over TCP。
  • GEM state model — 未实现 Communications / Control / Processing / Spooling 自动化。
  • VID/ECID/CEID 协商 — 无 S2F13 / S2F33 / S2F37 事件 link/enable 序列自动化。
  • S2F23 trace dataS6F11 event report 异步接收 — 仅单次 receive,无异步 push handler。
  • Deselect / Reject / Separate sType。
  • 数据消息 → ConcurrentMap 缓存 — 当前 read 每次调用都会新建 transaction。

测试覆盖

test/java/plantpulse/driver/protocol/secsgem/

测试验证内容
HsmsHeaderTest14-byte 头 + sType 分支 round-trip
HsmsMessageTestselect_req/rsp/linktest/data encode-decode
SecsItemTestL/A/B/Bool/I/U/F item codec 双向 (1/2/3-byte length)
SecsCommonTestS1F1/S1F2/S2F41/S5F1/S6F11 构建/解析
SecsAddressTestS<n>F<m>[W] 解析器
SECSGEMDriverTest / SecsGemSpecTest使用 mock 设备的 Select + read 序列

参考

  • SEMI E5 — SECS-II Message Content。
  • SEMI E30 — Generic Equipment Model (GEM)。
  • SEMI E37 — High-Speed SECS Message Services (HSMS)。
  • 代码:plantpulse-edge-driver/src/plantpulse/driver/protocol/secsgem/
  • 运维:完整 fab tool 集成将在后续 phase — 一期建议仅用于设备 connect / S1F1 ping / 报警 list 采集。