08-30-2016 10:36 AM
I want to make compare and combination logic in Labview.
Please refer below drawing
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.
Solved! Go to Solution.
08-30-2016 10:50 AM - edited 08-30-2016 10:51 AM
You can start with here state machine example and tutuorial: http://www.ni.com/white-paper/3024/en/
08-30-2016 11:16 AM
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/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?
08-30-2016 11:19 AM
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.
08-30-2016 12:05 PM
08-30-2016 01:15 PM
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.
08-30-2016 01:39 PM
08-30-2016 10:45 PM - edited 08-30-2016 10:46 PM
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.
08-30-2016 11:37 PM - edited 08-30-2016 11:43 PM
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!
08-31-2016 11:10 AM - edited 08-31-2016 01:43 PM
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).