Sign in to follow this  
Followers 0
ECSI

Alarms - Sounding a horn on rising edge of any alarm

15 posts in this topic

I have a CompactLogix L43 system and in one routine I have programmed approximately 400 alarm conditions. Each output is a BOOL base tag. The tags are read by a Maple Systems HMI to generate alarms. My customer came to me today and asked if I could add programming to pulse a horn for 3 seconds on a rising edge of any alarm. Is there an easy way to do this without adding 400 one-shot conditions? Is there a magical way to determine if any output in a routine turns on so that I can latch on a horn for 3 seconds? I'm not looking forward to a whole lot more programming to accomplish this so I'm looking for a simple solution if there is one. Any suggestion? Thanks!

Share this post


Link to post
Share on other sites
The way I do it is to use DINT tags and address the individual bits for my alarms. Then you're just looking for a change of state in any of your DINT's, and in addition, you can look for all your DINT's to be zero for "no alarms". You can group the alarms into DINT's by area, severity, category, whatever. That's probably just as much work to change over as 400 oneshots though Oh, and when I say "change of state", you have to look for a change of state to a HIGHER number, otherwise your alarm sounds every time an alarm turns off as well. It's not 100% bulletproof; in theory if you had one alarm turn off and another alarm using a lower bit of the DINT turn on in the same scan of the PLC, you wouldn't pick it up. But I figure for the purpose required that's hardly a deal breaker Edited by ASForrest

Share this post


Link to post
Share on other sites
Yes, I thought about changing my tags over to alias individual bits of DINTs, but that also seems like just as much work, and yes, it isn't bulletproof. I think the one-shot route will be a little quicker. I guess I should just get at it....lol. Actually now that I think of it, maybe the HMI has a way of writing to a PLC tag if it sees a new alarm. I must investigate further.... Thanks

Share this post


Link to post
Share on other sites
I use the DINT method as well, for exactly what you're trying to do. Any way to slice it, you've got to do some grunt work. However! There is a "spreadsheet method" of programming that speeds repetitive work up dramatically. Have you ever noticed that if you double-click on a rung of logic you get an input box at the top with a string of text? Well that's the background code of the ladder logic, and you can actually program in that. Say for example that your rung has a NO contact followed by an ONS instruction, followed by a latch instruction. The text will be: XIC InputTag ONS OneShotBit OTL LatchedBit Copy that into Excel with a column for "XIC", a column for "InputTag", etc. Add a column in the front with "SOR" (for start of rung) and one at the end for "EOR" (end of rung). Duplicate that for each alarm in your system, replacing "InputTag" with your 400 alarm tags and "OneShotBit" with different bits for the one-shot (I'd use a bit array). You can use all sorts of fun Excel tricks (formulas, search and replace, etc.) to make the duplication easier. Once you have everything set, copy and past the whole block into a blank Word document. Do a search and replace with ^p as the search text, and a single space for the replace text. This gets rid of all line feeds (p for paragraph). Then do a second search and replace with ^w as the search text and a single space for the replace text. This gets rid of all extra spaces (w for white space). You still need a single space between each item. Now, highlight everything and copy. Create a blank line in your program, double-click to open the input box and paste the whole shebang in. Hit enter, and there you go! Note that because of the quantity of rungs you will be creating, you may have to do smaller chunks. I've rung into limitations when doing a lot of rungs at once, I think it has to do with the amount of text that can fit in the input box. Also, you'll probably get an empty rung in addition to all your new rungs when you hit enter. You can just delete this. Let me know if you have any questions. You can also try searching the forum. There was a thread a several years ago that talked about this and gave more detail, though it was geared towards RS Logix 500.

Share this post


Link to post
Share on other sites
That's terrific, I had no idea you could do that! This is why I keep coming here

Share this post


Link to post
Share on other sites
I use this technique but find that looking for a higher number (value) doesn't work. Counting the bits works as you mention. but I still want to avound the case where 2 bits swap states. I am trying a a mask technique idea that started here and works better. Copy the dint to a mask , use the mask on following scans, if it doesn't match the mask, set the alarm and then copy the dint to the mask again. This detects ANY changes to the dint. Could be made to work on an entire array I suppose The downside is that it detects cleared alarms too.. Still working that part out... Edited by waterboy

Share this post


Link to post
Share on other sites
Yes, that's why I have to look for a higher number, not just a change. The case of two bits swapping states to me isn't really a big deal because it would only ever occur a higher bit turns off AND a lower bit turns on in the same array in the same scan. And once in a blue moon when all the planets align and that does actually happen, it's not like it causes a major problem. All that happens is your alarm doesn't trigger just that once. If it's really an issue, you'd have to use a couple of loops to scan each bit in the array individually. Have a look at the code below for an example (I haven't tested it, I just threw it together now, but it should be close to the mark) Edited by ASForrest

Share this post


Link to post
Share on other sites
Oh, just realised, that'll crash your PLC. If your array size is e.g. 6, and the array pointer is 5, it'll add one to your array pointer and go looking for element 6, which doesn't exist. That's the trap with starting arrays at zero, but starting at 1 when you count the size The fix is to swap the positions off the ADD and the LES instruction on the third rung. That way after searching element 5, the array pointer will increment to 6 and THEN check if it's less than the size. Since the size is equal to (not less than) 6, it'll stop there

Share this post


Link to post
Share on other sites
This is pretty much how I use DINTs for alarms. I use an AND instruction to avoid detecting cleared alarms. Here's the quick version: DINT tag called "Alarms" and another one called "AlarmsAcknowledged". If Alarms > 0 then I have an active alarm. If Alarms <> AlarmsAcknowledged, then I sound a horn. If the operator presses the silence/acknowledge button, I move the Alarms value into AlarmsAcknowledged. Every scan I AND the Alarms with AlarmsAcknowledged and put the result into AlarmsAcknowledged. Note that the AND instruction should occur before comparing the two registers for the horn or else you'll trigger the horn for one scan every time you clear an alarm!

Share this post


Link to post
Share on other sites
Why do none of you guys use the DDT or FBC instructions?? Annunciation must be a prime reason for their existence.

Share this post


Link to post
Share on other sites
Well I for one didn't know they existed, but I agree they look like they're geared towards annunciation. For a large number of alarms they would be very useful indeed. However, I'll probably continue to use my own method most of the time. This is primarily because I work in a lot of different platforms, not just RS Logix 5000, and my method is not dependent on specialized instructions, and is therefore more universal.

Share this post


Link to post
Share on other sites
Example please?

Share this post


Link to post
Share on other sites
Those two instructions would still give you the issue of detecting a cleared alarm as well as a new alarm. You'd still have to implement JRoss's Bitwise AND trick (which I hadn't thought of, good trick!) before you executed the DDT/FBC. Your AND instruction can only operate on one array element at a time, so while the DDT/FBC with a length of 15 would be neater than 15 individual compare instructions, you'd still need 15 AND instructions preceding it. Or, once again, a loop construct waterboy, if you add those instructions to your code, click on them and press F1, the help file gives a very good rundown on how they work

Share this post


Link to post
Share on other sites
Some great tips above from you guys. I appreciate the input. In the end, I was able to use the HMI capabilities to make life easier. Step 1: Modify first alarm in HMI list to give a notification to the PLC when an alarm goes from OFF to ON. Set PLC tag 'New_Alarm_Detected'. Step 2: Export HMI alarm database to excel spreadsheet. In the spreadsheet find the columns that have been changed for the first alarm. Drag down to copy cells to each alarm line. Step 3: Import spreadsheet back into alarm database and overwrite existing. Now every alarm is set to notify PLC of OFF>ON transition. Step 4 Write a rung in PLC. When New_Alarm_Detected is ON then pulse horn on and off at half second intervals for 3 seconds. Then reset ;New_Alarm_Detected' bit to OFF. Every new alarm that occurs in the HMI will again sound the horn. This all took less than half hour to program HMI...program PLC...test a few alarms. Beautiful! I like the suggestions you all made. If I had used DINTs for alarm bits from the beginning it would have made a lot of sense to try your ideas. Since I didn't use DINTs, this HMI solution was perfect for me. Also, it demonstrates the power of using the import/export features of your favorite PLC/HMI software and using spreadsheets for repetitive tasks. Thanks everyone!

Share this post


Link to post
Share on other sites
With a bit of forward planning, it is easy to only respond to new alarms. Requires a user-defined data type. Hope all can follow attached example. Alarms.ACD

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