LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time on x axis of waveform graph under 0,1 s

Solved!
Go to solution

Hello !

 

I tried also with block elapsed time and get the same results.

If I set while loop on every 0,1 s I get right results.

But if I set time of while loop on 0,01 s I get double points.

 

here is my program

 

any suggestion?

 

Thank you.

0 Kudos
Message 11 of 20
(1,109 Views)

You may want to use the Wait function rather than the Wait until next ms function.

 

Your X axis is coming from the elapsed time express VI which is based on the Windows clock.  It has a resolution of approximately 16 msec.  So depending on how your loop is executing, it is possible that you could get two points that are very close to each other in time, and they just happen to fall within the same update cycle of the windows clock.

0 Kudos
Message 12 of 20
(1,099 Views)

@DODI wrote:

But if I set time of while loop on 0,01 s I get double points..



I don't see that, even though there is some jitter. As has been mentioned, one problem is the use of "wait next ms multiple", which make the first loop iteration time not deterministic. It will be randomly between 0 and the wait time you specify. That is a inportant feature of this function, check the help.

 

Using "elapsed time" express VI is not very lightweight. As I said, just use tick count.

 

For better timing accuracy, use the timed loop.

 

Building potentially infinitely sized arrays at an autoindexing while loop boundary could cause memory and performance issues after a while of running.

 

As I said, an xy graph is probably overkill, since your x-values are spaced equally.

 

Fast aquisition timings should not be software controlled. Use hardware timed acquisition instead and read the buffer at leisure.

0 Kudos
Message 13 of 20
(1,090 Views)

Ok if I use the Wait function instead of the Wait until next ms function I will get better result.

But than I insert a delay with Wait function in my program which is not good as I want to record voltage during transient phenomenon (response on a step) and not just voltage at constant value.

 

I also wonder two things.

One is Windows clock  (16 ms resolution), is this connected just with Wait until next multiple function, or also with the execution of while loop.

For example: if I set while loop on 1 ms will it be correct executed or not. Or better saying what is the resolution of while loop in ms in LabVIEW?

 

 

 

 

 

 

 

 

0 Kudos
Message 14 of 20
(1,073 Views)

Ok if I use the Wait function instead of the Wait until next ms function I will get better result.

But than I insert a delay with Wait function in my program which is not good as I want to record voltage during transient phenomenon (response on a step) and not just voltage at constant value.

 

You said:

Use hardware timed acquisition instead and read the buffer at leisure.

What do you need for hardware timed acquisition? Is it possible to make hardware timed acquisition with PCI 6251 or I need something extra hardware, some clock perhaps.

0 Kudos
Message 15 of 20
(1,059 Views)

I made some program is it OK as I used  "wait next ms multiple" function and get time under 0,1s.

(I used "wait next ms multiple" function instead of wait function beacuse I do not want a time delay in my program)

I wonder how to make time out of ticks to make first tick count which is outside while loop to execute all the time not just once before entering in while loop?

 

 

 

0 Kudos
Message 16 of 20
(1,049 Views)

@DODI wrote:

I made some program is it OK as I used  "wait next ms multiple" function and get time under 0,1s.

(I used "wait next ms multiple" function instead of wait function beacuse I do not want a time delay in my program)

????  Wait next ms multiple is a wait function just like the ordinary wati function.  I don't know what you are talking about with "I do not want a time delay in my program".  If anything Wait Next ms could cause a longer wait.

 

Example, you have code in a loop that takes 9 msec, and you have a 100 msec wait.  The loop iteration time will be 100 msec.

You have code in a loop that takes 9 msec, and you have a 100 msec wait Next ms.  The loop iteration time will be unknown.  It will take anywhere from 9 msec to 109 msec depending on where in the time the loop occurs.  The wait releases itself on the 100 msec interval.

 

If you have code in a loop that takes 109 msec and a 100 msec wait.  The loop iteration time will be 109 msec.

If you have code ina loop that takes 109 msec and a 100 msec wait Next.  The loop iteration time will be anywhere from 109 msec to 209 msec depending on which 100msec interval the clock is in.

 

As you can see, Wait Next is not as determinate as a normal Wait.  It's only advantage is causing a wait to release itself at uniform clock intervals.

 

 

I wonder how to make time out of ticks to make first tick count which is outside while loop to execute all the time not just once before entering in while loop?

 

I don't understand your question.  Why do you want to do this?  You have the function inside the loop giving you this information as well.

 

 



@DODI wrote:

One is Windows clock  (16 ms resolution), is this connected just with Wait until next multiple function, or also with the execution of while loop.  This is based on anything that are time functions such as elapsed time.  It has nothing to do with the tick timer.

For example: if I set while loop on 1 ms will it be correct executed or not. Or better saying what is the resolution of while loop in ms in LabVIEW?

 

If the while looop is set for 1 ms, it will execute at 1 msec.  But if you used something like Elapsed Time which reads the Windows clock, you will see probably 16 readings that all have the same time.  If you use the msec tick counter, then you will see 16 different tick counts.

 


 


@DODI wrote:

Ok if I use the Wait function instead of the Wait until next ms function I will get better result.

But than I insert a delay with Wait function in my program which is not good as I want to record voltage during transient phenomenon (response on a step) and not just voltage at constant value.

 

Why do you say that? 

 

You said:

Use hardware timed acquisition instead and read the buffer at leisure.

What do you need for hardware timed acquisition? Is it possible to make hardware timed acquisition with PCI 6251 or I need something extra hardware, some clock perhaps

 

The 6251 will give you hardware timing.  Look at DAQmx example VI's.  When you set a data acquisition rate and request to read 1 sample at a time, the DAQ will act as you loop clock causing it to iterate whenever the sample is acquired and passed out of the DAQmx write.  If you did continuous acquisition, but let's say read 10 samples at a time, the loop will run slower, but the array of points you get you know will have been precisely the DAQ time interval apart.  Then when you do the next 10 samples, you know they are equally timed with respect to the previous 10. 




Message 17 of 20
(1,042 Views)
Solution
Accepted by topic author DODI

DODI wrote:

I wonder how to make time out of ticks to make first tick count which is outside while loop to execute all the time not just once before entering in while loop?


I guess you don't understand what the tick function does. The outside tick gives you the start reference, and subtracting it from the current tick inside the loop will give you elapsed time. Reading the outside tick multiple times would give you undesired results.

 

What is the purpose of the big sequence structure? All you need is wire the error out to the loop boundary to ensure that the loop starts after the nodes have executed.

You don't need the local variable of the stop button, just change the mechanical action of the button. Index array is resizeable, you only need one instancve to get the two rows., etc.

 

To do hardware timed acquisition, setup and start a continuous acquisition using the desired rate before the loop, then inside the loop read the buffer at a leisurely rate. You don't need to store time information, because it can be calculated from the array index, and vice versa. You also don't need an xy graph. A plain waveform graph is sufficient after setting the x-increment corresponding to the configured acquisition timing.

Message 18 of 20
(1,033 Views)

Thank you.

0 Kudos
Message 19 of 20
(1,018 Views)

Thanks.

0 Kudos
Message 20 of 20
(1,017 Views)