Jump to content

Clock the Time


Recommended Posts

Hi,

my problem is now a little bit more accurate than in my first Post.

I got two Signals and i want to take the Time from the starting of the first

till the second gets his peak.

How can i convert these signals that i get (Data (64bit)) into a analog Signal?

Is this necesary to measure?

And how can i get a timestamp from the Point when the first Signal starts?

(the Signal is normaly a little bit flickering between the Zero-Point but i want

the timestamp when it really starts)

Link to comment

QUOTE(CamilloN @ Sep 14 2007, 05:29 AM)

Hi,

my problem is now a little bit more accurate than in my first Post.

I got two Signals and i want to take the Time from the starting of the first

till the second gets his peak.

How can i convert these signals that i get (Data (64bit)) into a analog Signal?

Is this necessary to measure?

And how can i get a timestamp from the Point when the first Signal starts?

(the Signal is normally a little bit flickering between the Zero-Point but i want

the timestamp when it really starts)

There are a lot of ways to do most tasks. It is useful to know some more about the problem and the equipment on hand to do the task.

What DAQ hardware will you be using? What version of LabVIEW? Will you be using DAQmx or Traditional DAQ? You should be giving the answers to these questions every time you ask help so you can get useful advise quickly.

It is also very important to know more about the signals themselves. What will be the characteristics of the steady state of the two signals? What will be the characteristics of the peaks? How quickly will the peak events occur or how slowly? How far apart in time from one peak to the other? Are there any other important characteristics about the signals that are impossible to guess such as AC or DC?

Do you really need an absolute timestamp? Or do you just need the time that elapses from the start peak to the end peak? It would be very simple to get Date and Time when the acquisition is started. On the other hand the acquisition data rate is very well controlled so you can get the elapsed time in terms of the data rate by simply counting the number of readings taken between the two peaks.

You can acquire the two signals and post process that data to find out the timing between all sorts of events. By post process I mean indexing through the array in a for loop, looking at the values of the readings, analyzing what they mean, and sorting out the important events. The index of a reading in the array is the elapsed time of its occurrence. You can examine the slope by comparing adjacent readings, you can react to any readings exceeding a threshold, and so on.

If your acquisition is buffered (not continuous) then you always have data in the buffer from past readings. When you detect the peak and use this as the start trigger (also a normal thing to do) the data record is set to save some of the old data so you can see the peak and the shape of it before the peak occurred. This data is recorded until some other trigger occurs to says stop. Then your result is an array of the readings from two signals. Again you need to detect the end peak to tell the acquisition to stop.

Any storage scope does the same things, and LabVIEW can do it as well. The hard part is dealing with the peaks.

You must know something about the peaks and that should be shared with us. If you know that your first peak will occur according to some precondition, please explain that.

It is good to know what the peak will look like in general terms.

The end peak must occur during some roughly known period of time, or related some how to some other detectable event.

There must be some expected difference between the steady signals and the peaks.

Knowing these things it will be much easier to detect the peaks to control the acquisition and to post process the analog data to measure the elapsed time.

If the signals are very fast then it is possible to use counter timers to sense the edges. But you still have to know the threshold of a peak that makes it THE peak and not just some insignificant rise in the signal.

Imagine you had the acquisition of these two signals on a roll of paper in front of you. What thinking process would you use to determine that, "THERE! and THERE! are the two peaks I care about." What information did you use to decide that? Is that the correct information for all the peaks you will use? Or is there some variety in how those peaks will look? At what point is a peak not a peak?

If you only need to do this sort of acquisition one or a few times is may not even be useful to automate with start and stop triggers. If you can start the acquisition manually, watch a scope, and stop the acquisition manually you get what you want then take the resulting array and use LabVIEW to analyze it. Sometimes it is only worth writing a fancy VI if you are going to do the operation many times.

Mike

Link to comment

Thank you very much for your help.

Sorry my real bad english it's been awhile since i used it last time.

I have really no experience with LabView i have made nothing since now.

I don't know which DAQ i use, i got here a "Datalogger" (a CPU and a RAM

which stores signals.).

With this they gave me premade VI's. I have not seen the signal yet so i can't

give you accurate information about the interferences they got.

I know that one is a normal sine (AC) which starts after a few seconds and the other

is the response of a pressure pick-off (DC 0-10V). I think they are both not

difficult as for example a Audiosignal or somthing like that.

I only need the time between the two signals no absolut timestamp,

but since now i havn't seen a timer like a stopwatch.

My first idea was to find a VI which gives out a Timestamp when the

signal passes a defined voltage and reaches a defined voltage.

But i haven't found it yet.

The time i have to measure will be between 0.5 and 2 milliseconds.

Link to comment

QUOTE(CamilloN @ Sep 17 2007, 06:27 AM)

Thank you very much for your help.

Sorry my real bad english it's been awhile since i used it last time.

I have really no experience with LabView i have made nothing since now.

I don't know which DAQ i use, i got here a "Datalogger" (a CPU and a RAM

which stores signals.).

With this they gave me premade VI's. I have not seen the signal yet so i can't

give you accurate information about the interferences they got.

I know that one is a normal sine (AC) which starts after a few seconds and the other

is the response of a pressure pick-off (DC 0-10V). I think they are both not

difficult as for example a Audiosignal or somthing like that.

I only need the time between the two signals no absolut timestamp,

but since now i havn't seen a timer like a stopwatch.

My first idea was to find a VI which gives out a Timestamp when the

signal passes a defined voltage and reaches a defined voltage.

But i haven't found it yet.

The time i have to measure will be between 0.5 and 2 milliseconds.

I have to ask more questions, sorry.

Do you have the LabVIEW development software?

Or, do you only have the VI Logger software?

Mike

Link to comment

QUOTE(mross @ Sep 17 2007, 10:07 AM)

I have to ask more questions, sorry.

Do you have the LabVIEW development software?

Or, do you only have the VI Logger software?

Mike

Here is a VI that does the very simplest calculation of the elapsed time between maxima of two signals. I am sure it is not what you need but it will be instructive if you study it.

Mike

Link to comment

QUOTE

I have to ask more questions, sorry.

Do you have the LabVIEW development software?

Or, do you only have the VI Logger software?

No Problem, i got the development software.

I got a few questions too ;-)

You take the indices of the max-min function or also the

array from the for-loop as your x-axis-variable, but is this

the correct time? How does the PC know, how many

milliseconds is between index 1 and index 2?

Link to comment

QUOTE(CamilloN @ Sep 18 2007, 03:11 AM)

No Problem, i got the development software.

I got a few questions too ;-)

You take the indices of the max-min function or also the

array from the for-loop as your x-axis-variable, but is this

the correct time? How does the PC know, how many

milliseconds is between index 1 and index 2?

Good that you have LabVIEW. I have never used the data loggger, but it may not be able to provide the peak detection that you need. In LabVIEW if you can define good criteria for the peaks you can find them, getting the elapsed time is the easiest of all.

When you take your readings is will be at a very steady rate. The rate of acquisition is NOT set by the PC. Your DAQ card has an accurate and stable clock specifically to provide this steady rate.

In the case of the example I gave you the data rate of generation was 10KHz. If your data acquisition rate is 10KHz then you will have the same situation.

When you acquire 10K readings in one second, then the time between readings is 1/10000 seconds. 1/freq = the period.

To find any elapsed time from data taken at 10KHz you simple count the number of readings between start and finish and multiply by the period between readings - 1/f.

For your experiment you need to some common point in time from which to calcualte the relative time between two events. You could even have two different data rates and still get a good answer. In your case it is easy because you start both acquisitions at the same time and take the data at the same rate, they have a common point at 0 and at every other time.

So when I see the index of the peak of plot 1 is at 517 that is equal to 517 * 0.0001 = 0.0517 seconds from the start.

If the index of the peak of plot 2 is 9433, that is equal to 9433 * 0.0001 = 0.9433 seconds from the start.

The elpased time is 0.9433 - 0.0517 = 0.8916 seconds.

In the example I just subtract the earlier index from the later index and then convert to seconds. Index 2 - Index 1 = difference between indexes.

Difference between indexes *(1/data rate) = elapsed time.

Comprende?

The tricky part is actually finding the peaks. In the example, I added the Gaussian Noise to show you that with real signals the peak that is read is not always the true peak. If you were to generate just the sine wave and compare it to the sine wave with noise you would get different times for the peaks, and the noisy peaks would have an absolute value that is higher or lower than the actual peak of the signal.

If you can accept slight incorrectness due to noise then you are able to use the simple methods. If slight incorrectness is a problem, then you must investigate filtering which can introduce phase shift. You can look at averaging about each data point to reduce the effect of random noise, and so on. If you have multiple peaks then this can be very interesting. If you have only a step input and are looking for a distinct maxima caused by the step, then it may be simple.

If you have a lot of noise (a small signal to noise ratio) you will also have difficulty. In the example I gave you I increased the amplitude of the sine wave so that the noise would not obscure the results too much, but so that you could still the potential for error caused by the noise. If the sine wave had only an amphiltude of 10 volts then the noise would caise much more error in the readings.

Best regards,

Mike

Link to comment

Thank you very much for your help,

now i know how you got the time, it's clear.

The Array Max&Min Vi is great, but i don't think i can take it.

In the last days my signal is changed (since now i had only a forecast

how it could look like). It is more like this

post-9290-1190633628.png?width=400

Don't look at the numbers, i took the picture only as a example, it is also

mirror-inverted.

But like this it has no defined peaks. So i cannot search the min & max.

But i know that the maxima of the Signal is 10V, can i search in the array

for the point when the signal crosses this limit?

And for the first signal i also don't search the min, because it could remain

for a longer time 0 and i want, the Index when it begins to change.

I think it must be possible with the Treshhold 1D Array, isn't it?

Best regards

Vincenzo Nuzzi

Link to comment

QUOTE(CamilloN @ Sep 24 2007, 07:41 AM)

Thank you very much for your help,

now i know how you got the time, it's clear.

The Array Max&Min Vi is great, but i don't think i can take it.

In the last days my signal is changed (since now i had only a forecast

how it could look like). It is more like this

http://lavag.org/old_files/monthly_09_2007/post-9290-1190633628.png' target="_blank">post-9290-1190633628.png?width=400

Don't look at the numbers, i took the picture only as a example, it is also

mirror-inverted.

But like this it has no defined peaks. So i cannot search the min & max.

But i know that the maxima of the Signal is 10V, can i search in the array

for the point when the signal crosses this limit?

And for the first signal i also don't search the min, because it could remain

for a longer time 0 and i want, the Index when it begins to change.

I think it must be possible with the Treshhold 1D Array, isn't it?

Best regards

Vincenzo Nuzzi

Yes the threshold array function may be useful. I have never used it myself. I believe is walks through the array untill it finds when the threshold lies between two adjacent points and it returns the interpolated x value for the threshold crossing.

So you need to do that and get the result, then return to searching the array at the index after the threshold crossing just detected. Round the returned fractional index to +infinity and convert it to an integer. Starting at this index in the array, again use the Threshold function to find the next instance of a crossing and continue until the array is searched from start to finish. If you find instances where the returned index fractions are very close together you may wish to investigate them further to see if they are real data or noise.

This can all be done within a for loop. It will be very worthwhile for you to figure this out on your own. We all have to struggle with how to investigate arrays of data. You can't really be shown it all, you need to experience it. I find that I have to think hard to do these things, so don't be impatient. A better brain than mine may find this easy, but I do not.

If you have an actual array of the data you wish to analyze you should post that on the forum so we can use it to help you. We can lose a lot of time tryig to work with fake data.

Mike

Mike

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.