PLC leaves high tag values when probes disconnected, how to change this value to something more meaningful

Hi,

I am having issue displaying meaningful information on tags when the probes are disconnected and PLC fails these values to high

image

As you can see probes with 1372 values are disconnected and looking to change this to a more meaningful value or even a string that says disconnected.

I have tried looking at event scripts but it requires the value to change, so was looking to see how to change this if it sees value 1372. Any help is greatly appreacited.

Thank you,
John

1 Like

I would do this in the PLC. I typically fail a value to a user defined setpoint. Sometimes it makes sense to fail low, fail high, or fail somewhere in-between. I also like having the option to generate an alarm. Something extremely easy to do if you use UDTs, which it looks like you are not.

2 Likes

If the data type is integer, you won't be able to display anything else than an integer.
What you should be using is not special values, but the data quality.

See if you can do this hardware-side.
If not, maybe a tag change script monitoring those tags' values for '1372' and changing their quality if needed.

edit: If you want an example:

image

event script:

if currentValue.value == 1372:
	utils.tag.force_quality([str(event.getTagPath())], "Bad_NotConnected")

in the script library (utils.tag):

from com.inductiveautomation.ignition.common.model.values import BasicQualifiedValue, QualityCode

def force_quality(paths, quality):
	"""
	Force a quality on all the tags in {paths}.

	Values and timestamp are left unchanged.
	quality can either be a QualityCode, or a string that will be used to build a QualityCode.
	If quality is a string and not a valid QualityCode, QualityCode.Uncertain will be used instead.
	"""
	logger = base_logger.createSubLogger("ForceQuality")
	logger.info("forcing quality {} on the following tags: {}".format(quality, ", ".join(paths)))

	if not isinstance(quality, QualityCode):
		quality = getattr(QualityCode, quality, QualityCode.Uncertain)

	tags = system.tag.readBlocking(paths)
	values = [BasicQualifiedValue(tag.value, quality) for tag in tags]
	system.tag.writeBlocking(paths, values)

image

1 Like

This is definitely something dictated by the PLC, using its failure value settings for those channels. Some brands' AI cards will provide boolean status bits for underscale and/or overscale. Consider bringing such indicator bits into Ignition to generate alarms.

2 Likes