ThingWorx does not have an out of the box solution for that.
Have a look at Use Case 3 on
https://support.ptc.com/help/thingworx/platform/r10.2/en/#page/ThingWorx/Help/Composer/Things/ThingSubscriptions/ThingSubscriptions.html#wwID0EUZSW
“// Usecase 3: alert will be triggered if voltage is higher than 118V and it has last more than 3 minutes.”
I did not use the MultiEventSubscriptons - seem quite messy. Also with the example the alert conditions are coded into the code.
My idea would be similar to @CharlesJi - but more specific:
- Define alert normal on the assets (without time aspect)
- Create a scheduler running each minute or however precise you need the duration
- In scheduler subscription call Resources[“AlertFunctions”].QueryAlertSummary with a query matching the alert name(s) you want to monitor - so you have all alerts for all assets of that type with each duration (make sure to set maxItems high, so it also finds all your alerts if you have more than 500 (default maxItems=500))
- If the duration is exceeding you can
- call a service (but it would be called then on each scheduler run which might not be wanted)
- set an extra property on the asset to true (e.g. alertName_longer2Hours), which has an alert set. which you can react on with a subscription. you should then also make sure to reset it to false, when initial alert is finished.
Maybe there are better ideas ;)