LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing array values

Solved!
Go to solution

Sorry, I am on a different computer at the moment, but do you agree that such a truth table is significantly easier to understand than a long paragraph of ambiguous descriptions? 😉

 

(Same reason why graphical programming is better than text programming :D)

 

So lets, take a step back and look for the pattern. Seems simple enough:

 

  1. Both are typically OFF
  2. Except for the upper left four squares, where typically both are ON
  3. Except on the top left where W is OFF.

Now, since you are inspecting three values at a time, you potentially hit more than once square and you need to resolve the potential conflict. Do all three values need to be ON for the LED to be ON?

 

0 Kudos
Message 11 of 16
(1,243 Views)

It's definitely way easier Smiley Happy I'll be implementing this method from now on

 

Here's a screengrab from the VI I chalked up:

tfsp vi.JPG

 

0 Kudos
Message 12 of 16
(1,239 Views)

Personally, I feel it is often easier to just implement an explicit truth table as a lookup, then thresholding into an array of boundaries to get the corresponding lookup indices. Now you can easily adjust the result of any of the nine possible conditions without doing explicit mental boolean gymnastics. 😄

 

Here is one possible solution, but modify as needed.

 

TruthTable.png

0 Kudos
Message 13 of 16
(1,229 Views)

I didn't even know this was possible, this makes it way better because sometimes the conditions change. 

 

One thing I've been trying to accomplish is displaying the warning sign when any  1 of the states have a warning. See example below: truth table 2.JPG

 

I used a probe at the output of the index array and it always outputs false for the warning light unless ALL 3 are true. This doesn't follow the logic of the truth table since this configuration would be in the top middle cell of the truth table we made (both are ON).

0 Kudos
Message 14 of 16
(1,217 Views)
Solution
Accepted by gregb7

@altenbach wrote:

Now, since you are inspecting three values at a time, you potentially hit more than once square and you need to resolve the potential conflict. Do all three values need to be ON for the LED to be ON?

 


Since you have not answered my above question yet, I made some assumptions. To require at least one LED to be ON for the global to be on, you can init with F/F and replace the AND with OR (and rename the label of the cluster indicator). Just play around until you get what you need. We cannot know unless you provide full specs. 😉

 

TruthTable2.png

Message 15 of 16
(1,213 Views)

Oh I missed your question earlier. So I tried that but now it has the same issue with the interlock satisfied signal instead. If any of the 3 values are triggered, the global value has to match. I'll try to play around to get them to indicate correctly

0 Kudos
Message 16 of 16
(1,200 Views)