We are currently developing an OPC-UA server based on the code files generated with UaModeler from an OPC-UA model. We define default configuration values directly in the OPC-UA Model. Starting the server as generated yields the expected result of those default values being displayed as defined (when browsing the object model with UaExpert client).
To update the values provided by our server, we now create an instance of the object model generated and link it using LinkModelToNode on the "root" object node.
However, creating an instance of the "root object" using its default constructor initializes all values with the C# default values, not the default values configured on the model.
Code: Select all
public override void Startup() {
Console.WriteLine("TestProjectWrapper (OpcUa Nodes) startup");
base.Startup();
var testModel= new TestModel();
lock (InMemoryNodeLock)
{
LinkModelToNode(
new NodeId(TestModel, DefaultNamespaceIndex),
testModel, null, null, 500);
}
}
Is there a way to initialize the object model with the default values defined in the information model, or set the object models values from the ObjectNode representation of the OPC-UA model?