LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with time measurement during the loop

Hi Everybody,

I am fairly new to labview and I have a big problem that is preventing me to move forward with my research. So to make it quick, I have a power meter that i am connecting through VI and then I have created the Case Structure to manually choose the time when i want to do measurements. In this Case structure i want to take values from my power meter but also the time of the measurement. I need this Time values to create a XY graph (After couple transformation of the data from the power meter). I have prepared some code for this but when I was testing it in my lab it didn't work properly.

Can you help me or atleast give me some advice because right now i am pretty hopeless. 

Best Regards

Andrzej

Below I present you screenshots of my work:Program_Screenshot.PNG

0 Kudos
Message 1 of 7
(2,418 Views)

Use Get Date/Time In Seconds to get a timestamp.


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 2 of 7
(2,391 Views)

I have absolutely no idea what you're trying to do. When you say "didn't work properly" what do you mean? What is going on in those subvis with the generic icons (you should really make icons that are more meaningful)? Since you didn't include your code I can only take guesses from your picture. You're taking the output from vi3 (for lack of a better description) and reporting that value along with the time difference when you hit switch for measurement. Prior to that your output arrays will contain whatever is in the FALSE case. Depending on how you have the Switch for measurement control set the vi may continue as True or False. 

 

Edited to add: It's really a bad idea to have autoindexing outputs on a while loop as your arrays can grow large. Every iteration of the loop will add values until you exit the loop.

0 Kudos
Message 3 of 7
(2,384 Views)

All I see is Rube Goldberg code. Your x and y array sizes are most likely completely unrelated. Yes, autoindexing tunnels are a bad idea on while loops, but at least make them conditional.

 

I strongly recommended to go back to the basic tutorials.

0 Kudos
Message 4 of 7
(2,334 Views)

It seems you're starting and stopping the measurement and try to filter out 'dead' measurements afterwards?

As Altenbach mentioned, it's a lot better to set the while loop border to conditional and simply _not_ add those values to the array when in non measurement mode. With the current solution you'll need to filter the measured array in the same loop as you filter the times as those array will end up different sizes otherwise.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 7
(2,284 Views)

Hi,

Thank you for the answer and the questions regarding this case.

I should have add the code earlier but I didn't had access to that at the time I was writting this post. 

The subvis with the generic icons are provided by the producent of power meter and the one that is out of the loop provides connection to the device and the other one gives data from the power meter.

What i meant when i said that it doesnt work properly was that I want to get the real time of measurement that happens in Case Structure "True" case. This time have to be in miliseconds and then I want to put values from power meter on Y axis and Real time values in miliseconds on X axis. As you can see there is also some operation on the data that I gather from the power meter but It's not the case of the problem that I am struggling with. 

Please find attachement with my VI (You can put random data instead of power meter values from subvis). 

Best Regards

Andrzej

0 Kudos
Message 6 of 7
(2,253 Views)

Right click on each of your output tunnels and select "Conditional". Connect your boolean control to the ? that is now on the output tunnel. You will only have data in your array when the boolean value is TRUE. If I understand correctly this is what you want.

0 Kudos
Message 7 of 7
(2,239 Views)