Sign in to follow this  
Followers 0
Hugo Brown

How to use Fault OBs for Error Reporting

7 posts in this topic

Hi Guys, I have a small project with an S7-300 (CPU 317-2 DP – 317-1EA00-0AA0). I have been tasked with setting this PLC up as a glorified remote I/O base. We are connecting it to an Allen Bradley system (which is all working fine). What I am struggling with is how to report any faults. I have the error OBs which seem appropriate set up in my project and latching a flag when they are run. The problem is I’m struggling to figure out the logic of when the OBs are running. OB82 seems to fire once when a diagnostic fault from an I/O card appears and then once again when it goes. Others seem to stay on consistently. But since they don’t all do this I can’t stick to the logic of detecting a fault going away by the OB no longer running. So my question: Is there a standard way of using the fault OBs purely for error reporting and detecting when the error goes? Or does anyone know of a document which will explain when they run? Some googling (lots of it in fact) brought me to the “System Software for S7-300/400 System and Standard Functions Volume 1 of 2” which was quite handy but didn’t really answer my question. Thanks

Share this post


Link to post
Share on other sites
The error OB's are called when the PLC detects an error. OB121 = Programming Error OB81 = Power supply error OB122 = i/o access error OB73 = Communications error OB80 = Time error OB86 = Rack Failure OB84 = CPU hardware Fault OB30 to OB38 are cyclic interrupts. Plus many more. If your program latches a Marker in one of these OB's then you have to "evaluate" the condition of the Marker in OB1 (or a FC Called from OB1) The manual "System software for S7-300/400 System and Standard Functions" will list all of the OB's. The OB's also have error codes - look in the TEMP variables field in the OB Header Edited by Moggie
1 person likes this

Share this post


Link to post
Share on other sites
Here is an example to indicate Low Battery Error EV_CLASS = B#16#39 = Event comming EV_CLASS = B#16#38 = Event Cleared FLT_ID = B#16#22 = Battery Error M50.0 is SET when the low battery is detected and RESET when the Battery is OK L #OB81_EV_CLASS L B#16#39 ==I JCN M001 L #OB81_FLT_ID L B#16#22 ==I S M50.0 (BATTERY LOW) M001: NOP 0 L #OB81_EV_CLASS L B#16#38 ==I JCN M002 R M50.0 M002:NOP 0 Edited by Moggie

Share this post


Link to post
Share on other sites
Hi Moggie, thanks for responding and sorry for the late reply. Thanks for the example. I tried reading the “System and Standard Functions” document but didn’t find anything specific about each of the OBs and when they run and in what pattern (as regards running for the duration of the error or pulsing) but I will read through again. I was really hoping for an example setup someone had for an S7-300 with all the logic already in place for tracking errors as OBs flash up but I don’t think it’s going to be that simple.

Share this post


Link to post
Share on other sites
Here is the S7 help file document for OB81, it states when the OB is called. The Step7 help file can be found within the S7 programming software Power Supply Error (OB81) Description The operating system of the CPU calls OB81 if one of the following fails in a CPU or an expansion unit The 24-V voltage supplyA batteryThe complete backupThis OB is also called when the problem has been eliminated (the OB is called when an event comes and goes). Programming OB81 You must create OB81 as an object in your S7 program using STEP 7. Write the program to be executed in OB81 in the generated block and download it to the CPU as part of your user program. You can, for example, use OB81 for the following purposes: To evaluate the start information of OB81 and determine which power supply error has occurred.To find out the number of the rack with the defective power supply.To activate a lamp on an operator station to indicate that maintenance personnel should replace a battery.If you do not program OB81, the CPU does not change to STOP mode if a power supply error is detected. The error is, however, entered in the diagnostic buffer and the corresponding LED on the front panel indicates the error. Edited by Moggie

Share this post


Link to post
Share on other sites
Hi, So looking at that i created an example project with some basic info being taken from the OBs which my PLC is compatible with. The basic idea is that i have split the OBs in to 2 categories: 1) ones which run repeatedly when the error is active 2) ones which run at the beginning and end of a fault for the type 2 I evaluate the temp variables as moggie pointed out and set an error flag using that. for type 1 I set a temporary flag which i evaluate every second on a trigger: i copy this to another location and reset the temp one, if the temp one is returned to high within a second I keep my second flag high, otherwise it is reset. anyone got any thoughts on this? (see project attached) Oberrort.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0