The text of a manual · part 30 of 45
Enhanced and Ethernet PLC-5 Programmable Controllers User Manual: Chapter 15 - Preparing Fault Routines
Pages 239 to 252 of 388, from Enhanced and Ethernet PLC-5 Programmable Controllers User Manual
The original document is the PDF (5.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1785-L20B and Allen-Bradley 1785-L40B
Page 239
Chapter
15
Preparing Fault Routines
Using This Chapter For Information About
Understanding the Fault Routine Concept
See Page
Understanding the fault routine concept
15-1
Understanding controller-detected major faults
15-2
Defining a fault routine
15-4
Defining a watchdog timer
15-5
Programming a fault routine
15-6
Monitoring faults
15-11
Fault routines execute when a PLC-5 controller encounters a major fault during program execution. Use a fault routine to specify how you want the controller to respond to a major fault. If your controller experiences a fault during program execution, you can tell the controller to interrupt the current program, run your fault routine, and then continue processing the original program. A fault routine processes the major fault bit found in S:11 and determines the course of program execution based on the fault bit present. Fault routines provide a means to either: • systematically shut down a process or control operation • log and clear the fault and continue normal operation For a detailed list of the words in the controller status file, see Appendix B.
Responses to a Major Fault When the controller detects a major fault, the controller immediately interrupts the current program. If a fault routine exists (i.e., program file is specified in S:29 as a fault routine), the controller runs that fault routine program for recoverable faults. Depending on the type of fault, the controller then:
1
Publication 1785-UM012D-EN-P - July 2005
Page 240
15-2
Preparing Fault Routines
• returns to the current ladder program file if the controller can recover from the fault • enters fault mode if the controller cannot recover from the fault For example, this rung includes an instruction that causes a major fault: B
A
C
Causes a major fault
[
[
In this example, the processor runs the fault routine after detecting the fault. If the fault routine resets the faulted bits, the processor returns to the next instruction in the program file that follows the one that faulted and continues executing the remainder of the rung. If you do not program a fault routine for fault B, the processor immediately faults.
Understanding Controller-Detected Major Faults
In general: If the Controller Detects a
It Sets major fault a major fault bit and resets I/O memory loss fault outputs in 1771-ASB remote I/O racks and/or 1771-ALX extended-local I/O racks are set according to their last state switch setting The outputs remain in their last state or they are de-energized, based on how you set the last state switch in the I/O chassis.
IMPORTANT
In the PLC-5 controller-resident chassis, outputs are reset regardless of the last state switch setting when one of the following occurs: • controller detects a major fault • you set a status file bit to reset a local rack • you select program or test mode
Publication 1785-UM012D-EN-P - July 2005
Page 241
Preparing Fault Routines
15-3
To decide how to set this switch, evaluate how the machines in your process will be affected by a fault. For example: • how will the machine react to outputs remaining in their last state or to outputs being automatically de-energized? • what is each output connected to? • will machine motion continue? • could this cause the control of your process to become unstable? To set this switch, see Appendix E.
Fault in a Controller-Resident or Extended-Local I/O Rack If a problem occurs with the chassis backplane, the controller sets the appropriate minor fault bit (S:7/0-7) and continues scanning the program and I/O. As soon as this bit is set, the outputs for that rack are reset. However, the controller continues normal run-time operation. The outputs are enabled again only if the faulted rack condition is cleared. For example, if a local I/O module faults, all outputs in that rack are reset and the controller continues executing the program scan. Outputs will be enabled only after the faulted module is removed. Your ladder program should monitor the I/O rack fault bits (S:7/0-7) and take the appropriate recovery action. ATTENTION
If a controller-resident local I/O rack fault occurs and you have no recovery methods, the input image table and outputs for the faulted rack remain in their last state. Potential injury to personnel and damage to the machine may result.
Fault in a Remote I/O Chassis A remote I/O rack fault can be a loss of communications with the remote I/O device or a problem with the remote I/O device itself. When the controller detects a remote I/O rack fault, the controller sets an I/O rack fault bit in the controller status table. The controller then continues scanning the program and controlling I/O.
Publication 1785-UM012D-EN-P - July 2005
Page 242
15-4
Preparing Fault Routines
The outputs in the faulted rack remain in their last state or they are de-energized, based on how you set the last state switch in the I/O chassis. ATTENTION
If outputs are controlled by inputs in a different rack and a remote I/O rack fault occurs (in the inputs rack), the inputs are left in their last non-faulted state. The outputs may not be properly controlled and potential injury to personnel and damage to the machine may result. Be sure you have recovery methods.
Outputs in the controller-resident chassis and in any non-faulted remote rack can remain active if a remote I/O rack fault is detected. Make sure to design your program so that the system goes to a known state in the event that outputs in the controller-resident chassis or non-faulted remote racks are controlled by inputs from the faulted remote I/O rack. Your program must be able to account for the inputs remaining in their last state or the program must monitor the rack fault status bits and reset the input image data table to make remote inputs inactive. Here are two programming methods you can use: • In the very first executable instruction, the program monitors the rack fault bits. If any faults bits are set, the program copies zeros (0) to the faulted rack’s input image data table. The program must continually copy zeros at the beginning of the program scan to the input image table as long as the fault condition remains because the controller sets the input image bits back to the last state at the end of the program scan. • In the very first executable instruction, the program monitors the rack fault bits. If any fault bits are set, the program sets the corresponding inhibit bit for the faulted rack. The program must then execute a one time copy of zeros to the faulted rack’s input image table to reset all inputs.
Defining a Fault Routine
Publication 1785-UM012D-EN-P - July 2005
You can write multiple fault routine programs and store them in multiple fault routine files, but the controller runs only one fault routine program when the PLC-5 controller detects a major fault. You can, however, change the fault routine program that is to be run through ladder logic. If you do not specify a program file number, the controller immediately enters fault mode after detecting a fault.
Page 243
Preparing Fault Routines
15-5
To define a controller fault routine:
For more information about fault codes, see the documentation for your programming software.
Defining a Watchdog Timer
The watchdog timer (S:28) monitors the program scan. If the scan takes longer than the watchdog timer value, a fault routine is initiated and executed. The timer is the maximum time (in ms) for the watchdog; or if you use an SFC, it is the maximum time for a single pass through all the active steps. To define a different value other than the default: .
IMPORTANT
The watchdog timer can go only as low as 10 ms, even though the programming software allows single-digit inputs
Publication 1785-UM012D-EN-P - July 2005
Page 244
15-6
Preparing Fault Routines
Avoiding Multiple Watchdog Faults If you encounter a memory loss fault or watchdog major fault, it may be because multiple watchdog faults occurred while the controller was busy servicing a ladder-related major fault. The memory loss fault occurs when the fault queue, which stores a maximum of six faults, becomes full and cannot store the next fault. Before calling a service representative when you encounter either a memory loss fault or multiple watchdog faults, check: If You Encounter
Then watchdog error and Extend the watchdog timer so that the real run-time error is not a fault bit masked. Check your major fault bits. Ignore the watchdog faults and use any remaining fault bits to help indicate the source of the controller fault. memory loss fault
1.Power down then power up the controller. 2.Reload the program. 3.Set the watchdog timer to a value = 10 current setting 4.Run the program again.
If you continue to encounter the memory loss fault, call your local Rockwell Automation representative.
Programming a Fault Routine
To prepare your fault-routine program, first examine the major fault information recorded by the PLC-5 controller and then decide whether to do the following before the PLC-5 controller automatically goes to fault mode: • set an alarm • clear the fault • execute the appropriate fault routine through ladder logic • execute the appropriate ladder logic to recover from a fault IMPORTANT
Publication 1785-UM012D-EN-P - July 2005
If the PLC-5 controller detects a fault in the fault routine (double-fault condition), the PLC-5 controller goes directly to fault mode without completing the fault routine.
Page 245
Preparing Fault Routines
15-7
Setting an Alarm If you need an alarm to signal the occurrence of a major fault, put this rung first in your fault routine program: alarm output and combine it with a counter. You can also set an alarm in your fault routine to signal when the fault routine clears a major fault.
Clearing a Major Fault You can clear a major fault with one of these methods: • Turn the keyswitch on the PLC-5 controller from REM to PROG to RUN. • Use the programming software to clear the major fault (if recoverable). ATTENTION
Clearing a major fault does not correct the cause of the fault. Be sure to examine the fault bit and correct the cause of the fault before clearing it. For example, if a major fault is encountered causing bit S:11/2 to be set, indicating a programming error, do not use a fault routine to clear the fault until you correct your program.
If you decide to clear the fault in the fault routine, follow these steps: 1. Place the ladder logic for clearing the fault at the beginning of the fault routine. 2. Identify the possible major faults. 3. Select only those your application will let you safely clear. These are your reference fault codes. 4. From the fault routine, examine the major fault code that the controller stores in S:12. 5. Use an FSC instruction to compare the fault code to the reference file that contains “acceptable” fault codes (word-to-file comparison).
Publication 1785-UM012D-EN-P - July 2005
Page 246
15-8
Preparing Fault Routines
6. If the controller finds a match, the FSC instruction sets the found (.FD) bit in the specified control structure. 7. Use a MOV instruction to clear the fault in S:11. In the following figure, #N10:0 is the reference file.
Example of Comparing a Major Fault Code with a Reference R6:0 RES R6:0 U IN FSC FILE SEARCH/COMPARE Control Length Position Mode
EN R6:0 20 0 ALL
DN ER
Expression S:12 = #N10:0
R6:0
MOV
] [
MOVE Source Dest
FD
0 S:11 TND
Remainder of fault routine follows
If the Fault Routine
Then the Controller clears S:11 returns to the program file and resumes program execution.
does not clear S:11 executes the rest of the fault routine and then faults
IMPORTANT
If the fault routine clears the major fault, the controller completes the fault routine and returns to the next instruction in the program file that follows the one that contained the faulted instruction. The remainder of the rung is executed and it appears that the fault never occurred. The fault routine execution continues until you correct the cause of the fault.
Publication 1785-UM012D-EN-P - July 2005
Page 247
Preparing Fault Routines
15-9
Follow these guidelines when creating fault routines: • Store initial conditions and reset other data to achieve an orderly start-up later. • Monitor the shutdown of critical outputs. Use looping if needed to extend the single fault routine scan time up to the limit of the controller watchdog timer so your program can confirm that critical events took place. IMPORTANT
When you clear a fault within the fault routine, it is possible for the controller to clear the fault, return to the faulty code, experience the same fault again and repeat the process over and over. When this happens, the controller is executing the faulty code and the fault routine code, but not the main ladder program. This causes the inputs and outputs to remain in their last state. To avoid this problem, place additional code in the fault routine to instruct the controller to execute the main portion of the ladder code once the fault is cleared.
Changing the Fault Routine from Ladder Logic You can change the specified fault routine from ladder logic by copying a new fault routine file number into word 29 of the controller status file. The following figure shows an example rung for changing the fault routine file number. MOV MOVE Source Dest
ATTENTION
12 S:29
Do not corrupt the program-file number of the fault routine or use the same file for any other purpose. If the file number you specify results in a non-existent fault routine, the controller immediately enters fault mode after detecting a fault. Unexpected machine operation may result with damage to equipment and/or injury to personnel.
Publication 1785-UM012D-EN-P - July 2005
Page 248
15-10
Preparing Fault Routines
Using Ladder Logic to Recover from a Fault If you have the appropriate fault routine and ladder logic to perform an orderly shutdown of the system, you may want to configure an I/O rack fault as a minor fault. You can program ladder logic in several ways to recover from an I/O rack fault.
Ways to Recover from a Rack Fault Method
Description
User-generated major fault
The program jumps to a fault routine when a remote I/O rack fault occurs. In other words, if the status bits indicate a fault, you program the controller to act as if a major fault occurred (i.e., jump to the fault routine). You then program your fault routine to stop the process or perform an orderly shutdown of your system. When the controller executes the end-of-file instruction for the fault routine, a user-generated major fault is declared.
Reset input image table
You monitor the status bits and, if a fault is detected, you program the controller to act as if a minor fault occurred. After the status bits indicate a fault, use the I/O status screen in your programming software to inhibit the remote rack that faulted. You then use ladder logic to set or reset critical input image table bits according to the output requirements in the non-faulted rack. If you reset input image table bits, during the next I/O update, the input bits are set again to their last valid state. To prevent this from occurring, your program should set the inhibit bits for the faulted rack. The global inhibit bits control the input images on a rack by rack basis; the partial rack inhibit bits control the input images on a 1/4-rack basis. For more information on these global status bits, see the documentation for your programming software. This method requires an extensive and careful review of your system for recovery operations. For more information on inhibiting I/O racks, see the documentation for your programming software.
Fault zone programming method
Using fault zone programming method, you disable sections of your program with MCR zones. Using the status bits, you monitor your racks; when a fault is detected, you control the program through the rungs in your MCR zone. With this method, outputs within the MCR zone must be non-retentive to be de-energized when a rack fault is detected. For more information on MCR zone programming, see the documentation for your programming software.
Publication 1785-UM012D-EN-P - July 2005
Page 249
Preparing Fault Routines
15-11
Block-Transfers in Fault Routines If the controller runs a fault routine that contains block-transfer instructions, the controller performs these block-transfers immediately upon completing any block-transfers currently in the active buffer, ahead of block-transfer requests waiting in the queue. The block-transfers in a fault routine should be between the controller and local I/O only. ATTENTION
If you program block-transfer instructions to remote chassis within a fault routine, be aware that all ladder scanning will stop until the block transfer either completes or errors.
Testing a Fault Routine To test a fault routine, use a JSR instruction to jump to the fault routine. Send a fault code as the first input parameter of the JSR instruction. The controller stores the fault code in S:12 and sets the corresponding bit in S:11. You can detect and set your own faults by using fault codes 0-9 or by using the controller-defined fault codes 10-87.
Monitor controller faults using the controller status screen in your programming software.
Monitoring Faults
You can Monitor
Description
See Page
Minor and major faults
Controller faults are categorized into major and minor faults. The controller displays a unique bit for each fault and displays text that describes the fault.
15-12
Fault codes
Fault codes provide information about controller-defined errors.
B-5
Global status bits
Global status bits are set if a fault occurs in any one of the logical racks.
15-13
Multiple chassis status bits
Multiple chassis status bits are used to monitor the racks in your I/O system.
15-13
Publication 1785-UM012D-EN-P - July 2005
Page 250
15-12
Preparing Fault Routines
Monitoring Major/Minor Faults and Fault Codes When a fault occurs, the controller status screen in your programming software displays program file and rung number indicators that point to where the fault occurred.
Interpreting Major Faults Displaying a Description of the Major Faults • The status text that appears corresponds to the most significant fault when the cursor is not on the major fault status word. • If the cursor is on a major fault word bit and that bit is set, the status text that appears corresponds to the bit that the cursor is on. • If no bits are set, the message area is blank.
Clear the Faults by • Using the clear major-fault-function on the controller status screen of your programming software. When you clear major faults, the fault code, program file, and rung number fields are also cleared. • Resetting individual bits. If you have more than one major fault and you reset a bit, the status text displays the next major fault message.
For a description of the major faults (S:11), see Appendix B.
Interpreting Minor Faults Displaying a Description of the Minor Faults • The status text that appears corresponds to the most significant fault when the cursor is not on the minor fault status words. • If the cursor is on a minor fault word bit and that bit is set, the status text that appears corresponds to the bit that the cursor is on. • If no bits are set the message area is blank.
Publication 1785-UM012D-EN-P - July 2005
Clear the Faults by • Using the clear minor-fault-function on the controller status screen of your programming software. • Resetting individual bits. If you have more than one minor fault and you reset a bit, the status text displays the next minor fault message.
Page 251
Preparing Fault Routines
15-13
For a description of the minor faults in word 1 (S:10) and word 2 (S:17), see Appendix B.
Monitoring Status Bits Two types of status bits display information about your system: global status bits and multiple chassis status bits. Each bit represents an entire rack, no matter how many chassis make up a rack. (Remember that you can have a maximum of four chassis configured as quarter racks to make up one I/O rack.) These bits are stored in the lower eight bits of words S:7, S:32, and S:34. The global status bits are set if a fault occurs in any one of the racks. See the table below to determine the number of bits. Controller
Possible I/O Rack Bits
PLC-5/11, -5/20, 5/20E
4
PLC-5/30
8
PLC-5/40, -5/40L, 5/40E
16
PLC-5/60, -5/60L, -5/80, 5/80E
24
The multiple chassis status bits are used to monitor the racks in your I/O system. This information is stored in the I/O status file (S:16, low byte) that you specify using the controller configuration screen in your programming software. The software automatically creates an integer data file to store two words of status bits for every rack configured in your system. For more information on global status bits and multiple chassis status bits, see the documentation for your programming software.
Publication 1785-UM012D-EN-P - July 2005
Page 252
15-14
Preparing Fault Routines
Notes
Publication 1785-UM012D-EN-P - July 2005