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.

ItemChanged Event

More
18 May 2010 16:16 #23 by support
Replied by support on topic Re: ItemChanged Event
Thanks for the information.
You have the right build of QuickOPC.NET - it is the latest publicly available as of today.
And, the exception you are getting is actually coming from the OPC server, QuickOPC just passes it through. The exception is standard OPC error that means that the ItemID you are requesting is not known to the server. Your code passes this in third parameter of SubscribeItem, namely, "InMsgReady". This is the incorrect value. You just need to figure out what the right value is. This depends on the OPC server, and given that your code ues the BrowseLeaves method to see what's under the "FIM" branch, it is likely that the Matrikon server will construct the full ItemID as something like "FIM.InMsgReady". You can use some OPC client - such as the demo application that comes with the product - to visually browse the server's address space, and see what the full item ID is. You can also enhance your code to actually make use of the collection returned by BrowseLeaves: For each leaf (item), its full ItemID is in there. I can also install the Matrikon server and find it out for you, let me know if this is necessary, but I think that with this information above, you might be able to proceed yourself.
Some more information - please read, it's quite important:
- Unless the item has already been unsubscribed, your code can always access the ItemDescriptor property of the EasyDAItemChangedEventArgs. You are not getting the exception because of accessing ItemDescriptor. Your exception is generated in call to ReadItemValue
- When ItemChanged handler is called, QuickOPC already has the data value for you. It is in EasyDAItemChangedEventArgs.Vtq.value. You do not have (and you rather should not) call ReadItem or ReadItemValue to obtain the data value "again".
- Yes, the rate in SubscribeItem is in milliseconds. The "proper" rate depends on what are needs of your application - mainly, what's the allowed "reaction time" or "delay" you can allow before your code gets the notification.

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

More
18 May 2010 13:38 #22 by ianfenton@rmtrobotics.com
Ok, here are the details;
a) EasyDANet.dll version is 5.0.1081.1
b) Exception details;
{"OPC operation failure"}
OpcLabs.EasyOpc.OpcException: {"OPC operation failure"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: {"The item definition does not conform to the server's syntax."}
Message: "OPC operation failure"
Source: "EasyOpcDANet"
StackTrace: " at OpcLabs.EasyOpc.DataAccess.EasyDAClient.CheckComResult(Int32 hResult, IErrorInfo* pErrorInfo) at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(ServerDescriptor serverDescriptor, DAItemDescriptor itemDescriptor) at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(String machineName, String serverClass, String itemId, VarType dataType) at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(String machineName, String serverClass, String itemId) at FIM.frmFIM.OPC_ItemChanged(Object sender, EasyDAItemChangedEventArgs e) in D:\Software Dev\SVN (working copy)\ADAM System\FIM\frmFIM.vb:line 57"
TargetSite: {System.Reflection.RuntimeMethodInfo}

c) I am using the Matrikon OPC Server as a means to test the EasyOPCNet client. I recognize that the issue may be related to the Matrikon software and/or my inexperience in setting it up and using it. (see attachment which shows how I configured the tags)
d) I am attaching the VB.NET 2008 test files that I am using.
Thanks for the help.

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

More
18 May 2010 07:35 #21 by support
Replied by support on topic Re: ItemChanged Event
Hello,
I have tried to reproduce this but have not succeeded. You are right to expect the event be fired on further value changes, and accessing the ItemDescriptor should not throw an exception unless the item has already been unsubscribed or under other similar circumstances. Can you please provide more information, especially:
a) What is the QuickOPC.NET build number? You can find out by trying to re-run the installation package (it's on the first wizard page) and then cancelling it, or better by right-clicking any of the installed assemblies and selecting Properties->Details.
b) What are details of the exception you get?
c) What OPC server are you connecting to?
d) Can you please send more of your code - I'd like to see how the item is being subscribed, and even more importantly, what happens to the EasyDAClient object afterwards (couldn't it be deleted?).
Many thanks
ZZ

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

More
17 May 2010 19:15 #20 by ianfenton@rmtrobotics.com
I recently downloaded QuickOPC.NET 5.0 and I am slowly trying to learn how to use it.
I have a couple of questions/issues having to do with the subscription, i.e. ItemChanged event;
1. The event is fired on start up when then server is detected but when I change the data on the server I can't get the event to fire again. I'm not sure why?
2. I can't seem to get the value of the data item that fired the event, see code;
Private Sub OPC_ItemChanged(ByVal sender As Object, ByVal e As EasyDAItemChangedEventArgs)
Try
Dim val As Object = OPCClient.ReadItemValue(e.ServerDescriptor.MachineName, e.ServerDescriptor.ServerClass, e.ItemDescriptor.ItemId)
Label1.Text = String.Format("{0}: {1}", e.ItemDescriptor.ItemId, val)
Catch ex As Exception
End Try
End Sub
The ItemID seems to be generating an error but I don't understand why.
Thanks.
Ian

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

Moderators: support
Time to create page: 0.047 seconds