DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Time shift of two data sets

Having a problem in synching data sets from two different sources.  First source collected at 100Hz and the second collected at 50Hz.  Have scripts written to create a shift based on the amount found in a manual view.  Move left or right based on sign at R1 variable in last line and the amount controlled by the offset (currently 00:00:00:5103):

 

L2

= CNo("Original_Time")'Enter the channel to be offset to the left.

R1

= TTR("01/01/0000 00:00:00.5103", "mm/dd/yyyy hh:nn:ss.ffff")'Enter the noted offset in the numbers area to the left.

Call

ChnLinScale(L2, "/Orginal_OffsetTime", 1, -R1)

 

 

The issue is that there are a number of equivalent NO VALUES in the resultant time channel and as such leads to a problem when trying to determine the synchronized timing of events.

 

Is there a better way to synch different time scales?

0 Kudos
Message 1 of 23
(5,490 Views)

Hi Nick,

 

From what I understand, you are lining up two different data sets, one taken at 100Hz and the other taken at 50Hz. This results in the 100Hz data having twice as many data points as the 50Hz sample and when you compare these two, every other point of the 100Hz data is being compared to a value that is not there. This results in the NO VALUE problem. If you are comparing these signals, why not just filter the 100Hz signal so that it becomes 50Hz and you are able to compare data point to data point without gaps in the data?

 

Please let me know if I have understood your question correctly and if this solution works for you.

 

Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 2 of 23
(5,471 Views)

Thanks for the response.  Here is a bit more detail that I should have added:

 

1) Have two data sets, one recorded @ 50Hz and one recorded @ 100Hz.

2) Each data set starts at a different time, but share one channel (engine speed) since it is recorded off of the same vehicle CAN.

3) Trying to use the accelerator pedal position movement from the 100Hz set to determine the time to calculate vehicle speed from a GPS-based signal from the 50Hz set.

 

It definately is the comaprison of data from different channels + rates.  Attached is a snippet of the data.

 

Thanks

Nick

0 Kudos
Message 3 of 23
(5,466 Views)

Hi Nick_A,

 

Would you post a representative data set so I can see exactly what you mean?

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 23
(5,462 Views)

Hello Brad,

 

In my previous post, I added a zip file with one data set that I'm trying to analyze.

 

Nick

0 Kudos
Message 5 of 23
(5,439 Views)

Hi Nick,

 

Please post the TDX file associated with your data. These are the actual data points, whereas the TDM file is simply the associated properties.

 

Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 6 of 23
(5,428 Views)

Data and TDX file attached.

0 Kudos
Message 7 of 23
(5,425 Views)

Hi Nick,

 

Here's an attached VBScript that will align the curves you have plotted in the active area of the VIEW panel.  If you use the crosshair cursor, it will take the Y position of the crosshair cursor as a threshold level and time align the curves left and right in the graph based on when each curve rises above that crosshair cursor the first time.

 

If you use the band cursor, the script will consider only the points within that band and will align the curves at 50% of each curve's min/max range within that band.

 

When a time channel has negative values, they will not display on the graph or in a VIEW table.  You can change the time channel to a numeric channel by toggling that channel's "Display format" property in the Data Portal.

 

If you want to time align other waveforms that were not in the graph, just make the "Waveform x-offset" property the same for those waveforms as the new value for the waveform channel that was time-aligned by the script.

 

Brad Turpin

DIAdem Product Support Engineer

National Instrumetns

Message 8 of 23
(5,409 Views)

Hi all.

 

Been reading this post with some interest as I've been working on a similar problem recently of shifting curves left/right with data sets all recorded at the same sampling interval but maybe starting at different times causing the signals to be out of phase. Always interesting to see how someone else would solve the problem especially when there's a slightly different slant to the problem. I had trouble initially getting the script to do anything with the data set supplied but I'm over that obstacle now and impressed by what I see. Brad thanks for sharing the script I can see that being of big use to me in the future. All I need to do now is set aside some time to study how the script works.

 

Thanks

 

Matthew

0 Kudos
Message 9 of 23
(5,376 Views)

Brad, this is exactly what I want to do, but am not accustom to using VBscript. I downloaded the zipfile, unpacked it and attempted to run it and go some microsoft runtime engine error. I then opened up diadem and plotted two signals that I wanted to align and placed the cursurt at a location on the one signal where I was hoping to line up the second signal... then attempted to run the script again.. same error message. My guess is that I just need to learn how to run the script and where to run it from.. any help with that.

I am new to diadem, but this seems like a very common task and I am surprised that there is not already a function in the toolbar that does this. Almost every scope that I have ever used can do this easily.. my boss uses a program that is over twenty years old to plot this kind of data and it has this function built in. I am surprised that NI wouldn't have something like this as part of the standard tools in Diadem. I figured it did, but just thought that I didn't knwo where it was and how to use it yet..

If I can get your code to work, that should do the trick.

 

Thanks.

0 Kudos
Message 10 of 23
(5,121 Views)