cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MII, Query tags through PCO dynamically

0 Kudos

Hi,

I have an OPC server (FSGateway) where several hundreds of tags are defined. This OPC server is connected to MII through SAP PCo.

If I browse the tags in MII using PCO query , I can see all the tags in the OPC server.

When I read some of them, it is also working to display the value.

When I try to write these same tags it is also working through dynamic assignment of tags (using SelectedTags and SelectedTasDisplayName).

However, when I try to write to a tag that I have not yet browsed using the PCO query, the writing is not working. The following error message:

"Unable to convert value for tag xxx to required type".

This is due to the fact that PCO does not know the metadata for those tags (the datatype). The metadata is read from the source the moment I do a tagRetrieveQuery for the tags. However, I did not do it for all of them.

My requirement is that the tag names will be dynamically assigned because new ones will be created in the future. When this happens, PCO should retrieve the metadata even if I have never written or read the tag before. This is not happening.

I have tried all the query cache modes for my agent instance in SAP PCO.

We are using SAP MII 15 and SAP PCO 15.

Please advice

Regards,

Philippe

Accepted Solutions (1)

Accepted Solutions (1)

abhinaste
Explorer

Hi,

The cause for this issue is the value which we pass is not getting recognized by the PCO query. So for this whenever we call the PCO Store Query from BLS and pass the input parameters dynamically i.e. SelectedTags and SelectedValue then we also have to pass value as "true" for the parameter "TagValueEncoded". This should resolve the issue.

 

Regards,

Abhijeet

priyankaudgirkar
Discoverer
0 Kudos

It worked for me.
Thank You:)

SajtosMatyas
Explorer
0 Kudos

Thanks, this Works!

Answers (2)

Answers (2)

0 Kudos

if you want to write a string value to the Pco Query , you should set TagValueEncoded to true.

former_member196557
Active Contributor
0 Kudos

Hi Philippe,

Which Service Pack and Patch level of PCo 15 and MII 15?

Can you provide the complete verbose log of the attempt to write to a tag that has not been browsed?

Regards, Steve

0 Kudos

Hi Steve,

Sorry for the late reply.

We are using SAP MII 15.0 SP4 Patch 5 and SAP PCo 15.0.5.2522.

In the verbose log of the agent instance I find no message which indicates the writing failed.

It is only in the MII transaction that I get following messages:

16:22:09.775 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.MaterialCode: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.MaterialCode to required type
16:22:09.779 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.MaterialDesc: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.MaterialDesc to required type
16:22:09.784 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Type: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Type to required type
16:22:09.788 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Silo: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Silo to required type
16:22:09.793 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Target_Qty: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Target_Qty to required type
16:22:09.798 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Min_Qty: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Min_Qty to required type
16:22:09.802 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Max_Qty: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.Max_Qty to required type
16:22:09.806 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.UOM: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.UOM to required type
16:22:09.811 [INFO] [PCO_WRITE_BULK_INGREDIENT]Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.DosingSequence: Unable to convert value supplied for tag Archestra1/MIX02_MIX_QUEUE_POSITION_1_B01.DosingSequence to required type

former_member196557
Active Contributor
0 Kudos

Hi Philippe,

What is the setting for the PCo Agent Instance Tag Query Tab Cache Mode?

Regards, Steve

0 Kudos

Hi Steve,

In the agent instance the cache mode is set to 'demand'.

Edit: I noticed that writing a tag value succeeds once I have writen said  tag using Matrikon OPC client for example. Here I first need to select the datatype after which I can write it from Matrikon and from MII. Could it be that PCO is not able  to determine the datatype of the tag because it is not proparly configured in FSGateway? Once I close Matrikon and restart the agent instance, the tags are unwritable again.

former_member196557
Active Contributor
0 Kudos

HI Philippe,

I first would recommend that you update to the latest PCo 15.0SP06 Patch 6 to get to the latest release of PCo to eliminate version  issues. Are you on the current release of FS Gateway?

In the Demand mode that you have set above, for either a read or a write, PCo will first try to find a tag name in its Tag Query cache. if the tag is not there, then it will browse the OPC Server for the tag and metadata (raw tag address for the OPC Server, datat type, etc.) from the OPC Server. It sounds like FS Gateway is not correctly returning the tag data type to PCo.

What happens when you try to write the same tag a second time? Do you get the same error?

What happens when you configure two PCoQuery templates, one for TagRetrieveMode and one for TagStore mode, and execute them (TagRetrieve, then TagStore) from an MII transaction, for the same tag name?

Are you using DA 2.05a or DA3.00 interface for the FS Gateway OPC Server connection?

Regards, Steve