Code Monkey home page Code Monkey logo

Comments (13)

stephenctw avatar stephenctw commented on August 11, 2024

Hi Brendan,

I agree that it would be helpful to have the data converted to the correct data types. For now, this can be done in a separate custom module. We will consider integrate this function in the module.

Thanks,
Stephen

from iot-edge-modbus.

thegunshow avatar thegunshow commented on August 11, 2024

from iot-edge-modbus.

stephenctw avatar stephenctw commented on August 11, 2024

Hi Brendan,

Correct me if I misunderstood anything.

The JSON configuration is for the Modbus module to know what read operations need to be done. Adding any custom key-value pair to the configuration will not influence the output message, since they are handled with different piece of code. Furthermore, the module won't understand what such "datatype" means because there's no code logic handling it and thus will simply ignore that. One easy way to accomplish your goal is to rely on the "Address" field of the output message. Modbus module will always output values per register and by Modbus spec it's uint16.

Take the following for an example.

Let's say you are trying to read two registers as a full voltage value.

{
  "PublishInterval": "2000",
  "SlaveConfigs": {
    "Slave01": {
      "SlaveConnection": "192.168.0.1",
      "HwId": "PowerMeter-0a:01:01:01:01:01",
      "Operations": {
        "Op01": {
          "PollingInterval": "1000",
          "UnitId": "1",
          "StartAddress": "400001",
          "Count": "2",
          "DisplayName": "Voltage"
        }
      }
    }
}
    
[
  {
    "DisplayName":"Voltage",
    "HwId":"PowerMeter-0a:01:01:01:01:01",
    "Address":"400001",
    "Value":"19775",
    "SourceTimestamp":"2017-11-17 08:43:50"
  },
  {
    "DisplayName":"Voltage",
    "HwId":"PowerMeter-0a:01:01:01:01:01",
    "Address":"400002",
    "Value":"15650",
    "SourceTimestamp":"2017-11-17 08:43:50"
  }
]

In your custom module, you can always combine register 400001 and register 400002 as a float32 or whatever datatype you like.

Thanks,
Stephen

from iot-edge-modbus.

stephenctw avatar stephenctw commented on August 11, 2024

Close for inactivity. Reopen if you still want to discuss.

from iot-edge-modbus.

thegunshow avatar thegunshow commented on August 11, 2024

from iot-edge-modbus.

stephenctw avatar stephenctw commented on August 11, 2024

Hi Brendan,

I understand your concern. But I am not quite sure how I can modify the module to fit your request. Could you kindly provide a few example so I can look into it.

Thanks,
Stephen

from iot-edge-modbus.

kiranpradeep avatar kiranpradeep commented on August 11, 2024

This is tough on every one (cloud and edge) using this module. Now the edge v2 cloud developer has to write JSON configs for iot-edge-modbus module, and then JSON config for custom module all in sync. Then again, handle all borderline cases like failure to read one of registers of multi register type.

Also this case of Modbus is different from ble core[1] and ble_printer[2] where the ble_printer modules makes sense of data. Over there we are dealing with vast variety of varying BLE devices with varying specifications and types. That is different from this Modbus case where we can prespecify a set of data types.

from iot-edge-modbus.

stephenctw avatar stephenctw commented on August 11, 2024

Thanks for all the feedback. We will see how we can add this feature to the module.

from iot-edge-modbus.

whendric avatar whendric commented on August 11, 2024

Has there been any progress on adding the ability to define the data and byte swap types for an operation? I have upcoming applications that will require being able to do so, looking through some of the v2 preview documentation and code there are references to data types (Float, Int16 and Int32) and swap modes (BigEndian, BigEndianByteSwap, LittleEndian, LittleEndianByteSwap) but no mention of if they're implanted in the 1.0.5 release?

from iot-edge-modbus.

suneetnangia avatar suneetnangia commented on August 11, 2024

@whendric guidance is to use v2 for new workloads. We have designed it in a way to allow extensibility of data types etc. as you have figured out.

from iot-edge-modbus.

whendric avatar whendric commented on August 11, 2024

from iot-edge-modbus.

suneetnangia avatar suneetnangia commented on August 11, 2024

@whendric

  1. Marketplace version is 1.x, we have not got around to publish v2 to marketplace yet, plan is to do that in near future but that shouldn't block you. You can still compile v2 and create iotedge module/container image from the solution. There's even an Azure DevOps pipeline definition in v2 to get you started.
  2. It's defined by "ValueType" which maps to "ModbusValueTypes" Enum in V2 code. More info on this available in unit tests project in v2 solution.
    HTH

from iot-edge-modbus.

yphuangms avatar yphuangms commented on August 11, 2024

Close for inactivity.

from iot-edge-modbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.