# How to get the start time of the capsules, compare the value of two variables at the exact moment that the capsule starts?

Go to solution Solved by Chris Harp,

## Recommended Posts

how to get the start time of the capsules, compare the value of two variables at the exact moment that the capsule starts. Then make a condition compering their values?

##### Share on other sites

• Seeq Team
• Solution
Posted (edited)

Hello Manoel,

To compare values at the start of a capsule, you would use Signal from Condition with a summary statistic "Value at Start" for each variable and use the "Start" placement for the timestamp.  This will create two discrete signals at the starting time of your capsule.  To create a condition that compares the two values, use Formula.

You cannot directly compare discrete values in Formula.  You get an error stating "x must be continuous signal at \$signal1".  Using the resampleHold function, you hold the discrete value for the length of your desired condition.  For example, if you want your comparison condition duration to be 1 hour, you would use:

`\$signal2.resampleHold(1h, 1min) < \$signal1.resampleHold(1h, 1min)`

If you wish the have the comparison condition capsule duration be equal to the same duration as the original condition capsule, you could add a .touches() function where the original condition touches the comparison condition.

```\$comparison = \$signal2.resampleHold(1h, 1min) < \$signal1.resampleHold(1h, 1min)

\$originalCondition.removeLongerThan(40h).touches(\$comparison)```

Alternatively, you could change the timestamp placement in your signal from conditions to Duration for both and then use value search or formula to create the comparison conditions.  This will create a conditions equal to the length of the original condition.

Please let me know if you have any other questions.

Chris

Edited by Chris Harp