NC_SynchronizeTimeΒΆ

This function can be used to calculate the time offset (delay) between two data files. Example: Data files from two different data loggers that have been triggered manually.

Both data files must have a time signal and a sync channel. For example: engine or vehicle speed.

The time data must be measured in the same unit, i.e. seconds. The resolution in both files can be different.

The time offset is calculated by a cross correlation, therefore, the sync signal should not be constant. If the calculation of the offset fails the offset can be set manually.

Only the first 250000 data points are used to calculate the offset.

ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, bMerge)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, bMerge, bInterpolate)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, bMerge, bInterpolate, bUseOffset)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, bMerge, bInterpolate, bUseOffset, rsOffset)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, bMerge, bInterpolate, bUseOffset, rsOffset, nUseTimeChannel)
ssNCNewFile = NC_SynchronizeTime(ssNCFile1, ssTime1, ssSyncChannel1, ssNCFile2, ssTime2, ssSyncChannel2, oParameter)

Return Value

Name of the NC file or an empty string, if an error occurs.

Parameters

ssNCFile1

ssNCFile1 is the name of a NC file.

ssTime1

ssTime1 is the time channel name of file 1.

ssSyncChannel1

ssSyncChannel1 is the signal name of file 1.

ssNCFile2

ssNCFile1 is the name of a NC file.

ssTime2

ssTime1 is the time channel name of file 2.

ssSyncChannel2

ssSyncChannel1 is the signal name of file 2.

oParameter

Is an oject with the following elements:

Element Default Value Description
bMerge TRUE (1) If bMerge is TRUE (1), the channels of both files will be merge into one file.
bInterpolate TRUE (1) If bInterpolate is TRUE (1), the channels will be interpolated onto one time base.
bUseOffset FALSE (0) If bUseOffset is FALSE (0), the delay will be calculated. If TRUE (1) the offset can be set in the parameter rsOffset.
rsOffset No default value Is the time offset. Is used if bUseOffset is TRUE (1).
nUseTimeChannel 0 If nUseTimeChannel is set to 0 a dialog box will be displayed to select the time channel for the interpolation. If set to 1 the time channel of the first data file is used for the interpolation. If set to 2 the time channel of the second data file is used for the interpolation.
rsXStartSync not defined This parameter should only be added to the object if only a section of the data should be used for the offset calculation. X-Koordinates are set so that they start with 0.
rsXEndSync not defined This parameter should only be added to the object if only a section of the data should be used for the offset calculation.
bMerge

If bMerge is TRUE (1), the channels of both files will be merge into one file. Default value is TRUE.

bInterpolate

If bInterpolate is TRUE (1), the channels will be interpolated onto one time base. Default value is TRUE.

bUseOffset

If bUseOffset is FALSE (0), the delay will be calculated. If TRUE (1) the offset can be set in the parameter rsOffset. Default value is 0.

rsOffset

Is the time offset. Is used if bUseOffset is TRUE (1). Default value is 0.

nUseTimeChannel

If nUseTimeChannel is set to 0 a dialog box will be displayed to select the time channel for the interpolation. If set to 1 the time channel of the first data file is used for the interpolation. If set to 2 the time channel of the second data file is used for the interpolation. Default value is 0.

Example

bMerge = TRUE
bInterpolate = TRUE
bUseOffset = FALSE
rsOffset = 0
nUseTimeChannel = 1;

ssNC1 = auto_ImportData("c:/a.xls")
ssNC2 = auto_ImportData("c:/b.xls")
ssNCNew = NC_SynchronizeTime(ssNC1, "time", "speed", ...
                             ssNC2, "time_stemp", "rpm", ...
                             bMerge, bInterpolate, bUseOffset, rsOffset, nUseTimeChannel);

if (ssNCNew == "") {
    // Fehler
}

Example2

oParameter = [.];
oParameter.bMerge = TRUE;
oParameter.bInterpolate = FALSE;
oParameter.bUseOffset = FALSE;
oParameter.rsOffset = 0;
oParameter.nUseTimeChannel = 1;
oParameter.rsXStartSync = 0.0;
oParameter.rsXEndSync = 100.0;

ssNC1 = auto_ImportData("c:/a.xls")
ssNC2 = auto_ImportData("c:/b.xls")
ssNCNew = NC_SynchronizeTime(ssNC1, "time", "speed", ...
                             ssNC2, "time_stemp", "rpm", ...
                             oParameter);

if (ssNCNew == "") {
    // Fehler
}

History

Version Description
R2014.3 New parameter oParameter.
5.14.8 New.

id-653736