zoukankan      html  css  js  c++  java
  • EdgexGo2.0学习-11 测试读取ModBus协议

    1、配置文件如下

    name: "Ethernet-Temperature-Sensor"
    manufacturer: "Audon Electronics"
    model: "Temperature"
    labels:
      - "Web"
      - "Modbus TCP"
      - "SNMP"
    description: "The NANO_TEMP is a Ethernet Thermometer measuring from -55°C to 125°C with a web interface and Modbus TCP communications."
    
    deviceResources:
      -
        name: "ThermostatL"
        isHidden: true
        description: "Lower alarm threshold of the temperature"
        attributes:
          { primaryTable: "HOLDING_REGISTERS", startingAddress: 3999, rawType: "Int16" }
        properties:
          valueType: "Float32"
          readWrite: "RW"
          scale: "0.1"
      -
        name: "ThermostatH"
        isHidden: true
        description: "Upper alarm threshold of the temperature"
        attributes:
          { primaryTable: "HOLDING_REGISTERS", startingAddress: 4000, rawType: "Int16" }
        properties:
          valueType: "Float32"
          readWrite: "RW"
          scale: "0.1"
      -
        name: "AlarmMode"
        isHidden: true
        description: "1 - OFF (disabled), 2 - Lower, 3 - Higher, 4 - Lower or Higher"
        attributes:
          { primaryTable: "HOLDING_REGISTERS", startingAddress: 4001 }
        properties:
          valueType: "Int16"
          readWrite: "RW"
      -
        name: "Temperature"
        isHidden: false
        description: "Temperature x 10 (np. 10,5 st.C to 105)"
        attributes:
          { primaryTable: "HOLDING_REGISTERS", startingAddress: 4003, rawType: "Int16" }
        properties:
          valueType: "Float32"
          readWrite: "R"
          scale: "0.1"
    
    deviceCommands:
      -
        name: "AlarmThreshold"
        readWrite: "RW"
        isHidden: false
        resourceOperations:
          - { deviceResource: "ThermostatL" }
          - { deviceResource: "ThermostatH" }
      -
        name: "AlarmMode"
        readWrite: "RW"
        isHidden: false
        resourceOperations:
          - { deviceResource: "AlarmMode", mappings: { "1":"OFF","2":"Lower","3":"Higher","4":"Lower or Higher"} }
    View Code

    2、如果使用串口的话,要加上

    3、Docker-compose yaml配置

    device-modbus:
        image: edgexfoundry/device-modbus:2.0.0
        ports:
          - "0.0.0.0:59901:59901"
        container_name: edgex-device-modbus
        hostname: edgex-device-modbus
        networks:
          - edgex-network
        environment:
          EDGEX_SECURITY_SECRET_STORE: "false"
          REGISTRY_HOST: edgex-core-consul
          MESSAGEQUEUE_HOST: edgex-redis
          CLIENTS_CORE_DATA_HOST: edgex-core-data
          CLIENTS_CORE_METADATA_HOST: edgex-core-metadata
          CLIENTS_CORE_COMMAND_HOST: edgex-core-command
          CLIENTS_SUPPORT_NOTIFICATIONS_HOST: edgex-support-notifications
          CLIENTS_SUPPORT_SCHEDULER_HOST: edgex-support-scheduler
          DATABASES_PRIMARY_HOST: edgex-redis
          SERVICE_HOST: edgex-device-modbus
        depends_on:
          - consul
          - data
          - metadata
        security_opt: 
          - no-new-privileges:true
        user: root:root 
    

      

    本博客是个人工作中记录,遇到问题可以互相探讨,没有遇到的问题可能没有时间去特意研究,勿扰。
    另外建了几个QQ技术群:
    2、全栈技术群:616945527,加群口令abc123
    2、硬件嵌入式开发: 75764412
    3、Go语言交流群:9924600

    闲置域名www.nsxz.com出售(等宽等高字符四字域名)。
  • 相关阅读:
    Great StackOverflow questions
    通过cdn引用的js
    iphone中点击input不能选中input中的内容
    php创建文件默认所属用户和组
    在Linux下php连接mysql数据库遇到2002错误
    一些命令的参数作用
    ubuntu安装完成之后wifi无法连接
    根据MAC地址获取网络地址及ZDP_NwkAddrReq函数的用法
    结合MeteoInfo开发WinformGIS系统--省份shape文件的提取
    简单的EntityFrameWork Code First代码
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/15034587.html
Copyright © 2011-2022 走看看