LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing 2 plots on the same graph

Hi all,

 

I am working on a project at the moment, where a user inputs a signal via the position of a sensor, connected via arduino,and tries to match an ideal waveform. 

 

I am trying to figure out a way of grading how well the user is doing using a percentage of time that the user is within a certain tolerance. 

 

Is there a way to set this up, where LabVIEW looks at a plot while it is generating and creates a percentage as the plot is being made? 

 

I've included below the front panel and block diagram

 

Thanks in advance,

 

Chris

Front PanelFront PanelBlock Diagram midway through routineBlock Diagram midway through routine

0 Kudos
Message 1 of 9
(3,601 Views)

We can't help you debug pictures, and certainly not ones where critical code is buried in Express VI's.

 

Isn't your VI doing what you want it to do?  I see the plots of two signals, a good triangle and a second that is being read from a VISA resource.

 

And I see an indicator that says percentage, and is coming from some hidden calculation of those two signals.

 

I don't see an actual VI I can open and poke at to see what is behind that Express VI.

0 Kudos
Message 2 of 9
(3,596 Views)

Apologies, this is my first time using this forum properly, including the vi probably would be helpful!

 

 

0 Kudos
Message 3 of 9
(3,592 Views)

Hi CSimons,

 

the "nice" thing about ExpressVIs and their DDT wires is: they effectivly hide the real datatype from programmers view!

 

What kind of result (aka datatype) do you expect from a comparison function? Why do you expect some percentage float value instead?

 

Lesson learned: ExpressVIs are for quick&dirty experiments - but as soon as you need to understand what your own VI does they will not be of much help…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(3,578 Views)

Thanks for your reply GerdW, I had this as an earlier version (see file attached).

 

What I want it to do from there (and what I can't figure out how to do) is to get a percentage for the amount of time that the LED is on for.

 

Any guidance or tips on that matter would be greatly appreciated

0 Kudos
Message 5 of 9
(3,573 Views)

Wow,  it really isn't clear at all what that result is supposed to be, the express VI and blue dynamic datatype wire hides it so well.  Seeing what is in the setup panel for the Express VI gives a clue as to what the output would be, but only if you really, really think about it.  I had to turn that into a subVI and dig down deeper into another subVI to confirm what it was really outputting!

0 Kudos
Message 6 of 9
(3,571 Views)

Hi CSimons,

 

to get a percentage for the amount of time that the LED is on for.

Then you need to count how often the LED is on and how often it is off.

To calculate the percentage is rather easy then - simple math…

 

(Counting something is rather easy once you understand how to use shift registers!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(3,568 Views)

Thank you for the tip of using shift registers, my question now is how can I get this vi to check the boolean true/false from the LED on/off and only add 1 if the value is true? And is the way I have the shift registers a lean way of getting the denominator for the percentage calculation?

 

My lack of knowledge in regards to labview is what is tripping me up here, so any advice or tips on which tools/functions to use to count the ON/OFF output would be super helpful.

 

Thanks,

 

Chris

0 Kudos
Message 8 of 9
(3,553 Views)

Use Boolean to 0,1 to turn the boolean value into a number.  Then add that number to a shift register.

Note there is a Increment +1 function so that you can add one with a single node.

 

You need two shift register.  One that adds one when the boolean is true.  (Bool to 0,1)   and one that adds one on every iteration (like you have now).  Just divide the two sums!

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

Message 9 of 9
(3,548 Views)