LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delaying some part of the VI

I want to give some signals to the output and then gather data from the sensors after some specific amount of time, so I wont get the transient data.

 

So I want to give analog output out and then after like 5sec collect data from AI. I have tried "wait(ms)" and "wait until next ms multiple", but what they just add some delay and do the same thing, instead of just starting to collect data after some time. 

0 Kudos
Message 1 of 16
(2,972 Views)

To clarify:

Lets say I want to send signal from AO from 0-15sec and collect data from AI from 10-15sec. So the question is how to do that?

 

Thanks.

0 Kudos
Message 2 of 16
(2,970 Views)

From the most simplistic standpoint, the wait function is the easiest to do, assumign you don't have a tight tolerance on your 5 secs delay.  You didn't give an example of how you tried to use it, so I don't know what you ddn't like about it.  If you dropped the code and had no data flow, you may have run your wait in parallel with your analog output.

 

A more complex way, but would give you more accurate timing is to use triggering to start your acquisition, but you'll need to provide more information about your setup and what you are doing with the analong input and output lines.

0 Kudos
Message 3 of 16
(2,961 Views)

As I said I want some part of the VI start running after T seconds. But when I use the wait function, it looks like it just put the data into buffer and process them after T seconds.  

For example, in the attached file, I want to collect data in [0,10] then plot them in [2, 10] and do the process in [5,10]...

The part that I have not put it yet, is to send a signal and run the motor at t=0sec and then collect data at t=2sec.

0 Kudos
Message 4 of 16
(2,945 Views)

Or to make it more complete, how can I have some sub-VI that can calculate something based on the data I am collecting from some T1 to T2. So it should wait till T1 and just get the data till T2.

0 Kudos
Message 5 of 16
(2,938 Views)

Base don your test vi, you can use Extract Portion of Signal xpress VI.  It will take a subset of your signal.  I don't know howvwer that this will ultimately fulfill all your needs.

 

The issue in your VI is all the time delays occur in parallel with the signal acquisition.  Sicne you acquisition takes 10s, the waits are useless.  The signal data is 10s worth of acquisition since that is how much you requested.  Simply adding time delays does not make LabVIEW split the signal data.

 

You may wish to explicitly state what your ultimate task is, as you can get better answers that way.

Message 6 of 16
(2,933 Views)

Oh thanks. This is pretty helpful. I guess that's what I need. 

I am trying to send some signals to run a motor and then after T sec (so the motor is its steady state) I want to plot some graphs and do some calculations. So the whole thing is about throwing out the transient part of the data.

 

Also, for some reasons, the graph has hour/min/sec as its x-axis. I tried to changed it from the graph properties/display format; but I couldn't. Do you know how can I fix it?

 

Thanks. 

0 Kudos
Message 7 of 16
(2,921 Views)

Hey Baran,

 

I'm assuming you mean the graph titled Section on your front panel. Unfortunately, that is a byproduct of the way the Dynamic Data Type is stored. However, there are two quick fixes. First, right click on the graph and select Ignore Time Stamp. That will change the format of the x-axis for you. The second solution is to change the data type to a waveform, as is this code snippet;

 

forum2.png

 

That will also change the formatting of the x-axis. Hope that helps!

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
Message 8 of 16
(2,906 Views)

Yes. The problem is the way x-scale is presented in front panel, as you can see in the attached. The second method you said works, however it shows based on samples not time. Is there anyway I can get the plot based on time?

 

Thanks again. 

0 Kudos
Message 9 of 16
(2,901 Views)

Hey Baran,

 

Try this code and see what you think. Have a great evening!

 

 

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
Message 10 of 16
(2,877 Views)