04/08/2025
OfflineHi all ,
Iam trying to create asset type in my customized model. with the below code snippet in xml
<opc:ObjectType SymbolicName="IND:GenericTemperatureSensorAssetType" BaseType="UAFX:FxAssetType">
<opc:Children>
<opc:Object SymbolicName="Sensor"
TypeDefinition="IND:GenericTemperatureSensorType"
ModellingRule="Mandatory" />
</opc:Children>
</opc:ObjectType>
its compiling fine and iam able to create nodeset2 file, and also able to generate required .c and .h file using nodeset compiler(open62541)
so basically iam assigning base type as Fx asset type, and in Opc.ua.fx.ac under fx asset type we do have interface with name IAssetRevisionType.
Now in mycustomized model i want to fill values like Major version and Minor version which is part of "IAssetRevision Type".
But once I browse my all nodes in my model (using open62541) under my object GenericTemperatureSensorAssetType iam not seeing any interface with name IAssetRevisionType and hence other fields also like Major version and minor version.
Am I doing anything wrong while creating my GenericTemperatureSensorAssetType , is so then what is correct way of doing it?
How should I assign some default values to this major and minor version fields, can i do it by in xml itself or is it done during runtime ie (using server code in open62541).
Regards,
Rahil
04/08/2025
OfflineRandy Armstrong said
You will likely need to manually add the Nodes brought in from the Interface because the tooling does not support it.More importantly, even if the tooling did support all optional Nodes in a Type or Interface need to be manually added to instances.
Hi Randy,
even if thats the case , then how can we reuse the interface and variable defined in those interface in any new object that i creates.
for example:
<opc:ObjectType SymbolicName="IND:GenericTemperatureSensorAssetType"
BaseType="UAFX:FxAssetType">
<!-- Link to the IAssetRevision interface -->
<opc:References>
<opc:Reference IsForward="false">ua:HasInterface</opc:Reference>
<opc:TargetId>UAFX:IAssetRevision</opc:TargetId>
</opc:References>
<!-- Add major version -->
<opc:Variable SymbolicName="IND:Sensor_MajorAssetVersion"
TypeDefinition="UAFX:MajorAssetVersion"
DataType="ua:UInt16"
ModellingRule="Mandatory" />
</opc:Children>
</opc:ObjectType>
In above case creation of sensor major asset version again fails , as Model compiler says "The TypeDefinition reference for node GenericTemperatureSensorAssetType_Sensor_MajorAssetVersion is not valid: MajorAssetVersion".
Even if we do so how exactly we are defining relation that my object GenericTemperatureSensorAssetType is of type "UAFX:FxAssetType" and have interface with name UAFX:IAssetRevision , which contains fields "UAFX:MajorAssetVersion" , this field i needed in my object with proper semantics. Can you pls provide me some working examples and correct of modelling such things.
Regards,
Rahil
04/08/2025
OfflineRandy Armstrong said
There are three distinct namespaces for UAFX. Which one did you map UAFX to?
Hi Randy ,
I did required changes in my DemoModel_Asset.xml , below is how my DemoModel_Asset.xml looks like,
<!-- Assets Definations -->
<opc:ObjectTypeSymbolicName="IND:GenericTemperatureSensorAssetType"BaseType="UAFX:FxAssetType"><opc:References><opc:Reference><opc:ReferenceType>ua:HasInterface</opc:ReferenceType><opc:TargetId>UAFX:IAssetRevisionType</opc:TargetId></opc:Reference></opc:References><opc:Children><!-- Major Version Variable for the IAssetRevision Type --><opc:PropertySymbolicName="IND:TemperatureSensorMajorAssetversion"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorMinorAssetversion"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorBuildAssetNumber"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorSubBuildAssetNumber"DataType="ua:UInt16"ModellingRule="Mandatory"/></opc:Children></opc:ObjectType>
04/08/2025
OfflineMohammad Rahil Quazi said
Randy Armstrong said
There are three distinct namespaces for UAFX. Which one did you map UAFX to?
Hi Randy ,
I did required changes in my DemoModel_Asset.xml , below is how my DemoModel_Asset.xml looks like,
<opc:ModelDesignxmlns:uax="https://opcfoundation.org/UA/20...../Types.xsd"xmlns:xsi="http://www.w3.org/2001/XMLSche.....a-instance"xmlns:ua="https://opcfoundation.org/UA/"xmlns:di="https://opcfoundation.org/UA/DI/"xmlns:opc="https://opcfoundation.org/UA/Mo.....Design.xsd"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:UAFX="https://opcfoundation.org/UA/FX/AC/"xmlns:IND="http://opcua.rocks/UA/ind/"xmlns="http://opcua.rocks/UA/ind/"TargetNamespace="http://opcua.rocks/UA/ind/"TargetXmlNamespace="http://opcua.rocks/UA/ind/"TargetVersion="1.05.03"TargetPublicationDate="2023-12-15T00:00:00Z"><opc:ModelModelUri="https://opcfoundation.org/UA/FX/Data/"Version="1.00.02"PublicationDate="2024-02-02T00:00:00Z"/><opc:ModelModelUri="https://opcfoundation.org/UA/FX/CM/"Version="1.00.02"PublicationDate="2024-02-02T00:00:00Z"/><opc:ModelModelUri="https://opcfoundation.org/UA/FX/AC/"Version="1.00.02"PublicationDate="2024-02-02T00:00:00Z"/><opc:NamespaceName="UAFX"XMLNamespace="https://opcfoundation.org/UA/FX/AC/">https://opcfoundation.org/UA/FX/AC/<opc:NamespaceName="ind"Prefix="ind"XmlNamespace="http://opcua.rocks/UA/ind/Types.xsd"XmlPrefix="ind">http://opcua.rocks/UA/ind/<!-- urn:opcfoundation.org:2024-01:DemoModel --><opc:NamespaceName="OpcUa"Prefix="Opc.Ua"Version="1.05.02"PublicationDate="2022-06-28T00:00:00Z"InternalPrefix="Opc.Ua.Server"XmlNamespace="https://opcfoundation.org/UA/20...../Types.xsd"XmlPrefix="OpcUa">https://opcfoundation.org/UA/<opc:NamespaceName="DI"Prefix="Opc.Ua.Di"InternalPrefix="Opc.Ua.Di.Server"XmlPrefix="OpcUaDi">https://opcfoundation.org/UA/DI/<opc:ObjectTypeSymbolicName="IND:GenericTemperatureSensorType"BaseType="ua:BaseObjectType">A generic Temperature Sensor<opc:VariableSymbolicName="IND:Temp_Measurement"DataType="ua:Double"/><opc:VariableSymbolicName="IND:Temp_Unit"DataType="ua:String"/><opc:MethodSymbolicName="IND:Reset_Temp"ModellingRule="Mandatory"><opc:ArgumentName="IND:Reset_Temp_Success"DataType="ua:Boolean">Reset temperature Successfully<opc:ObjectTypeSymbolicName="IND:GenericHeaterType"BaseType="ua:BaseObjectType">A generic sensor for Heater<opc:VariableSymbolicName="IND:Status"DataType="ua:Boolean"ModellingRule="Mandatory"><opc:MethodSymbolicName="IND:TurnOn_Heater"ModellingRule="Mandatory"/><opc:MethodSymbolicName="IND:TurnOff_Heater"ModellingRule="Mandatory"/><opc:ObjectTypeSymbolicName="IND:ProximitySensorType"BaseType="ua:BaseObjectType">A generic Proximity sensor<opc:VariableSymbolicName="IND:Proximity"DataType="ua:Double"ModellingRule="Mandatory"><opc:ObjectTypeSymbolicName="IND:RoboticArmType"BaseType="ua:BaseObjectType">A Robotic Arm<opc:VariableSymbolicName="IND:Position"DataType="ua:String"ModellingRule="Mandatory"><opc:MethodSymbolicName="IND:Reset_Position"ModellingRule="Mandatory"><opc:ArgumentName="IND:TargetPosition"DataType="ua:String">How frequently to scan values when calibrating.<opc:ArgumentName="IND:Success_Movement"DataType="ua:Boolean">Robotic Arm Moved Successfully<opc:ObjectTypeSymbolicName="IND:GenericTemperatureSensorAssetType"BaseType="UAFX:FxAssetType">ua:HasInterfaceUAFX:IAssetRevisionType<opc:PropertySymbolicName="IND:TemperatureSensorMajorAssetversion"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorMinorAssetversion"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorBuildAssetNumber"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:PropertySymbolicName="IND:TemperatureSensorSubBuildAssetNumber"DataType="ua:UInt16"ModellingRule="Mandatory"/><opc:ObjectTypeSymbolicName="IND:MyFunctionalEntity"BaseType="UAFX:FunctionalEntityType"><opc:ObjectSymbolicName="IND:TempSensor"TypeDefinition="IND:GenericTemperatureSensorType"/><opc:ObjectSymbolicName="IND:Heater"TypeDefinition="IND:GenericHeaterType"/><opc:ObjectSymbolicName="IND:Proximity"TypeDefinition="IND:ProximitySensorType"/><opc:ObjectSymbolicName="IND:Arm"TypeDefinition="IND:RoboticArmType"/><opc:ObjectTypeSymbolicName="IND:MyAutomationComponentType"BaseType="UAFX:AutomationComponentType"><opc:ObjectSymbolicName="IND:MyFE"TypeDefinition="IND:MyFunctionalEntity"/>in the above highlighted section i have created object GenericTemperatureSensorAssetType with base type as "FxAssetType" and then under it, created properties like Major Asset version , Minor Asset version etc.It's compiling fine and Iam able to create nodes using open62541, But I have few questions.1. all properties which I have created manually (TemperatureSensorMajorAssetversion , TemperatureSensorMinorAssetversion , TemperatureSensorBuildAssetNumber, TemperatureSensorSubBuildAssetNumber ), all this variables are already defined in (Opc.ua.fx.ac.nodeset2.xml). is there any way, we can say that my manually created nodes should refer to those variables defined in opc.ua.fx.ac.2. if iam doing it correctly , then how someone can say that whatever nodes i have created those are not newly define types , they come from interface IAssetRevision Type define in opc.ua.fx.ac.3. if Iam doing it wrong then what's the correct way of doing such mapping?Regards,Rahil
Continuing the same topic I need to ask few generic questions as well.
When we define base type , that means we are creating object of some instance (example UAFX Asset Type defined in namespace UAFX.AC) , do the variables define under Asset type inherited automatically (both mandatory and Optional) , if Not then if we again create them as children in our own namespace , how can we deferentiate which one are inherited and which one are extending our base class UAFX Asset type (ie the nodes created manually).
Regards,
Rahil
05/30/2017
OfflineIt is not clear why you are not able to find the type.
When you declare a subtype of an instance in another namespace you do not need to copy the nodes from the parent into the subtype definition.
When you create a instance of the subtype in the ModelDesign file the tool will collect all of the inherited mandatory components and add them to the instance. inherited components will have a BrowseName with the Namespace set to the Namespace of the source model.
You need to explicitly declare optional nodes (make use you use the right Namespace when declaring nodes defined by the base type).
1 Guest(s)


Log In

Usage Policy