Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Read tag values from WCF Service

More
15 Nov 2018 14:20 #6865 by support
Many OPC Servers are designed in such a way that they cannot reasonably run twice. This is because if there is a common, single-use communication channel (such as serial port, or something similarly constrained), only one process will get access to it. I think that the MBus OPC Server probably falls into this category.

In this case, you need to configure the computer (COM/DCOM, and possibly the service configuration etc.) in such way that the OPC server is guaranteed to run only once. It looks like you configuration does not guarantee that.

Best regards

Please Log in or Create an account to join the conversation.

More
15 Nov 2018 13:45 #6864 by SZL
The administrator of the production server manually set direct user (Administrator) to the OPC Server service to ensure the highest privileges to the service. So the user is currently different:

Attachments:

Please Log in or Create an account to join the conversation.

More
15 Nov 2018 09:48 #6863 by support
When there are 2 processes of the OPC server in the task Manager, what do they have in the "User Name" column?

Please Log in or Create an account to join the conversation.

More
15 Nov 2018 09:15 - 15 Nov 2018 09:17 #6862 by SZL
Hello,

We contact with the vendor and he asks the same question (the vendor also use QuickOPC for the Explorer software :)). Please find details here:

Do the MBusOPC.exe process start when you connect with your AVReporter client? Mostly YES, but some cases no, please see the below scenario in STEP 09.
Is your client running as a 32-bit process as well? Our service running with “Any CPU” mode.
Are there any differences in the EasyOpcClient configuration between your code and ours? I transfer the InitializeEasyDAClientParameters() method to our source code.

Today we check the following scenario:

{STEP 01} Restart Computer.
{STEP 02} Start WCF Service (Explorer is not running) -> Communication OK in WCF service (1 running process).
{STEP 03} Start Explorer (WCF is not closed) -> Communication ERROR in Explorer (2 running process).
{STEP 04} WCF Service closed, then refresh in Explorer -> Communication OK in Explorer (1 running process).
{STEP 05} Start WCF Service, Explorer keep running -> Communication ERROR in WCF Service (2 running process).
{STEP 06} Stop Explorer, WCF Service keep running -> Communication OK in WCF Service (1 running process).
{STEP 07} Start Explorer, WCF Service keep running -> Communication ERROR in Explorer (2 running process).
{STEP 08} Refresh WCF Service, Explorer keep running -> Communication ERROR in WCF Service (2 running process).
{STEP 09} Close Explorer, Refresh WCF Service -> Communication ERROR in WCF Service (0 running process – it seems, in this case, no new process created in Task Manager).

So it seems that only one client can connect to the OPC Server at the same time, but in other cases, we also can find strange behavior (STEP 09).

Thank you!
Last edit: 15 Nov 2018 09:17 by SZL.

Please Log in or Create an account to join the conversation.

More
15 Nov 2018 06:24 #6858 by support
Hello,
there is one more thing to check, quite important.

in The Task Manager switched to Details view and with processes fro all users displayed (not just the current user), figure out what is the name of the running OPC Server process. Then, verify then when using your WCF service and making a call into it, you do not get more than one instance of the OPC Server process. If there are two or more instances, that would be a configuration problem, and an explanation to the "bad" quality data probably.

Regards
The following user(s) said Thank You: SZL

Please Log in or Create an account to join the conversation.

More
14 Nov 2018 12:15 #6856 by SZL
That is also not clear for me, but the WinForms application uses the ReadItemValue method.

Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.Generic
Imports OpcLabs.EasyOpc.DataAccess.OperationModel

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Using CL As New EasyDAClient()
lblValue.Text = CL.ReadItemValue(txtServer.Text, txtProgID.Text, txtTag.Text).ToString()
End Using
Catch ex As Exception
MsgBox(ex.Message)
If ex.InnerException IsNot Nothing Then
MsgBox(ex.InnerException.Message)
End If
End Try
End Sub

End Class

And the value appears in one second:



We contact the vendor and I will write feedback.
Thank you!
Attachments:

Please Log in or Create an account to join the conversation.

More
14 Nov 2018 12:08 #6855 by support
While it is not clear why you get good results from the WinForms application, it is quite clear that for the Windows service problem, you need to address it on the OPC server side. There is no problem in your Web service, and no problem in QuickOPC either.

The server returns "bad quality" for the item in question. If you think the item should not have bad quality, talk to the server vendor.

In test (3), the ReadItem method reads the value/quality/timestamp, and returns them to you. It can be seen that the quality is "bad". The OPC client has no responsibility for delivering proper values - the OPC server has.

In tests (2) and (1), if the value is not "good" initially, the ReadItemValue method sets up a subscription and waits until a "good" value is shipped by the server - or until a timeout occurs. In test (2), the "good" value was not shipped by the server within 100 seconds, and the ReadItemValue method returned an appropriate timeout error. In test (1), the ReadItemValue waited in the same way, but the WCF timeout was shorter than the "read timeout", so you have received the WCF error instead.


Regards
The following user(s) said Thank You: SZL

Please Log in or Create an account to join the conversation.

More
14 Nov 2018 11:45 - 14 Nov 2018 11:46 #6854 by SZL
The name of this OPC Server: PiiGaB M-Bus v2.04.00.002

It's run as a service, but the software package contains an Explorer application. I attach a picture of the settings.



We check the DCOM config (Identity tab):
The "The system account (services only)" is checked.



For testing I created two method:

Public Function ReadItemValueOPC(ByVal param As ItemParam) As String Implements IService1.ReadItemValueOPC
Try
Using CL As New EasyDAClient()
CL.InstanceParameters.Timeouts.ReadItem = param.TimeoutMSec
Return CL.ReadItemValue(param.Server, param.ProgId, param.TagName).ToString()
End Using
Catch ex As Exception
Return ex.Message & ", INNEREXCEPTION: " & ex.InnerException.Message & ", STACKTRACE: " & ex.InnerException.StackTrace
End Try
End Function

Public Function ReadItemOPC(ByVal param As ItemParam) As String Implements IService1.ReadItemOPC
Try
Using CL As New EasyDAClient()
CL.InstanceParameters.Timeouts.ReadItem = param.TimeoutMSec
Dim davtq = CL.ReadItem(param.Server, param.ProgId, param.TagName)
Return davtq?.Quality?.ToString & " - " & davtq?.TimestampLocal.ToString & " - Value: " & davtq?.DisplayValue
End Using
Catch ex As Exception
Return ex.Message & ", INNEREXCEPTION: " & ex.InnerException.Message & ", STACKTRACE: " & ex.InnerException.StackTrace
End Try
End Function

And the testing cases (I increase the WCF timeout to 10 min):

{1} - ReadItemValueOPC (with 1.000.000 OPC timeout in millisec)

The request channel timed out while waiting for a reply after 00:09:59.9990139. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService1.ReadItemValueOPC(ItemParam param)
at Service1Client.ReadItemValueOPC(ItemParam param)

{2} - ReadItemValueOPC (with 100.000 OPC timeout in millisec), Request and response XML:

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="schemas.microsoft.com/ws/2005/05/addressing/none">tempuri.org/IService1/ReadItemValueOPC
</s:Header>
<s:Body>
<ReadItemValueOPC xmlns="tempuri.org/">
<param xmlns:d4p1="schemas.datacontract.org/2004/07/THIS.WCFSERVICE.Globals" xmlns:i="www.w3.org/2001/XMLSchema-instance">
<d4p1:ProgId>PiiGAB.MBus.2</d4p1:ProgId>
<d4p1:Server>localhost</d4p1:Server>
<d4p1:TagName>MB01 RS07 Mbus HKP3.33 épület 33 (fszt HKP) 20 épület radiátor.Hőmennyiség</d4p1:TagName>
<d4p1:TimeoutMSec>100000</d4p1:TimeoutMSec>
</param>
</ReadItemValueOPC>
</s:Body>
</s:Envelope>

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<ReadItemValueOPCResponse xmlns="tempuri.org/">
<ReadItemValueOPCResult>An OPC operation failure with error code -1073430513 (0xC004C00F) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem., INNEREXCEPTION: Topic not updated with quality that is not bad (timeout). , STACKTRACE: </ReadItemValueOPCResult>
</ReadItemValueOPCResponse>
</s:Body>
</s:Envelope>

{3} - ReadItemOPC (with 45.000 OPC timeout in millisec), Request and response XML:

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="schemas.microsoft.com/ws/2005/05/addressing/none">tempuri.org/IService1/ReadItemOPC
</s:Header>
<s:Body>
<ReadItemOPC xmlns="tempuri.org/">
<param xmlns:d4p1="schemas.datacontract.org/2004/07/THIS.WCFSERVICE.Globals" xmlns:i="www.w3.org/2001/XMLSchema-instance">
<d4p1:ProgId>PiiGAB.MBus.2</d4p1:ProgId>
<d4p1:Server>localhost</d4p1:Server>
<d4p1:TagName>MB01 RS07 Mbus HKP3.33 épület 33 (fszt HKP) 20 épület radiátor.Hőmennyiség</d4p1:TagName>
<d4p1:TimeoutMSec>45000</d4p1:TimeoutMSec>
</param>
</ReadItemOPC>
</s:Body>
</s:Envelope>

<s:Envelope xmlns:s="schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<ReadItemOPCResponse xmlns="tempuri.org/">
<ReadItemOPCResult>CommFailure LimitOk (24) - 2018. 11. 14. 12:15:27 - Value: </ReadItemOPCResult>
</ReadItemOPCResponse>
</s:Body>
</s:Envelope>

With Kepware OPC Server the service working fine with these methods.
Attachments:
Last edit: 14 Nov 2018 11:46 by SZL.

Please Log in or Create an account to join the conversation.

More
13 Nov 2018 14:50 #6852 by support
Is the OPC server itself running as a service? If so, is it pre-started before your service runs, or do you rely on it being started by the OPC?

Or is it started as normal process?

What are the DCOM settings settings for the server (I understand that it is local, but here the DCOM may apply too, under some circumstances). Specifically, what is on its DCOMCNFG Identity tab?

Regards

Please Log in or Create an account to join the conversation.

More
13 Nov 2018 14:44 #6851 by SZL
These errors occurred under the same conditions without change.

Yes, the quality can be the problem, we check it with the OPC Server vendor.
We check the help and the property ID of good quality is 192.

With different OPC Server (Kepware OPC Server) this code working well in WCF Service too.

But I do not understand why this working without any problem in the WinForms application...

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.082 seconds