LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combination Logic

Solved!
Go to solution

I want to make compare and combination logic in Labview.

 

Please refer below drawing

1.jpg

In above drawing we provide 250 set point and using 14 reading compare and choose specific reading as per given set point like

38.2+54.3+75.8+81.7 = 250 as per given drawing

So we make Combination & compare logic like above system.

0 Kudos
Message 1 of 10
(4,497 Views)

You can start with here state machine example and tutuorial: http://www.ni.com/white-paper/3024/en/

Thanks
uday
0 Kudos
Message 2 of 10
(4,485 Views)
Solution
Accepted by topic author Mak41188

You haven't shown any of your work, so all I'll offer is a few links that I found interesting:

 

http://forums.ni.com/t5/LabVIEW/Easiest-way-to-sum-all-possible-different-combinations-in-an/td-p/20...

http://forums.ni.com/t5/LabVIEW/How-can-I-create-list-of-permutations/td-p/1256988

http://forums.ni.com/t5/LabVIEW/permutations-of-a-6-numerically/td-p/1173677

 

What have you tried?  What isn't working?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 10
(4,471 Views)

What are your exact rules?  Can only use 4 measurements or as many or little as needed?  Can you repeat using measurements?

 

At the top of my head, I think recursion will be very useful here.


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 4 of 10
(4,467 Views)

My first link contains a nearly-complete answer.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 10
(4,452 Views)

The rule is the combination addition equal to given set point. You can use number of measurements out of 14 readings & 14 reading are unknown every time is changing and we finding out the correct combination that’s it.   

 

0 Kudos
Message 6 of 10
(4,439 Views)
  1. Show me your code, wire-worker, and I'll show you mine.
  2. The first link I provided, very slightly modified, will do what I think you need.
  3. How much LabVIEW experience do you have?
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 10
(4,429 Views)

Do you have problems with the logic or with the LabVIEW implementation?

 

You have 2^14 possible selections, so the brute force approach would be to simply count up to that, covert each number to a boolean array, multiply with the aray of selections and take the sum, then pick the combination that is closest to 250. Be aware that you might not get an exact equality due to limitations of the DBL format. You actually might want to multiply all values with 10 and operate on integers instead.

0 Kudos
Message 8 of 10
(4,396 Views)

OK, you got 4 possible solutions as follows. Takes just an instant to calculate using my suggestion.

 

42.1 + 59.6 + 72.5 + 75.8 = 250.00
57.3 + 59.6 + 65.6 + 67.5 = 250.00
38.2 + 42.1 + 42.9 + 54.3 + 72.5 = 250.00
38.2 + 54.3 + 75.8 + 81.7 = 250.00     <<<<< your solution above

 

Try it!

 

0 Kudos
Message 9 of 10
(4,388 Views)

Here's a simple example.

 

 

 

(Many things could be optimized, of course. This one takes about 10ms, which seems long. I have one that is ~6x faster but I am sure it can be furthre improved :D).

 

0 Kudos
Message 10 of 10
(4,347 Views)