海創(chuàng)IOT是基于圖形節(jié)點(diǎn)和流程的快速開(kāi)發(fā)平臺(tái),采用可視化編程方法,將預(yù)定義的代碼塊(稱為“節(jié)點(diǎn)”,Node)連接起來(lái)執(zhí)行任務(wù)。連接的節(jié)點(diǎn),通常是輸入節(jié)點(diǎn)、處理節(jié)點(diǎn)和輸出節(jié)點(diǎn)的組合,當(dāng)他們連接在一起的時(shí)候,構(gòu)成一個(gè)“流”(Flows),與傳統(tǒng)的程序開(kāi)發(fā)工具相比,它更好地適應(yīng)物聯(lián)場(chǎng)景。它可以與JavaScript和Node.js、C語(yǔ)言混合開(kāi)發(fā)使用;谶@個(gè)平臺(tái)我們可以快速的實(shí)現(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) 請(qǐng)參考《海創(chuàng)智能網(wǎng)關(guān)設(shè)置》
**西門子PLC ** 配置好設(shè)備連接ip
四、項(xiàng)目部署調(diào)試
打開(kāi)海創(chuàng)-IIoT。本次教程需要用到如下節(jié)點(diǎn),在左側(cè)節(jié)點(diǎn)欄中拖拽出使用
定時(shí)器周期性觸發(fā)輸入時(shí)間戳或者相應(yīng)的字符
S7西門子用于讀取S7西門子通信協(xié)議的設(shè)備數(shù)據(jù)
調(diào)試用于調(diào)試節(jié)點(diǎn)輸出
配置相應(yīng)節(jié)點(diǎn)后配置界面如下:
節(jié)點(diǎn)配置:
定時(shí)器設(shè)置成周期性觸發(fā),主要當(dāng)觸發(fā)流程使用,具體配置如下圖
S7西門子設(shè)置如下配置,即可取到M區(qū)0.1的地址數(shù)據(jù)
調(diào)試在右側(cè)調(diào)試窗口輸出調(diào)試結(jié)果,無(wú)需配置
部署調(diào)試:
按照以上教程配置好流程后,點(diǎn)擊部署,部署成功后程序開(kāi)始運(yùn)行,就會(huì)在調(diào)試窗口輸出相應(yīng)的結(jié)果,調(diào)試結(jié)果如下
[
{
"id": "3c9559.b5d63aa8",
"type": "iot-s7",
"z": "41f61d2.fbe09e4",
"name": "",
"server": "f0605fb0.3a733",
"columns": [
{
"Key": "2號(hào)跑馬燈",
"Label": "2號(hào)跑馬燈",
"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"
}
]