|
Back to all documents
Troubleshooting Strategies
The key to troubleshooting any system is to first understand that errors will happen and that your application needs to be prepared accordingly. Therefore it is imperitive
that you code "defensively" and utilize all the tools available to know what is happening at any moment in time.
Understanding where problems can occur
Problems can occur at all levels of your system
- The PLC/Device may crash or become unavailable
- The communications medium (serial or Ethernet) may become unavailable
- The OPC Server may stop responding
- Windows may lose the connection to the OPC Server (although the OPC Server is still responding)
Looking for Errors
Depending on the development language you use will dictate the level of control you will have over your application. One thing that is common though is the that you need to
check for 2 things:
- That an Error/Exception did NOT occur when trying to perform a Read or a Write
- That the Quality of a Tag read is Good, Bad or Uncertain.
Each time you perform a Read or a Write transaction, you need to verify that no error occurred. Furthermore you need to have a means to trap the error, handle it and most
importantly have some means of LOGGING that the error occurred. Simply having the ability to log such errors can save you an incredible amount of debugging time later on.
Some suggested error-trapping methods include:
- VBScript users have the "On Error Resume Next"
- VB users have "On Error Goto"
- JavaScript users have "Try... Catch"
- Borland development languages have "Try... Catch"
- .NET (VB.NET & C#) languages have "Try... Catch"
When an error occurs you should handle it any way that you deem fit, but you should ensure that there is a way in which a notification can be given to the end-user via an
on-screen log, or a log file.
So far we have discussed a SERIOUS problem... some problems are not so serious in your applications stability but are equally or more serious in the
overall-grand-scheme-of-things.
OPC Servers reports on the quality of a connection. Each time you read or receive a new tag update you are given the Tag's value, QUALITY and timestamp. The Quality is an
IMPORTANT element that you absolutely must observe.
Do NOT ever assume that because the ReadItem or ReadItemValue returned a Tag value that all is well. There is only
one way to assume that all is well, and that is with the following pseudo:
if (ReadItem = ok AND tagQuality = good) then (success) else (fail)
Tag qualities are essentially a 16-bit number. The least-significant byte (8-bits) are common to ALL OPC Servers. You can find out more about the values and meanings to OPC Quality codes our online support system.
Checking that the OPC Web Client Process is Running
The OPC Web Client is essentially an "out of process" engine that runs in the back-ground. If you open the Windows Task Manager, click on the "Processes" tab you should see:
If the process does not appear in this list, then the OPC Web Client's primary engine is not running. Windows will start the process automatically when you try to use it, therefore you can simply shutdown and then restart your client
application(s). This should launch the process. If not, a reboot should be performed. If this fails, re-installation of the product should be performed next. Failing this, contact support.
OPC Web Client Engine Log
The OPC Web Client may be experiencing problems... problems such as not being able to connect to an OPC Server, or problems performing a specific task etc.
The OPC Web Client utilizes a log which you are free to view at any time. In fact, you can specify to log events to a file
or to the Windows Event Log along with other settings too.
Above, the main log configuration tool, found in [default location]: Start > Programs > Software Toolbox > OPC Web Client 3.0 > Utilities > Event Log Options
Below are the options for the NT Event Log:
Below are the options for the Text stream:
You can look through the OPC Web Client log looking for errors and clues as to what errors have occurred and from where.
Checking the OPC Servers log
Depending on your OPC Server you may have access to a Log or a Last Error code. Do not forget to look at the OPC
Server for errors and/or clues as part of your troubleshooting strategy.
You will need to check the documentation of your OPC Server to see what options are available for tracking errors.
Checking the PLC/Device(s) log
Depending on the PLC/Device(s) in use, they may have an event logging system of their own. If such a logging system
does exist, then do also use that resource to try and locate errors. This type of log could yield errors ocurring that the OPC Server may miss.
Summary
This paper has outlined some simple strategies in troubleshooting, and it has also given some very basic outlines as to
where errors can occur. This paper has outlined where errors can occur and has suggested some ways in which to detect errors, handle them and research from what & where they came from.
If in doubt, go to the Support Center.
|