Does Ignition have schedule events?

As the topic title asks, does Ignition have scheduled events?

The majority of SCADA platforms that I’ve used (6 or 7) have the ability to schedule an action or group of actions to occur on a regular schedule (once a day at x time, 4 hourly every day, every Monday, Wednesday, Friday at 1200, etc.), very similarly to the Windows Task Scheduler.

Is this possible natively in Ignition? (without having to write a bunch of scripting in Gateway Timers or trying to work out how to use other Java functions E.g. java.util.concurrent.ScheduledThreadPoolExecutor or java.util.concurrent.Timer)

Cheers!
Nick

no not really unless you are doing something in the reporting module.

I usually do this type of thing with a gateway timer script. You will to execute the script often enough to catch whatever event you are trying to start your task on. Its not real complicated when once you figure out one of them. Give us more detail and I am sure someone can help.

I do agree, it would be nice to have this feature set. I will say it is the one thing that I miss from wonderware.

Doing something every x-hours is indeed possible via the gateway timer scripts. Of if you just need a transaction group (to write PLC tags to a database), that also supports a timer.

Executing something at the same time every day is not natively supported in Ignition. The easiest solution would probably be to create an expression tag, use the date/time expressions to fill in the current hour. And finally execute an onChange script when the hour changed (checking whether the hour matches the one you want, and after that, executing any code you want).

Consider playing with the Gateway Context’s Execution Manager, which I believe is really a BasicExecutionEngine. That has a cron-style schedule() method.

1 Like

Has anyone used this great task method as suggested by pturmel? It is very interesting, I have to start using it but there is not much documentation about it. Does anyone have any sample code?

I got this working (with Phil’s help):

'''
Creates a schedule that will execute a task(s) using a crontab schedule string.
This should be shutdown and restarted on gateway startup. Note that the gateway restart script will run any time the project is saved/published!!
'''

from java.lang import Runnable
from com.inductiveautomation.ignition.common.execution.impl import BasicExecutionEngine

MyBEE = BasicExecutionEngine()

# Create the task to run. Execution code should be put inside the 'run' function
class Task(Runnable):
	def run(self):
		print 'Hello World'

# schedule the task using crontab
task = Task()

# gets a reference to the globals so that we can reference our BEE again! Otherwise it would be lost in the ether and the schedule will always run...
_globals = system.util.getGlobals()

# get a reference to the existing BEE stored in the globals (if it exists) and shut it down
_oldBEE = _globals.get('BEE_ScheduledEvents')
if _oldBEE:
	try:
		print _oldBEE.getTasks('')
		_oldBEE.shutdown()
	except:
		pass

# Store our new BEE in the globals so we can reference it later
_globals['BEE_ScheduledEvents'] = MyBEE

MyBEE.schedule("task_name2", task, "* * * * *")

# either of these will shutdown the new BEE
#MyBEE.shutdown()
#_globals['BEE_ScheduledEvents'].shutdown()

This will run in whatever scope you call it from. E.g. if you want it to run on the gateway, make sure to call it from the gateway startup script. Just make sure to check it’s not already running, as the gateway startup script is run every time you publish (script?) changes.

3 Likes