Jump to content

Create a condition for a variable portion of another condition


Recommended Posts

FAQ:

I have a condition for events of variable duration. I would like to create a new condition that comprises the first third of the time (or 4th, or 10th) of the original condition. 

Solution:

A stepwise approach can be taken to achieve this functionality. 

1. Begin with your condition loaded in the display pane. 

image.png

2. Create a new Signal using Signal from Condition that calculates the total duration of each of your event capsules, interpolated as a step signal. 

image.png

3. Create a new signal that is your total event duration multiplied by the proportion of the event that you would like to capture. e.g. for the first 1/3 of the event, divide your total duration signal by 3, as shown below. 

image.png

4. Create an arbitrary discrete signal with a sample at the start of each of your event capsules. 

image.png

5. Shift the arbitrary discrete signal in time by the value of your signal calculated in step 3. In this example, the 1/3 duration signal. Note, depending on your version of Seeq, the function to do this may be called move() or delay(). 

image.png

6. Use the toCapsules() function in Formula to create a tiny (zero duration) capsule at each of your shifted, discrete samples. 

image.png

7. Join the start of your original condition with the capsules created in step 6 using the composite condition tool. 

image.png

image.png

  • Like 3
Link to comment
Share on other sites

  • Seeq Team

For those Formula-savvy users, a one Formula approach to this would be as follows where you would define your percentage of the capsule in the first line:

$percent = 10%.tosignal().resample(1s)
$condition.transform($capsule ->{
$movetime = $capsule.duration()*$percent.toScalars($capsule).first()
capsule($capsule.startKey(),$capsule.startKey()+$movetime)})

 

  • Like 4
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...