I want to be able to take the value of a certain tag and then every day at the "same time" (as in I don't need to account for something like daylight savings or whatever) have that value write to a different tag. In my head it would work best to use a reference tag that writes the value to a dataset, however I am curious if it is possible to script it so that the dataset is limited to only 5 rows, only writes on weekdays, and would rewrite / clear All rows when the limit is exceeded, so that 0,1 is Always Monday, 0,2 is Always Tuesday, and so on.
Is this something that can be done as simply as I am thinking it can, or is this getting out of scope of the scripting capabilities when you get into specific days of the week triggering the value writing process?
Yes this is something that is simple to do. This is something that you can do within a scheduled script under the Gateway Events. I would have this event trigger every weekday and use an if statement to clear the dataset every Monday.
1 Like
So I took over this job from the last guy quitting with no notice, and the only training I ever had was the certification so some stuff is outside my general knowledge. Have been hesitant to use too many gateway events, is the risk of slowdown relatively low? Should I not be worried about "bogging down" the scan rate with event scripts?
Also, slightly unclear on global vs gateway vs whatever scope for scripts, can I define a function in the project library and call it from the gateway events?
Gateway event scripts (the ones you configure within the project browser) have no influence on how Ignition polls tag values. Tag event scripts (scripts configured within the tag browser, directly attached to a particular tag instance) can affect execution and overlap with each other.
But in general, there's no single "scan rate" to bog down. Ignition is a complex multi-threaded program running on a standard computer, not a real time OS running on a PLC.
The project script library is just that - a library. Anything else in your project can invoke scripts from that library, and where the script was invoked from is what determines your scope.
That is, a "gateway scheduled script" is, by definition, running on the gateway. Almost everything in Ignition works in some kind of 'event driven' manner - Ignition will decide when to call your scripts and invoke them for you based on your saved configuration, and then it's up to your script to do whatever it needs to do.
4 Likes