Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Andreas Heine
@AndreasHeine
you need to find ns=6;i=180 typedefinition
the easiestr way is th write a small client which just reads it definition
Simon Bowen
@simonbowen
image.png
Is that it?
Andreas Heine
@AndreasHeine
no you need the datatype of that nodeid
Simon Bowen
@simonbowen
OK could I read that Node and then get the data type that way?
Andreas Heine
@AndreasHeine
sure!
Simon Bowen
@simonbowen
async getGeneralPackMLMode(): Promise<DataValue> {
    return await this.session.read({
      nodeId: new NodeId(NodeIdType.NUMERIC, 180, 6),
      attributeId: AttributeIds.DataType
    });
  }
DataValue {
  value: Variant { dataType: 0, arrayType: 0, value: null, dimensions: null },
  statusCode: ConstantStatusCode {
    _value: 2150957056,
    _description: 'The attribute is not supported for the specified Node.',
    _name: 'BadAttributeIdInvalid'
  },
  sourceTimestamp: null,
  sourcePicoseconds: 0,
  serverTimestamp: 2022-08-26T15:17:47.617Z {
    high_low: [ 30980446, -4282142 ],
    picoseconds: 917000000
  },
  serverPicoseconds: 917000000
}
Andreas Heine
@AndreasHeine
progress ^^ ok it does not have the attribute good to know try "AttributeIds.DataTypeDefinition"
Simon Bowen
@simonbowen
DataValue {
  value: Variant { dataType: 0, arrayType: 0, value: null, dimensions: null },
  statusCode: ConstantStatusCode {
    _value: 2150957056,
    _description: 'The attribute is not supported for the specified Node.',
    _name: 'BadAttributeIdInvalid'
  },
  sourceTimestamp: null,
  sourcePicoseconds: 0,
  serverTimestamp: 2022-08-26T15:21:08.710Z {
    high_low: [ 30980447, 2006644838 ],
    picoseconds: 615000000
  },
  serverPicoseconds: 615000000
}
Andreas Heine
@AndreasHeine
ok...
does AttributeIds.Value work?
Simon Bowen
@simonbowen
DataValue {
  value: Variant { dataType: 0, arrayType: 0, value: null, dimensions: null },
  statusCode: ConstantStatusCode {
    _value: 2150957056,
    _description: 'The attribute is not supported for the specified Node.',
    _name: 'BadAttributeIdInvalid'
  },
  sourceTimestamp: null,
  sourcePicoseconds: 0,
  serverTimestamp: 2022-08-26T15:22:15.452Z {
    high_low: [ 30980447, -1620898998 ],
    picoseconds: 961000000
  },
  serverPicoseconds: 961000000
}
If it's any help, I can call the method in UAExpert without a problem.
Andreas Heine
@AndreasHeine
can you send a screenshot how it looks (the dialog for the methodcall)
i am confused...
Simon Bowen
@simonbowen
image.png
Andreas Heine
@AndreasHeine
its a ENUM
Simon Bowen
@simonbowen
Ahhh OK
Andreas Heine
@AndreasHeine
try Int32 instead of UInt32 !
DataType.Int32 in your variant
should do the trick
Simon Bowen
@simonbowen
That did. Thank you!
So that I can understand, are enums always Int32?
because the Enumeration DataType is a subtype of Int32
Simon Bowen
@simonbowen
Thank you so much.
Andreas Heine
@AndreasHeine
your welcome!
Simon Bowen
@simonbowen
@AndreasHeine Have you got a paypal or something, I'd like to buy you a beer by sending some money over.
Andreas Heine
@AndreasHeine
Simon Bowen
@simonbowen
Sponsored. Thanks once again.
Andreas Heine
@AndreasHeine
Thanks ;)
Simon Bowen
@simonbowen

Me again. I have a set of nodeset.xml files that I have exported from UAExpert. I am trying to set up my own server in node-opcua using the following code.

(async () => {
  const server = new OPCUAServer({
    port: Number(process.env.SERVER_PORT) || 4840,
    nodeset_filename: [
      './nodesets/nodeset_0.xml',
      './nodesets/nodeset_1.xml',
      './nodesets/nodeset_2.xml',
      './nodesets/nodeset_3.xml',
      './nodesets/nodeset_4.xml',
      './nodesets/nodeset_5.xml',
      './nodesets/nodeset_6.xml'
    ]
  });

  await server.initialize();

  const endpoint = server.endpoints[0].endpointDescriptions()[0].endpointUrl;
  console.log(`OpcUA Server: ${endpoint}`);
  await server.start();
})();

but I get this error...

TypeError: Cannot read properties of null (reading 'objects')
    at prepareServerDiagnostics (/home/simon/Projects/portal-api/node_modules/node-opcua-server/source/server_engine.ts:1180:47)
    at /home/simon/Projects/portal-api/node_modules/node-opcua-server/source/server_engine.ts:1242:13
    at __node_internal_ (node:util:281:10)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

How am I being stupid?

Simon Bowen
@simonbowen
I think it's because of this error that occurs before hand
14:53:03.306Z :generateAddressSpaceRaw       :32    generateAddressSpace:  Loading xml file  ./nodesets/nodeset_4.xml  failed with error  String cannot be coerced to a nodeId : BrAccessRightsDataType
Simon Bowen
@simonbowen
To give some context to the above, I want to set up a "mock" opcua server that has the same interface as the PLC we are using for testing purposes. Does anyone have any ideas on how I could approach this?
Andreas Heine
@AndreasHeine
can you share the nodeset4 via mail?
Simon Bowen
@simonbowen
@AndreasHeine I can do, do you want to me PM your email address?
Simon Bowen
@simonbowen
@AndreasHeine I've just seen that it's on your profile, I'll send the nodeset_4.xml across.
Etienne
@erossignon
@simonbowen how did you generate the xml file in the first place ? the order is important, all dependent NodeSet.xml must be loaded first.
Sterfive has a tool that interogates a PLC and suck out the nodeset.XML files , so you can regenerate mock server easily.
Please contact me by DM if you are interested.
@simonbowen , one trick is to use the toString() method to console.log or display dataValue, callResult or any other node-opcua datastructure. The formating will be nicer ...
Etienne
@erossignon
console.log(dataValue):
//
console.log(dataValue.toString());
 const endpoint = server.endpoints[0].endpointDescriptions()[0].endpointUrl;
you can now use this as a short cut
 const endpoint = server.getEndpointUrl();
Simon Bowen
@simonbowen
@erossignon I exported the node sets from UAExpert. There were 6 in total, named nodeset_0, nodeset_1 etc. I definitely loaded them in numerical order.
@erossignon I worked through the issue with @AndreasHeine in private chat, I am still not totally sure on what the issue is to be honest. But that is down to my lack of understanding on how OPCUA works.
@erossignon I would be interested in the Sterfive tool, but I am not sure how that would be any different to me exporting the nodesets from UAExpert and ultimately hitting the same issue.
Etienne
@erossignon
@simonbowen I would also be intereseted to get a private copy of the XML file that you have generated with UAExpert for investigation. THere mgith be a parsing issue in node-opcua we need to fix
mcdoim14
@mcdoim14
Can file nodes only be used for static files? I have a requirement to provide various files (mainly csv/png) that are generated at runtime. Is there a way to do this using file nodes, or would I have to send these in their raw format?
Etienne
@erossignon
No. file node can be dynamic. Image are supported.
Sebastian
@SebsSa

Hello guys :) tried to find the answer to this question online - but sadly i did not find it :(

I created a server with :

`            allowAnonymous: false,
        securityPolicies: [SecurityPolicy.Basic256Sha256],`

User/PW: abc/123

So i tried to connect : Via

None Anonymous - Like expected did not work
Basic256Sha256 Anonymous - Like expected did not work
Basic256Sha256 abc/123 - Like expected did work

But now i tried :

None abc/123 - And i got logged in - expected it to NOT work

What is happening here ?