ulrick65

How to use an Output tag effectively

Discussion created by ulrick65 on Mar 2, 2014
Latest reply on Mar 23, 2014 by bryan@osisoft.com

I am using OPC DA (getting ready to upgrade to 2.5) connected to a Matrikon OPC server for Allen Bradley PLC's.

 

Although we do not want to do many Outputs from PI...there are occasions where this is necessary in our system.  My question is:

 

What is the best way to execute this?

 

For example:

 

I have a counter that the PLC is incrementing.  I have a Counter Reset in the PLC that can be triggered by a couple of other means (unrelated to PI) and I have a button on a processbook screen that, when the operator presses it, I send an output to the PLC to reset the counter.  I also need to know in PI the exact time the reset occurs (both by the operator and by the external triggers) so I have a tag setup that reads the status of the boolean for the counter reset from the PLC.  Because of the time lag we were seeing, we force the bit to stay on in the PLC for 10 seconds to be sure that PI "see's" it.

 

What is the best way to execute this? (assume that I have OPC DA 2.5 installed as I will have shortly).

 

What I currently do is I have 3 tags setup for this:

 

'PLCReset' = OPC tag of Boolean tag in PLC.  Digital state (Normal, Reset) with 10 second polled scan class

'PIReset' = Calculated tag (point source C). Digital state (Normal, Reset) with 10 second scan class

'PIOutputReset' = OPC output tag (location3 = 2, location4 = 0) Digital state (Normal, Reset), EVENT TRIGGERED with Source tag = 'PIReset'

 

The PE calculation for 'PIReset' is:

 

if tagval('PIOutputReset','*') <> "Normal" then "Normal" else NoOutput()

 

The operator button in Processbook updates 'PIReset' to "Reset" when they click on it.  This in turn caused 'PIOutputReset' to be "Reset" which outputs to the PLC.  The PLC then turns on 'PLCReset' so I have the timestamp along with that tag.  Since 'PIOutputReset' is now <> "Normal" then the PE calc for 'PIReset' sets it back to "Normal" (effectively resetting the button like a one-shot).  This in turn set's 'PIOutputReset' back to "Normal" and the output to the PLC turns off.

 

This works very well...but given that it relies on scan times, it can get "hung up" once in a great while if there are any interface issues, etc.  Not to mention the fact that it seems like a VERY convoluted way to do something that seems fairly simple and straightforward (however, I set this up when I was brand new to PI and couldn't come up with a solid way of doing it so that I could be sure the output happened and was captured by the PLC).

 

As always...any help and feedback is very much appreciated.

 

Thanks. 

Outcomes