Jump to content

Recommended Posts

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.

image.png

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-')
                       )))

image.png

and the Output is:

image.png

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-'))

image.png

and the Output is:

image.png

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. 

image.png

Link to comment
Share on other sites

  • 3 months later...

Thanks Allison! I currently have a use case where I'm looking at the transition of the mode of a piece of equipment, but I'm struggling to make the above code work for me.

I want to look at the transition of mode 3 to 2 but I want my capsule to start at the time it entered state 3 and end when it leaves state 2. (not a set amount as shown in the example). I have some instances where this is 5 minutes and some where it is 2 seconds so using the transition text above some of my capsules have multiple transitions in them. (I shortened it to 4 seconds vs 1 minute to fix this, but then I can't get the information (performance of another tag) before/after that transition.

Additionally, my equipment can enter and exit state 3 without passing through state 2 and enter/exit state 2 without passing through state 3, so I can't use the advanced value filter. I hope this is enough information to help answer my question. Thank you

update: used simple composite condition of touches, Thank you

Edited by Jules
update
Link to comment
Share on other sites

Hi Jules!

I think that we can come up with a better solution than that shown above to address your particular problem. Here is the generalized approach that I would take as well as an example below. 

  • Start by doing a Value Search on your state signal for each of State 3 and State 2.
  • Then use Formula to Join State 3 (condition A) to State 2 (Condition B) inclusive of A and B. 
  • Once this is done, I would follow a modified version of steps 2 and 3 in the post above to limit the capsules you created using the composite condition tool to only those who go directly from state 3 to state 2. 

Here is an example on some fake data that I have generated. I've got a signal that cycles through a series of states [STATE0,STATE1,...,STATE7]. I want to identify only the periods of time when I transition from STATE1 to STATE7 with no other states in between (the pink capsules sketched on the image below).

image.png 

1. I identified conditions for State 1 and State 7 using the Value Search tool.

image.png

2. Use the Formula below to create a capsule that joins the beginning of each state 1 capsule to the end of each state 7 capsule. Note that we use Formula rather than Composite Condition and the Join operator so that we can include the optional 'false' input. 

//Use the join function to connect the start of state1 capsules to the end of state7 capsules. 
//Use a max capsule duration of 30d.
//'false' tells Seeq to make the shortest capsule that joins the two states. You can experiment with 'true' and examine how the results change. 
join($S1, $S7, 30d, false)

image.png

3. Use Formula to assign the sequence of states cycled through over the 'Join State 1 to State 7- Short' condition as a property of the capsules. 

$JoinCondition
  .transform( $cap -> $cap.setProperty('sequence',
    $state.toCondition()
         .toGroup($cap , CAPSULEBOUNDARY.INTERSECT)
         .reduce("", ($seq, $stepCap) -> $seq +
               $stepCap.getProperty('Value')
                      )))

image.png

Check out the results by adding the 'Sequence' property to the capsules pane.

image.png

4. Now filter this 'Add sequence as capsule property condition' for only capsules that have the property 'Sequence' equal to 'STATE1STATE7'.

$condition.filter(
  $capsule -> $capsule.getProperty('sequence').isEqualTo('STATE1STATE7'))

image.png

The final result:

image.png

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • Seeq Team

Seeq Version R22.0.46 introduces the .keep() Formula operator for filtering a condition based on capsule properties.  In Step 3 of the original post, the following Formula was used to generate a new condition that only has capsules where the StartModeEndMode property is equal to '-TRANSITION--STAGE2-:

Prior to R22.0.46:

$condition.filter($capsule->
      $capsule.getProperty('StartModeEndMode').isEqualTo('-TRANSITION--STAGE2-')

With Seeq Version 22.0.46, the same result is achieved using the simpler keep() function syntax:

Version R22.0.46 and later

$condition.keep('StartModeEndMode', isEqualTo('-TRANSITION--STAGE2-'))
  • Like 2
Link to comment
Share on other sites

  • 1 year later...

Hi,

I am pretty interested by this use case for transition identification.

I do have a similar discrete base signal but was not able to reproduce.

So I tried with the Cooling Tower Compressor stages from "Example data" and it came up with the exact same error I had with my own data (see screenshot below). 

Is there anything that has changed in the syntax since the original post ?

Thank you

 

image.png.58985e96de9242c62794e7813b997b5c.png

Link to comment
Share on other sites

  • Seeq Team

I tried this on R54.1.4 and came across a similar error but fixed it by appending .toString() to $seq. Below is the updated formula code.

//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.toString() +
               $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-')
                       )))

 

  • 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
×
×
  • Create New...