海創IOT是基于圖形節點和流程的快速開發平臺,采用可視化編程方法,將預定義的代碼塊(稱為“節點”,Node)連接起來執行任務。連接的節點,通常是輸入節點、處理節點和輸出節點的組合,當他們連接在一起的時候,構成一個“流”(Flows),與傳統的程序開發工具相比,它更好地適應物聯場景。它可以與JavaScript和Node.js、C語言混合開發使用。基于這個平臺我們可以快速的實現西門子PLC數據的獲取
一、硬件環境
1、海創Box智能網關
2、西門子PLC
二、產品連接方式
三、產品配置
海創智能網關 請參考《海創智能網關設置》
**西門子PLC ** 配置好設備連接ip
四、項目部署調試
打開海創-IIoT。本次教程需要用到如下節點,在左側節點欄中拖拽出使用
定時器周期性觸發輸入時間戳或者相應的字符
S7西門子用于讀取S7西門子通信協議的設備數據
調試用于調試節點輸出
配置相應節點后配置界面如下:
節點配置:
定時器設置成周期性觸發,主要當觸發流程使用,具體配置如下圖
S7西門子設置如下配置,即可取到M區0.1的地址數據
調試在右側調試窗口輸出調試結果,無需配置
部署調試:
按照以上教程配置好流程后,點擊部署,部署成功后程序開始運行,就會在調試窗口輸出相應的結果,調試結果如下
[
{
"id": "3c9559.b5d63aa8",
"type": "iot-s7",
"z": "41f61d2.fbe09e4",
"name": "",
"server": "f0605fb0.3a733",
"columns": [
{
"Key": "2號跑馬燈",
"Label": "2號跑馬燈",
"Address": "M0.2",
"Arithmetic": ""
}
],
"x": 340,
"y": 380,
"wires": [
[
"1fa324c1.eb258b"
]
]
},
{
"id": "1421da2b.ec0216",
"type": "inject",
"z": "41f61d2.fbe09e4",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 240,
"y": 380,
"wires": [
[
"3c9559.b5d63aa8"
]
]
},
{
"id": "1fa324c1.eb258b",
"type": "debug",
"z": "41f61d2.fbe09e4",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 480,
"y": 380,
"wires": []
},
{
"id": "f0605fb0.3a733",
"type": "iot-s7-client",
"z": "",
"name": "",
"communicate": "TCP",
"host": "192.168.7.163",
"post": "102",
"baudrate": "9600",
"databits": "8",
"stopbits": "1",
"parity": "None",
"expand": {},
"connmode": "tsap",
"rack": "0",
"slot": "2",
"localtsaphi": "10",
"localtsaplo": "00",
"remotetsaphi": "03",
"remotetsaplo": "00",
"verbose": "default"
}
]