Default value of structured datatype

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
Sr. Member
Sr. Member
Posts: 18
Joined: 25 Feb 2015, 15:58

Default value of structured datatype

Post by Maarten_BE »

Hi support team,

I am doing an evaluation of the latest C++ SDK/UaModeler and I am running into the following issue:

I created a subclass from AnalogItemType called MyCoolTemperatureType and overridden the EngineeringUnits property. I entered the "degrees celcius" engineering unit as value of the overriden EngineeringUnits property.

The goal is to already provide the degrees C value in the Type so that it is pre-filled when instantiating a MyCoolTemperatureType variable.

However the codegen C++ template 1.7 does not seem to take the default value into account. The resulting code just enters an emtpy default value:

Code: Select all

UaVariant     defaultValue;
 // Mandatory variable EngineeringUnits
        UaEUInformation valEngineeringUnits;
        s_pEngineeringUnits = new OpcUa::PropertyType(UaNodeId(msgcatalogId_MyCoolTemperatureType_EngineeringUnits, nsTypeIdx), "EngineeringUnits", NodeManagerRoot::getTypeNamespace(), defaultValue, 1, pTypeNodeConfig);
        addStatus = pTypeNodeConfig->addNodeAndReference(pVariableType, s_pEngineeringUnits, OpcUaId_HasProperty);
I would expect that the default value would be entered like this:

Code: Select all

        UaEUInformation valEngineeringUnits = UaEUInformation(
            UaLocalizedText("", "\302\260C"),
            UaLocalizedText("", "degree Celsius"));
For simple datatypes like Doubles it does work as expected, only for structured datatypes the default value seems not to be set.

Is there a explanation/workaround for this?

Best regards,


User avatar
Support Team
Hero Member
Hero Member
Posts: 2670
Joined: 18 Mar 2011, 15:09

Re: Default value of structured datatype

Post by Support Team »

Hello Maarten,

As a workaround you can set the value in the afterStartUp method of the generated NodeManager.
Best regards
Unified Automation Support Team

Post Reply