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.

Writing Mapped object Receives Callback after calling writing method of UAClientMapper

More
25 Aug 2017 09:39 #5456 by Captain_Dash
I will prove at our company site if i am allowed to follow your suggestion otherwise we will collect some informations via wireshark next week. I will write you next week what we can do.

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

More
25 Aug 2017 07:36 #5455 by support
OK I think I understand now.

The expected behavior is that QuickOPC will deliver to you all the data change notifications it receives from the server, and in the same order it receives them. Therefore, if you write to the Initialize item and it is supposed to act as a "register" in the server, that is that it will reflect and keep the value written, there should not be a callback after that "write" that would set it to a different value. You are correct in this.

There are therefore 2 possibilities: a client bug, or a server bug. I tend to think it is a server bug (although it is weird that it behaved differently with earlier client version, but there can be timing differences, and still it could be a server bug).

I suggest to take a Wireshark trace of the communication. You can then send it to us and we can analyze it and decide on which side the problem is.

The necessary instructions are here:

Collecting information for troubleshooting: kb.opclabs.com/Collecting_information_for_troubleshooting
Analyzing OPC UA Communications with Wireshark: opcconnect.opcfoundation.org/2017/02/analyzing-opc-ua-communications-with-wireshark/
OPC UA & Wireshark: www.prosysopc.com/blog/opc-ua-wireshark/

Note: I have earlier asked whether it's possible to obtain the server (or a demo of it) for a test here, but have not received an answer. If we could get hold of the server and set up a repro, it would be easier for you because we would do all the work. A third possibility (technically perfect but usually difficult to achieve in corporate environment due to security concerns) is to simply expose the server endpoint on the internet (can be from an isolated virtual machine to keep the surface low), and we can then connect to it remotely and do the repro&analysis.

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

More
23 Aug 2017 15:32 #5454 by Captain_Dash
1)

Yes i will set Initialize = true and it will be reset to false.

2)

What I want to say is, that i will trigger the write method later again and then in the plc the variable for Initialize will be set to false because my property was set by the callback to false(because it receives the previous value) although the correct value should be true like it is in the plc at the moment.

The problem is that the callback will make the property and the variable differ in its value and at application site i am not aware of the correct current value.

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

More
23 Aug 2017 14:52 - 23 Aug 2017 14:55 #5453 by support
Not all builds make it to NuGet, as the package is fairly big and the changes sometimes minor.
There is 5.41.1275 on NuGet, but is "unlisted" - that is, those that have referenced it will still be able to use it, but new users do not see it. This particular should probably be listed, because it is the last build for that version, and I will list it again soon.

I understand the broad principle of your issue with Live Mapping, but I do not understand it in full, and I am missing some important details.

1) What do you mean by "...properties of my application receives the old value."? You have changed just one property (Initialize = true), so did you mean to say that *this* property reverts back to false? If not, what precisely what the expected, and observed behavior with regard to other properties?

2) "If I set another Property in application and write it to the plc with the same method, the complete mapped object will be written with the previous states, but that is not what i want to.". With the piece of code you have listed, the Initialize and Enable properties should be written, because they include UADataMappingOperations.Write in their UADataAttribute.Operations, but IsInitialized should not be written, because it has only UADataMappingOperations.ReadAndSubscribe. Are you saying that sometimes less is written, and sometimes more is written? Please describe in details

I am not aware of a change in the mapping implementation that would cause this. But there still may be an explanation - I need to get the full understanding first.

Regards
Last edit: 23 Aug 2017 14:55 by support.

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

More
23 Aug 2017 14:11 - 23 Aug 2017 14:15 #5452 by Captain_Dash
As an Addition in version 5.41.1274.1 everything works as expected. My Properties are always correctly synchronized to the variables of the plc.

Unfortunately I was not able to get this via nuget. Why is it not possible to get the previous version via nuget, too?
Last edit: 23 Aug 2017 14:15 by Captain_Dash. Reason: added question

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

More
23 Aug 2017 10:48 - 23 Aug 2017 11:13 #5451 by Captain_Dash
Hello,

I updated to version 50.50.334 and received a behavior which was not present in previous versions.

I have a mapped object where i mapped properties like this
 
        [UANode(BrowsePath = ".Initialize"),
         UAData(Operations = UADataMappingOperations.All, Kind = UADataMappingKind.Value),
         UAMonitoring(SamplingInterval = 250), UASubscription(PublishingInterval = 500)]
        public bool Initialize
        {
            get { return initialize; }
            set { SetProperty(ref initialize, value); }
        }
 
        [UANode(BrowsePath = ".Is_initialized"),
         UAData(Operations = UADataMappingOperations.ReadAndSubscribe, Kind = UADataMappingKind.Value),
         UAMonitoring(SamplingInterval = 250), UASubscription(PublishingInterval = 500)]
        public bool IsInitialized
        {
            get { return isInitialized; }
            set { SetProperty(ref isInitialized, value); }
        }
 
        [UANode(BrowsePath = ".Enable"),
         UAData(Operations = UADataMappingOperations.All, Kind = UADataMappingKind.Value),
         UAMonitoring(SamplingInterval = 250), UASubscription(PublishingInterval = 500)]
        public bool Enable
        {
            get { return enable; }
            set { SetProperty(ref enable, value); }
        }
 

I do the following things:

1. I Create a mapping
2. Create a subscription
3. Read all values (to be sure i have all initial values, all values are false at start)
4. I set the Property Initialize = true
5. I call write method of the UAClientMapper

Now something strange happens what possibly could be a bug. The value will be written correctly as I am seeing it in the plc, but it occurs, that some callbacks coming in which set back the properties to its previous state.

To Clarify, in the plc is the new value present and the properties of my application receives the old value.

I added the callstack:

> HWComponents.Plc.dll!Orbotech.Spirit.HWComponents.Plc.PlcMapping.Axis.AxisMeta.Initialize.set(bool value) Line 127 C#
[Native to Managed Transition]
[Managed to Native Transition]
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.Reflection.Extensions.MemberInfoExtension.SetValue(System.Reflection.MemberInfo memberInfo, object obj, object value, object[] index) Unknown
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.ComponentModel.Linking.ObjectMemberLinkingTarget.SetValue(System.Type dataType, object value) Unknown
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.LiveMapping.AbstractMapping.SetTargetValue(System.Type dataType, object value) Unknown
OpcLabs.EasyOpcUA.dll!OpcLabs.EasyOpc.UA.LiveMapping.UAClientDataMapping.SetResult(OpcLabs.EasyOpc.UA.OperationModel.UAAttributeDataResult attributeDataResult) Unknown
OpcLabs.EasyOpcUA.dll!OpcLabs.EasyOpc.UA.LiveMapping.UAClientDataMappingSource.DataChangeNotification(object sender, OpcLabs.EasyOpc.UA.OperationModel.EasyUADataChangeNotificationEventArgs eventArgs) Unknown
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.Widgets.NotifyingWidget.Callback.AnonymousMethod__0() Unknown
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.Widgets.NotifyingWidget.SafeCallback(string name, System.Action action) Unknown
OpcLabs.BaseLib.dll!OpcLabs.BaseLib.Widgets.NotifyingWidget.Callback<OpcLabs.EasyOpc.UA.OperationModel.EasyUADataChangeNotificationEventArgs>(object state) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) Unknown
Shell.exe!Company.Shell.App.Main() Unknown


If I set another Property in application and write it to the plc with the same method, the complete mapped object will be written with the previous states, but that is not what i want to.

Is it a bug? And how can I prevent these callbacks from writing the old values to my properties?
Last edit: 23 Aug 2017 11:13 by Captain_Dash. Reason: corrected title

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

Moderators: support
Time to create page: 0.065 seconds