| Dettagli del download |
|
OPC_DeviceCommStatus is a project designed to demonstrate how to use a script to determine the state of an OPC server by testing the quality of a tag. Via the Device Manager, you have to configure the OPCDevice1 device according to your local OPC server. The OPC group of this device contains an internal tag that is periodically tested in the script (if the tag quality is not 'Good', it means that the OPC server is not connected). For this purpose, the Random_UInt1 tag is used in the project. The project also contains the OPCDevice1Connected tag that, after the script is evaluated, contains information regarding the OPC device connection status and is linked to the Active Text component placed in the visualization window. In addition, the Define script, which is executed at the thread initialization, is defined via the Script Manager. This script defines the procedure that evaluates the tag quality (it is more effective to define a procedure than to write the code directly into the script's body). The script reads the Random_UInt1 tag value with the RTag.GetTagValue method. Each method of the Reliance objects sets the value of the RError.Code property. If the value of this property is not equal to zero, an error occurs. To ensure that 'Bad' quality of the value is considered an error, the Treat invalid tag value as error option must be enabled (Project Options > Scripts > Other). The procedure is called from the UpdateOPCDeviceCommStatus script with the period of one second. |
|
|||||||||||||||||||||||||||||||||

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