Jump to content
  • To Search the Seeq Knowledgebase:

    button_seeq-knowledgebase.png.ec0acc75c6f5b14c9e2e09a6e4fc8d12.png.4643472239090d47c54cbcd358bd485f.png

Search the Community

Showing results for tags 'transform'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community Technical Forums
    • Tips & Tricks
    • General Seeq Discussions
    • Seeq Data Lab
    • Seeq Developer Club
    • Seeq Admin Forum
    • Feature Requests

Categories

  • Seeq FAQs
  • Online Manual
    • General Information

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Company


Title


Level of Seeq User

Found 5 results

  1. The correlationOffset() Formula function can be a useful tool for identifying the time shift which maximizes the correlation between two signals: see this post for additional background. In some situations, a user will have a condition defined for time periods of interest (startups, process runs, specific product grades, specific modes of operation, etc.). The user then wants to analyze how the correlation offset varies for each time period of interest (each capsule in the condition). The key to this calculation is applying the transform() function to the condition in Seeq Formula, in combination with the correlationOffset() function. Let's say we have a temperature sensor in a reactor. At some point, well downstream of this temperature measurement, we have a relative humidity sensor that is sensing the same volume of air, but due to the locations of the two sensors, we know that the inverse correlation between the two signals is offset by a significant amount of time delay (at least 2 hours, as visually estimated with the dashed regions in the trend below). As a reminder, for this use case, the objective is to calculate the correlation offset separately for the data contained within each capsule in a condition of interest (shown as Time Periods to Calculate Correlation in the trend below): The formula approach for this is shown below, with comments to describe the details. The transform() function enables the correlationOffset() function to be applied separately to each capsule in the Time Periods to Calculate Correlation condition, and the correlation offset time is stored as a capsule property of the condition generated by the formula: The resulting calculated offset (in units of seconds) is shown in the capsules pane at the lower right and also at the top of the screen as labels. Optionally, the "Offset" capsule property can be converted to a signal (see Max Correlation Offset in lane 2) for trending purposes, and here the units were converted to hours. Looking at the final results, the time shift which maximizes the correlation between the 2 signals varies between 2.1 and 2.5 hours over the 3 time periods of interest shown in chain view, and this variation may offer valuable insights to the user. The time shift is a negative value which means that the relative humidity (downstream signal) would need to be shifted to the left by that time amount to maximize its correlation with the temperature signal. This is the formula to create a signal for the max correlation offset, based on the "Offset" capsule property. In this example the time shift is more meaningful in units of hours, so we convert from seconds to hours: Note that in this use case we wanted to calculate the correlation offset separately for each capsule in a condition. If the goal is to calculate the correlation offset over rolling window time periods, there are other functions in Formula expressly for this purpose, such as CrossCorrelations_timeShifts().
  2. In some cases you may want to do a calculation (such as an average) for a specific capsule within a condition. In Seeq Formula, the toGroup() function can be used to get a group of capsules from a condition (over a user-specified time period). The pick() function can then be used to select a specific capsule from the group. The Formula example below illustrates calculating an average temperature for a specific capsule in a high temperature condition. // Calculate the average temperature during a user selected capsule of a high temperature // condition. (The high temperature condition ($HighT) was created using the Value Search tool.) // // To prevent an unbounded search for the capsules, must define the search start/end to use in toGroup(). // Here, $capsule simply defines a search time period and does not refer to any specific capsules in the $HighT condition. $capsule = capsule('2019-06-19T09:00Z','2019-07-07T12:00Z') // Pick the 3rd capsule of the $HighT condition during the $capsule time period. // We must specify capsule boundary behavior (Intersect, EnclosedBy, etc.) to // define which $HighTcapsules are used and what their boundaries are (see // CapsuleBoundary documentation within the Formula tool for more information). $SelectedCapsule = $HighT.toGroup($capsule,CapsuleBoundary.EnclosedBy).pick(3) // Calculate the temperature average during the selected capsule. $Temperature.average($SelectedCapsule) The above example shows how to select and perform analysis on one specific capsule in a given time range. If instead you wanted to select a certain capsule of one condition within the capsule of a second condition, you can use the .transform() function. In this example, the user want to pick the first capsule from condition 2 within condition 1. Use formula tool: $condition1 .removeLongerThan(1d) .transform($c -> $condition2.removeLongerThan(1d).toGroup($c).pick(1)) The output: Content Verified DEC2023
  3. Seeq has functions to allow easy manipulation of the starts and ends of capsules, including functions like afterStart(), move(), and afterEnd(). One limitation of these functions is that they expect scalar inputs, which means all capsules in the condition have to be adjusted by the same amount (e.g. move all capsules 1 hour into the future). There are cases when you want to adjust each capsule dynamically, for instance using the value of a signal to determine how to adjust the capsule. Solution: This post will show how to accomplish a dynamic / signal-based version of afterStart(). This approach can be modified slightly to recreate other capsule adjustment functions. Assume I have an arbitrary condition 'Condition', and signal 'Capsule Adjustment Signal'. I want to find the first X hours after each capsule start, where X is the value of 'Capsule Adjustment Signal' at the capsule start. I can do this with the below formula. $condition .afterStart(3h) // has to be longer than an output capsule will ever be .transform($capsule -> { $newStartKey = $capsule.startKey() $newEndKey = $capsule.startKey() + $signal.valueAt($capsule.startKey()) capsule($newStartKey, $newEndKey) }) This formula only takes two inputs: $condition, and $signal. This formula goes through each capsule in the condition, and manipulates its start and end keys. In this case, the start key is the same as the original, but the new end key is set to the original start key plus the value of my signal. This formula produces the following purple condition: Some notes on this formula: The output capsules must be within the original capsules. Therefore, I have included .afterStart(3h) in the formula. This ensures the original capsules will always be larger than the outputted capsules. If you don't do this, you may see the following warning on your item, which indicates the formula is throwing away capsules: Your capsule adjustment signal must have units of time To accomplish other capsule adjustments, look at changing the definitions of the $newStartKey and $newEndKey variables to suit your needs.
  4. Use Case: Users are often interested in identifying when a particular process is operating in a specific mode, or when it is in transition between modes. When looking at these transition periods, you may want to know what the modes of operation were immediately before and after the transition. If you can assign the starting and ending modes during a transition period to each transition capsule, you can filter for specific types of transitions and get a better idea of what to expect during like transitions. Solution: For Versions R.21.0.43 + 1. Add a signal to your display that describes the mode of operation you are interested in. In this example I have added the Example Data > Cooling Tower 1 > Area A > Compressor Stage string signal. Other signals that this use case applies to may include: production grade code, equipment operating mode, signal for step in a sequential or batch process. 2. Next we can use Formula to create a new condition comprised of capsules each time our Compressor Stage signal changes value. These capsules will contain a new capsule property called 'StartModeEndMode' that represents the value of the compressor stage immediately before and immediately after the signal changed value, or transitioned. The formula syntax to achieve this is: //creates a condition for 1 minute of time encompassing 30 seconds on either side of a transition $Transition = $CompressorStage.toCondition().beforeStart(0.5min).afterStart(1min) //Assigns the mode on both sides of the step change to a concatenated string that is a property of the capsule. $Transition .transform( $cap -> $cap.setProperty('StartModeEndMode', $CompressorStage.toCondition() .toGroup($cap, CAPSULEBOUNDARY.INTERSECT) .reduce("", ($seq, $stepCap) -> $seq + $stepCap.getProperty('Value') //Changes the format of the stage names for more clear de-lineation as a property in the capsules pane. .replace('STAGE 1','-STAGE1-').replace('STAGE 2','-STAGE2-').replace('TRANSITION','-TRANSITION-').replace('OFF','-OFF-') ))) and the Output is: Note that we added the new property 'StartModeEndMode' to the Capsules Pane. 3. We can now filter this condition to look for specific transitions of interest. In this example, we are interested in every time our compressor went from a TRANSITION state to STAGE2. Use Formula and the filter() function with the following syntax to achieve this. //Create a new condition comprised only of capsules where the 'StartModeEndMode' property is equal to '-TRANSITION--STAGE2-' $ConditionCreatedInStep2.filter( $capsule -> $capsule.getProperty('StartModeEndMode').isEqualTo('-TRANSITION--STAGE2-')) and the Output is: 4. Now we are able to add other signals of interest to the display and switch to Capsule Time view to observe how those signals behave during these similar transition events.
  5. Another interesting question through the support portal this morning. The user has a signal where each discrete point represents the run length recorded at the end of the run. They would like to translate this signal into a condition so it can be used for further analysis. The original signal looks a bit like this To create the matching condition we need to use a transform and the ToCapsules() function $Signal.toCapsules( //for each sample in the signal create a capsule $sample -> //create a variable name of your choice to reference each indivudal sample in your signal capsule( //open the capsule $sample.key()-$sample.value(), //Capsule Start definition (Key = timestamp of the sample - value of the sample) $sample.key() //Capsule End definition (timestamp of the sample) ),5d) //Maximum length of any given capsule in the condition
×
×
  • Create New...