LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Array with case structure

Solved!
Go to solution

Hello, 

 

I'm fairly new to LabVIEW but was able to put together and automated system using cRIO and scan (if I can do it, anyone can).  Now, I'm trying to make a fail-safe mechanism with float switches.  I was tinkering around on a new VI to figure it out but I'm running into an issue.  I get the first three float switch indicators to turn off the pump but the last array doesn't work.  I've swapped the indicators around to ensure it was faulty wiring but I still run into the same problem.  

 

Best,

Josh

 

 

0 Kudos
Message 1 of 6
(5,123 Views)

I cannot see your VI (running LV 2016), but if you are auto-indexing through a for loop, then it will only run as many times as the smallest of all array sizes or count terminal inputs. This is just a guess, if you upload a back-saved VI or picture of the diagram I can take a look.

0 Kudos
Message 2 of 6
(5,120 Views)

Why not just Or the array and see if you the result is true. If it is, turn ff the pump.

 

Or array.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 6
(5,098 Views)

Thanks for the input.  I'll show you what I'm trying to set up as a safety mechanism.  I have a multiple pump setup (6 pumps) that all run on a timer with 30 second intervals.  I'll show both VIs.  I was doing a trial safety VI to get an understanding of how it works before I put it into my VI that will actually run.  Is there a reason why the number four array doesn't input? I'm guessing I would have to put all the pumps in one big case structure that feeds from the array of float switches, correct?

0 Kudos
Message 4 of 6
(5,054 Views)

Thanks for the input.  I'll show you what I'm trying to set up as a safety mechanism.  I have a multiple pump setup (6 pumps) that all run on a timer with 30 second intervals.  I'll show both VIs.  I was doing a trial safety VI to get an understanding of how it works before I put it into my VI that will actually run.  Is there a reason why the number four array doesn't input? I'm guessing I would have to put all the pumps in one big case structure that feeds from the array of float switches, correct?

Message 5 of 6
(5,053 Views)
Solution
Accepted by topic author jmed87

When you convert an array of Booleans to a number, the resulting value is a bitwise representation of the individual elements. So, if you have a 4 element Boolean array the first element in the array is the least significant bit of the number. The last element of the array is the most significant bit of the number. So, here are some examples of the values you will get.

 

A[T, F, F, F] = 1d = 0x1 = 0001b

A[F, F, F, T] = 8d = 0x8 = 1000b

A[F, F, T, F] = 4d = 0x4 = 0100b

 

In your case statement you have no option 8. which would correspond to your 4th Boolean control in your array. Your case statement would also need to account for cases when more than one Boolean is set. A single case can handle multiple values by using a comma delimited list. For example, a case that would trigger whenever the first Boolean is true would be "1", "3", "5", "7".



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 6
(5,040 Views)