FIFO anyone? (more characters to meet the 15 character limit)

I have some Tag ‘Value Change’ event scripts. When the tag goes high, the change script passes its tag name to a shared script that reads a row of data out of a database table and then inserts the line into another table.

This works fine except for one important issue. If two (or more) tag values go high at the same time, all events may or may not be triggered. I have simulated the behavior using 4 tag values and I can repeatedly catch the result being only 3 of the 4 scripts being executed.

Is there a way to put the event scripts (with each tag name) in a FIFO arrangement so that all events are processed?

Or, is there a way to set a flag that pauses the update script if another one is in process? (If tag = high and flag = low, execute script script, if tag = high and flag = high, wait)

Or a way I can step through the tag list and when one tag value is high and has not been processed, process the event then step to the next tag?

Does the alarm subsystem handle events differently? Can I leverage that?

I asked about running the scripts from a Gateway scope, but the answer was that two values going high at the same time = one script execution.

If you have the SFC module I would go that route.

Hmm, what now?

And do what, loop through each tag?

Email response -> “I believe the gateway tag change script just taps into the listener already in place on every tag that checks for value changes. There would be minimal impact to performance if it all. If the tags do change at the same time, as long as they are in the same set of tags being watched by the script, there will only be one execution. However, if one tag changes and the script finishes execution, then another tag change happens the script will execute again regardless of how recently the previous script executed.”

I’m confused. Are these value change tag events (defined on the tag), or gateway tag change events (defined as a gateway script with a list of tags to monitor)?

I have applications with hundred-plus tags monitored by a single script of the latter type, and nary a missed event. The event object contains a reference to the triggering tag, so the script can distinguish them.

The question was about Gateway Tag value change events. Each tag value change triggers a shared script that does an SQL query. The query has the tag name passed to it, so the SQL queries are different for each tag. For the project I am currently working on, there would be several hundred events. But future larger installations may have 10,000 or so events.

I have tried using a value change on each tag, but testing with only 4 tags I would routinely get missed events. I am now trying to call the the scripts by setting an alarm and then using ‘Alarm Active’ and ‘Alarm Cleared’ events. This looks promising so far. However, using a Gateway tag change would be cleaner, I think.

Whoever you were talking to in support is simply wrong about this. All 4 tag change scripts execute without regard to the timing of the value change.

The only time a script execution doesn’t happen is when you are using tag event scripts (the ones defined directly on each tag), and that tag value changes more than 5 times while the current instance of the script is still executing. Script execution for reach tag get queued up but there is a limit to the queue size.

None of this applies to the kind of tag change scripts you’re talking about, and doesn’t matter anyway because you’re talking about 4 different tags changing.

1 Like

Four tags was simply my test setup. The current system I am working with will have several hundred tags, larger systems in the future may have 10,000+ tags to keep track of. I know that in practice, all of the tags will never change state at the same time. This is more of a cover all the bases thing for me.

I attempted to move the tag change events to trigger off an alarm, but I still lost some events (testing with 50 tag changes at the same time). The Alarm Journal captured the alarm but the shared script did not always run.

I will now test the Gateway Tag change. It is coming up on crunch time for this project.

It doesn’t matter how many tags change at once, all the scripts should execute. How were you determining they weren’t?

I’ve got 1000 tags set up to change simultaneously and I am seeing 1000 script executions each time they change.

This is from the database entries

‘30’, ‘SCADA_ALARM_CP01_1_13’, ‘ALM0100113’, ‘1’, ‘SPARE’, ‘CP01’,
Missing SCADA_ALARM_CP01_1_14
‘31’, ‘SCADA_ALARM_CP01_1_15’, ‘ALM0100115’, ‘1’, ‘SPARE’, ‘CP01’,
‘32’, ‘SCADA_ALARM_CP01_2_0’, ‘ALM0100200’, ‘1’, ‘SPARE’, ‘CP01’,

‘35’, ‘SCADA_ALARM_CP01_2_3’, ‘ALM0100203’, ‘1’, ‘SPARE’, ‘CP01’,
‘36’, ‘SCADA_ALARM_CP01_2_4’, ‘ALM0100204’, ‘1’, ‘SPARE’, ‘CP01’,
Missing SCADA_ALARM_CP01_2_5
‘37’, ‘SCADA_ALARM_CP01_2_6’, ‘ALM0100206’, ‘1’, ‘SPARE’, ‘CP01’,
‘38’, ‘SCADA_ALARM_CP01_2_7’, ‘ALM0100207’, ‘1’, ‘SPARE’, ‘CP01’,

Mr. Herron,
I just turned on 300 tags with out a miss. Thank you so much.

How did you resolve this issue? I’m having the same thing happen. If I use only 1 tag, no missed events. But once I turn more tags on, then I start seeing a missed event on each tag.