Dynamic disabling/enabling of ModbusRTU devices

Hi!

I’m working on a machine which reads a lot of different energy meters using ModbusRTU.
At times, some of these energy meters will not be powered.
To prevent having to wait for a timeout every time the program wants to communicate with a disconnected energy meter, I would like to disable the device based on some inputs in the program.

I found this thread on Codesys forge which describes a similar situation, but none of the solutions offered there seem to work.

Is there any way to do this without changing from cyclical readings?

You can use the WAGOAppPLCModbus library and the FbMbMasterSerial function block. This function block allows you to control the queries and triggers directly, so you can selectively avoid reading from devices that are not powered.

I also tried the CAA Device Diag Libary, but unfortunately get “Not Supported” Error when I try to disable the RTU Server node.

Hi Mike.

Thanks for confirming that disabling it using CAAdeviceDiag doesn’t work. Good to know that I wasn’t just configuring it wrong.

The project started out simple, so I thought I would get away with using modbus IO mapping.

I ended up turning off auto-reset coms and made some lock-out logic for when to reset and retry coms to slaves. Next time I’ll just start out using AppPLCModbus.

For future reference, when working with the CAA Device Diagnostic Library, I tested a few additional fieldbuses.

Functional:

  • Enable/Disable EtherCAT Slave
  • Start/Stop/Reset EthernetIP Remote Adapter
  • Enable/ Disable EthernetIP Remote Adapter
  • Enable/Disable EthernetIP Local Adapter
  • Enable/Disable EthernetIP Scanner
  • Enable/Disable Ethernet (X1/X2)
  • Enable/Disable ModbusTCP Master
    • Worked via ToggleNode, ‘Inst Not Found’ Error with ToggleBus

Not Supported:

  • Enable/Disable Modbus RTU Slave
  • Enable/Disable CanOpen Device
    • CANRemoteDevice_Diag Error during compile (needs more testing).