Value Change script not evaluating

Can anyone shed some light on why this script with these tags is not setting the "Comm_Cond" tag to True? I ran this exact same script on a VM on my home machine and it worked. Now on my Development server it just does not want evaluate correctly. Screenshot clearly shows Comm_Cond_Dly_Tmr (34) is > Comm_Cond_Dly_SP (10), but Comm_Cond is still false. Been banging my head against the wall on this one. The Comm_Cond_Dly_Tmr is an Expression that just calculates seconds difference between Now() and the Comm_Timestamp.

currentvalue.value should be currentValue.value.

The boolean values shouldn't be strings either, but the tag system may accept and coerce those for you.

Thank you! I just found that the "v" in Value wasn't capitalized (saw message in logger). Once I changed it to currentValue it executes perfectly. Thanks for the quick response.

Since this script is in a valueChanged script, then you should be at most limiting the number of blocking calls that you are making. (IMO, this should really be moved to a Gateway Script).

Based on what the script is doing, I believe that you would also want to filter out initial changes.

So I would think that your script would look something like this:

if not initialChange:
    spPath = ['[.]Comm_Cond_Dly_SP']
    almPath = ['[.]Comm_Cond']

    almVal = currentValue.value > system.tag.readBlockign(spPath)[0].value
    systme.tag.writeAsync(almPath,[almVal])

Are Gateway Tag Change scripts more efficient? They're certainly not as convenient, since you have to specify a list of tags that they apply to, rather than just applying the script to a UDT that automatically applies to any tag of its type...

It's not really about efficiency. There are limitations to valueChange scripts that make them unsuitable for many types of scripts (e.g long running tasks, DB Access, etc.).

General recomendation is that valueChange scripts execute in single digit ms.

The main reason for this is that they execute in a limited queue. Each change is by default limited to a 5 event queue, any change after that will be missed.

On top of that valueChange scripts for all tags are run in a limited thread pool which by default has a size of 3. Which means that you can only have 3 valueChange events running at any one time. Having many valueChange scripts which execute at longer times (even in 100's of ms) can cascade and cause missed events.

3 Likes