variable locks reading

I have a problem with a variable that I need to monitor, it simply stops reading, I want to create an event that triggers an email if it stops for more than 5 minutes, does anyone know how to generate this event?

How do you normally tell that the variable stops reading? Does the value stop changing? Does the value go to bad quality?

You could possibly set up a gateway timer event at 30s or 1 minute intervals to inspect the timestamp of the offending tag and if the last timestamp was >5 minutes ago, send an email. You would also have to make sure to check if you sent an email already, so you don't spam emails every time the script fires after the tag stopped reading.

I can't remember if timestamps still update even if value did not change, I believe they do change on tag quality change.

1 Like

in this case, I know that the problem is in the hardware, which generates the signal, in this case a temperature, the hardware locks the temperature value, therefore in the ignition, the tag maintains the status of a good signal, it does not go to a bad signal, where do I generate this event? do you have any example?

You would configure a Gateway Timer Event in the project under the Scripting Section.

1 Like

in this case, the timestap value varies, as the ignition keeps reading and writing the variable, it happens that the value is locked, because the hardware freezes the generation of the value, due to some error, so it can't be by timestamp

There's nothing built into Ignition that will do this. You can cobble something together with scripting as follows:

  • Make a memory tag alongside the temperature tag to hold a LastChange datetime.
  • Make a valueChange script on the temperature tag like so:
def valueChange(.....):
	if not initialChange and previousValue.value != currentValue.value:
		system.tag.writeBlocking(['[.]LastChange'], [])
  • Make a boolean expression tag alongside these, named StuckValue:
dateDiff({[.]LastChange}, now(500), "minute") >= 5.0
  • Display or alarm on StuckValue

Perfect! thanks!!

I created a time event to check the difference, it's not working, you can see what I did wrong???

if dateDiff("[default]Manutencao SMART/Utilidades/UPS/UPS1/LastChange", now(0), "minute") >= 5.0:
	system.tag.write("[default]Manutencao SMART/Utilidades/UPS/UPS1/StuckValue",True)
	system.tag.write("[default]Manutencao SMART/Utilidades/UPS/UPS1/StuckValue",False)

dateDiff is an expression language function. You can't use it in Python.

For scripting you would need to use*Between

Tip: "it's not working" is not an adequate description of the problem. Describe what you expect and what you got - especially any error messages.

1 Like

Couple of things.

  • The expression language is not python and doesn't work in that way.
  • What you have is not what @pturmel recommended.
  • Just putting a tagPath in as a string does not get a value, you must explicitly read the values.
  • The system.tag.* functions take a list of tag paths and return a list of Qualified values. Do a search on the forum about how to correctly do that.

Look up "Expression Tags" in the manual.

1 Like