Model methods
- ua.emptyModel(config)
Create empty model. To use need to load specification from XML files (including NS0) and create NS1.
- ua.baseModel(config)
Create model with NS0 and NS1 initialized. Built in NS0 contains minimal net of nodes required for operating. To get full standard nodeset NS0 you can load it from XML file: nodes will be merged. To create a full nodeset from the beginning you can use
ua.emptyModel()and then load the required models.
- model.newNodeId()
Generates a NodeId. This method is used to generate new node identifiers for all new nodes created in the model. If you want to generate your own node identifiers, you can replace this method with your own implementation.
- Returns:
NodeId with new node identifier.
- model.createNamespace(namespaceUri)
Create a new namespace. If namespace with same URI already exists error will be thrown. Return index of the new namespace. For every new namespace index will be incremented by 1. Namespace index 0 reserved for default namespace ‘http://opcfoundation.org/UA/’ and index 1 reserved for namespace reserved for current server. All new created namespaces will be mapped to namespaces with indexes starting from 2.
- NamespaceUri:
URI of the namespace.
- Throws:
Error if namespace with same URI already exists.
- Returns:
index of the new namespace.
- model.validate(callback)
Validate the model for errors: Missing references, unreferenced nodes, etc.
- Callback:
Function callback(error) to be called when the validation is done. Error is string with error message.
- Returns:
nil
- Throws:
Error if there are errors in the model.
- model.commit()
- Returns:
nil
- Throws:
Error if there are errors in the model.
Commit the model changes. This method should me called after all changes are made to the model. It validates changes, fills internal structures and makes model ready for use.
- model.edit()
Create editor to edit the address space. Every editor stores new nodes that are not yet committed to the model. To commit changes to the model you should call
editor.save()method.- Returns:
Editor object.