Modbus flow for multiple reads

There are numerous posts regarding this topic, but none of them are specific to my question.

I need to talk to 36 inverters. I'm using node-red-contrib-modbus 5.25.0, serial RTU.
In order to perform a good flow and queue messages, I'm using Modbus-Flex-Getter node.

My basic approach is:

If an inverter is off-line, I catch it and set a flag for off-line.

However, I still need to specify different function nodes for each id. Is it possible to make an array of objects?

I can't get it to work:

msg.payload = [];

msg.payload[0] = { 
    value: msg.payload, 
    'fc': _fc, 
    'unitid': 1, 
    'address': _PXXXX,
    'quantity': _qty 

msg.payload[1] = {
    value: msg.payload,
    'fc': _fc,
    'unitid': 2,
    'address': _PXXXX,
    'quantity': _qty

Besides, after checking that the inverter is off-line, is there a way to change the pooling rate dynamic?
For exempla: I check speed every 500ms. But since I get the first off-line message from the inverter, I can way 5s to test it again.

Hello .. this is my approach using an array of objects for the Modbus-Flex-Sequencer

Flow :

flows.json (35.2 KB)

  1. Initially i create a global Context mbConfig variable that holds the modbus configuration of how the reply of each modbus request will be translated by the buffer parser node.
  2. In sequences function i create the array configuration for each modbus request (used by Modbus-Flex-Sequencer )
  3. Handle errors with the error function which basically fills context with null values for any offline devices
  4. setGlobal function updates mbValues global Context with valid values

I dont think there is an easy way of doing this as the delay settings are in the Modbus client config node
and cannot be independently set for each request.

Hope it helps

You have no idea how much. Thanks a lot. You gave me a lot of ideas.

Here is my approach:

  1. Define a global node using JSON:

  2. Queue the messages an serialize them:

  3. Catch the messages with no response and set an increment before trying again:

If the message is catch, it will noot pass queue until it fills an iteration.

Thanks a lot

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.