SECS/GEM HSMS 드라이버
개요
반도체 fab 장비 통신 표준 (SEMI E5/E30/E37). HSMS = SECS-II over TCP. equipment ↔ host 간 S/F (Stream/Function) 메시지 교환으로 장비 상태 / alarm / event report 를 수집.
| 항목 | 값 |
|---|---|
opc_type | SECSGEM |
| 구현 클래스 | plantpulse.driver.protocol.secsgem.SECSGEMDriver |
| 라이브러리 | 자체 자바 구현 (외부 의존 없음) |
| read | ⚠️ 1차 (Select handshake + S1F1/S1F2 등 fixture-level) |
| write | ⚠️ 1차 (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.
클래스 구조
| 클래스 | 역할 |
|---|---|
SECSGEMDriver | TCP / Select handshake / read·write 디스패치 / 백그라운드 Linktest |
HsmsHeader | 14-byte 프레임 헤더 (length BE 32 + sessionId 16 + W-bit·stream + function + pType + sType + sysbytes BE 32) |
HsmsMessage | encode/decode + select_req(1) / select_rsp(2) / linktest_req(5) / data(0) helper |
SecsItem | SECS-II item 인코더/디코더 — format byte (6-bit code + 2-bit length-byte count) + length + value |
SecsCommon | 표준 메시지 빌더 — S1F1, S1F2, S2F41, S5F1, S6F11 |
SecsAddress | S<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 (default 30 초) 마다 Linktest.req 송신.
OPC 등록 옵션
| 필드 | 의미 | 디폴트 |
|---|---|---|
opc_agent_ip / opc_agent_port | 장비 IP / 포트 | port 0이면 5000 |
options.connect-timeout | TCP connect 타임아웃 (ms) | 5000 |
options.read-timeout | read SO 타임아웃 (ms) | 10000 |
options.linktest-interval | Linktest 주기 (ms, 0=off) | 30000 |
태그 plc_address 형식
| 표기 | 의미 |
|---|---|
S1F1 | "Are You There" — empty body, reply expected |
S1F2:0 | reply List 의 0번째 자식 (예: MDLN) |
S1F2:1 | 1번째 자식 (예: SOFTREV) |
S1F13 | Establish Communications Request |
S2F41 | Host Command Send (write 전용) |
S5F1 / S6F11 | Alarm 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 data, S6F11 event report 비동기 수신 — 단일 receive 만, 비동기 push handler 없음.
- Deselect / Reject / Separate sType.
- 데이터 메시지 → ConcurrentMap 캐시 — 현재 read 가 매 호출마다 새 transaction.
테스트 커버리지
test/java/plantpulse/driver/protocol/secsgem/
| 테스트 | 검증 |
|---|---|
HsmsHeaderTest | 14-byte 헤더 + sType 분기 round-trip |
HsmsMessageTest | select_req/rsp/linktest/data encode-decode |
SecsItemTest | L/A/B/Bool/I/U/F item codec 양방향 (1/2/3-byte length) |
SecsCommonTest | S1F1/S1F2/S2F41/S5F1/S6F11 빌드/파싱 |
SecsAddressTest | S<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 — 1차에선 장비 connect / S1F1 ping / 알람 list 수집 정도 권장.