OMRON FINS 드라이버
개요
OMRON FINS over TCP. OMRON 의 공식 매뉴얼 (W342, W421) 의 wire spec 만으로 외부 라이브러리 / 외부 프로세스 의존 없이 동작하는 자체 자바 구현.
| 항목 | 값 |
|---|---|
opc_type | FINS |
| 구현 클래스 | plantpulse.driver.protocol.fins.FINSDriver |
| 라이브러리 | (없음 — 자체 구현. OMRON W342/W421) |
| read | 양호 (Memory Area Read 0101) |
| write | 양호 (Memory Area Write 0102) |
| 디폴트 포트 | 9600 |
| 보안 | 없음 |
클래스 / 구조
FINSDriver (BaseProtocolDriver)
├── Socket — host:9600
├── clientNode/serverNode — connect() 의 Auto-Assign 응답에서 획득
├── sid — 0~255 순환 (요청-응답 매칭, 0 회피)
├── ParsedAddr — areaChar, wordAddr, bit
├── putBeInt / beInt — 4-byte big-endian helper
└── memAreaRead / memAreaWrite — synchronized
connect() 시 FINS/TCP Node Address Auto-Assign (CIP cmd=0) 으로 client/server 노드를 발급받습니다.
wire 포맷 요약
CIP 헤더 (16 byte, big-endian)
'F' 'I' 'N' 'S' | length(4) | command(4) | error(4)
command = 0Auto-Assign Request,=1Auto-Assign Response,=2FINS frame sendlength=command부터 끝까지의 byte 수
FINS 헤더 (10 byte)
ICF | RSV | GCT | DNA | DA1 | DA2 | SNA | SA1 | SA2 | SID
0x80 0x00 0x02 <dn> <sn> <du> <sn> <cn> <su> <sid>
ICF=0x80: 응답 요구- DA1 = 서버 노드, SA1 = 클라이언트 노드 (auto-assign 결과)
Memory Area Read (MRC=01 SRC=01)
01 01 | area(1) | addrHi addrLo | bit | countHi countLo
응답 = FINS 헤더(10) + 01 01 + MRES(1) SRES(1) + 데이터.
메모리 영역 코드
| 영역 | word 코드 | bit 코드 |
|---|---|---|
| CIO | 0xB0 | 0x30 |
| W (Work) | 0xB1 | 0x31 |
| H (Holding) | 0xB2 | 0x32 |
| A (Auxiliary) | 0xB3 | 0x33 |
| D (DM) | 0x82 | 0x02 |
| Timer / Counter PV | 0x89 | 0x09 (완료 flag) |
wordAreaCode(char) / bitAreaCode(char) 가 변환.
OPC 등록 옵션 (options)
| 키 | 의미 | 디폴트 |
|---|---|---|
dna | Destination Network Address | 0 |
da2 | Destination Unit | 0 |
sna | Source Network Address | 0 |
sa2 | Source Unit | 0 |
connect-timeout | ms | 3000 |
read-timeout | ms | 3000 |
태그 주소 형식
| 표기 | 의미 |
|---|---|
D100 | DM 100 (16-bit word) |
D100.05 또는 D100/5 | DM 100 의 bit 5 |
H0.05 | Holding bit |
CIO10 | CIO word |
W50 | Work word |
format 키워드 (대문자):
| format | 의미 |
|---|---|
X / BIT | bit |
W / WORD | signed 16 |
UI / UW / UWORD | unsigned 16 |
DW / DWORD | signed 32 (low word first) |
UDW / DUW / UDWORD | unsigned 32 |
LW / LWORD | signed 64 |
REAL / FLOAT | IEEE 32-bit |
LREAL / DOUBLE | IEEE 64-bit |
BIN[n] | word 의 n번 비트 추출 |
32/64-bit 멀티-워드는 OMRON 컨벤션을 따라 low word first.
지원 / 미지원
- ✅ Memory Area Read / Write (MRC=01 SRC=01/02)
- ✅ Bit / Word / DWord / LWord / Float / Double
- ✅ FINS/TCP Auto-Assign 핸드셰이크
- ❌ Multiple Memory Area Read (MRC=01 SRC=04)
- ❌ Program Area / Parameter Area / Clock 명령
- ❌ FINS over UDP
테스트 커버리지
test/java/plantpulse/driver/protocol/fins/
| 클래스 | 테스트 수 |
|---|---|
FINSDriverTest | 38 |
총 38 테스트 — 주소 파싱, 영역 코드 매핑, 워드 디코딩, 핸드셰이크 시뮬레이션 등.
참고
- OMRON W342 FINS Communications Reference Manual
- OMRON W421 CS/CJ Series Communications Commands Reference
- 코드:
src/plantpulse/driver/protocol/fins/FINSDriver.java