Top 10 error implementation.

yoko911

Member
Join Date
Sep 2013
Location
Rosarito
Posts
14
Hello good people,

Im implementing a so called "Top 10 Fails" in a indexer machine in the company and oh boy, I need help :p

You see, this Indexer machine has a register (N7:0) where its registered the indexer status, if its Idle, running, error etc. so in the index there is always a number from 0 to N, N being the number of states.
Then on the HMI, we have a LookUp table, with preprogramed strings that are asigned to each N7:0 value. Pretty normal i think.

What i want to do is, every time an error occurs i want to add a count to it, if error 100 has apeared, add 1 to the counter, then check the 10 errors with the highest counters, and move the numbers to a register that is being pointed in the HMI, (The HMI its no problem)

The think is, i dont know if i should have 200+ counters/rungs just to do this screen, plus i dont know if i can use a sort method on the PLC.
What do you recommend? Maybe some kind of structure where i have the error number and his counts or instead of counts just a numeric register. I dont know i need sugestions.

Thank you so much in advance,
if someone has question or if im not being clear enough feel free to reply i will be checking the post regularly.


PLC is SLC 5/03 and HMI C-More EA7-T8C
 
It's a great question.

Are there more than 255 possible alarms ? I'm just asking because it's easiest to do indexed memory operations within a single data file, and SLC-500 controllers are limited to 255 elements in a file.

I would use an Integer data file, like N100:0-254.

Use ADD instructions with one-shots to increase the accumulated alarm counts in each Integer register. It's easy to index across N100:[x], but more difficult to index across C100:[x] because Counters have 3 INTS each.

I can go dig up my "bubble sort" routine I wrote for a MicroLogix 1400, to see if it's applicable.
 
It's a great question.

Are there more than 255 possible alarms ? I'm just asking because it's easiest to do indexed memory operations within a single data file, and SLC-500 controllers are limited to 255 elements in a file.

I would use an Integer data file, like N100:0-254.

Use ADD instructions with one-shots to increase the accumulated alarm counts in each Integer register. It's easy to index across N100:[x], but more difficult to index across C100:[x] because Counters have 3 INTS each.

I can go dig up my "bubble sort" routine I wrote for a MicroLogix 1400, to see if it's applicable.

Great idea, instead of using another register i can use the adress as the identifier and just save on the register the times the error pops, it leave us with the sorting question though.

PD i can shrink the alarms to 254 it not a big deal some alarms are not that important.

Another idea, can I define data types on scl? i could define the data, and put it on an array, then sort the array and have the HMI point to the top 10 registers.
 
I would not actually sort them, I would have an index file with the indices sorted and only update it when necessary (once per new alarm state).

That way, alarm number 38, for example, uses counter number N57:38 and so on and so forth. The index file would just be a list of the top offenders by pointer, so if alarm number 38 was the high hitter, item zero in the index file would be "38" and if alarm number 1 "E-Stop" was the 2nd most common alarm, the next element would be "1".

To get this to the HMI, you may be able to use multistate display objects for each line and read the index file for the states. But, to get the counter values listed along side them might require that you have PLC code to make a list of those too, since that sort of indirection in the HMI might be difficult or impossible.

I have seen a similar sort of alarm logic in a machine in which they also had some count down logic so that if an alarm did not occur for so many hours, it would eventually fall off the "warning list" as it was called.

In any case, you will want to think carefully about how and when to reset these values and start fresh. FIFO-ing them by each hour is one thing I have seen done, then you set how many hours to look back for your totals. Each increment of the real time clock hour would trigger a shuffle and the oldest numbers would be thrown out and the most recent stored in the front of the array.
 
Last edited:
I would not actually sort them, I would have an index file with the indices sorted and only update it when necessary (once per new alarm state).

That way, alarm number 38, for example, uses counter number N57:38 and so on and so forth. The index file would just be a list of the top offenders by pointer, so if alarm number 38 was the high hitter, item zero in the index file would be "38" and if alarm number 1 "E-Stop" was the 2nd most common alarm, the next element would be "1".

To get this to the HMI, you may be able to use multistate display objects for each line and read the index file for the states. But, to get the counter values listed along side them might require that you have PLC code to make a list of those too, since that sort of indirection in the HMI might be difficult or impossible.

I have seen a similar sort of alarm logic in a machine in which they also had some count down logic so that if an alarm did not occur for so many hours, it would eventually fall off the "warning list" as it was called.

In any case, you will want to think carefully about how and when to reset these values and start fresh. FIFO-ing them by each hour is one thing I have seen done, then you set how many hours to look back for your totals. Each increment of the real time clock hour would trigger a shuffle and the oldest numbers would be thrown out and the most recent stored in the front of the array.

Ok, i think i got it, having a N file, where the adress is the alarm number itself and the number stored its the number of times the alarm occurred.

but how can i found the 10 highest numbers on that file? another thing, if i have in N100:38 the higher count how can i retrieve the number 38?

Thank you!
 
That is where sorting logic will come into play, you still have to sort the index file, I should have clarified what i meant. This could be a full bubble sort initially or on demand, or you might get by with just sorting by exception as alarms occur. This would mean logic that would run on each alarm occurrence that would find the sort order of the total for that alarm only, and then shift all the necessary subsequent elements (this should only be one per alarm) and "insert itself" there...

Or just buy a red lion HMI, log all the alarms. Log in with your browser to get the latest copy and sort them with Excel, run statistical analysis and generate pie charts until your boss is humping in mid air.
 
Last edited:
That is where sorting logic will come into play, you still have to sort the index file, I should have clarified what i meant. This could be a full bubble sort initially or on demand, or you might get by with just sorting by exception as alarms occur. This would mean logic that would run on each alarm occurrence that would find the sort order of the total for that alarm only, and then shift all the necessary subsequent elements (this should only be one per alarm) and "insert itself" there...

Or just buy a red lion HMI, log all the alarms. Log in with your browser to get the latest copy and sort them with Excel, run statistical analysis and generate pie charts until your boss is humping in mid air.


To be precise i have 180 alarms,
lets see if i understand. I will have a file with 180 N-register, the adress will be the alarm itself and the value saved will be the count, then ill have another file with the index of the top offenders, check the numbers on the 180N registers for the top ten and just save the adress.

even if its correct i dont know how to acomplish the second part, i can create the file and save the counts on the file, i have problem sorting the index and pointing the adress :(
 
Yoko,
Here is a RSLogix 500 program that will sort up to 255 numbers. If you are sorting 180 numbers in N7:1 to N7:180 then after sorting, the largest 10 numbers will be in N7:170 to N7:180. You could put this routine in a Subroutine, and call it each time one of your numbers changes.
 
Last edited:
Yoko,
Here is a RSLogix 500 program that will sort up to 255 numbers. If you are sorting 180 numbers in N7:1 to N7:180 then after sorting, the largest 10 numbers will be in N7:170 to N7:180.

THANKYOU!,

I've been breaking mah head on this idea, you guys can tell me if its cool or just a waste of time.

Suppose i have 4 files, N100, N101, N102 and N103, each with 180 registers.

In N100 i would save the Error identifier, (because errors states start on number 45 and end on 45+180 so i cant use addres as the identifier without leaving a lot of registers empty) this N100 will be constant just saving the identifier, in N101 i will save the corresponding count of the error. something like this.

34rua38.jpg

This will be on normal operation of the machine, When someone wants to check the top 10 screen, it will trigger this process, (Link scrren from HMI to PLC)

The procces will do as follows,
Coppy all registers from N100 to N102 and N101 to N103, so now i have 4 registers, now i can apply a buble sort to N103 (this one has the counts), and when one swap is needed, so will be swaped the same registers on N102, i will now have a sorted N103(Counts) and corresponding identifier on N102, and i can just point to the first or last 10 registers.

I think its a lot of processing time, thats why i will only do it when they want to see the screen, wich will be with the machine idle, so the process wont be compromised by the sorting loop.

In other words, it will look like this:
When the process is triggered, we will copy the values:
16ad7bq.jpg

then we will sort only the temp registers, using count as the sorted value but swaping both registers.
In the end i will have this:
15he7lx.jpg


So wath do you guys think??

Thank you!
 
Yoko,
It looks like it will work. The sorting will not take much time at all, 2 or 3 seconds probably.
 
Yoko,
It looks like it will work. The sorting will not take much time at all, 2 or 3 seconds probably.

I simulated that piece of code (SORT) in RSLOGIX and it worked, but when I implemented it on the PLC it didnt work.

I have the sort in a subrutine and it only runs once when i need it, should i run it indefinitely untill the "Done" contact has been closed? or this piece of code is intended to be runned once?

Thank you
 
You should run it until "Done" (B3:1 is equal to B3:0). It will normallly take more than 1 SLC scan to do a complete sort of 180 numbers.
 
Last edited:
You should run it until "Done" (B3:1 is equal to B3:0). It will normallly take more than 1 SLC scan to do a complete sort of 180 numbers.

OK then, i save your code on LAD3, only changing direction to files cuz B3 and N7 was already occupied, and i was using this:

25s4y86.jpg

So it was running LAD3 only once, im gonna change that to this:

10eovw6.jpg

Latching the condition until the sorting is done, Obviusly im gonna change direction to SORT FINISHED. I hope its correct how am i gonna implement it.


Thank you.
 
The Sort Routine uses words B3:0, B3:1, B3:2, B3:2 and B3:4 (all 16 bits of each of those 16-bit words). You need to use different address for your control bits B3:0/0, B3:0/1, B3:0/2, and B3:0/3. Suggestion: you could use B3:5/0, B3:5/1, B3:5/2, and B3:5/3.

But you are making it too complicated. To call the Sort Routine until done, use a NEQ comparison instruction as in the attached picture below. You do not need a ONS One-Shot or a Latch. Call it on every scan until Sorting is done, then stop calling Sort.

Call Sort Routine- Yoko911.JPG
 
Last edited:
The Sort Routine uses words B3:0, B3:1, B3:2, B3:2 and B3:4 (all 16 bits of each of those 16-bit words). You need to use different address for your control bits B3:0/0, B3:0/1, B3:0/2, and B3:0/3. Suggestion: you could use B3:5/0, B3:5/1, B3:5/2, and B3:5/3.

But you are making it too complicated. To call the Sort Routine until done, use a NEQ comparison instruction as in the attached picture below.

That was just an example in my program im not using the same contacts as you can se here, im using B13.

2jazpxl.jpg

BUT hey! your code is nice and neat, Thank you for your help i will try that and comment the results :)

thank you very much :)
 

Similar Topics

I'm trying to remotely update a G10 HMI. We have two of them at the remote site, one updated fine. On the other, after it connects, it tries to...
Replies
0
Views
1,549
Hi, I have a porject using controllogix L62, There is some minor error which is cause by assign big integer to INT data type, But it's...
Replies
2
Views
1,683
Hi everyone I am using VIPA 200 series plc with three profibus slaves - two sew drives and a valve block. When I power up the machine, after a few...
Replies
4
Views
3,021
Hi All, I have a S7318 and it will not go into Run Mode. The Diagnostic Buffer says 'Stop caused by Error When Allocating Local Data'...
Replies
4
Views
4,023
We are facing intermittent issue with emergency stop and line stop. Line stop triggering with alarm of line stop push button activated at one...
Replies
11
Views
310
Back
Top Bottom