Modbusãããã³ã«ã¯ã
M2Méä¿¡çšã®æãäžè¬çãªæ¥çãããã³ã«ã§ãã ããã¯äºå®äžã®æšæºã§ãããç£æ¥æ©åšã®ã»ãŒãã¹ãŠã®ã¡ãŒã«ãŒã«ãã£ãŠãµããŒããããŠããŸãã
ãã®æ±çšæ§ãšéæŸæ§ã«ããããã®èŠæ Œã§ã¯ããŸããŸãªã¡ãŒã«ãŒã®æ©åšãçµ±åã§ããŸãã Modbusã¯ãã»ã³ãµãŒããã®èªã¿åãå€ã®åéããªã¬ãŒãšã³ã³ãããŒã©ãŒã®å¶åŸ¡ãç£èŠãªã©ã«äœ¿çšãããŸãã
ãã®èšäºã§ã¯ãModbusãããã³ã«ã®å®è£
ãããŒã¿åœ¢åŒããããã³ã«ãæäœããããã®ãœãããŠã§ã¢ãåæããŸãã å®éã«ããã€ã¹ããããŒã¿ãèªã¿åã£ãŠã¿ãŸãããã
Modbusã®æŽå²
Modbusã¯1979幎ã«ModiconïŒçŸåšã®Schneider ElectricïŒã«ãã£ãŠå°å
¥ãããŸããã RS-232ã€ã³ã¿ãŒãã§ãŒã¹ã§åäœãããªãŒãã³ã¹ã¿ã³ããŒãã§ããã åŸã«ãRS-485ããã³Modbus TCPã€ã³ã¿ãŒãã§ãŒã¹ã®ãããã³ã«å®è£
ãç»å ŽããŸããã ãã®ãããã³ã«ã¯ããã«äººæ°ãåããå€ãã®ã¡ãŒã«ãŒãããã€ã¹ã«å®è£
ãå§ããŸããã
ãã®åŸããããã³ã«ã®æš©å©ã¯éå¶å©çµç¹
Modbus Organizationã«ç§»ç®¡ãããŸãã
ãModbusOrganizationã¯ä»æ¥ãŸã§æšæºãææããŠããŸãã
ModbusèŠæ Œã§ã¯ã
ã©ããŒããžãã¯ãã掟çããçšèªã䜿çšããŠããŸãã ãããã£ãŠãããšãã°ãäžéšã®ã¬ãžã¹ã¿ã¯ã³ã€ã«ïŒè±èªã³ã€ã«ïŒãšåŒã°ããŸãã
身äœã¬ãã«
- RS-232 / 422/485ã¯ãæ¥çã§åºã䜿çšãããŠããã·ãªã¢ã«ã€ã³ã¿ãŒãã§ã€ã¹ã§ãã RS-422 / 485ã€ã³ã¿ãŒãã§ãŒã¹ã¯ãæ倧1200ã¡ãŒãã«ã®ä¿¡å·ç¯å²ãæäŸããŸãã 䜿çšãããModbus RTU / ASCIIãããã³ã«
- TCP / IPãããã¯ãŒã¯ -ã€ãŒãµãããã€ã³ã¿ãŒãã§ã€ã¹ã¯ç©çããŒã¿äŒéãã£ãã«ã«ãªããŸãã Modbus TCPãããã³ã«ã®äœ¿çš
è«çã¬ãã«
Modbusãããã³ã«ã®éãModbus ASCII
ããŒã¿ã¯ASCIIããŒãã«ã®æåã§ãšã³ã³ãŒãããã16é²åœ¢åŒã§éä¿¡ãããŸãã åãã±ããã®éå§ã¯ã³ãã³ã§ç€ºãããçµäºã¯ãã£ãªããžãªã¿ãŒã³ãšã©ã€ã³ãã£ãŒãã§ç€ºãããŸãã ããã«ãããé
延ãé·ãåç·ãã¿ã€ããŒã®ç²ŸåºŠãäœãæ©åšã§ãããã³ã«ã䜿çšã§ããŸãã
Modbus RTU
Modbus RTUãããã³ã«ã§ã¯ãããŒã¿ã¯ãã€ããªåœ¢åŒã§ãšã³ã³ãŒããããæéééã¯ãã±ããã»ãã¬ãŒã¿ãŒãšããŠæ©èœããŸãã ãã®ãããã³ã«ã¯é
延ã«ãšã£ãŠéèŠã§ãããããšãã°ã¢ãã åç·ã§ã¯æ©èœããŸããã åæã«ãã¡ãã»ãŒãžã®é·ããçããããããŒã¿è»¢éã®ãªãŒããŒãããã¯Modbus ASCIIãããå°ãããªããŸãã
Modbus TCP
ãã±ããæ§é ã¯Modbus RTUã«äŒŒãŠãããããŒã¿ããã€ããªåœ¢åŒã§ãšã³ã³ãŒããããIPãããã¯ãŒã¯ã§ã®éä¿¡çšã«éåžžã®TCPãã±ããã«ããã±ãŒãžåãããŸãã TCPã«ã¯ãã§ã«ç¬èªã®æŽåæ§å¶åŸ¡ã¡ã«ããºã ããããããModbus RTUã§äœ¿çšãããæŽåæ§ãã§ãã¯ã¯é©çšãããŸããã
ããã±ãŒãžåœ¢åŒ
ããŸããŸãªModbuså®è£
ã®ããã±ãŒãžåœ¢åŒãã¹ãŠã®Modbusããã€ã¹ã¯ããã¹ã¿ãŒã¹ã¬ãŒãã¢ãã«ã«åŸã£ãŠéä¿¡ããŸãã èŠæ±ã¯ãã¹ã¿ãŒããã€ã¹ã«ãã£ãŠã®ã¿éå§ã§ããã¹ã¬ãŒãã¯èŠæ±ã«ã®ã¿å¿çã§ããèªåã§ããŒã¿è»¢éãéå§ããããšã¯ã§ããŸããã ãããã³ã«ã®å®è£
ã«å¿ããŠããã±ããããããŒã¯ç°ãªããŸãã ç¥ã£ãŠããã¹ãéèŠãªããã±ãŒãžã®äž»ãªã³ã³ããŒãã³ãã¯æ¬¡ã®ãšããã§ãã
ADUïŒã¢ããªã±ãŒã·ã§ã³ããŒã¿ãŠãããïŒ -ãã¹ãŠã®ããããŒãPDUããã§ãã¯ãµã ãã¢ãã¬ã¹ãããŒã¯ã³ãå«ãModbusããã±ãŒãžå
šäœã ãããã³ã«ã®å®è£
ã«ãã£ãŠç°ãªããŸãã
PDUïŒãããã³ã«ããŒã¿ãŠãããïŒ -ããã±ãŒãžã®äž»èŠéšåããããã³ã«ã®ãã¹ãŠã®å®è£
ã§åãã§ãã ãã€ããŒãèªäœãå«ãŸããŸãã
ããã€ã¹ã¢ãã¬ã¹-åä¿¡è
ãã€ãŸãã¹ã¬ãŒãããã€ã¹ã®ã¢ãã¬ã¹ã Modbusãããã¯ãŒã¯ã®1ã€ã®ã»ã°ã¡ã³ãã«æ倧247å°ã®ããã€ã¹ãé
眮ã§ããŸãã ã¹ã¬ãŒãã®ã¿ãç°ãªãã¢ãã¬ã¹ãæã¡ããã¹ã¿ãŒã¯ã¢ãã¬ã¹ãæã¡ãŸããã ã¢ãã¬ã¹ã0ãã¯ãã¹ã¿ãŒããã®ãããŒããã£ã¹ãèŠæ±ã«äœ¿çšãããŸãããã¹ã¬ãŒãã¯ãããã®ãããŒããã£ã¹ããã±ããã«å¿çã§ããŸããã
ãã§ãã¯ãµã -ãã±ããæŽåæ§ãã§ãã¯ã¢ã«ãŽãªãºã ã Modbus RTUããã³ASCIIã¯2ãã€ãã®ãã§ãã¯ãµã ã䜿çšããŸãã Modbus RTUã¯CRC16ã¢ã«ãŽãªãºã ã䜿çšããModbus ASCIIã¯ããã·ã³ãã«ã§ä¿¡é Œæ§ã®äœãLRC8ã䜿çšããŸãã Modbus TCPã§ã¯ãTCPã¬ãã«ã§æŽåæ§ããã§ãã¯ãããããããã§ãã¯ãµã ã¯ADUã«è¿œå ãããŸããã
ãããã³ã«ã®åã
ã®å®è£
ã«åºæã®è¿œå ã®ããããŒã¯åæããŸãããããã¯ãã¢ããªã±ãŒã·ã§ã³ã¬ãã«ã§ãããã³ã«ãæäœããå Žåã¯éèŠã§ã¯ãªãããã§ãã
Modbusã¬ãžã¹ã¿ãšæ©èœ
ç°¡ç¥åããã圢åŒã§ã¯ãModbusãªã¯ãšã¹ãã®æ§é ã¯ãæ©èœã³ãŒãïŒèªã¿åã/æžã蟌ã¿ïŒãšãèªã¿åããŸãã¯æžã蟌ã¿ãå¿
èŠãªããŒã¿ã§æ§æãããŸãã åæã«ãæ©èœã³ãŒãã¯ããŒã¿åããšã«ç°ãªããŸãã ã¬ãžã¹ã¿ãšã¯äœããããããæäœããããã®æ©èœãåæããŸãã
- é¢æ£å
¥å -ããã€ã¹ã®é¢æ£å
¥åã¯èªã¿åãå°çšã§ãã ã¬ãžã¹ã¿ã¢ãã¬ã¹ã®ç¯å²ïŒ10001ãã19999ããããã¯æ©èœã02ããæã£ãŠããŸã-ã¬ãžã¹ã¿ã®ã°ã«ãŒããèªã¿åããŸã
- ã³ã€ã« -ããã€ã¹ã®åå¥åºåããŸãã¯å
éšå€ã èªã¿æžããå¯èœã§ãã ã¬ãžã¹ã¿ã¢ãã¬ã¹ã®ç¯å²ã¯20001ã29999ã§ããæ©èœã¯æ¬¡ã®ãšããã§ããã01ã-ã¬ãžã¹ã¿ã°ã«ãŒãã®èªã¿åããã05ã-åäžã¬ãžã¹ã¿ã®æžã蟌ã¿ãã15ã-ã¬ãžã¹ã¿ã°ã«ãŒãã®æžã蟌ã¿
- å
¥åã¬ãžã¹ã¿ -16ãããããã€ã¹å
¥åã èªã¿åãå°çšã ã¬ãžã¹ã¿ã¢ãã¬ã¹ã®ç¯å²ïŒ30001ã39999ãæ©èœããïŒ "04"-ã¬ãžã¹ã¿ã®ã°ã«ãŒããèªã¿åããŸãã
- ä¿æã¬ãžã¹ã¿ -16ãããããã€ã¹åºåããŸãã¯å
éšå€ã èªã¿æžããå¯èœã§ãã ã¬ãžã¹ã¿ã¢ãã¬ã¹ã®ç¯å²ïŒ40001ã49999ã
ååã«ãããããããå
¥åãšåºåã¯å®éã«ã¯å
éšå€æ°ã§ããããã«ãŠã³ã¿ãŒããã©ã°ãæ ŒçŽããããå¶åŸ¡ããªã¬ãŒã§ããå¯èœæ§ããããŸãã ä»ã®ç¯å²ã®ã¬ãžã¹ã¿ããããŸããã倧éšåã®ããã€ã¹ã§ã¯äœ¿çšãããªãããã4ã€ã®äž»èŠãªã¿ã€ãã®ã¬ãžã¹ã¿ãæ€èšããŸãã ããã€ã¹ãç°ãªãã°ãç°ãªãã¬ãžã¹ã¿ç¯å²ã䜿çšããããšããäžåºŠã«ãã¹ãŠäœ¿çšããããšãã§ããŸãã
äœæ¥äŸ
Modbus TCPãããã³ã«ã䜿çšããäŸã«ã€ããŠã¯ãRubyã§æžãããæãåçŽãªã³ã³ãœãŒã«ãŠãŒãã£ãªãã£
modbus-cliã䜿çšããŸãã Modbusã¬ãžã¹ã¿ãžã®ããŒã¿ã®èªã¿æžããç°¡åã«ããŸãã
ç£æ¥çšã¹ã€ããAdvantech EKI-5524SSIã§éä¿¡ããããã±ããã®ã«ãŠã³ã¿ãŒã®ã¹ããŒã¿ã¹ãèªã¿åã£ãŠã¿ãŸãããã ãŸããå¿
èŠãªæ
å ±ãä¿åããã¬ãžã¹ã¿ã®ã¢ãã¬ã¹ã決å®ããå¿
èŠ
ããããŸãã
ãã®ããã«ã¯ãããã€ã¹ã®
ããã¥ã¡ã³ããã芧ãã ããã ã¬ãžã¹ã¿ã®èª¬æã¯ãModbusãããã³ã°ããŒãã«ã»ã¯ã·ã§ã³ã«ãããŸãã
EKIã¹ã€ããã®ããã¥ã¡ã³ãã®ã¬ãžã¹ã¿å€ã®èª¬æ1ã€ã®ããŒãã®éä¿¡ãã±ããã®å€ã¯4ã€ã®ã¬ãžã¹ã¿ã«æ ŒçŽãããæåã®ããŒãã®å Žåã¯ã¬ãžã¹ã¿38193ã38197ã§ããããšãããããŸããããŒã¿æ ŒçŽåœ¢åŒã«ã€ããŠã説æããŸãã 0xAB4130ãšããŠãå³ããå·Šã«æžãããŠããŸãã
ãªã¯ãšã¹ããããïŒ
$ modbus read 192.168.0.17 38193 4 38193 0x0000 38194 0x0000 38195 0x0000 38196 0x3459
readã¯
èªã¿åãã³ãã³ãã§ãã ããã°ã©ã èªäœã¯ãã¬ãžã¹ã¿ã®ã¢ãã¬ã¹ã«å¿ããŠã䜿çšããç¹å®ã®èªã¿åãã³ãã³ããèªèããŸãããã®å Žåãã04ãã³ãã³ãã䜿çšããŠ16ãããã¬ãžã¹ã¿ãèªã¿åããŸãã
192.168.0.17-ããã€ã¹ã®IPã¢ãã¬ã¹ã
38193-ã¬ãžã¹ã¿ã®éå§ã¢ãã¬ã¹ã
4-éå§ã¢ãã¬ã¹ããã®ãªãã»ããã ããŒã¿ã·ãŒããã次ã®ããã«ãããŒã1ã®4ã€ã®ã¬ãžã¹ã¿ãèªã¿åããŸãã
4ã€ã®ã¬ãžã¹ã¿ã®å€ãå«ãåçãåŸãããŸãã ãã±ããæ°ãå°ãªãããšãããããŸãïŒ0x3459ãã€ãŸã13401-ã¹ã€ããã¯æè¿ãªã³ã«ãªããŸããã
Modbusãããã³ã«ã®æ¬ ç¹
å
¬å¹³ã«ã¯ããããã³ã«ã®æ¬ ç¹ã«èšåãã䟡å€ããããŸãã 40幎以äžåã«éçºããããããããã»ããµã®ããã©ãŒãã³ã¹ã倧å¹
ã«äœäžããããŒã¿ä¿è·ãèæ
®ããã«ãããã³ã«ãéçºããããããå€ãã®ãã€ãã¹é¢ããããŸãã
- ãã®ãããã³ã«ã¯ãéä¿¡ããŒã¿ã®èªèšŒãšæå·åãæäŸããŸããã ãããã£ãŠãModbus TCPã䜿çšããå Žåãè¿œå ã®VPNãã³ãã«ã䜿çšããå¿
èŠããããŸãã
- ã¹ã¬ãŒãããã€ã¹ã¯ããŒã¿è»¢éãéå§ã§ããªãããããã¹ã¿ãŒã¯åžžã«ã¹ã¬ãŒããããŒãªã³ã°ããå¿
èŠããããŸã
- ã¹ã¬ãŒãããã€ã¹ã¯ããã¹ã¿ãŒãšã®æ¥ç¶ã®åªå€±ãæ€åºã§ããŸããã ãã®åé¡ã¯åã®åé¡ããçŽæ¥ç¶ããŸãã
ãããããã¹ãŠã®æ¬ ç¹ã«ãããããããModbusã¯äŸç¶ãšããŠæãäžè¬çãªç£æ¥çšãããã³ã«ã§ããããã®ãªãŒãã³æ§ã®ãããã§ãç°ãªãã¡ãŒã«ãŒã®ããã€ã¹ãç°¡åã«çµã¿åãããããšãã§ããŸãã ãªãœãŒã¹èŠä»¶ãäœãããããããã³ã«ãæãäœé»åã®ããã€ã¹ã«çµ±åã§ããŸãã
Modbus察å¿ããŒããŠã§ã¢
ã¢ããã³ããã¯ã¯ãèªååãå¶åŸ¡ãããŒã¿åéãäŒéãªã©ã®ããããã¿ã¹ã¯ããµããŒãããModbusãããã³ã«ãåããå¹
åºãç£æ¥æ©åšãæäŸããŠããŸãã
ADAM-6000ããã³WISE-4000-ãªã¢ãŒãI / Oã¢ãžã¥ãŒã«
ADAM-6000ããã³
WISE-4000ã·ãªãŒãºã®ã¢ãžã¥ãŒã«ã䜿çšãããšãModbus TCPãããã³ã«ã䜿çšããŠããžã¿ã«ããã³ã¢ããã°ã®å
¥åºåããªã¢ãŒãã§å¶åŸ¡ã§ããŸãã åšèŸºæ©åšãå¶åŸ¡ããã¹ã¬ãŒãã¢ãŒãã§ããŒã¿ãåéããããã«äœ¿çšãããŸãã ããã°ã©ããã«ããžãã¯ã³ã³ãããŒã©ãŒãšãã¢ã«ããããšããSCADAãµãŒããŒã«çŽæ¥æ¥ç¶ããããšãã§ããŸãã â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â
EKI-1200-ã€ã³ã¿ãŒãã§ãŒã¹å€æçšã®Modbusã²ãŒããŠã§ã€
Modbus RTU / ASCIIãããã³ã«ãModbus TCPã«å€æããã«ã¯ãModbusã²ãŒããŠã§ã€ã䜿çšãããŸãã
EKI-1200ã·ãªãŒãºã®ããã€ã¹ã«ã¯ãæ倧4ã€ã®ã·ãªã¢ã«RS-232 / 422/485ã€ã³ã¿ãŒãã§ãŒã¹ãš2ã€ã®ã€ãŒãµãããããŒããæèŒãããŠããŸãã ãããã䜿çšãããšãç°ãªããããã³ã«ã®ããã€ã¹ã1ã€ã®ãããã¯ãŒã¯ã«çµåã§ããŸãã ããšãã°ãRS-485ã€ã³ã¿ãŒãã§ãŒã¹ãä»ããŠModbus RTUã®ã¿ããµããŒãããã¹ã¬ãŒãããã€ã¹ãModbus TCPãããã¯ãŒã¯ã»ã°ã¡ã³ãã«æ¥ç¶ããŸãã
ã³ã³ãããŒã©ãŒã¯ãã¹ã¬ãŒã/ãã¹ã¿ãŒããã³Modbus TCPã¯ã©ã€ã¢ã³ã/ãµãŒããŒãšããŠModbus RTUæ©èœããµããŒãããŸãã
å¿çšäŸ
枩宀ç£èŠã·ã¹ãã
ã¢ããã³ããã¯ã®ç£èŠãœãªã¥ãŒã·ã§ã³ã¯ãTPC-1070HãADAM-6024ãADAM-6050ãADAM-6060ãããã³WebAccessãœãããŠã§ã¢ã蟲å°ã®é£ã®æ©æ¢°ãã£ããããã«çµ±åããŸãã ããŸããŸãªææãªããã€ã¹ã«æ¥ç¶ããããšã§ãADAM-6000ã¢ãžã¥ãŒã«ã¯ãªã¢ã«ã¿ã€ã ã®ç°å¢ããŒã¿ãåä¿¡ããæ©åšã®åãæ¿ããç£èŠããŠã枩宀ãæ€ç©ã®æé·ã«æé©ãªç°å¢ã«ããããšã確èªã§ããŸãã ã¢ããã³ããã¯ã®ç¹å¥ãªæ©èœã§ããã°ã©ãã£ã«ã«æ¡ä»¶ããžãã¯ïŒGCLïŒã«ããããŠãŒã¶ãŒã¯ç¬èªã®å¶åŸ¡ããžãã¯ã«ãŒã«ãå®çŸ©ãããããã®ã«ãŒã«ãADAM-6000ã€ãŒãµãããI / Oã¢ãžã¥ãŒã«ã«ããŒããããšãã¢ãžã¥ãŒã«ã¯ã¹ã¿ã³ãã¢ãã³ã¢ãžã¥ãŒã«ã®ãããªè«çã«ãŒã«ãèªåçã«å®è¡ããŸãã ã³ã³ãããŒã©ãŒã å¥ã®æ©èœ-ãã¢ããŒãã¢ïŒP2PïŒã¯ãæããªãŒãã³ã§æè»ãªã€ãŒãµããããããã¯ãŒã¯ã䜿çšããŠãã³ã³ãããŒã©ãŒãªãã§å®è£
ããã»ã¹ãç°¡çŽ åããã ãã§ãªããããŒããŠã§ã¢ã³ã¹ããç¯çŽããŸãã
ãã¹ãŠã®åä¿¡ããŒã¿ã¯ãTPC-1070Hã¿ããããã«ãåããã³ã³ãã¥ãŒã¿ãŒã«ã€ãŒãµãããçµç±ã§éä¿¡ãããŸãã ãã¡ã³ã¬ã¹å·åŽã·ã¹ãã ãšIP65ã«æºæ ããããã³ãããã«ãåããTPC-1070Hã¯ãå€åããåäœç°å¢ã«é©ããå
ç¢ã§ã³ã³ãã¯ããªãã¶ã€ã³ã§ããããã®åŒ·åãªã³ã³ãã¥ãŒãã£ã³ã°æ©èœã¯å€§éã®ããŒã¿ãåŠçã§ããŸãã ããã€ã¹ã管çããããã«ãAdvantech WebAccessã䜿çšãããšããšã³ãžãã¢ããããŒãžã£ãŒã¯ãã¿ãã¬ãããã¹ããŒããã©ã³ãªã©ã®ããã€ã¹ããæšæºã®Webãã©ãŠã¶ãŒã䜿çšããŠãã€ã³ãã©ããããŸãã¯ã€ã³ã¿ãŒãããçµç±ã§ç£èŠã·ã¹ãã ã衚瀺ãç£èŠãããã³æ§æã§ããŸãã
倪éœç±æž©æ°Žã·ã¹ãã ã®ç£èŠ
ãšã³ãžãã¢ãªã³ã°äŒç€Ÿã¯ãæ°ããéçºããããœãŒã©ãŒããã«ã«ãã£ãŠæäŸããããªãªã³ããã¯ãµã€ãºã®ããŒã«çšã®å€ªéœç±æž©æ°Žã·ã¹ãã ã®å€ªéœãšãã«ã®ãŒã枩床ãããã³æ°Žã®æµéãå¶åŸ¡ã§ããªããã°ãªããŸããã§ããã ãŸãããããã®å€ãšã¢ã©ãŒã ãLCDããã«ã§çŽæ¥è¿œè·¡ããå°æ¥ã®åç
§ã®ããã«ãããã®å€ãä¿åã§ããå¿
èŠããããŸãã
Advantech Adamã¢ãžã¥ãŒã«ã¯ãRS485ãä»ããŠæ¥ç¶ãããããŒã¿åéã¢ãžã¥ãŒã«ãšããã¹ãŠã®ã»ã³ãµãŒããããŒã¿ãéä¿¡ããããã®2ç·åŒãã¹ãå©çšãããœãªã¥ãŒã·ã§ã³ã顧客ã«æäŸããŸããã ãã®ã·ã¹ãã ã¢ãŒããã¯ãã£ã«ã¯ãäž»ã«2ã€ã®å©ç¹ããããŸãã1ã€ç®ã¯ããã€ã§ãããŒã¿åéã¢ãžã¥ãŒã«ã«ã»ã³ãµãŒãè¿œå ã§ããããšã§ãã2ã€ç®ã¯ãPCã§ãããã®å€ãç£èŠããã³èšé²ããããã®ã¿ã°ããœãããŠã§ã¢ã«è¿œå ããããšã¯éåžžã«ç°¡åã§ãã