Disabling tags from a PLC that has failed.

On a serial network, you can use a single driver to communicate with several devices; depending on the protocol being used, each tag’s N1 parameter will be responsible for telling them apart.

Whenever there is a communication failure with a certain device (which can be expected on a large network), the driver will continue trying to read this device’s tags; this can cause the responses to fail or be delayed, thus giving it the false appearance of system hanging.

This article features a demo application which disables tag reading in a device when it has failed for a certain time. The application has one control tag per device; when the tag’s quality turns bad, a counter will start up to check its quality periodically. If the quality remains bad after a certain time, the tags in the device won’t be read anymore.

The application retrieves three I/O tags and a two-element block from different devices. The I/O driver being used in the example is Modicon Modbus Master. To simulate the devices, you can use any Modbus simulator that enables simulating more than one device with different IDs.

In this application, the driver was connected via ethernet (because of the simulator being used, which does not interfere with the proposed solution). We use MOD_RSSIM simulator, which is attached to this article and can also be downloaded from this site.

This article also features a library called desabilitaleituraemerro.lib which contains only one XObject, called xoDisable. This object contains scripts for enabling and disabling tag reads. For each device to be controlled, a new instance of xoDisable must be added to the data server (data folder).

To each new instance added to the main project, fill out the following xoDisable‘s properties:

AppDriver: driver to which the device belongs
Database: database object where “read enabled” or “read disabled” messages are recorded
IDEquip: the device’s ID on the network (N1 parameter in the I/O driver)
Table:  name of the table where read events are recorded
ControlTag: checks if communication has failed. This is the only tag whose read is not disabled when in fail
PresetValue: time interval (in seconds) when communication is checked when in fail

To enable the counter tag in the xoDisable‘s instance where the device has failed (N1), you must add a script to the driver’s OnCommError event. Example:

Sub Driver_OnCommError(EvtType, Size, Element, N1, N2, N3, N4)
‘Script that checks which N1 has failed and enables a counter.
if N1 = 1 then
Application.GetObject(“Data.xoDriver1”).CounterTag.Enabled = true
elseif N1 = 2 then
Application.GetObject(“Data.xoDriver2”).CounterTag.Enabled = true
end if
End Sub

To use this application, follow these procedures:

  1. Execute a Modbus simulator that simulates two PLCs at port 502, or the use two PLCs, whose network IDs are 1 and 2, and which contain Holding Register-type variables with addresses ranging from 1 to 5.
  2. Open the application in edition mode, set up the driver’s connection IP, and run the application.
  3. At the Modbus simulator, disable only one (control) variable of one of the PLCs, or then completely disable one of the simulating PLCs.
  4. Wait for Elipse E3’s timing and check whether the other tags’ reading has been disabled.
  5. Enable again the variable or PLC previously disabled.
  6. Reading will be reestablished after one good-quality variable is read.

The demo application was developed with Elipse E3 version 4.6 build 162.

Attachments:

DisableReadOnError.zip

mod_RSsim_8_20 (1).zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *