在我們日常生活中絕大數用到的電表都是單相的,三相電表主要用於工業用途。今天我們將介紹單相智能電表(Modbus協議)的鏈接案例。
一、使用產品
- 海創Box智能采集網關
- 串口服務器 (上海卓嵐 4口 ZLAN5443A)
- modbus智能電表 (XT 微型RS485單相導軌電表220V DDS5188)
二、產品連接方式
三、產品配置
四、設備寄存器地址
五、項目部署調試
在桌面打開海創Box智能采集網關可視化開發平台進入可視化編輯器。本次教程需要用到如下節點,在左側節點欄中拖拽出使用
- inject周期性觸發輸入時間戳或者相應的字符
- Modbus用於讀取Modbus通信協議設備的數據
- debug用於調試節點輸出
配置相應節點后配置界面如下:
節點配置
- inject設置成周期性觸發,主要當觸發流程使用,具體配置如下圖
- Modbus需要設置串口服務器對應設備設置的相應端口以及ip,協議選擇Modbus-TCP,通訊模式選擇Telnet(透傳模式),該設備值為寄存器,使用功能碼FC4讀取數據,配置相應的寄存器地址和標簽以及數據處理規則即可,配置詳情如下圖
- debug在右側調試窗口輸出調試結果,無需配置
部署調試
按照以上教程配置好流程后,點擊部署,部署成功后程序開始運行,就會在調試窗口輸出相應的結果,調試結果如下
五、示例
以上教程可以通過拷貝下面代碼實現快速復用,在新建的流程中點擊界面右側菜單欄-導入-剪貼板,在文本框中粘貼下面代碼后點擊確定,即可快速復用。
[{"id":"18edc865.e61278","type":"inject","z":"f07ef040.fe124","name":"","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"onceDelay":"5","x":335,"y":420,"wires":[["53590ef.87eeaf"]]},{"id":"6a9ef38e.1edecc","type":"debug","z":"f07ef040.fe124","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":635,"y":420,"wires":[]},{"id":"53590ef.87eeaf","type":"iot-modbus","z":"f07ef040.fe124","name":"","server":"4cdb19a6.5b1728","fc":"HoldingRegister","columns":[{"Key":"40001","Label":"有功電能總和","UnitId":"5","Address":"1","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"},{"Key":"40003","Label":"電壓","UnitId":"5","Address":"2","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/100"},{"Key":"40004","Label":"電流","UnitId":"5","Address":"3","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/1000"},{"Key":"40006","Label":"有功功率","UnitId":"5","Address":"5","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"},{"Key":"40008","Label":"視在功率","UnitId":"5","Address":"7","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"},{"Key":"40010","Label":"無功功率","UnitId":"5","Address":"9","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"},{"Key":"40012","Label":"頻率","UnitId":"5","Address":"11","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/100"},{"Key":"40013","Label":"功率因素","UnitId":"5","Address":"12","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/1000"},{"Key":"40014","Label":"輸入有功電能","UnitId":"5","Address":"13","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"},{"Key":"40016","Label":"輸出有功電能","UnitId":"5","Address":"15","Quantity":"1","ValueType":"Int16BE","Arithmetic":"%s/10"}],"x":475,"y":420,"wires":[["6a9ef38e.1edecc"]]},{"id":"4cdb19a6.5b1728","type":"iot-modbus-client","z":"","name":"","clienttype":"Modbus-TCP","host":"192.168.7.203","post":"4196","tcptype":"Telnet","serialport":"COM1","serialtype":"RTU-Buffered","baudrate":"9600","databits":"8","stopbits":"1","parity":"None","unitid":"admin","timeout":"2000","sleep":"60","showActivity":true}]