cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Writing tag problem using PCo Query

mahdiamrani
Explorer
0 Likes
917

Hi,

I am facing problems in writing a tag on OPC server.

I have two error messages in the query result window when executing the PCo Query:

  1. <Tag Name>: The given key was not present in the dictionary.
  2. <Tag Name>: Unable to perform operation.

These messages are also visible in the PCo log.

For information:

  • SAP MII 12.2,
  • SAP PCo 2.2,
  • OPC DA agent,
  • PCo connector,
  • PCo Query configured in TagStoreQuery mode,
  • FactoryTalk Gateway OPC server.

Please, help !

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

mahdiamrani
Explorer
0 Likes

Hi Steve,

The problem has been solved by upgrading PCo to the most recent available version which is 2.2 SP3 and/or installing it directly on the OPC server.

I assume that it was probably due to the DCOM settings.

However, the PCoStoreQuery works now perfectly for writing tags.

Thank you again for your contribution.

Kind regards,

Mahdi

Answers (1)

Answers (1)

Former Member
0 Likes

Mahdi,

1.  Can you browse/read tags through the PCoConnector in MII?

2.  Can you clear the Agent Instance Log, restart the Agent Instance in Verbose log mode, execute the TagStoreQuery and provide the Log details?

Regards, Steve

mahdiamrani
Explorer
0 Likes

Steve,

Yes, I can browse tags using the PCo Management Console while creating or editing an alias in the Source Systems Aliases tab, as well as read tags values using the TagRetrieveQuery.

After clearing the Agent instance log, restarting the Agent instance and executing the TagStoreQuery again, I have the following log message :

Exception found while trying to process the store of item <Tag Name>

And the following log stack trace :

The given key was not present in the dictionary.

   at System.ThrowHelper.ThrowKeyNotFoundException()

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

   at SAP.Manufacturing.Connectivity.Agents.Opc.DaGroup.Add(String name, String itemSource, Type dataType)

   at SAP.Manufacturing.Connectivity.Agents.Opc.Da.OpcDaAgent.DoStore(Item item, Object value, DateTime timestamp, ItemSecondaryCollection secondaries)

One important thing I don't understand and I forgot to mention is that I can only write the tag value once but...

After writing successfully the tag value for the first time (after restarting the Agent instance), I can read it as many times as I want but I can't write it again. I need to restart the Agent instance before. And if I start reading it instead of writing it, I can't write it at all!

I hope I was clear in my answer...

Thank you, Steve, for your help.

Regards,

Mahdi

Former Member
0 Likes

Mahdi,

Try this.  In the Agent Instance, browse the OPC Server and add the tag you want to write as a subscription, and add a different tag for reading..  then use the PCoQuery in MII and test both a read and and a write to the tag subscribed to in the Agent Instance.  This error appears to be with trying to browse for the tag address in the PLC.  I would try to get this to work without the PCo Alias for now, and then setup the Alias later.

Also:

What type of PLC are you connecting to through the FactoryTalk Gateway?

Is the OPC Server running on the same server as PCo? If not, have you confirmed all your DCOM configuration?

Can you install/test using a standalone OPC Client (either FactoryTalk, or Matrikon, or Kepware Quick Client) and test tag reading/writing from the client as well?

Regards, Steve

mahdiamrani
Explorer
0 Likes

Hi Steve,

I can't browse the OPC server through the Agent instance Subscription Items tab, I have the following browsing error message that appears in a popup:

Browsing failed; check connections and try again

[[severity = Fatal] COM Exception

[[FactoryTalk]: This error code is not a known error.]]

Also, in the Event Viewer of the system where PCo is installed, I have the following error :

DistributedCOM

DCOM was unable to communicate with the computer <Computer name> using any of the configured protocols.

About the PLC:

Vendor: Allen-Bradley

Type: 1756-L62 Controller ControlLogix5562

Revision: 16.52

The OPC server is not running on the same server as PCo.

What do you mean by "confirming all DCOM configuration"?

I have already installed the Rockwell Automation OPCTest standalone OPC test client; reading/writing works correctly.

Thank you.

Regards,

Mahdi

Former Member
0 Likes

Mahdi,

OPC DA Servers that run on separate OS instances than any OPC client requires that DCOM be configured on both the client and the server to allow the OPC Client to have permissiions to connect to and send/retrieve data from the server.  You need to contact Rockwell and get their documentation on how to set up DCOM for non-Rockwell OPC Clients.  There is also some information on setting up security here: http://help.sap.com/pco22.

There should also be an Error in the Windows Event Log that contains the COM exception error when you attempt to browse the OPC Server. Please post that error. 

Also, note that the default User Account for PCo services is .\localsystem.  You will have to change the User settings to a named user account that has also been granted DCOM access.  Granting DCOM access to localsysem is generally considered a security risk and many customers will not permit that account to be added to DCOM.

Regards, Steve

mahdiamrani
Explorer
0 Likes

Hi Steve,

The customer has confirmed that all DCOM settings are configured correctly, according to Rockwell recommendations.

Unfortunately, there is no log related to this COM exception in the Windows Event Viewer. The corresponding error is only notified by a popup that appears when attempting to browse the OPC server through the agent instance Subscription Items tab.

Regarding to the default user of PCo services, the customer uses a user that have administrator rights for all of them.

Thanks.

Regards,

Mahdi

Former Member
0 Likes

Mahdi,

I was re-reading the post history and saw where you said that you WERE able to write to the tag once, and read from the tag as well.  Was this from the Alias tags configuration?  It appears from your posts that if the Alias configuration is not present then PCo fails when trying to browse tags.  Can you post a sample of your Alias Configuration, and a sample of your Tag Write Query? I am especially interested in the full path of the Tag in both the Alias and the Tag Write.

Regards, Steve

mahdiamrani
Explorer
0 Likes

Steve,

Yes, I am able to write into the tag once, only and only if I do not read it before. No problem for reading the tag. To make writing possible again, I need to restart the agent instance.

Indeed, this was with an alias.

In the agent instance Subscription Items tab, PCo fails when trying to browse tags with or without an alias. To subscribe an item, I have to stop the agent instance first, the alias has no effect on browsing tags.

The full path (source) of the tag in the alias configuration is not the same that in the PCo query.

  • In the alias configuration, the path is [group1]group3.tag (note that the group2 does not appear).
  • In the PCo query, the path is group1/group2/group3/tag.

I assume that PCo is able to deal with this difference.

Regards,

Mahdi

Former Member
0 Likes

Mahdi,

I think at this point you will need to log a CSS ticket and report the details of the browsing errors. There appear to be some discrepancies in the tag names used in browsing.  Include the full version of PCo and MII, and the full version of the FactoryTalk OPC Server as well.

Regards, Steve

mahdiamrani
Explorer
0 Likes

Steve,

An OSS ticket has already been opened and is being handled by SAP.

However, thank you for helping me to find a solution to my problem.

I will keep you informed about this issue.

Kind regards,

Mahdi