Search the Community
Showing results for tags 'splice()'.
It is often useful to create a scorecard metric that displays a signal name for use in Organzier Topics. This is relatively simple using Formula and the toSignal() function. This Formula creates a string signal that has a value of "Signal Name" for all of time. After I have my string signal, I can use a simple scorecard metric with no statistics to create a scorecard that just displays the value of this string. I have changed the header to only display the end time. Now, I can use this scorecard in an auto-updating Organizer Topic that will always show "Signal Name". This functionality is very useful if you want to create a string signal that has more than one value. For example, say that I have three signals. I want to create a scorecard metric that tells me which of these three signals is the largest at any point in time. I will start by creating conditions for when each signal is larger than the other two. First, I use Deviation Search to find when Signal 1 > Signal 2 and for when Signal 1 > Signal 3. Then I use Composite Condition (logic: intersection), to find when Signal 1 is max. I repeat this process for Signal 2 - Deviation Search to find Signal 2 > Signal 1 and Signal 2 > Signal 3 + composite condition. Finally, I use Formula to find when Signal 3 is max by using union() and inverse() to find when Signal 1 or 2 are not max : $1max.union($2max).inverse(). Now I have 3 conditions which should cover the whole time series, which are true when each Signal is the maximum of the 3 at any point! I'm now ready to create the string signal. Just like I did for a single string, I will essentially be creating new signals with toString(), but this time, I will use splice() to splice in the different strings ("1 is max", "2 is max", or "3 is max") when each condition is present. This works because my "X is max" conditions will never overlap. The result is a string signal that equals whatever signal is the maximum at every point in time! Finally, I'll use Simple Scorecard again to create a metric that displays this Max Signal for use in Organizer Topics.
When performing certain types of analysis, it is desirable to combine past measured data with some future prediction, whether that prediction is dynamic or static. Future predicted data can be used for degradation or maintenance date predictions, future performance modeling, signal forecasting, or a wide variety of other potential use cases. Combining some future data with a measured signal is simple in Seeq! Another major benefit? As new data comes in the predicted values can be automatically updated with the actual data! Here is one way to join past measured data with some future forecast signal. Signals To combine measured and forcasted data we will need: Measured Data - a signal(s) that will replace the predicted signal as it becomes available Prediction / Forecast Signal - This could be a flat signal entered in formula, a signal developed in the prediction tool, or some other signal that extends out into the future Method for Combining the Signals 1. Create Future Data Valid Condition This Condition defines the period of time in which the Forcasted signal will be spliced into the Measured Data signal. The formula is based on the last known measured time stamp. In formula we will create a condition by inputting the code snippet below and calling it $validPlanningRange Formula: /* Define the period when planning data should be used. This time period will start at now (i.e., the last available measured data point) and extend to some point in the future. */ //Define a search window to look for now, This must have a past time to start in, and a future time to look through $searchPeriod = capsule('2018-08-01T00:00-08:00', '2020-01-01T00:00-08:00') //Identify now by finding the last available measured time stamp $now = $measuredData.toGroup($searchPeriod).last().getKey() //Create a condition representing now to now plus 6 months $nowCapsule = capsule($now, $now + 6 months) condition(7 months, $nowCapsule) Variable Descriptions $searchPeriod - Capsule defining the search window which will be used to located the most recent data point. For best performance, the start date should be periodically updated to limit the number of measured data points which will be returned. The end date can be set way into the future. $now - Date representing the point in time where the combined signal we are creating will switch from historical to future data. $nowCapsule - This creates a capsule which is then made into a condition for use in the next step Create Combined Signal. For maximum performance, recommend keeping the capsule length to the minimum necessary duration (e.g., don't add 1 year if only 6 months is the standard analysis window). 2. Create a Combined Master Signal Once again, in formula we will input the code below to create a new signal that is the combination of the Measured Data and a Forcast Signal Formula $measuredData.splice($forecastSignal,$validPlanningRange) The result is one signal that combines our Measured Data and a Forecast Signal: The Master Signal appears as dashed line whereas the measured data appears as a solid line. The dashed line indicates the signal is uncertain and therefore, expected to change. 3. Make sure the Master Signal is Auto-Updating By default when the page is loaded or the time range adjusted, the Master Signal will be recalculated and any new data from the Measured Signal will replace the Forecast Signal. Additionally, the analysis can be set to Auto Update.