Adding a Timer in Perspective

In Perspective, I want to start and monitor a timer when a Boolean Tag becomes true, and I need to be able to clear the timer when the Boolean goes false. What’s the easiest way to accomplish this for a newbie please? In the PLC world, I would use a TON in Allen Bradley.

I don’t know what your use-case is exactly, but this binding might work.

if({tagPath},
	secondsBetween(
		{tagPath.Timestamp},
		now(1000)
	),
	0
)

Few options to consider:

  1. Make a tagChange script that writes the timestamp to a custom property on the tag when the value changes to true, but when the value changes to false it does a system.date.*Between the current timestamp and the one from the custom property and writes that to a memory tag somewhere.
  2. Utilize system.tag.queryTagCalculations() with durationOn which will calculate the amount of time the tag was ‘true’ between some interval.
  3. @pturmel might have a better option using his Simulation Aids Module and its objectScript() expression function…

Incredibly fast response, thanks guys. It would be helpful to me if you could “dumb” down the suggestions. I have used bindings (my gosh, there’s a bazillion properties and ways to bind just about anything to them), but have used no scripting in my application thus far. My programming is limited to C+, Basic, Pascal, etc. (I’m dating myself) and I am unfamiliar with Python syntax.

That said, it sounds like if I created a tag called “RobotWaiting” with its expression is pointing at an AB PLC Boolean Tag needs to have Zacht’s script written and bound to something. But what should it be bound to? And what should “RobotWaiting” have for a datatype?

Thanks for your patience.

Let’s back up a little. You mention Perspective, but you’re also talking a lot about tags.

Can you name a specific task you’d try to accomplish with a timer in another HMI/SCADA system?

Perspective is just (a) visualization system. If you’ve got logic to run involving your tags, you generally don’t want that to be run by a e.g. a Perspective session, because then you’re subject to two problems:

  1. If there are multiple sessions running, they might both end up trying to write to the same tag(s) at different times
  2. If there are no sessions running, nothing writes to your tags.

Ignition has lots of ways to manage tags outside of a given HMI session, e.g. gateway event scripts, tag event scripts, transaction groups, and a bunch more.

1 Like

Hi Paul.

I haven’t done this in another HMI/SCADA system in recent years.

Typically, I do tasks in PLCs. But so far, I found it’s easier to do tasks within Perspective.

What I’m wanting to do now, is to start a timer when an Ignition Tag I created comes TRUE, and display it’s elapsed time while the Tag is TRUE. Once the Tag goes FALSE, I’d like to retain the elapsed time until I clear the Tag.

I’m working with Corporate to figure out our licensing snafu as Inductive reports my license support has run out. I suspect if someone at IA can remote in, this task could be solved fairly quickly.

Kindest regards,

Anthony

Confidential Communication: Information is for use only by approved users.

Hi Paul.

I’ve gotten my Priority Care support restored for license. Please feel free to schedule a teams meeting to remote in and see what I’m wanting to do.

Kindest regards,

Anthony

Confidential Communication: Information is for use only by approved users.

A couple thoughts:

One, every time you reply to a forum email, it is automatically posted to the forum on your behalf. With that in mind, edit this post to remove your license key.

Traditionally you have to get in contact with support through a traditional support channel. The form usually isn’t it.

Keep in mind edits are still viewable. An admin will probably have to delete.

1 Like

Good point. I didn’t think of that.

The forum isn’t an official support venue. If you want someone to remote in then give us a call or open a ticket at support.inductiveautomation.com.

Wouldn’t it be possible just to save the tag history based on change. Then take the time stamp from when it went true subtracted from the current time. May need to do some SQL work to get that last true value

You will also then have a historical record of all the times.