# Siemens S7-300 Drive & Tag Change Scripts

**URL:** <https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [December 11, 2024, 2:28pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688 "2024-12-11T14:28:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [December 11, 2024, 2:28pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/1 "2024-12-11T14:28:45Z")

</div>

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

```Python
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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 2:35pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/2 "2024-12-11T14:35:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [December 11, 2024, 2:59pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/3 "2024-12-11T14:59:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 3:04pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/4 "2024-12-11T15:04:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [December 11, 2024, 3:05pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/5 "2024-12-11T15:05:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [December 11, 2024, 4:08pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/6 "2024-12-11T16:08:39Z")

</div>

> [@Kevin.Herron](#):
>
> queue overflow, `missedEvents` flag will indicate this

I did a little more poking around. The program is in instruction list 🤮 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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 4:32pm UTC](https://forum.inductiveautomation.com/t/siemens-s7-300-drive-tag-change-scripts/99688/7 "2024-12-11T16:32:27Z")

</div>

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