KB-32972: Recording data only when tag’s value is 1.

Question:

How can I have some tags recorded in a database only when another’s I/O tag value turns 1?

Solution:

To do so, follow these procedures:

  1. Create a Historic with the tags that you want to record;
  2. Set up Add a new record every X ms as 0; by doing this, you will disable the automatic recording;
  3. Create a script with If command in the tag’s OnRead event to check the tag’s value; when it is equal to 1, Historic‘s WriteRecord() method will be executed.

Example:

Sub IOTag01_OnRead()
   if Value = 1 then
      Application.GetObject("Hist1").WriteRecord()
   end if
End Sub
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *