Search the Community
Showing results for tags 'delay signal'.
To better understand their process, users often want to compare time-series signals in a dimension other than time. For example, seeing how the temperature within a reactor changes as a function of distance. Seeq is built to compare data against time but this method highlights how we can use time to mimic an alternate dimension. Step 1: Sample Alignment In order to accurately mimic the alternate dimension, the samples to be included in each profile must occur at the same time. This can be achieved through a couple methods in Seeq if the samples don't already align. Option 1: Re-sampling Re-sampling selects points along a signal at select intervals. You can also re-sample based on another signal's keys. Since its possible for there not to be a sample at that select interval, the interpolated value is chosen. An example Formula demonstrating how to use the function is shown below. //Function to resample a signal $signal.resample(5sec) Option 2: Average Aggregation Aggregating allows users to determine the average of a signal over a given period of time and then place this average at a specific point within that period. Signal From condition can be used to find the average over a period and place this average at a specific timestamp within the period. In the example below, the sample is placed at the start but alignment will occur if the samples are placed at the middle or end as well. Step 2: Delay Samples In Formula, apply a delay to the samples of the signal that represents their value in the alternative dimension. For example, if a signal occurs at 6 feet from the start of a reactor, delay it by 6. If there is not a signal with a 0 value in the alternate dimension, the final graph will be offset by the smallest value in the alternate dimension. To fix this, in Formula create a placeholder signal such as 0 and ensure its samples align with the other samples using the code listed below. This placeholder would serve as a signal delayed by 0, meaning it would have a value of 0 in the alternate dimension. //Substitute Period_of_Time_for_Alignment with the period used above for aligning your samples 0.toSignal(Period_of_Time_for_Alignment) Note: Choosing the unit of the delay depends upon the new sampling frequency of your aligned signals as well as the largest value you will have in the alternative dimension. For example, if your samples occur every 5 minutes, you should choose a unit where your maximum delay is not greater than 5 minutes. Please refer to the table below for selecting units Largest Value in Alternate Dimension Highest Possible Delay Unit 23 Hour, Hour (24 Hour Clock) 59 Minute 99 Centisecond 999 Millisecond Step 3: Develop Sample Profiles Use the Formula listed below to create a new signal that joins the samples from your separate signals into a new signal. Replace "Max_Interpolation" with a number large enough to connect the samples within a profile, but small enough to not connect the separate profiles. For example, if the signals were re-sampled every 5 minutes but the largest delay applied was 60 seconds, any value below 4 minutes would work for the Max_Interpolation. This is meant to ensure the last sample within a profile does not interpolate to the first sample of the next profile. //Make signals into discrete to only get raw samples, and then use combineWith and toLinear to combine the signals while maintaining their uniqueness combineWith($signal1.toDiscrete() , $signal2.toDiscrete() , $signal3.toDiscrete()).toLinear(Max_Interpolation) Step 4: Condition Highlighting Profiles Create a condition in Formula for each instance of this new signal using the formula below. The isValid() function was introduced in Seeq version 44. For versions 41 to 43, you can use .valueSearch(isValid()). Versions prior to 41 can use .validityCapsules() //Develop capsule highlighting the profile to leverage other views based on capsules to compare profiles $sample_profiles.isValid() Step 5: Comparing Profiles Now with a condition highlighting each profile, Seeq views built around conditions can be used. Chain View can be used to compare the profiles side by side while Capsule View can overlay these profiles. Since we delayed our samples before, we are able to look at their relative times and use that to represent the alternate dimension. Further Applications With these profiles now available in Seeq, all of the tools available in Seeq can be used to gain more insight from these examples. Below are a few examples. Comparing profiles against a golden profile Determine at what value in the alternate dimension does each profile reach a threshold Developing a soft sensor based on another sensor and a calibration curve profile
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. 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 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) 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. 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') 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) 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). 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) 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:
A common analytics need is to calculate changes in a signal's value over different time periods (such as hourly or daily). One example is calculating the change in a tank level signal as a way to infer flow rates, production, amount transferred, etc. While the Seeq Formula derivative() function is often useful in these situations, in some cases the user may want to simply calculate the signal change over a specified time period (perhaps once/hour). While there are many ways to do this in Seeq, two efficient ways are: 1) using the Delta statistic in Signal from Condition and 2) using $signal-$signal.delay() in Formula. Here is an example to illustrate: We have a tank level signal shown in lane 1 and we have calculated the hourly change in the tank level by two different methods (the results are shown in lane 2): The first method to calculate the level change per hour uses an Hourly condition (created using the Periodic Condition tool to generate the green capsules). Then, Signal from Condition is used to generate the Hourly Level Change (Signal from Condition) in lane 2, by selecting the Delta statistic over the Hourly bounding condition: The second method uses the delay() function in Formula, subtracting the one hour delayed level from the current value of the level signal. This generates the Hourly Level Change (Formula Delay Function) in lane 2 Note that this approach creates an hourly level difference for each sample point, where the first approach generates a level difference result once per hour. Also note that the user could choose to filter (smooth) the level signal and then apply the level difference calculations, if they desire a more smoothed calculation result. There are several filtering options in Seeq. The agileFilter() function would work well for the level signal in the example.
Use Case Background In certain cases, it can be advantageous to delay or shift your time series data by some amount of time. Perhaps a process variable signal lags a set point by a known amount of time, or you are working on a clever analysis where you are shifting signals in a plug flow reactor or conveyor belt style production by known periods of time so that all of the signals line up for each widget or volume of flow to enable simplified cause and effect style analysis. Delaying or shifting the time stamp of a signal is easily accomplished in Seeq using the Formula tool: Using Delay() If I simply want to delay a given signal, say signal $measuredData, by 5 seconds i can use the delay() function in formula as follows 1. Search and select the relevant signal in the Seeq Data tab so that the trend is showing in the display pane and the signal name is showing in the Details pane. 2. Click the Tools tab and select the Formula tool. 3. Give the formula an appropriate name and enter the following formula: $measuredData.delay(5s) A new signal (with the name given in step 3) should appear where all of the time stamps are delayed by the given amount of time, in this case 5s. Now you can continue with your analysis! To shift a signal ahead in time instead of delaying it, we use the same delay() signal but would give a negative time value to shift the signal forward by 5 seconds: $measuredData.delay(-5s) Using delay() Signal The delay() function can also accept signals as the time delay input and requires some maximum delay value. We would typically only want to delay one signal, say $measuredData, by another signal, say $delaySignal, where $delaySignal is relatively consistent in its value. We typically wouldn't want the $delaySignal to jump between seconds and days. A great example of where this might be helpful would be delaying signal $measuredData by signal $delaySignal where $delaySignal is the speed of a conveyor belt and $measuredData is one of a series of measurements made on the widgets being produced on the conveyor belt. In this way we can dynamically shift all of our measurement signals by conveyor belt speed so that each widget produced has one "time stamp" associated with it for all of its measurement signals to ease further analysis. 1. Identify the signal to delay, in my case i will use $measuredData, and a delay signal, I will use $delaySignal 2. In the tools tab, open the Formula tool 3. Give the formula an appropriate name and enter the following formula: $measuredData.delay($delaySignal, 5h) Here, my $measuredData will be delayed by a $delaySignal amount of time up to the maximum of a 5 hour delay. Any timestamp with a $delaySignal value of greater than 5 hours will result in my $measuredData only being delayed by 5 hours. Using correlationOffset() One final way we can delay or shift a signal is by using the correlationOffset() function. This function is a bit more advanced and will be covered in a follow up post. We can use this function to compute the required delay between two signals such that the two signals have a maximum correlation. This is a very useful tool for finding a delay between two signals when the amount of the delay is uncertain but the signals are known to be correlated. More information about this can be found in the Seeq Formula documentation within Seeq. Play around with it and see what you can find!