Industry Online Support
Technical Forum
5/16/2008 4:33 PM  
Joined: 1/24/2008 Last visit: 11/8/2023 Posts: 6 Rating: (0) 
Hi. I need to program a 2 out of N voting of 18 inputs in an Fprogram. I was thinking about using the ADD_R block and interconect the output to the next ADD_R block for all 18 inputs and check when the output at the last oneis equal to or greater than 2. The problem is to convert the FBOOL inputs to FREAL so it can be interconected to the ADD_R block? Any other sugestions for a solution of 2 out of N voting are also welcome! Vegar 
Last edited by: vroy at: 5/19/2008 11:36 PM 

5/19/2008 8:51 PM  
Posts: 2661 Rating: (278) 
First convert the FBOOL's to BOOL's. Then develop a custom block for carrying out a 2outofN voting. The simplest algorithm I can think of is using a counter. Count up if the BOOL is 1 and count down if the BOOL is 0 for each input. At the end of the block if the counter is >= 2 then set a BOOL output that indicates 2 or more inputs are 1. 
5/19/2008 11:35 PM  
Joined: 1/24/2008 Last visit: 11/8/2023 Posts: 6 Rating: (0) 
That was a good thougt but since the output function also is failsafe the program has to be faisafe straight trough. I found a solution using the F_XOUTY block. Used four of them, two with 2 out of 16 and two with 1 out of 16. The output from the two with 1 out of 16 interconected to an andblock and theninto a or blocktogether with the two with 2 out of 16. This should give the 2 out of N function with expandability ut to a total of 32 inputs. Every input is interconnected to one 2oo16 and one 1oo16. 
Follow us on