Jump to content

Time Warping to Align Sample Points


Lindsey.Wilcox
 Share

Recommended Posts

  • Administrators

This method demonstrates how to apply time warping to a signal which can shorten the time between sample points while retaining the signal’s characteristic shape. This is useful for batch processes where batches may have different durations or for aligning data from multi-step processes with different durations. Note that this method is distinct from the more complex Dynamic Time Warping.

The following example is based upon the Area A Compressor Power signal available in the Example Data.  A single condition was created to capture each compressor run, as shown in the following image.

image.png

Step 1: Specify a Time Normalization Factor

The user uses the Formula tool to specifiy a time duration (scalar value), set to 4 hours for this example. The compressor power signal for each compressor run will be normalized to this time duration. There is no single correct value; the value needs to be shorter than the minimum time duration for all signals to be normalized.

// User specified time duration (scalar value).
4 hours
image.png
 
Step 2: Create the Normalized Condition
Use Formula to create the normalized Compressor Run condition based on the user-specified time normalization factor. This condition will be used later when the calculated signal delay is used for normalization.
$CompressorRuns.afterStart($nF)
image.png
 
Step 3: Calculate the Run Duration
Use the Signal from Condition tool to calculate the duration for each compressor run. This value will be used later for determining the calculated signal delay applied to each compressor run.
image.png
 
Step 4: Calculate the Elapsed Time During Each Run
Use the Formula tool to calculate the elapsed time during each compressor run. This value will be used later for determining the calculated signal delay applied to each compressor run.
timeSince($CompressorRuns, 0.25min).convertUnits('h')
image.png
 
Step 5: Calculate the Signal Delay Factor Needed for Time Warping
Each sample (timestamp) for compressor power will be shifted to the left by a calculated amount to time warp the power signal from its original time period (Compressor Runs) to the normalized time period (Compressor Runs Normalized). The first sample point in each run will have no delay, and the last sample point will have the greatest delay. For example, if the original time period is 10 hours and we are normalizing to a time period of 4 hours, then the last sample point in the run will be shifted to the left by 6 hours (Delay Factor = -6 hrs).
// This Formula first creates a signal with a value of 0 (default delay), then splice in the calculated delay during each compressor run.
0.toSignal(0.25min).convertUnits('hr').splice($ElapsedTime*($nF/$RunDuration-1),$CompressorRuns)
image.png
At this point we zoom in to a single compressor run and use the Capsule Time view to better visualize the results of our intermediate calculations. For this compressor run lasting 10.9 hours, the Compressor Run Elapsed Time finishes at the correct value (10.9 hours) and the Delay Factor correctly decreases from 0 hours (beginning of run) to -6.9 hours (end of run).
image.png
 
Step 6: Apply the Signal Delay to Time Warp the Signal
Now that the appropriate delay factor is calculated for each sample point during the compressor runs, we apply it to the Area A Compressor Power signal using the delay() function in Formula. This generates the time warped signal called Compressor Power Normalized.
$CompressorPower.delay($delayFactor,24h).within($CompressorRunsN)
image.png
When applying the signal delay, we are required to specify a maximum delay. This is important for the Seeq calculations going on in the background, so that the queries know how far back and forward to go when requesting input data. The maximum delay also provides a convenient way for the user to limit the applied delay, if they have some reason to do so. In our case, we just want the chosen value to be longer than the longest expected compressor run duration.
 
Results
Now that the compressor power signal has been normalized, Capsule Time view gives a nice comparison of the power signal behavior across the 3 runs contained in the Display Range:
image.png

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...