Skip to Content
author's profile photo Former Member
Former Member

MII and PCO Notification Process over OPC Agent


I'm using MII 14.0 and Pco 2.3 to work on a B&R PLC.

I use MII to collect production data from a PLC using a PCo OPC-UA agent, and to save it to a DB.

PLC and MII share a boolean flag tag "NewDataAvailable" to cooperate on data exchange.

When the PLC has new data, it publishes it to a MII-visible area and sets the "NewDataAvailable" flag to 1.

Then, MII reads data from PLC, makes some logic on it, saves it to a DB, and re-sets the "NewDataAvailable" flag to 0.

I have developed a version of the project on Query Mode, i.e., MII periodically (every 1 second) asks the PLC if any new data is available, and, if the answer is positive (flag to 1), it collects data, etc. It works fine, but I don't like such a static approach.

I have tried to develop a version of the project using Notification Process. At PCo level, I have defined an agent notification with a trigger on flag "NewDataAvailable" ==1 expression, onTrue mode. The trigger destination is my MII transaction collecting data, saving it and setting flag back to 0 as last step.

If PLC has lot of data on a queue, it can reset flag to 1 in few ms.

I like this approach because it is dynamic: PLC acts as a master triggering MII operation only when required.

Here is my problem.

For some reason, when I activate the agent with the notification, the trigger works fine only for 2-3 times, and then it stops.

The flag is set too 1, but the trigger does not react.

I have a feeling that if the flag is re-setted to 1 by the PLC while the MII transaction has not been completely released yet , the trigger misses the true/false/true transition, and so it does not react any longer.

Is there anybody with a specific experience on this subject?

What is the best approach to manage dynamically data exchange between a PLC and MII?

I'm rather new on MII so I wonder if I'm missing some basic piece of information.

Thanks in advance for any kind suggestion.


Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Mar 27, 2015 at 02:59 PM

    Hi Mauro,

    What is most likely happening is the NewDataAvailable tag is getting set to 0 by MII, then set to 1 by the PLC, and all of this occurs within the Update Rate you have specified for the OPC UA Agent. Here is an example:

    Update rate set to 1 sec

    1. At second x PCo sees tag ==1, previous value was 0
    2. PCo notification fires and executes MII transaction
    3. At sec x+1, no tag change
    4. MII sets tag=0
    5. PLC sets tag=1
    6. At sec x+2 NO TAG CHANGE as tag transition from 1 to 0 to 1 occurred within the 1 second update interval.

    Effectively you are defining a sampling interval. By theorem, if you want to capture all change values your sample rate should be 2x the change rate of the value.

    You can change the Agent Update Rate to a smaller interval, but there is a practical lower limit of this rate, determined by how quickly the OPC Server can read the tag, and to a lesser extend by the Network latency and throughput. If your requested Update rate is faster than the OPC Server can read the tag, it will read the tag at a rate determined by the OPC Server which will be SLOWER than the Agent Update Rate. So if you set Update rate to 20 mSec, and 50mSec is the read rate limit determined by the OPC Server, tag updates to PCo will only occur at 50mSec intervals or more.

    Simplest fix may be to put a timer in the PLC that delays setting NewDataAvailable to 1 after seeing it set to 0, to allow time for the OPC server to see the tag change and notify PCo.

    Regards, Steve

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Steve,

      thank you for your reply.

      In few days I will be back to the customer plant and will be able to make some tests on the PLC.

      But your explanation sounds reasonable, as I have already checked that the subscription update rate in the PCo agent was set to 1000ms (default value)...definitely too much to intercept PLC tag change.

      I will get back to you soon with some feedback.

      with regards