LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling indicator with several inputs

Solved!
Go to solution

Hello, I have attached what I want to implement in LabVIEW on a much larger scale, there will be dozens of controls (only 4 are shown in the code) and they will be located in different parts of the code, so dragging wires to inputs of compound OR gate will clutter the code and I already have way too many wires. In normal code, I'd write something like:

 

result = 0;

if boolean == 1 and numeric == 0 then result = 1

if boolean2 == 1 and numeric == 2 then result = 1

if boolean3 == 1 and numeric == 7 then result = 1

if boolean4 == 1 and numeric == 5 then result = 1

 

I can easily implement the "if" portion of the code with local variables, but I'm not sure how to pass that values to result LED without using OR gates.

0 Kudos
Message 1 of 6
(925 Views)

Can you "save for previous" (LabVIEW 2020 or below, and attach again)?

 

Easies would to use a SET with a cluster of [array of all booleans, integer] and enter all combination that result in 1. Generate a 0 or 1 depending on if the entry is found or not.

 

(Above assumes that  0, or 1 are the only possible output values. If some combinations can result in a 2, 3, or similar, you could use a MAP containing all non-zero entries where the value is the result.

 

 


@John32d wrote:

I can easily implement the "if" portion of the code with local variables, but I'm not sure how to pass that values to result LED without using OR gates.


Why in the world would you need local variables for any of this????

At least in the USA, OR gates are still legal. What prevents you from using them???????

0 Kudos
Message 2 of 6
(905 Views)
Solution
Accepted by topic author John32d

@altenbach wrote:

Can you "save for previous" (LabVIEW 2020 or below, and attach again)?


Here's a snippet of the original code:

 

 

I'm guessing that the Numeric should be an Integer as floating points are not exact.  Here is another option using arrays:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(898 Views)

Code for LabView 19 version is attached.

What prevents me from using OR gates is the complexity of the code, I'll have to drag the code across multiple screens and this makes debugging extremely difficult, I'm looking for a better way to achieve that. 

0 Kudos
Message 4 of 6
(887 Views)

@John32d wrote:

I'll have to drag the code across multiple screens and this makes debugging extremely difficult, 


So your problem really is elsewhere! 😄

 

0 Kudos
Message 5 of 6
(880 Views)

@John32d wrote:

Code for LabView 19 version is attached.


Major flaw: As has been said, doing equal comparisons with DBLs. Should they be integers?

 

You said you have dozens of controls, not just four. Why all these loose booleans, why not a boolean array? Where does the truth table come from? How often does it change? What are all possible values for the numeric?

0 Kudos
Message 6 of 6
(868 Views)