2 out of n voting block in RSlogix 5k

Some of the early posts in this thread proposed why the original poster might want to use this type of 'voting'. But, conceptually, I can't understand why you would ever want to make a control decision based on minority values.
rdrast said:
So, a 2 of 16 voting function would output true if any two inputs are on, and false in all other cases. A 4+ of 16 would output true any time 4 or more inputs are on, false otherwise.
So if this is a true 'voting' system, then the 14 inputs that say off would get ignored, and the 2 that say on are the ones with all the power? I have been involved in voting systems, mainly where plant, process or human safety was at stake. Generally speaking, you want an odd-numbered electorate so you can't get ties. Either have one signal sensor, or three, or five etc for each process point. Then only take action when a majority of signals agree. Commonly, such systems will adopt 2-out-of-3 voting. There doesn't seem much point in 2-out-of-anything-else since you're no longer accepting the vote of the majority.

On the other hand is this a simple threshold system where we're not actually trying to eliminate the possibility of false measurement and resulting action? If 2 out of 16 is good enough to initiate action, then presumably we're not measuring the same thing with all 16 signals. What we really have is 16 different signals, and for the sake of the application we are assuming that either the likelihood of failure of these is low, or the consequences of incorrect action are minimal.

It would indeed be useful if Asim Rana actually chipped in to say whether any of the answers fitted what he wanted.

Regards

Ken
 
Index into an array

Terry Woods said:
So... I think it is entirely reasonable to pursue the fastest way possible to make the (at least) 2 out of N determination.
I took Peter Nachtwey's suggestion and used the search term 'bit counting' in Google - about 3,140,000 results, by the way.

I came upon a method which would require only one instruction on an A-B processor and requires no runtime iteration. Would you believe, a lookup table? If you've got the data table space and the addressing power to get to it, it's a pretty simple thing.

Index into an array
 unsigned char parity_array [256] = 
{ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, ... };
// Note that you need to fill-in this array

unsigned char countbits_array_method (unsigned char b)
{
return (parity_array );
}

On a PLC-5 it would be: MOV TABLE[ARG] ONBITS

Forgive the C formatting, even with the LADDER tags, this posting editor always left justifies for me.
 
I assumed 2oo3 type voting earlier, but it could be used for a valve manifold system. When only one valve should be open at any time, then by doing 2 ooN logic, you could set an alarm, fault bit, etc... whenever more than one is open.

Just a thought.

Ken
 
Question

Ken Moore said:
I would guess that he is working on a safety interlock system (SIS). In these systems, many times you will use 3 or more devices sensing the same thing, when any 2 of them detect a problem, action is taken. The number of devices depends on the degree of reliability required.

Ken,

Why on a safety interlock would you wait until 2 things sensing the same thing are active before taking action. I'm trying to think of why you wouldn't want to disable something when any 1 is active? Can you elaborate for the simple minded?
 
When 2oo3 is required, you've basically decided you will not trust any one instrument. The voting prevents false positives AND false negatives.

In my plant, when a SIS system shuts down a process, the only concern is bringing the process to a safe state, this might cause the loss of thousands of dollars, due to ruining the in process material.

So if one instrument goes haywire, you don't shut down. However, a "bad" instrument is read as one shut down vote, so then if any other one votes shut down, you still shut down.

Hope that helps, I can elaborate further if needed.
 
A real life example of 2 (or more) out of N voting that I've seen is Halon fire protection in a computer room. A small system would involve a couple of detectors in the ceiling and a couple under the floor. The system would require at Least 2 detectors to be in alarm before initiating a Halon dump.
Note: Any detector in alarm would still annunciate, but ANY TWO would initiate a dump.

-William
 
So if this is a true 'voting' system, then the 14 inputs that say off would get ignored, and the 2 that say on are the ones with all the power? I have been involved in voting systems, mainly where plant, process or human safety was at stake. Generally speaking, you want an odd-numbered electorate so you can't get ties. Either have one signal sensor, or three, or five etc for each process point. Then only take action when a majority of signals agree. Commonly, such systems will adopt 2-out-of-3 voting. There doesn't seem much point in 2-out-of-anything-else since you're no longer accepting the vote of the majority.

An example 'n of x' situation might be as an interlock in a vacuum feed material handling system. Out of 'x' hoppers, only 'n' can be actively services at one time. You don't care which ones are 'n's, only that you never exceed a certain number of them.

Another might be a dispensing system with a common manifold... You can service 3 dispensing stations at one time out of 20, without an unacceptable drop in manifold pressure.

Many applications are not 'safety' applications you know
 
Rdrast

I understand the difference between 'safety' and 'non-safety' but perhaps you missed my point about voting or threshold?

A voting system takes, say, a temperature and measures the same temperature using 3 probes, and compares the results. There is only one temeprature, but it is being measured three times. This protects against the possibility of sensor drift, sensor failure etc. So far, so good?

A threshold system has multiple items, all with one measurement each. In your dispensing scenario, what if one of the stations reports it's not in use when actually it is? How does n-out-of-x protect against this? If you've only got one sensor on each station you have to assume each one is 100% correct and reliable and telling the truth. Taking a majority decision is irrelevant here.

Voting isn't necessarily tied in to safety applications. But what you're describing sure as hell isn't voting. If you've got 3 stations open and 17 stations closed, who wins the vote? There is no vote! If you had 4 stations (3+1) or 20 stations (3+17) the answer would always be the same. If this was voting 3 vs 1 would produce one result but 3 vs 17 would produce another, because 17's bigger than 3, but 1 isn't (it's always good to get back to first principles!)

Regards

Ken
 
rdrast...

Here's a single rung solution using basic Interger Math...

How about a Divide-and-Conquer Routine... where the binary value is basically de-constructed.

This method should work for any PLC that is capable of Integer-Math.

Let's assume that the lower 8-bits of a 16-bit word (V100) are being used. The upper 8-bits are always zero.

Divide V100 by 16 using Integer Math thus producing a Quotient and a Remainder.



+-------+ +-------+ +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
| DIV | | DIV | | ADD | | DIV | | ADD | | DIV | | ADD | | ADD |
| V100 | | Q(1) | | Total | | R(2) | | Total | | R(3) | | Total | | Total | ALWAYS
| By 16 | | By 8 | | +Q(2) | | By 4 | | +Q(3) | | By 2 | | +Q(4) | | R(4) | OFF
-+ ----- +-+-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +--| |--+--( )
| Q(1) | | | Q(2) | | Total | | Q(3) | | Total | | Q(4) | | Total | | Total | |
| R(1) | | | R(2) | | | | R(3) | | | | R(4) | | | | | |
+-------+ | +-------+ +-------+ +-------+ +-------+ +-------+ +-------+ +-------+ |
| |
| +-------+ +-------+ +-------+ +-------+ +-------+ +-------+ +-------+ |
| | DIV | | ADD | | DIV | | ADD | | DIV | | ADD | | ADD | |
| | R(1) | | Total | | R(5) | | Total | | R(6) | | Total | | Total | |
| | By 8 | | +Q(5) | | By 4 | | +Q(6) | | By 2 | | +Q(7) | | R(7) | |
+-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +-+ ----- +-------+
| Q(5) | | Total | | Q(6) | | Total | | Q(7) | | Total | | Total |
| R(5) | | | | R(6) | | | | R(7) | | | | |
+-------+ +-------+ +-------+ +-------+ +-------+ +-------+ +-------+



.
At the end of the Rung, Total equals the number of bits that are ON.

The "ALWAYS OFF" bit is used to prevent those PLCs that look for the "first out" from doing so.

If more than 8-bits in the word are being used then begin the calculation by dividing by 32. Then divide the Qs and Rs with 16, 8, 4, 2.

Now, the original poster never clarified whether he was looking for 2 or more, or only 2... however, this solution will satisfy either case. If he is looking for only 2 out of N then he simply needs to see if Total = 2. If he is looking for at least 2, then he simply needs to see if Total is greater than, or equal to, 2.

If indeed he is looking for at least 2, then it seems that bit-counting might be a bit overboard. It still seems like there ought to be a way to use AND, OR, NOT, etc, with a bit-shift or two to make the determination faster.
 
It is amazing at the amount of effort expended to answer a qustion that the originator obviously has no more interest in.

By the way I would expect that the File Bit Compare instuction that Gerry/Peter recomended closer to the top of this thread would be the fastest and easiest to accomodate changing values of N.

Just my penny's worth of opinion,

Darren
 
2oo3 Ladder Logic

Sorry, I'm too late to answer but I have something that may be useful to you people for 2oo3 (2 out of 3) ladder logic. Kindly See attached pic.

Appologize, If this answer was already posted.

2OO3 PLC LADDER LOGIC.png
 
We have a n-out of m Matrix Voting in place. We have a very large Logix 5000 infrastructure created that makes the PLC work as a very large 'configurable' DCS. As part of the cause & effect or SAFE charts for a safety shutdown system (which is a small part of the whole system) it handles n out of m voting. Off course n & m have to be reasonable value. The Microsoft HMI helps 'configure' the 'triggers' as inputs & the Shutdown effected output devices, as well as 'n' & 'm' values. The outputs can also be of unlimited quantity & a mix of PIDs, DOs, valves, pumps & a lot of other things. The input 'triggers' could be any quantity of DIs, internal PLC bits or other 'events'. For each 'row' of the SIS system's safe chart the triggers are configurable as are the outputs for a column. The logic execution is event based, so it does not 'tax' the scan time of the PLC. We cannot share the code as it is intertwined with a lot of other activities that are being supported. It is designed so an authorized user of the system can 'configure' the safe charts without using RSLogix5000. We can advise in general how to implement it. [email protected]
 

Similar Topics

Hi, I have a question to implement digital logic. these are.....I have total 8 inputs and my question is any 2 of 8 inputs is true, the output...
Replies
4
Views
2,162
Hi. The election for the STEP7 and WinCC Flexible improvement lists is getting closer. I have the following suggestion for how it shall be done...
Replies
14
Views
3,613
We are presently looking to upgrade an old voting system which has a legacy software program, and uses mechanical switches. We would like to keep...
Replies
22
Views
4,467
Greetings to all, just something to think about while we’re all voting next Tuesday ... how would WE (at www.plcs.net) go about designing a...
Replies
48
Views
11,439
I just wanted to post what I've done and see if anyone has a better solution. We're using fans to pull dust and smoke directly off of a electric...
Replies
6
Views
6,745
Back
Top Bottom