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
To create a 1 year period that resets daily at midnight, you can use the following formula:
periods(1y, 1d, '2024-01-01', 'America/Chicago')
When creating your rolling average calculation, use the endKey() in your aggregate function.
$signal.aggregate(average(),$1yearPeriod,endkey())
Let me know if you have any questions.
Hi Paul,
In R60+, you can use the resampleHold() function. Here is a link to the Knowledge Base article.
https://support.seeq.com/kb/latest/cloud/optimizing-for-infrequently-updating-data
If you are using an older version, you can splice a signal that is equal to the last value.
$capsule = capsule(now()-7d,now())
$last_value = $signal.toScalars($capsule).last().tosignal()
$signal.forecastSplice($last_value)
You may need to modify how far back from now in your capsule definition to capture the last signal.