Midnight bit to rset counters

Hello,

I come from a PLC background and have no experience with scripting (yet) I am running in some basic problems, that I could probab;y quit easily solve with phyton knowledge (as I understood, this is what Ignition is using as it’s scription language)

I want to have a bit that is active (flank) at 12am or 00:00 daily. This is a bit used to clear several counters through the project. Relatively easy to do (for me) in a Siemens PLC, but a bit confusing in Ignition (for me). I am not sure if I am to use an expression tag with a script running, or if there are other “easier” possibillities. My tag is a memory tag “reset_midnight”.

Some guidance is apriciated.

Kind regards,
Jarno

I use an expression tag. The string is easily settable to whatever time you wish:

dateFormat(now(), 'HH:mm:ss') = '00:00:00'

This would also work, but you’re only limited to midnight:

now() = midnight(now())

Consider not using such a bit. If its purpose is to trigger further actions, simply put all of the actions in the script that you run at midnight.

I would use a datetime memory tag (to hold the last actual run timestamp) and a timer script determine when to trigger, and then call a project script that actually performs all of the reset operations you need (saving last values, perhaps, then writing zeros to counters).

Those are vulnerable to delays in executing the expression tag skipping over midnight, which yields no reset bit at all. The latter would only work exactly on the millisecond of midnight, I think.

1 Like