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.

Mapping object to Kepware Simulator Sample

More
04 Oct 2019 15:52 #7801 by Whistlerone
I thought I had already tried that, but I guess not. That does clear the error and now I'm getting data.
The following user(s) said Thank You: support

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

More
02 Oct 2019 12:54 - 02 Oct 2019 12:54 #7784 by support
Hello,

I have not verified my suggestion below, but I have checked how the nodes in the KepServerEx are organized with your configuration,l and it seems to me that I know the reason.

"Channel1" is "Organizes" reference from the Objects folder.
"Device1" is "Organizes" reference from "Channel1".
"Tag1" is "HasComponent" reference from "Device1".

For the first two, the character that precedes them in browse path should be '/', which means "any hierarchical". The use of '.', which means "any component", is not possible beween the Object folder and Channel 1, because the "Organizes" reference is not a component.
The Tag1 is a component, and therefore either '.' or (a broader) '/' will work.

I think that the browse path to Device1 should therefore be [ObjectsFolder]/Channel1/Device1 ; the browse path to Tag1 should be [ObjectsFolder]/Channel1/Device1.Tag1 (or [ObjectsFolder]/Channel1/Device1/Tag1 ).

I hope this helps
Last edit: 02 Oct 2019 12:54 by support.
The following user(s) said Thank You: Whistlerone

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

More
01 Oct 2019 12:29 #7783 by Whistlerone
Simulation Server Demo.opf is the configuration file.
Attachments:

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

More
01 Oct 2019 06:54 #7782 by support
Hello,

can you attach here the project, and the KepServerEx configuration file?

Thank you

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

More
30 Sep 2019 20:40 #7778 by Whistlerone
I am attempting a proof of concept example of Live Mapping an object in our system to an OPC UA device, in this case the 'Device1' that is the sample object provided by Kepware's Simulator driver. I am basing this code off of the ConsoleUALiveMapping sample in the Knowledgebase.

Sample code to do a read of the value I am trying to map(This works):
//test = new UAAttributeData();
            // Define the target controls, the OPC data we want to monitor, and how fast.
            var arguments = new[]
            {
                new EasyUAMonitoredItemArguments(test, uri,"ns=2;s=Channel1.Device1.Tag1",1000)
            };
 
            // Hook the event handler, and subscribe to OPC data
            _client.DataChangeNotification += ClientOnDataChangeNotification;
            _handles = _client.SubscribeMultipleMonitoredItems(arguments);

Now the this is the object I am trying to map to.:
[UANamespace("KEPServerEX")]
    [UAType]
    public class OPCDevice : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void OnPropertyChanged([CallerMemberName]string property = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
        }
 
        [MetaMember("NodeDescriptor")]
        public UANodeDescriptor NodeDescriptor { get; set; }
 
        [UANode(BrowsePath ="/Tag1"), UAData]
        public UInt16 Tag1
        {
            get => _tag1;
            set { _tag1 = value; OnPropertyChanged(); }
        }
        private UInt16 _tag1;
    }

and the code to preform the mapping:
private void Map()
        {
            UAEndpointDescriptor endpointDescriptor = uri;
            Device = new OPCDevice();
            _mapper.Map(Device, new UAMappingContext
            {
                EndpointDescriptor = endpointDescriptor,
                // The NodeDescriptor below determines where in the OPC address space we want to map our data to.
                NodeDescriptor = new UANodeDescriptor
                {
                    // '#' is a reserved character in a browse name, and must be escaped by '&' in the path below.
                    BrowsePath = UABrowsePath.Parse("[ObjectsFolder].Channel1/Device1", "KEPServerEX")
                },
                MonitoringParameters = 1000,  // requested sampling interval (for subscriptions)
            }); 
            _mapper.Subscribe(true); 
        }

This results the exception being thrown:
OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
Status Code: {BadNoMatch} = 0x806F0000 (2154758144)

with no inner exception.

The kepware diagnostic log of the transaction:
9/30/2019 10:09:19.023 AM [OpcLabs.EasyOpc.UA.Implementations.NetSdk.Internal.EasyUASession;5.54.1311.1@PFC-DEVELOPERPC/11628:1;1] TranslateBrowsePathsToNodeIdsRequest
 
	0000000000: Event started
 
	0000000000:    Request Header: 
 
	0000000000:       authenticationToken: i=1283819093 
 
	0000000000:       timestamp (UTC): 2019-09-30T14:09:19.022 
 
	0000000000:       requestHandle: 9 
 
	0000000000:       returnDiagnostics: 0 
 
	0000000000:       auditEntryId: [empty] 
 
	0000000000:       timeoutHint(ms): 0 
 
	0000000000:    Parameters: 
 
	0000000000:       relativePath []: Size: 1 
 
	0000000000:          relativePath [ 0 ]: 
 
	0000000000:             startingNode: i=85 
 
	0000000000:             relativePathElement []: Size: 3 
 
	0000000000:                relativePathElement [ 0 ]: 
 
	0000000000:                   referenceTypeId: i=44 
 
	0000000000:                   isInverse: 0 
 
	0000000000:                   includeSubtypes: 1 
 
	0000000000:                   targetName: ns=2|Channel1 
 
	0000000000:                relativePathElement [ 1 ]: 
 
	0000000000:                   referenceTypeId: i=44 
 
	0000000000:                   isInverse: 0 
 
	0000000000:                   includeSubtypes: 1 
 
	0000000000:                   targetName: ns=2|Device1 
 
	0000000000:                relativePathElement [ 2 ]: 
 
	0000000000:                   referenceTypeId: i=33 
 
	0000000000:                   isInverse: 0 
 
	0000000000:                   includeSubtypes: 1 
 
	0000000000:                   targetName: ns=2|Tag1 
 
	0000000000: Event complete
 
9/30/2019 10:09:19.023 AM [OpcLabs.EasyOpc.UA.Implementations.NetSdk.Internal.EasyUASession;5.54.1311.1@PFC-DEVELOPERPC/11628:1;1] TranslateBrowsePathsToNodeIdsResponse
 
	0000000000: Event started
 
	0000000000:    Response Header: 
 
	0000000000:       timestamp (UTC): 2019-09-30T14:09:19.023 
 
	0000000000:       requestHandle: 9 
 
	0000000000:       serviceResult: 0x00000000 (Good) 
 
	0000000000:    Parameters: 
 
	0000000000:       translateResults []: Size: 1 
 
	0000000000:          translateResults [ 0 ]: 
 
	0000000000:             statusCode: 0x806f0000 (BadNoMatch) 
 
	0000000000:             targets []: Size: 0 
 
	0000000000: Event complete

So I'm trying to figure out why the TranslateBrowsePathsToNode is failing. I confirmed that 'KEPServerEX' is namespace ns=2 in this instance, and the path seem to match. Is there something obvious that I am missing?

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

Moderators: support
Time to create page: 0.053 seconds