Timer Functions: How do they work?

One of our design concepts that Ignition has enabled us to pursue is that of a time-sensitive color scheme for our operators alerts.

In a nutshell:
There are three states to our machine. Running, Idle and Faulted
Anything with a state of 1 is Running.
Anything with a state of 2 is Idle/Stopped
Anything with a state of >2 is Faulted (Not really but let’s carry on with this assumption :slight_smile: )

Now with our original design from the early-mid 2000’s and late nineties. We had a predefined color for certain values. Anything with a fault was considered RED anything Idle/Stopped was Considered BLUE and Running was GREEN.

This was great, until messages with non-critical or time sensitive component came into play adding more colors. This creates a conundrum of flashing colors and the overload that arises from it.

The plan with Ignition is create a sort of color decay.
Anything that is a Shortstop (< 120 Seconds) Will be YELLOW
Anything greater than 120 Seconds will be considered a RED event.

What this does is it simplifies the color scheme. Anything actionable will be yellow, anything red will prioritize response.

tl;dr I need a timer that is unique to each machine’s state

My initial thought was to use the Production Model tag “Active Downtime Is a Short Stop”. This proved to have too much of a delay and was unreliable in properly indicating the Machines state in real time.
The Timer “Active Downtime Duration” was also subject to this delay, much to my chagrin.

The only other option I have considered is the following bit of Python code:

[code]#Timer Function that is a template for our New Messaging and color scheme
#Read the Machine’s Tag Value
#If the value is > 2 then we start counting
#Check the amount again at the end of timer and set appropriate bit

import time
interPoll = 0

TagValPoll1 = 3 #Preferably from the Modbus Value


if TagVal > 2: #If polled tag’s value is greater than 2, commence the countdown
for int in range(5):
time.sleep(2) #Sleep for X amount of seconds
TagValPoll2 = 3 #Pull again after X seconds
if TagValPoll2 > 2: #If we are still in a faulted state
print “2 Second triggered!” #Do Stuff, Most likely set a Boolean.


Pardon the hack. The “clear” condition is not quite worked out in strict coding terms per se.

Now, Anyone figure out the best method for a triggerable, time counting mechanism unique to each machine?

Hi! Welcome to forums!

One option would be to use a set of alarms.

One low level alarm can be active when the state goes above 2. Another can do the same thing, but with an Active delay time of 120 seconds.

Sample tag (This one is set with a 10 second delay for display purposes):
Test Tag JC.xml (896 Bytes)

You can then grab these alert values and use them in your label styles.

Here’s a sample window to use with the sample tag :wink: :
Test Tag JC Example Window_2015-06-02_0335.proj (6.84 KB)