《OPC UA信息模型最佳實踐.pdf》由會員分享,可在線閱讀,更多相關《OPC UA信息模型最佳實踐.pdf(11頁珍藏版)》請在三個皮匠報告上搜索。
1、June 19th-23rd,2023OPC Day InternationalDr.Wolfgang MahnkeSenior Consultant/Chair of OPC F Harmonization WGwolfgang.mahnkeunified-June 19th-23rd,2023OPC Day InternationalContent of this presentation is based on UA Modelling Best PracticeWhitepaper created in subgroup of Harmonization WGVersions Init
2、ial version 1.00 released 2020-07-21 Current version 1.01.00 released 2023-01-16Whitepaper can be downloaded from OPC F web page 2June 19th-23rd,2023OPC Day InternationalBasics of information modelling How to use OPC UA Modelling Concepts How to use existing Companion Specifications Naming Conventio
3、ns How to return application-specific statuses in Methods Rules for backward compatibility of Information Models How to model configuration changes affecting the AddressSpaceCompanion Specifications How to create a Companion Specification How to extend an existing Companion Specification How to defi
4、ne StatusCodes in Companion Specifications Handling NodeSet-Files for Dictionary References How to define Conformance Units and Profiles3Focus todayJune 19th-23rd,2023OPC Day International0:Objects2:DeviceSetMyDeviceMyMeasurement0:EngineeringUnitsCalibrate0:Objects2:DeviceSetMyDeviceMyDeviceType2:De
5、viceTypeMyMeasurement0:EngineeringUnitsMyMeasurement0:EngineeringUnitsCalibrateCalibrate0:Objects2:DeviceSetMyDeviceMyDeviceType0:AnalogUnitType0:EngineeringUnits2:DeviceTypeMyMeasurement0:EngineeringUnitsMyMeasurement0:EngineeringUnitsCalibrateCalibrate0:Objects2:DeviceSetMyDeviceMyDeviceType0:Anal
6、ogUnitType0:EngineeringUnits2:DeviceTypeMyMeasurement0:EngineeringUnitsMyMeasurement0:EngineeringUnitsCalibrateCalibrateCalibrationEventTypeGeneratesEvent4Objects organize AddressSpaceVariables contain ValuesMethods can be calledObjectTypes define semantic and structure of ObjectsInheritance of Type
7、sVariableTypes similar to ObjectTypesEventTypes and ReferencesNot shown:DataTypes and ReferenceTypesJune 19th-23rd,2023OPC Day InternationalWhere to derive from?Consider not only base specification but also Companion Specifications.Reuse is good!Use BaseObjectType if nothing more appropriate applies
8、.Abstract or concrete?You may define abstract supertypes in your hierarchy you need concrete types to create instancesComposition vs inheritance Avoid deep type hierarchies,use composition instead.Subtypes only to refine main characteristics.Composition to use common aspects across the type hierarch
9、y,for example for locking.Grouping of substructures Use grouping Objects to avoid having a flat list of too many subcomponents.Group components together that belong together to simplify usage.Interfaces or AddIns?Both can be used for composition,Interfaces only for simple constructs(has limitations)
10、Optional vs Mandatory Trade-off between Client needs and available information of a Server.Avoid mandatory variable with default value,use optional variable instead of.5June 19th-23rd,2023OPC Day InternationalIssue:Modelling of various data points,e.g.IPConfig with IPAddress,SubnetMask and DefaultGa
11、tewayIndividual Variables Pro:Individual access Con:No consistent access,read with potential different time stamps,write may only be partial successfulStructured DataType and one Variable Pro:Consistent reading and writing of data,all or nothing Con:No individual accessStructured DataType and Variab
12、le with subvariables Pro:Individual access and consistent access possible(selected by client)More Nodes in the AddressSpaceMethods Pro:Consistent access Con:No subscriptions possible Should only be used if application logic is involvedEvents Pro:Consistent data at a server-defined time,client can se
13、lect the data it is interested Con:Only for reading In case of IPConfig probably not the right choice6IPConfigurationPropertyTypeIPAddressPropertyTypeSubnetMaskPropertyTypeDefaultGatewayIPConfigurationBaseDataVariableTypeIPConfigIPConfigDataTypeIPAddressString,SubnetMaskString,DefaultGateway StringA
14、ttributeDataType=IPConfigDataTypeIPConfigurationBaseDataVariableTypeIPAddressBaseDataVariableTypeSubnetMaskBaseDataVariableTypeDefaultGatewayBaseDataVariableTypeIPConfigAttributeDataType=IPConfigDataTypeIPConfigurationGetIPConfigSetIPConfigIPConfigurationChangeEventTypePropertyTypeIPAddressPropertyT
15、ypeSubnetMaskPropertyTypeDefaultGatewayJune 19th-23rd,2023OPC Day InternationalGeneral(for BrowseNames,Structure fields and Enum values)Use PascalCase(e.g.PortMacAddress)Use letters,avoid special characters if needed adjusted SymbolicName in NodeSet for code generation Use each BrowseName for TypeDe
16、finitions(Object-,Variable-,and DataType)only once per NamespaceObjectTypes Type,for example ServerType,BaseEventTypeVariableTypes Type,for example PropertyType Use VariableType if is used in other TypeDefinitions,e.g.BaseDataVariableType(in addition to the BaseDataType)DataTypes Structure:DataType,
17、for example TimeZoneDataType Enums:or Enum,for example ServerState Built-in(only defined in base spec):,for example Boolean,String Simple:Same as bult-in DataTypes,for example Image,UtcTimeReferenceTypes No prefix or suffix,should describe the direction,for example HasComponent,Aggregates,HasChild7J
18、une 19th-23rd,2023OPC Day InternationalReuse existing CS increases interoperability on information model layerOnline reference helps finding appropriate CSsCommon Models include OPC 10000-100 Devices OPC 10000-110 Asset Management Basics OPC 10000-200 Industrial Automation OPC 10031-4 ISA-95 Job Con
19、trol OPC 30050 PackML OPC 40001 Machinery(multiple parts)Common Models typically define some building blocks that can be used Not all or nothing but you can choose what you want to use8June 19th-23rd,2023OPC Day International91:ReusedType1:Feature 1Initial VersionUpdated Version2:MyObjectType2:My Fe
20、ature 11:ReusedType1:Feature 12:MyObjectType2:My Feature 11:ReusedSubType1:Feature 2InheritanceExtended by subtypingWhen base adds subtypes the extension cannot be used1:ReusedType1:Feature 1Initial VersionUpdated Version2:MyObjectType2:My Feature 11:ReusedType1:Feature 11:ReusedSubType1:Feature 21:
21、ReusedType2:Base1:Feature 12:MyObjectType2:My Feature 11:ReusedType2:Base1:Feature 1CompositionExtended by compositionInstances can use new extension of baseRecommendation:Use composition if applicableJune 19th-23rd,2023OPC Day International10General Idea:Old Client works with new Server and new Cli
22、ent with old ServerSome rules(not complete list)Add mandatory Components to existing Types Add optional Components to existing Types Add new values for existing Enum DataType Define additional defaults for MultiStateVariables Change fields of structured DataTypes Create subtypes with additional fiel
23、ds Change signature of a Method Define a new Method(optional or on subtype)Strategies for breaking changes Avoid them!Create a new Namespace(new Model)Create new Types in existing NamespaceJune 19th-23rd,2023OPC Day InternationalWhitepaper freely available for Best Practice Information Modelling Use
24、ful for everybody doing OPC UA Information Modelling In addition specific topics for creators of Companion SpecificationsContains information on How to create an OPC UA based Information Model How to maintain an OPC UA based Information ModelDownload and read if you do OPC UA based Information Models11Download-Link:https:/opcfoundation.org/developer-tools/documents/view/312