海創(chuàng)IOT是基于圖形節(jié)點和流程的快速開發(fā)平臺,采用可視化編程方法,將預(yù)定義的代碼塊(稱為“節(jié)點”,Node)連接起來執(zhí)行任務(wù)。連接的節(jié)點,通常是輸入節(jié)點、處理節(jié)點和輸出節(jié)點的組合,當(dāng)他們連接在一起的時候,構(gòu)成一個“流”(Flows),與傳統(tǒng)的程序開發(fā)工具相比,它更好地適應(yīng)物聯(lián)場景。它可以與JavaScript和Node.js、C語言混合開發(fā)使用;谶@個平臺我們可以快速的實現(xiàn)西門子PLC數(shù)據(jù)的獲取
一、硬件環(huán)境
1、海創(chuàng)Box智能網(wǎng)關(guān)
2、西門子PLC

二、產(chǎn)品連接方式

三、產(chǎn)品配置
海創(chuàng)智能網(wǎng)關(guān) 請參考《海創(chuàng)智能網(wǎng)關(guān)設(shè)置》
**西門子PLC ** 配置好設(shè)備連接ip


四、項目部署調(diào)試
打開海創(chuàng)-IIoT。本次教程需要用到如下節(jié)點,在左側(cè)節(jié)點欄中拖拽出使用
定時器周期性觸發(fā)輸入時間戳或者相應(yīng)的字符

S7西門子用于讀取S7西門子通信協(xié)議的設(shè)備數(shù)據(jù)

調(diào)試用于調(diào)試節(jié)點輸出

配置相應(yīng)節(jié)點后配置界面如下:

節(jié)點配置:
定時器設(shè)置成周期性觸發(fā),主要當(dāng)觸發(fā)流程使用,具體配置如下圖

S7西門子設(shè)置如下配置,即可取到M區(qū)0.1的地址數(shù)據(jù)


調(diào)試在右側(cè)調(diào)試窗口輸出調(diào)試結(jié)果,無需配置
部署調(diào)試:
按照以上教程配置好流程后,點擊部署,部署成功后程序開始運行,就會在調(diào)試窗口輸出相應(yīng)的結(jié)果,調(diào)試結(jié)果如下

[
{
"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"
}
]