Siemens S7-300 Drive & Tag Change Scripts

Good morning to my driver and Siemens experts,

Has anyone experienced the Siemens S7-300 driver having issues with tag change scripts?

We are using Ignition 8.1.42.

I have a 300 that is running a machine and we are using Ignition for the HMI. We also have a tag change script on a start tag to fire off a gateway project script to store some info. This works great about 78% of the time, but there are times where the tag will go from false to true and the tag change script never picks it up.

Initially we had

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	if not initialChange:
		if currentValue.value == True:
			Some.Project.Script(currentValue.value)

We took out the if not initialChange after noticing that we were missing more changes of the tag. But even now we still miss tag changes. This is even if we are simply logging the value of the tag change with system.util.getLogger.

There are no error logs of any kind, and it just seems like it doesn't catch the tag change, but it will show that the value is true. They have ControlLogix that are collecting info and running tag change scripts and there are no issues whatsoever. Only issues are with this S7-300.

Check the missedEvents flag. The script you execute may be running long enough that your queue overflows and you miss events.

Thanks for the reply.
Even for just a simple log? We have gone as far as removing all scripting and just logging the change and it doesn't always happen.

I will still check the missedEvents flag. It just is weird to me that something like logging wouldn't be caught.

There's really only two possibilities here:

  1. queue overflow, missedEvents flag will indicate this
  2. your OPC tag value is out of sync with the PLC value somehow. This can happen in some cases when you introduce a race condition by using Tag Group settings like "Read After Write" and are writing to a tag that is updated by both Ignition and the PLC.

Okay, thanks for the feedback. I am going to do some digging. This was designed previously by another SI so I may be missing something else.

I did a little more poking around. The program is in instruction list :face_vomiting: but it seems like the start tag is not being edited anywhere in the PLC it is strictly controlled from the HMI. I haven't had the chance to get into the missedEvents flag, but the customer thinks we should just look at the tag on a gateway script. I don't remember how the gateway tag change scripts run. They are independent of the tag change thread right? Would I have the same issue possibly with missed events due to queue overflow?

No queue overflow on the gateway tag change scripts, go for it.

1 Like