Optional Placeholder Modelling Rule

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
taki
Jr. Member
Jr. Member
Posts: 1
Joined: 20 Mar 2019, 03:21

Optional Placeholder Modelling Rule

Post by taki »

I want to use a Collabolation model. I use UaModeler(1.6.2) project to generate and include its generated codes into my C++ based OPC UA SDK (1.7.0) project .
However, I find out something do not work correctly when objects ModellingRule with "Optional Placeholder" are not added by "addObjectsFolder***(const XmlUaNodeFactoryManager &factory)" method of its nodemanager.

I inspect generated code in following steps by using UaModeler.

I create a blank project and add two namespaces.
Then, I create new types following.

Types/ObjectTypes/TestType(namespace=1)
-Children
-Variable/Test1/TestType/Optional
-Variable/Test2/TestType/Mandatory

Types/ObjectTypes/TestType2(namespace=1)
-Children
-Object/TestObject0/TestType/Mandatory
-Object/TestObject1/TestType/OptionalPlaceholder
-Object/TestObject2/TestType/OptionalPlaceholder

And then, I create new object "Test2Object" following with setting "Select Placeholder components".
Objects/Test2Object(namespace=2)
-TestObject0
-Test1
-TestObject1
-Test1
-TestObject2
-Test1

Then, I generate "C++ Server 1.6.0" code and add these code into Unified Automation OPC UA SDK example "server_cpp_demo".

And I add following lines into "servermain.cpp".

#include "test1_nodemanagertest1.h"
#include "test2_nodemanagertest2.h"

Access::NodeManagerAccess *pAccessNodeManager = new Access::NodeManagerAccess(OpcUa_True);
pServer->addNodeManager(pAccessNodeManager);
// Start New Code
test1::NodeManagertest1 *pTest1NodeManager = new test1::NodeManagertest1(OpcUa_True);
pServer->addNodeManager(pTest1NodeManager);

test2::NodeManagertest2 *pTest2NodeManager = new test2::NodeManagertest2(OpcUa_True);
pServer->addNodeManager(pTest2NodeManager);
// End New Code

#if SUPPORT_Method_Server_Facet

Then, I build this project and run this application.
I check whether TestObject1 and TestObject2 is existing or not by using UaExpert.
But, they are not found.

Could you tell me correct instructions to use Optional Placeholder components?
Thank you in advance.

Best regards,
Shota Taki

Post Reply