OPC Unified Architecture
Content 1. Motivation 2. An Overview of Distributed Software Architecture Approaches 2.1 Pro & Contra Middleware 2.2 Message-Based Architectures 2.3 Service-Based Architectures 2.4 Subscribe-Based Architectures 2.5 Component-Based Architectures 3. Inter-Process-Communication (IPC) in Unix 4. Example: MPI 5. Example: Web Services 6. Example: OPC UA 7. Critical Sections and Deadlocks 8. Example: DDS 9. Example: OSGi 10. Redundancy and Consistency 11. MultiCore Programming and Synchronous Languages
Introduction Successor of the OPC protocol will be standardized as IEC 62541 first version in 2006 current version in 2009
Introduction Message Serialization: XML or binary Message Security: Web Service Security or UA binary security Message Transport: TCP or HTTP/SOAP OPC UA Client OPC UA Server OPC UA Client SDK OPC UA Server SDK OPC UA Stack Message Serialization Message Security Message Transport OPC UA Stack Message Serialization Message Security Message Transport
Introduction OPC UA has two main components: 1. the OPC UA information model 2. the API to access data, events, and the information model The information model allows for an explicit modeling of the data syntax and its semantics OPC UA API OPC UA Information Model OPC UA Server
Information Model The information model comprises data, data types, references, etc., i.e. the information model comprises instances and the meta layer (inner meta layers) The data type information and the data items themselves are accessed via the same API, i.e. the APIs support reflection OPC UA Information Model Meta-Model Outer Meta Layers Data types and the data themselves are modeled explicitly using the OPC UA information model meta-model (outer meta layers) Type Levels Inner Meta Layers Instance Level
Information Model The OPC UA information model meta-model comprises 1. nodes, 2. their attributes, and 3. references Node Attributes Node Attributes Nodes have the following attributes NodeID: unique ID in the address space NodeClass: e.g. object, method, type,... BrowseName: non localized name DisplayName: localized name... Node Attributes Reference
Information Model The OPC UA information model meta-model comprises 1. nodes, 2. their attributes, and 3. references References comprise source NodeID target NodeID direction of the reference Semantic of the reference defined as ReferenceType, ReferenceTypes are nodes Node Attributes Node Attributes Node Attributes Reference Additional attributes of ReferenceTypes: Symmetric: same meaning in both directions? InverseName: semantic of backward direction IsAbstract: can not be used directly
Information Model The following ReferenceTypes are defined by OPC UA and can be extended: References HierarchicalReferences NonHierarchicalReferences HasChild Organize HasTypeDefinition Aggregates HasComponent HasSubtype HasSubtype reference ReferenceType
Information Model NodeClasses: Variable: Stores a value (data or meta information) Clients can read, write and subscribe to variables Additional attributes: Value DataType: NodeID of the type of the value ValueRank: Array?... Method: Represent method calls; methods calls are defined by their input and output arguments, these arguments are defined by variables (called properties here) beneath the method Object: Objects structure the OPC UA server address space; objects comprise objects, variables, and methods Additional attributes: EventNotifier: Objects can generate events
Information Model NodeClasses: ObjectType: ObjectTypes type objects, ObjectTypes can use inheritance ObjectTypes can be simple: Sensor DisplayName "Sensor" NodeClass = ObjectType Sensor42 DisplayName "Sensor42" NodeClass = Object I/O Sensor DisplayName "I/O Sensor" NodeClass = ObjectType HasType Reference HasSubtype Reference
Information Model Types of nodes can also be complex: Sensor DisplayName "Sensor" NodeClass = ObjectType Sensor42 DisplayName "Sensor42" NodeClass = Object Temperature DisplayName "Temperature" NodeClass = Variable Temperature DisplayName "Temperature" NodeClass = Variable Calibrate DisplayName "Calibrate" NodeClass = Method Calibrate DisplayName "Calibrate" NodeClass = Method Provider DisplayName "Provider" NodeClass = Object Address DisplayName "Address" NodeClass = Variable Provider DisplayName "Provider" NodeClass = Object Address DisplayName "Address" NodeClass = Variable HasType Reference HasComponent Reference
Information Model NodeClasses: VariableType: VariableTypes behave as ObjectType but do not allow objects or method beneath the type definition
OPC UA API The OPC UA API is defined language-independent Each method is defined by a request (defined by a set of parameters) and a response (defined by a set of parameters) The general procedure is as follows: 1. find servers 2. establish connection 3. find information in the address space 4. access information - read/write/subscribe to data and/or meta information - call methods - access historical data - modify structure of the address space 5. close connection
OPC UA API The OPC UA API is defined language-independent Each method is defined by a request (defined by a set of parameters) and a response (defined by a set of parameters)
1. Find Server API OPC UA API RegisterServer: register specific server at the discovery server FindServer: find specific server at the discovery server GetEndpoints: get connection information from specific server
FindServer-Methode <ua:server> <ua:applicationuri>urn:somehost:myserver</ua:applicationuri> <ua:applicationtype>server_1</ua:applicationtype> <ua:discoveryurls> <ua:string>http://somehost:51211/myserver/discovery</ua:string> </ua:discoveryurls> </ua:server>
GetEndpoint-Methode <EndpointDescription> <ua:endpointurl>http://somehost:51211/myserver</ua:endpointurl> <ua:server> <ua:applicationuri>urn:somehost:myserver</ua:applicationuri> <ua:applicationtype>server_1</ua:applicationtype> <ua:discoveryurls> <ua:string>http://somehost:51211/myserver/discovery</ua:string> </ua:discoveryurls> </ua:server> <ua:servercertificate>...</ua:servercertificate> <ua:securitymode>signandencrypt_3</ua:securitymode> <ua:securitypolicyuri>http://opcfoundation.org/ua/ SecurityPolicy#Basic128Rsa15</ua:SecurityPolicyUri> <ua:useridentitytokens /> <TransportProfileUri>http://opcfoundation.org/UA/profiles/ transport/wsxml</transportprofileuri> <ua:securitylevel>1</ua:securitylevel> </EndpointDescription>
2. Establish Connection OpenSecureChannel: open secure channel OPC UA Stack OPC UA API Message Serialization Message Security Message Transport CreateSession: creates a session between two applications ActivateSession: activates channel, assigns secure channel
OPC UA API 3. Find Information in the Address Space Browse: get description including all references for one or several specific NodeIDs TranslateBrowsePathToNodeIds: pathname-like node description is translated to NodeIDs
OPC UA API 4. Access Information Read: reads values of NodeIDs Write: writes values of NodeIDs Call: Calls a method HistoryRead: Reads historic data
OPC UA API 4. Access Information Subscriptions are skipped here...
OPC UA API 4. Modify Information in the Address Space AddNode: creates a new node, parent node and type must be provided AddReference: add reference between two nodes DeleteNode: removes a node DeleteReference: removes a reference
5. Close Connection CloseSecureChannel: close secure channel CloseSession OPC UA Stack OPC UA API Message Serialization Message Security Message Transport
Beispiel Grundstruktur einer SOAP- Nachricht <v:envelope xmlns:i="http://opcfoundation.org/ua/2008/02/types.xsd" xmlns:d="http://www.w3.org/2005/08/addressing" xmlns:v="http:// www.w3.org/2003/05/soap-envelope"> <v:header> <d:action> http://opcfoundation.org/ua/2008/02/services.wsdl/[methodenname] </d:action> </v:header> <v:body> <! hier kommen die Daten rein --> </v:body> </v:envelope>
Beispiel Response <?xml version="1.0"?> <s:envelope xmlns:s="http://www.w3.org/2003/05/soap- envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:header> <a:action s:mustunderstand="1">http://opcfoundation.org/ua/2008/02/services.wsdl/publishresponse</a:action> </s:header> <s:body> <PublishResponse xmlns="http://opcfoundation.org/ua/2008/02/types.xsd" xmlns:i="http://www.w3.org/2001/xmlschema- instance"> <ResponseHeader> <Timestamp>2011-12- 19T09:33:16.359Z</Timestamp> <RequestHandle>0</RequestHandle> <ServiceResult> </ServiceResult> <ServiceDiagnostics i:nil="true"/> <StringTable/> <AdditionalHeader i:nil="true"/> </ResponseHeader> <SubscriptionId>2</SubscriptionId> <AvailableSequenceNumbers> <UInt32>194</UInt32> <UInt32>195</UInt32> <UInt32>196</UInt32> <UInt32>197</UInt32> <UInt32>198</UInt32> <UInt32>199</UInt32> <UInt32>200</UInt32> <UInt32>201</UInt32> <UInt32>202</UInt32> </AvailableSequenceNumbers> <MoreNotifications>false</MoreNotifications> <NotificationMessage> <SequenceNumber>202</SequenceNumber> <PublishTime>2011-12- 19T09:33:16.359Z</PublishTime> <NotificationData> <ExtensionObject> <TypeId> <Identifier>i=810</Identifier> </TypeId> <Body> <DataChangeNotification> <MonitoredItems> <MonitoredItemNotification> <ClientHandle>15</ClientHandle> <Float>249.79657</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds>
Beispiel Response <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>26</ClientHandle> <Float>411.959625</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>27</ClientHandle> <Float>237.4888</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>13</ClientHandle> <Float>365.875</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp>
Beispiel Response </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>25</ClientHandle> <Float>237.845108</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>24</ClientHandle> <Float>411.651276</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>10</ClientHandle> <Float>- 282.232483</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> <MonitoredItemNotification> <ClientHandle>9</ClientHandle>
Beispiel Response <ClientHandle>9</ClientHandle> <Float>188.494675</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>7</ClientHandle> <Float>142.31485</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>0</ClientHandle> <Float>49.99325</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>3</ClientHandle> <Float>1.0514977</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp>
Beispiel Response <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>23</ClientHandle> <Float>235.833267</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp> 0001-01- 01 T00:00:00 </ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>6</ClientHandle> <Float>0.7545927</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>22</ClientHandle> <Float>410.21875</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp>
Beispiel Response </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>1</ClientHandle> <Float>1.551388</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>12</ClientHandle> <Float>- 126.348686</Float> <StatusCode> <SourceTimestamp> 0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification><MonitoredItemNotification> <ClientHandle>4</ClientHandle> <Float>0.388971239</Float> <StatusCode> <SourceTimestamp>0001-01- 01T00:00:00</SourceTimestamp> <SourcePicoseconds>0</SourcePicoseconds> <ServerTimestamp>0001-01- 01T00:00:00</ServerTimestamp> </MonitoredItemNotification> </MonitoredItems> <DiagnosticInfos/> </DataChangeNotification> </Body> Sonntag, 26. </ExtensionObject> Mai 13
Beispiel Response </Body> </ExtensionObject> </NotificationData> </NotificationMessage> <Results/> <DiagnosticInfos/> </PublishResponse> </s:body> </s:envelope>
Beispiel The same response as a binary message <?xml version="1.0" encoding="utf- 8"?> <s:envelope xmlns:s="http://www.w3.org/2003/05/soap- envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:header> <a:action s:mustunderstand="1">http://opcfoundation.org/ua/2008/02/services.wsdl/publishresponse</a:action> </s:header> <s:body> 485454502f312e3120323030204f4b0d0a436f6e74656e742d4c656e6774683a20313636340d0a436f6e74656e742d547970653a206170706c69636174696f6e2f736f61702b786d6c3b20636861727365743d7574662d 380d0a5365727665723a204d6963726f736f66742d485454504150492f312e300d0a446174653a204d6f6e2c2031392044656320323031312030393a34303a333620474d540d0a0d0a3c733a456e76656c6f706520786d 6c6e733a733d22687474703a2f2f7777772e77332e6f72672f323030332f3035f736f61702d656e76656c6f70652220786d6c6e733a613d22687474703a2f2f7777772e77332e6f72672f323030352f30382f616464726 57373696e67223e3c733a4865616465723e3c613a416374696f6e20733a6d757374556e6465727374616e643d2231223e687474703a2f2f6f7063666f756e646174696f6e2e6f72672f55412f323030382f30322f53657 276696365732e7773646c2f52656164526573706f6e73653c2f613a416374696f6e3e3c2f733a4865616465723e3c733a426f64793e3c52656164526573706f6e736520786d6c6e733d22687474703a2f2f6f7063666f7 56e646174696f6e2e6f72672f55412f323030382f30322f54797065732e7873642220786d6c6e733a693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e6365223e3 c526573706f6e73654865616465723e3c54696d657374616d703e323031312d31322d31395430393a34303a33362e3438345a3c2f54696d657374616d703e3c5265717565737448616e646c653e303c2f5265717565737 448616e646c653e3c53657276696365526573756c743e3c436f64653e303c2f436f64653e3c2f53657276696365526573756c743e3c53657276696365446961676e6f737469637320693a6e696c3d2274727565222f3e3 c537472696e675461626c652f3e3c4164646974696f6e616c48656164657220693a6e696c3d2274727565222f3e3c2f526573706f6e73654865616465723e3c526573756c74733e3c4461746156616c75653e3c56616c7 5653e3c56616c75653e3c4e6f646549643e3c4964656e7469666965723e6e733d323b733d303a4c4d463c2f4964656e7469666965723e3c2f4e6f646549643e3c2f56616c75653e3c2f56616c75653e3c5374617475734 36f64653e3c436f64653e303c2f436f64653e3c2f537461747573436f64653e3c536f7572636554696d657374616d703e303030312d30312d30315430303a30303a30303c2f536f7572636554696d657374616d703e3c5 36f757263655069636f7365636f6e64733e303c2f536f757263655069636f7365636f6e64733e3c53657276657254696d657374616d703e303030312d30312d30315430303a30303a30303c2f53657276657254696d657 374616d703e3c5365727665725069636f7365636f6e64733e303c2f5365727665725069636f7365636f6e64733e3c2f 4461746156616c75653e3c4461746156616c75653e3c56616c75653e3c56616c75653e3c496e74 33323e313c2f496e7433323e3c2f56616c75653e3c2f56616c75653e3c537461747573436f64653e3c436f6465 </s:body> </s:envelope>
Beispiel TCP Transport