OMRON FINS ドライバ
概要
OMRON FINS over TCP。OMRON の公式マニュアル (W342、W421) の wire spec のみで、外部ライブラリ / 外部プロセスに依存せず動作する独自 Java 実装。
| 項目 | 値 |
|---|---|
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