Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)

一、已知信息

PLC西门子 S7-200 Smart
IP/Port192.168.102.23/102
点表(DB1)
地址数据类型属性名称
I1.2Boolean只读风机压差
VW108Unsigned16只读静压
VW200Unsigned16读写静压设定

二、读西门子S7-200 Smart

2-1、读S7-200_Smart示例

[{"id":"c8d138cd30e452fc","type":"s7 in","z":"2cc0cdd019e2d62d","endpoint":"374f5d9e3d2741c0","mode":"all","variable":"","diff":false,"name":"读PLC数据","x":220,"y":220,"wires":[["9bb59cb5c92923f1"]]},{"id":"9bb59cb5c92923f1","type":"debug","z":"2cc0cdd019e2d62d","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":400,"y":220,"wires":[]},{"id":"c3f08b05d373b392","type":"comment","z":"2cc0cdd019e2d62d","name":"读取【西门子S7-200_Smart】示例","info":"","x":300,"y":160,"wires":[]},{"id":"374f5d9e3d2741c0","type":"s7 endpoint","transport":"iso-on-tcp","address":"192.168.102.23","port":"102","rack":"0","slot":"2","localtsaphi":"10","localtsaplo":"02","remotetsaphi":"03","remotetsaplo":"01","connmode":"tsap","adapter":"","busaddr":"2","cycletime":"2000","timeout":"2000","name":"PLC","vartable":[{"addr":"I1.2","name":"I1.2"},{"addr":"DB1,INT108","name":"VW108"},{"addr":"DB1,INT200","name":"管道静压"}]}]

2-2、连接配置说明

针对【s7 in】,即读西门子PLC,S7系列的节点;需要配置PLC的连接信息,一是IP地址,二是端口

Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)

标记红框处就是需要注意的配置参数,此处配置不正确,导致无法建立连接;

该项配置,是针对S7-200;其余型号选择Rack/Slot。

2-3、Node-Red点表配置说明

Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)

点位表读取,请参考node-red-contrib-s7官方说明

PS:V区需要设置成固定的数据块,即DB1;之后可以设定不同的V区地址访问V区变量;例如:要访问 V40.0,请使用 DB1,X40.0;要访问 VW100,请使用 DB1,INT100。

2-4、读取结果

Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)

三、写西门子S7-200 Smart

3-1、写S7-200_Smart示例

[{"id":"c87e89ca50456707","type":"s7 out","z":"2cc0cdd019e2d62d","endpoint":"374f5d9e3d2741c0","variable":"管道静压","name":"DB1.VW200","x":530,"y":480,"wires":[]},{"id":"22d59e0c54565e46","type":"inject","z":"2cc0cdd019e2d62d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"554","payloadType":"num","x":330,"y":480,"wires":[["c87e89ca50456707"]]},{"id":"374f5d9e3d2741c0","type":"s7 endpoint","transport":"iso-on-tcp","address":"192.168.102.23","port":"102","rack":"0","slot":"2","localtsaphi":"10","localtsaplo":"02","remotetsaphi":"03","remotetsaplo":"01","connmode":"tsap","adapter":"","busaddr":"2","cycletime":"2000","timeout":"2000","name":"PLC","vartable":[{"addr":"I1.2","name":"I1.2"},{"addr":"DB1,INT108","name":"VW108"},{"addr":"DB1,INT200","name":"管道静压"}]}]

3-2、写入配置说明

Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)

3-3、写入结果

Node-RED软网关使用手册-入门指南(创建第二流程【西门子PLC S7-200_Smart读写】)