前言
为了实现和西门子PLC的数据交互,宏集物联网HMI集成了S7 PPI、S7 MPI、S7 Optimized、S7 ETH等多个驱动来适配西门子200、300、400、1200、1500、LOGO等系列PLC。
**本文主要介绍宏集物联网HMI如何通过S7 ETH协议采集西门子1200 PLC的数据,**文中详细介绍了在西门子博图编程软件中的配置以及如何将标签导入到JMobile Studio的操作步骤中。

使用软件
1.宏集JMobile Studio组态软件
2.西门子TIA Portal V16编程软件
操作步骤
1.S7-1200和S7-1500 PLC配置
(1)使用博图V16软件打开PLC项目。
(2)从项目树中选择PLC并打开PLC 属性。

(3)在"常规">"防护与安全">"访问级别中"中选择前三个权限之间的一个权限,即在HMI列上确保打勾。注意:如果选择"不能访问",则不会与HMI建立通信。

(4)在"连接机制"页面并选中"允许访问来自远程合作伙伴的PUT/GET通信访问"。

(5)要检查或更改DB优化,右键DB块打开DB 块属性。

(6)在常规>属性中取消选中"优化块访问",点击确定。

编译完项目后,标签偏移量将显示在变量名附近。
这些设置可以应用于TIA Portal编程软件,S7-1200 PLC系列,从PLC固件版本4.0和S7-1500 PLC系列开始。
2. 从博图软件中导出DB块和PLC标签
(1)导出DB块,右键单击DB块,选择从块生成源。

(2)保存为"DBxxx.db",其中xxx= DB块个数。

(3)导出PLC标签,双击"显示所有标签",显示标签表,单击Export按钮并浏览路径文件,定义文件名。

(4)单击保存确认。

(5)点击确定导出。

3. 在JMobile Studio中添加通信协议和导入标签
(1)打开JMobile Studio软件,点击协议,添加Simatic S7 ETH协议,双击配置。

(2)在配置中选择PLC的型号,写入PLC IP地址和插槽两个数据。

(3)导入标签,在标签编辑窗口中选择所创建的协议,选择批量添加标签,选择西门子编程软件类型。

(4)选择目录文件,对于DB块导入,选择DB1.db文件;对于PLC标签,选择PlcTags.xlsx文件。

(5)打开导入标签进行检查,对应到DB1块中。

至此,已完成所有操作步骤。
总结
西门子PLC数据标签导入到JMobile Studio软件后,用户可以根据需求使用趋势功能完成PLC数据的曲线展示 ,使用数字控件完成PLC数据的展示 ,使用JS代码完成PLC数据的处理和分析等等。
