关于通过编写配置文件完成对PLC寄存器数据的采集

zhangning
zhangning This guy is lazy,Introduction has not been set

2 People liked this article · 2478 views

  今天通过给大家做一个路由器采集PLC地址为00001数据类型为bit的寄存器数值的配置文件来介绍一下如何完成编辑配置文件来采集数据。     controllers:    - controller:      id: Bit      name: Bit      protocol: mbrtu      address: localhost      param: 19200-8-N-1      port: /dev/ttyO5      machine_address: '1'      byte_order: cdab ## 这里定义了控制器的一些参数,此次示例是通过485串口采集数据,实际操作时根据具体情况做相应调整。 groups:    - group:      name: Bit var test      polling_interval: 5 ## 这里创建了一个采集组并定义了组名和采集时间间隔。      io:        - var:          address: '00001'          controller_id: Bit          type: bit ## 这里定义了要采集的哪个PLC的哪个寄存器地址和地址对应的数据类型。      vars:        - var:          id: Bit 00001          level: 2          type: bit          calc_mode: instant          unit: '°F'          expression: values['Bit.00001']          desc: config-bit-00001 ## 这里定义了数据在平台上的如何显示。此处的tpye为数据以何种数据类型在平台上显示,而expression则对在PLC采集的数据做相应计算,然后将计算后的值上传至平台。     附件是一些简单的数据采集示例,包括bit、word、dword、float。大家可用作参考和练习。

Published on 2017-12-24 11:07

Disclaimers:

This document is written by zhangning Original published on 技术社区 ,The copyright belongs to the author。

Log in,More exciting content waiting for you to find,Contribute wonderful answers,Participate in comment interaction

go Sign in! No accountgoregister