cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to OPC tags via Xmii BL

Former Member
0 Kudos

Hi,

Does anyone know how to write to an OPC server using Business Logic? I would like to write a "part number" from a Historian Calc to a OPC tag.

OPC is Kepware OPC/DDE KepserverEx

I can pull "part number" from Historian in a BL transaction and I can pull OPC "partnumber" tag in seperate BL transaction. Ho do I get info from first transaction to the next.

I have info on how to accomplish in SQL but unfortunately it is tag.

Thanks

Mike

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Also, I can change the OPC tag value from the currentwrite query template by setting the tag value then testing it.

Mike

jcgood25
Active Contributor
0 Kudos

Then save that as a query template and configure it in your second sequence (they should be one sequence on top of the other). Then in the Incoming links for the action in the 2nd (bottom) sequence link the value into TagValue.1 (it should be a "T" icon property on the root (not the results xml structure).

From your last post it sounded like maybe you were trying to 'push' the results from one into the other, but the way it works is the 2nd one will 'pull' the results from the Current query.

Answers (6)

Answers (6)

Former Member
0 Kudos

Jeremy,

I attended theTZMII intro class a few months ago. The problem for me is that we did not have Xmii installed yet. My background is in manufacturing not IT which made the class quite overwhelming. I have never had an IT class before. Right now I know enough to play around, and that is about it.

Do you know of any BL tutorials or of anything which can help my development. I will attend the next training class when it is available. Besides the SAP network, I cannot find any help.

Thanks

Mike

jcgood25
Active Contributor
0 Kudos

If you want to send me an off-list email with your contact info, I would be happy to put you in touch with your account rep. They can recommend an integration partner to come in and help you get a head start on your project work if you think that would be advantageous.

Regards,

Jeremy

Former Member
0 Kudos

Yes, this is actually a very common practice, even after attending the two xMII training courses.

Former Member
0 Kudos

Ahhhhhhhhhhh, there it is. I was forcing the issue. Thanks for all the help Jeremy.

Mike

jcgood25
Active Contributor
0 Kudos

Mike,

Glad to hear it's working now! Any chance you are signed up for training, but are attempting to learn xMII on the job before the class is scheduled?

Incoming Links happen before the action does its job and Outgoing Links happen after the action has done its job. So in this case running the CurrentWrite query template was the 2nd action's job, and the incoming link told it what value to use in the write process.

The attempt to push a link down doesn't work because the scope of a given action is only relevant to objects above. The current query action couldn't push the link to the write query action since it didn't really exist yet.

Regards,

Jeremy

Former Member
0 Kudos

Jeremy,

I have created the 2 sequences and linked them how you said. When I evaluate, the part number appears to be fine. But yet I have no results in the OPC.

Just to verify

Incoming Current Query (TagQuery action) is

IllumTagQuery_MaterialDesc.Results{/Rowsets/Rowset/Row/Material_Desc_Calc}

links to TargetXPath

CurrentWrite Query (TagQuery action) is

IllumTagQuery_WRITETO.Results{/Rowsets/Messages/Message}

I do not see TagValue.1 property in right side

Mike

Former Member
0 Kudos

I have enabled write on the OPCUDS data server and tested the query. For results I get "No tag value specified for tagname"

In BL, I open up a tagQuery called CALC with the incoming value for tag "MaterialDescCalc" outgoing to tagQuery WRITETO tag "PartNumber"

It evaluates in the link editor OK but I get a blank for the tag value in the OPC

Mike

jcgood25
Active Contributor
0 Kudos

Mike,

You will first need to do a Current Query (TagQuery action) against your MaterialDescCalc tagname to get the source value.

Then in the next sequence put a CurrentWrite Query (TagQuery action) that references your PartNumber tagname, and in the Incoming Links assign Rowsets/Rowset/Row/MaterialDescCalc from the first action to the TagValue.1 property.

This way it will query the value and the CurrentWrite template will use the results to send the update to the OPC server.

Regards,

Jeremy

Former Member
0 Kudos

Jeremy,

I get an error "The UDS is not enabled for write modes" when I test the query. Rhis may be why I am having trouble.

Mike

jcgood25
Active Contributor
0 Kudos

You need to enable write capability in the Data Server settings (it's there as a safety measure and is disabled by default).

Regards,

Jeremy

jcgood25
Active Contributor
0 Kudos

Have you investigated CurrentWrite mode for the TagQuery?