System diagnostics is for recognizing, evaluating and displaying errors that occur in an automation system. For this there is a diagnostic buffer in each CPU and module that supports system diagnostics, in which detailed information on all the diagnostic events is entered.
With system diagnostics errors
- are given a system-wide uniform number (cause)
- with location and time of occurrence
by the operating system of the module and displayed as plain text in the medium shown. In addition, the previous history of an error is registered, because this error message is stored automatically in a diagnostic buffer without the user doing anything.
The basic functions of system diagnostics include all error events of the operating system and particularities of the run of the user program, which are stored in the diagnostic buffer with location, time, error number and additional relevant information.
In addition, the user can use the SFC52 WR_USMSG to enter user-defined diagnostic events (information about the run of the user program, for example) in the diagnostic buffer or send user-defined diagnostics messages to registered nodes (monitoring devices like PG, OP and TD, for example).
The diagnostic buffer provides the user with the following options:
- Rapid detection of error causes and therefore increased plant availability.
- In the case of plant stoppage, evaluation of the events just prior to the STOP to find the cause of the STOP.
The diagnostic buffer is a ring buffer with separate diagnostics entries. In the diagnostic buffer, the diagnostic events are displayed in the order of their occurrence. The first entry contains the latest event. When the buffer is full, the oldest entry is overwritten with each new diagnostic buffer entry. Depending on the CPU, the size of the diagnostic buffer is either fixed or can be set with parameters in the hardware configuration.
Items entered in the diagnostic buffer
- Error events
- Mode changes and other operating events important for the user
- User-defined diagnostic events (with SFC52 WR_USMSG)
In STOP as few as possible events are entered in the diagnostic buffer so that when the plant stops, the user can find the STOP cause easily in the buffer. There, the operating system ensures that events are entered in the diagnostic buffer only if the event requires a user reaction (for example if the system requests an overall reset or a battery has to be changed) or important information has to be registered (firmware update executed or station failure, for example).
No user programs are processed in the STOP mode. Therefore, in STOP mode, no diagnostic buffer entries triggered by the user program are entered.
Items NOT entered in the diagnostic buffer
- Temporary error events
- Statistics information or traces
- Information about the quality of data or services
- Cyclic OB start calls
Error events that occur cyclically are usually only entered the first time they occur and only again when the event of the outgoing error is recognized. This ensures that important entries are not so easily overwritten in the case of diagnostic buffer overflow. Using the Online Help the user can recognize the possible causes and appropriate remedies for each event from the diagnostic buffer.
Practical evaluation of the diagnostic buffer
Typically you use diagnostic tools like the S7 System Diagnostics to evaluate the diagnostic buffer entries. You can use the user program to read out the diagnostic buffer, but compared with the process in the user program it is not adequate to derive from it control reactions in a polling process.
Increasing the diagnostic buffer to maximum number of entries in RUN mode
The maximum number of entries in the diagnostic buffer depends on the CPU type. In the diagnostic buffer you click the "Settings" button and make the following changes:
- Change the default setting from "Default set according to module property" to "Preselect".
- In the input field you enter the maximum number of entries (500, for example).
- Enable the "Save settings for this dialog box" option.
- Save the settings with OK.
If you then click the "Update" button in the diagnostics buffer, the maximum number of entries are shown in the display. Using the "Save as..." function you can save the contents of the diagnostic buffer as ASCII text (in a file named "Diagnostic.txt", for example).