Skip to content
  • There are no suggestions because the search field is empty.

How to find how long a tag is in condition using Cogent DataHub scripting

How can I monitor a tag for when it is true and write how long it is true to another tag?

In this example script we monitor a boolean tag for the value of True. If it is true for longer than 5 seconds, we write out to another tag how long the value was true. The full script is attached.

Running the Script

Go to the Scripting section in the DataHub. Then click Add and the script.  Then you can highlight the script and click Load Now to load the script once. Or you can check the box next to it and click apply to make it run on every start up and then restart the DataHub to load the script.