Closed ghettus closed 1 year ago
The Value of a Variable is the DefaultValue Xml element - not an Xml attribute. You cannot set it the way you did.
<opc:DefaultValue>
<uax:UInt32>11</uax:UInt32>
</opc:DefaultValue>
Thanks a lot @opcfoundation-org ! But there's something else that doesn't work. Inside my Object I added three properties:
<Property SymbolicName="OpcUaSmTest:FixedValue_S" DataType="OpcUa:String" ValueRank="Scalar" >
<DefaultValue>
<OpcUa:String>My constant string</OpcUa:String>
</DefaultValue>
</Property>
<Property SymbolicName="OpcUaSmTest:FixedValue_B" DataType="OpcUa:Boolean" ValueRank="Scalar" >
<DefaultValue>
<Boolean>true</Boolean>
</DefaultValue>
</Property>
<Property SymbolicName="OpcUaSmTest:FixedValue_I" DataType="OpcUa:Int32" ValueRank="Scalar" >
<DefaultValue>
<Int32>456</Int32>
</DefaultValue>
</Property>
But in the resulting nodeset I cannot find the String default value and the other two are not setted correctly:
<UAVariable NodeId="ns=1;i=180" BrowseName="1:FixedValue_S" ParentNodeId="ns=1;i=1" DataType="String">
<DisplayName>FixedValue_S</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=1</Reference>
</References>
</UAVariable>
<UAVariable NodeId="ns=1;i=181" BrowseName="1:FixedValue_B" ParentNodeId="ns=1;i=1" DataType="Boolean">
<DisplayName>FixedValue_B</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=1</Reference>
</References>
<Value>
<Boolean xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">false</Boolean>
</Value>
</UAVariable>
<UAVariable NodeId="ns=1;i=182" BrowseName="1:FixedValue_I" ParentNodeId="ns=1;i=1" DataType="Int32">
<DisplayName>FixedValue_I</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=1</Reference>
</References>
<Value>
<Int32 xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">0</Int32>
</Value>
</UAVariable>
The namespace for elements inside default values is define by the OPC UA XML Encoding. It is not the same as the UANodeSet schema. See xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" In https://github.com/OPCFoundation/UA-ModelCompiler/blob/master/Opc.Ua.ModelCompiler/Design.v105/OpcUaDiModel.xml
Hello all,
I also have another question about defining values. I would like to define a generic sensor object type in my model. In the object type I have the property "Unit", which I would like to define when I define my specific sensors in the model.
Thank you in advance
Hi,
in my instance's declaration XML I want to define fixed values for some nodes: for example I want a Boolean Variable to be always "true". I've tried to define the attribute "Value":
Then, I've tried to define the element "Value":
In both case the build is succesfull but in my Nodeset2 there's no information about that "true" value. Is this behavior not implemented? Or I'm doing it wrong?
I'd like to be able to define values for
<Property>
and<DataType>
also.Thanks