Testing a tag value change to run every Sunday in trial version of Ignition messing everything up

You may remember my last post about trying to call a stored procedure from a tag value change, that all worked out now (was due to the stored procedure being defined by a user not in the db - never forget Ignition isn’t responsible for everything!).

Here’s my current issue. I am using Igntition in trial mode on a VM. I am trying to get the event to now trigger on the first Sunday of every month. Now changing the computer’s date does change the tag values appropriately, but fast fowarding two hours does instantly kill the trial mode. Which, is not that big of a deal, I set it up to be 10 5-10 minutes before Saturday/Sunday midnight so I can reset the trial. However, when the day flips over, my logs show this error

|…drivers.TCPDriver[MarkEm_CoLOS_CimJet].T|06Apr2019 23:56:18|Error connecting to 192.168.0.50:1912. Connection timed out: connect

after which nothign happens for a while, definitely not my tag change stuff.

Here’s my tag change, I added a logger to write just on the day change over midnight and that too doesn’t get triggered -

import java.lang.Exception
import traceback
import system
logger = system.util.getLogger("myLogger")
logger.warn("Change of Day!")
    
if currentValue.value <= 7 and "[~]dayOfWeek" == 1:
    #First sunday of the month
    try:
        call = system.db.createSProcCall("sp_performarchive", "antidivkd")    
        system.db.execSProcCall(call)
    except java.lang.Exception e:
        logger.warn("Java Error:", e)
    except Exception, e:
        tb = traceback.format_exc()
        logger.warn("Python error: \n"+tb)

The expression for currentValue.value is dayOfMonth(now()) and the expression for dayOfWeek is dayOfWeek(now()).

Anyone know why this is failing to fire? Is it due to me changing the internal clock to try to make it run? Is there another way I can test this?

    
if currentValue.value <= 7 and "[~]dayOfWeek" == 1:
    #First sunday of the month

Most likely your issue lies here, because, the string “[~]dayOFWeek” is never equal to the integer 1.

You need to read the tag value into a variable, something like this:

import java.lang.Exception
import traceback
import system
logger = system.util.getLogger("myLogger")
logger.warn("Change of Day!")

dayOfWeek = system.tag.read("[.]dayOfWeek").value

if currentValue.value <= 7 and dayOfWeek == 1:
    #First sunday of the month
    try:
        call = system.db.createSProcCall("sp_performarchive", "antidivkd")    
        system.db.execSProcCall(call)
    except java.lang.Exception e:
        logger.warn("Java Error:", e)
    except Exception, e:
        tb = traceback.format_exc()
        logger.warn("Python error: \n"+tb)
1 Like

That’s definitely one thing that would have messed up. I changed that am still not getting anything.

I do see a new error in the logger, ClockDriftDetector, Clock drift, degraded performance, or pause-the-world detected. Max allowed deviation=1000ms, actual deviation=2418828820ms. Is this “pause the world” thing not moving my tag values and that’s why nothing is running?

That is definitely very possible, I’ll leave that to someone more knowledgeable on the inner workings of Ignition to speak towards.

The code as written will execute, I am doing something very similar in multiple locations.

You may try changing the tag to just a standard tag and manually changing the value as opposed to needing to manipulate the clock to test. As far as the script is concerned it would be exactly the same.