7.10 Diagnostics, Error Detection and Error Handling 277
Vendors offer various tools for diagnostics. These can be either additional
hardware that checks for error conditions and provides information about them, or
software functions to be included in the application. SFC is a good language for
detecting errors in a running installation (e.g. “Transition XY not firing”) or for
continuing with a defined response after detecting an error.
Error concept of IEC 61131-3.
IEC 61131-3 has only a very general approach to error handling, giving the user a
certain amount of support in handling cases 2) and 3) above. The standard requires
an error list to be provided by PLC manufacturers, indicating the system response
to a variety of specified error conditions (see Appendix E):
1) The error is not reported. There must be a statement to this effect in the user
documentation.
2) The possibility that the error might occur is detected when preparing (editing,
compiling or loading) the program, and the user is warned accordingly.
3) The error is reported during execution of the program (at run time).
Manufacturer-dependent procedures for handling the error are provided.
Quality assurance plays an important role in the automation business. The quality
of today’s compilers effectively prevents some typical program errors from
slipping through at the compilation stage. Concepts of IEC 61131-3, like strict
data type checking, even prevent some errors from occurring in the first place,
during programming. However, some errors can only be detected at run time.
Some error situations, like division by zero (see Appendix E) should be checked
by the PLC system. IEC 61131-3 [IEC TR3-94] recommends the definition of a
uniform global (manufacturer-dependent) data structure for errors, which should
contain the status of an operation (Error Yes/ No), the type of error (Division by
zero) and the location of the error (POU name). This information could then be
scanned by the application, or connected to the SINGLE input of a task (see
Section 6.3.4). This task would be connected to a system routine or error routine.
In the event of an error, the PLC system would set the error status to TRUE and
set other members of the data structure accordingly, thus starting the error task.
Extended error handling model (beyond IEC).
To improve software quality, it is desirable to provide the users themselves with a
means of defining error conditions in a standardised form. A language construct
like “asserted conditions” could be used for this. In this case, the programmer
would implement the application with checks.