| Dettagli del download |
|
DeviceCommErrorAlarm is a project designed to demonstrate how to replace the alarm automatically triggered by a device communication error with a custom alarm defined through the Device Manager. This alarm will remain active for the duration of the communication error. This is the difference from the alarm that is automatically triggered by Reliance when an error in the communication with a device occurs. It is an "event" type of alarm – it is triggered, but it does not remain active; Reliance does not check to see if the error condition still exists – this is a drawback). Within the Modbus1 and Modbus2 devices, the CommError tag of type Bool is defined via the Device Manager. It is an internal tag (not a physical tag from a PLC). In addition, the CommError alarm defined within the same devices is linked to the CommError tag. The alarm is triggered by the leading edge of the tag value (the off-to-on transition). The Modbus1 and Modbus2 devices are connected to the PC1 computer via the Project Structure Manager. The communication options are defined through the Channel1 object that represents a communication channel. On the Advanced page of the channel properties, there are links to scripts to be executed when communication with the respective device is started, interrupted due to an error, and restored. The full name of the communication channel (device name/channel name, e.g., Modbus1/Channel1) is automatically passed to these scripts. This information is available in the scripts as the value of the SenderName property. This allows you to choose the same scripts for both devices' communication channels. The Define script, which contains the definition of the SetDeviceCommError procedure, is defined via the Script Manager. On the Advanced page of the script's Properties pane, the Run on thread initialization option is active to execute the script prior to any other script supposed to run in the same thread of execution. The SetDeviceCommError procedure is called from a script named DeviceCommError, which executes every time that an error in communication with the device occurs, and from a script named DeviceCommStarted, which executes every time that communication with the device is started or restored. The SetDeviceCommError procedure has the following parameters: FullChannelName: the full name of the communication channel (device name/channel name, e.g., Modbus1/Channel1) CommError: the value of True or False (determines whether there is an error in communication) The SetDeviceCommError procedure first splits the value of the FullChannelName parameter into the device name and the channel name and then writes the value of the CommError parameter to the internal tag CommError in the respective device by calling the RTag.SetTagValue method. This results in triggering a new alarm or ending the existing one. |
|
|||||||||||||||||||||||||||||||||

Gli esempi presenti su questo sito sono stati liberamente inviati dagli utenti di automationforum.it, è stato espressamente specificato loro di inviare solo esempi FREE. Automationforum.it non si ritiene responsabile dell'eventuale presenza di esempi rilasciati sotto licenza commerciale, Automationforum.it invita tutti coloro che individuano esempi rilasciati sotto licenza commerciale presenti in questa raccolta a segnalarlo dall'apposito