12-14-2015 03:47 PM
Hi
I'm still very green in LabVIEW and are working on a project where i could use a hint or two.
I am making a VI with a slide that controls 2 points on a xy graph. The slide can go from 0-100 and i want a counting system which can detect and count one set. A set is defined as when the slide goes from below 25 to above 60 and back below 20 again. Futhermore i want it to store the max and minimum value of each set.
Fx
If the slide goes from 0 to 81 and back to 5 it should count 1 set. If the slide then goes from 5 to 71 and then back to 2, another set should be added and the indicator that counts sets should now say two sets done. If the slide doesnt get above 60 in a set, it shouldnt be counted.
I've attached a VI which have a slide and a graph that shows the two points plotted, to give a better understanding of my problem.
I hope someone got a hint for a solution to this, thanks!
12-14-2015 03:55 PM
Hi there, can you save in LV 2014 or lower?
12-14-2015 03:58 PM - edited 12-14-2015 04:03 PM
This is all pretty basic. See how far you get....
12-14-2015 05:48 PM
12-14-2015 06:07 PM
12-15-2015 03:08 AM
Thanks gregoryj! I have been searching far and wide for that! 😄
12-15-2015 05:07 AM
I have troubles finding a boolean that only switches when above and below certain values. Is there an easy solution or do i have to make a system for that function? 🙂
12-15-2015 09:15 AM
OpenG comes with a boolean trigger function, I'm not sure how useful that would be though. If you values change in a somewhat continuous way, (i.e. in steps of 5, not 80) then you can probably easily catch it with a case a structure. The next case would be held in a shift register of the while loop.
Case 1: If x<25 --> Case 2, else Case 1.
Case 2: If x>60 --> Case 3, else Case 2.
Case 3: If x<20 --> Case 4, else Case 3.
Case 4: Increment set counter then back to Case 1.
12-15-2015 09:23 AM - edited 12-15-2015 09:24 AM
It could look something like this. I haven't filled in all of the cases for you or put in any logic for picking the next state. Also, if you use those enum constants, it's always a good idea to make them type definitions. That way if you add or remove states, the constants will be updated everywhere. Right click >> Make Type Def. Right click >> Open Type Def. then save it near your VIs, or in an appropriately named subfolder.