Script writing error during variable communication error

Script writing error during variable communication error
aaa



Is there any way to check the communication quality of variables in the script

Okay, a few things:

  1. Its difficult to help you if you don't also post a preformatted text version of your code, because then we have to re-write your code instead of just copy pasting it. So please post a preformatted version of your code.

  2. It appears that this is in a tag change script, which makes this doubly bad, but you should utilize the system.tag.read* and system.tag.write* functions acceptance of a list. It is far more performant than making consecutive calls to the functions. This is especially important in tag value change scripts where you want the script to execute as quickly as possible. On top of that it generally makes it , more readable.

Now on to your question, Yes. The system.tag.read*() functions return a list of QualifiedValues which are objects that include a value, timestamp, and quality.

Your script should look something more like this:

now = system.date.now() #when executed in a gateway scope this will return the gateway time
hour = system.date.getHour24(now)
minute = system.date.getMinute(now)

tagPaths = ["[default]BZCLARIOS/ASM/AGM/heightCheck/HeightCheck6/count", "[default]BSCLARIOS/DayTotal/COS6/OldTotal","[default]BZCLARIOS/DayTotal/COS6/Total"]

currentCount6, oldCount6, total6 = system.tag.readBlocking(tagPaths)
lastTotal6 = total6.value
if all(currentCount6.quality.good,oldCount6.quality.good,total6.quality.good):
  if not (hour in (8,20) or minute == 0):
    if currentCount6.value = oldCount6.value:
        total6.value += currentCount6.value - oldCount6.value
    else:
        toatl6.value += currentCount6.value
  
  writePaths = []
  writeValues = []
  if  not lastTotal6 == total6.value:
      writePaths = tagPaths[1:]
      writeValues = [total6,currentCount6]
  else:
      writePaths = tagPaths[-1:]
      writeValues = [currentCount6]
  
  system.tag.writeAsync(writePaths,writeValues)

NOTE: the script is untested and so may need some tweaking, but I think it illustrates what you might want to do. If this is in a Gateway Tag Change script, then the performance isn't as critical, however, it is still the recommended best practice.

In this script, if any of the tags has a not good quality, then none of the calculation is performed.

thank you very much it's very useful