opcua structure variables with javascript|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
opcua structure variables with javascript
Avatar
Denis Sangaletti
Member
Members
Forum Posts: 4
Member Since:
09/07/2023
sp_UserOfflineSmall Offline
1
09/07/2023 - 10:32
sp_Permalink sp_Print

Hi all,

I'm new in opcua server with nodered and javascript

I would like create a variable structure as described in the xml report which follow as created in plc siemens. But I would like create it using javascript as I started with the following lines 

function constructAlarmAddressSpace(server, addressSpace, eventObjects, done) {
  const opcua = coreServer.choreCompact.opcua;
  const LocalizedText = opcua.LocalizedText;
  const namespace = addressSpace.getOwnNamespace();
  const Variant = opcua.Variant;
  const DataType = opcua.DataType;
  const DataValue = opcua.DataValue;
  var flexServerInternals = this;
  const rootFolder = addressSpace.findNode("RootFolder");
  node.warn("construct new address space for OPC UA");
  const ordiniFolder = namespace.addFolder(rootFolder.objects, {
    "browseName": "ordini"
  });
  const ordine = namespace.addObject({
    organizedBy: ordiniFolder,
    browseName: "ordine"
  });
 
  })
  done();
}
can someone help me to learn how to create the structures?
many thanks 
[Image Can Not Be Found]
Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
09/07/2023 - 16:00
sp_Permalink sp_Print

Deleted the long XML you posted because it made the thread hard to read.

Are you using the node-opcua framework:

https://github.com/node-opcua/node-opcua

It should have functions that allow you to do this.

Avatar
Denis Sangaletti
Member
Members
Forum Posts: 4
Member Since:
09/07/2023
sp_UserOfflineSmall Offline
3
09/08/2023 - 01:39
sp_Permalink sp_Print

many thanks for your help. I cannot find information on that link to create the structure I mean. I would like create new dataType

for example in uaexpert I connect to a opcua server and a variable is datatype: "ordine"."ordini" where ordine is a object while ordini is array with value rank 1 and arrayDimension UInt32 Array[1] is [0] = 2

can I set a dataType as created by default from plc using javascript?

many thanks

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
09/08/2023 - 02:03
sp_Permalink sp_Print

Are you using the node-opcua framework or are you trying to write something from scratch?

Avatar
Denis Sangaletti
Member
Members
Forum Posts: 4
Member Since:
09/07/2023
sp_UserOfflineSmall Offline
5
09/08/2023 - 02:10
sp_Permalink sp_Print

I'm using node-red node compact server opcua node and inside it request a javascript code where I can define the structure of variables.

But I cannot undestrand how to create list of structures as I described int the last post https://opcfoundation.org/foru.....res/#p4846

 

can you help me to undestand how to create this?

many many many thanks in advance

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
09/08/2023 - 13:55
sp_Permalink sp_Print

Documentation should be here:

https://github.com/node-opcua/....._server.md

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1353
Posts: 4589