???Why can’t I use a function name in the topic title without getting the message: “The title is not clear, is it a complete sentence?” ???
Now for the topic:
To verify if the connections with numerous PLC’s still exist, we have made a watchdog gateway module.
The watchdog is started as follows:
In the Ignition 7.9.3 documentation the function is defined as follows at http://files.inductiveautomation.com/sdk/javadoc/ignition784rc1/com/inductiveautomation/ignition/common/execution/impl/BasicExecutionEngine.html
void registerAtFixedRateWithInitialDelay(java.lang.String owner, java.lang.String name, java.lang.Runnable command, int rate, java.util.concurrent.TimeUnit unit, int initialDelay)
The application.getStartupDelaySeconds() is necessary as the opc is not available immediately adn so the watchdog delays startup with 10 (seconds).
These 10 (seconds) however appear to be to small so we increased it to 60 but that resulted in module not starting at all.
The sampling rate of the watchdog is set to 6 seconds.
Question: Is the initialDelay in the same unit as is specified as the unit for rate?
In our case that would mean 10 seconds and 60 seconds.
What prevents our module from starting?
Any help would be appreciated.
I’ve never had a problem like this, but I would expect there to be errors logged from the BasicExecutionEngine when it fails to run. If necessary, consider adding an outermost
catch construct in your watchdog to log the details of any possible
Throwable you might be encountering.
And your link is to v7.8.4 JavaDocs. The v7.9.3 JavaDoc is here:
Yes, it should be.
Phil is right that there should be some error(s) or warnings in the logs, or you could try starting the gateway/restarting your module and using the gateway control utility to get a thread dump.
Thanks for the help. I looked into the log and found the problem.
In my constructor where I created my watchdog I already did a check if the tags existed.
And as the opc was still starting they did not.
This gave a lot of logging immediately on creation and even before registering, making me believe that the registering function did not work.
The problem was solved as follows:
The run() method of the watchdog, that will not be called until after the initial delay, increases a heartbeat counter.
I moved the “initial Tag exists” check to here and only when the heartbeat is 0 will it be executed.
The other PLC checks will be executed on every call of the run() method.
BTW when the watchdog would be restarted this problem would not occur and everything worked flawlessly, adding to the mystery of what was wrong. But in that case the OPC was already started.
I can confirm that the initial delay and rate have the same time unit. I now use a 30 seconds initial delay and a rate of 5 seconds without any problem.
However I have not tested whether the initial delay of 60 second still gives an error.
This might be the case if second values above 60 are not allowed but instead only minutes.
TBI To Be Investigated