mainpage.dox 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. \mainpage Open62541 Developer Documentation
  3. <a href="http://en.wikipedia.org/wiki/OPC_Unified_Architecture">OPC UA</a> (short for OPC Universal
  4. Architecture) is a protocol for industrial communication and has been standardized in the IEC62541.
  5. At its core, OPC UA defines a set of services to interact with a server-side object-oriented
  6. information model. Besides the service-calls initiated by the client, push-notification of remote
  7. events (such as data changes) can be negotiated with the server. The client/server interaction is
  8. mapped either to a binary encoding and TCP-based transmission or to SOAP-based webservices. As of
  9. late, OPC UA is marketed as the one standard for non-realtime industrial communication.
  10. We believe that it is best to understand OPC UA *from the inside out*, building upon conceptually
  11. simple first principles. After establishing a first understanding, we go on explaining how these
  12. principles are realized in detail. Examples are given based on the *open62541* implementation of the
  13. standard.
  14. OPC UA, a collection of services
  15. --------------------------------
  16. In OPC-UA, all communication is based on service calls, each consisting of a request and a response
  17. message. Be careful to note the difference between services and methods. Services are pre-defined in
  18. the standard and cannot be changed. But you can use the *Call* service to invoke user-defined
  19. methods on the server.
  20. For completeness, the following tables contain all services defined in the standard. Do not bother
  21. with their details, yet. We will introduce the different services later in the text. In open62541,
  22. each service is implemented in a single function. See the \ref services section for details.
  23. __Establishing communication__
  24. | Discovery Service Set | SecureChannel Service Set | Session Service Set |
  25. |-----------------------|---------------------------|---------------------|
  26. | FindServers | OpenSecureChannel | CreateSession |
  27. | GetEndpoints | CloseSecureChannel | ActivateSession |
  28. | RegisterServer | | CloseSession |
  29. | | | Cancel |
  30. __Interaction with the information model__
  31. | NodeManagement Service Set | View Service Set | Query Service Set | Attribute Service Set | Method Service Set |
  32. |----------------------------|--------------------------------|-------------------|-----------------------|--------------------|
  33. | AddNodes | Browse | QueryFirst | Read | Call |
  34. | AddReferences | BrowseNext | QueryNext | HistoryRead | |
  35. | DeleteNodes | TranslateBrowsePathsToNodeIds | | Write | |
  36. | DeleteReferences | RegisterNodes | | HistoryUpdate | |
  37. | | UnregisterNodes | | | |
  38. __Notifications__
  39. | MonitoredItem Service Set | Subscription Service Set |
  40. |---------------------------|--------------------------|
  41. | CreateMonitoredItems | CreateSubscription |
  42. | ModifyMonitoredItems | ModifySubscription |
  43. | SetMonitoringMode | SetPublishingMode |
  44. | SetTriggering | Publish |
  45. | DeleteMonitoredItems | Republish |
  46. | | TransferSubscription |
  47. | | DeleteSubscription |
  48. OPC UA, a web of nodes
  49. ----------------------
  50. The information model in each OPC UA server is a web of interconnected nodes. There are eight
  51. different types of nodes. Depending on its type, every node contains different attributes. Some
  52. attributes, such as the *NodeId* (unique identifier) and the *BrowseName*, are contained in all node
  53. types.
  54. <table>
  55. <tr> <td>ReferenceTypeNode</td> <td>MethodNode</td> </tr>
  56. <tr> <td>DataTypeNode</td> <td>ObjectTypeNode</td> </tr>
  57. <tr> <td>VariableTypeNode</td> <td>ObjectNode</td> </tr>
  58. <tr> <td>VariableNode</td> <td>ViewNode</td> </tr>
  59. </table>
  60. Nodes are interconnected by directed reference-triples of the form `(nodeid, referencetype,
  61. target-nodeid)`. Therefore an OPC UA information model is easiest imagined as a __web of nodes__.
  62. Reference types can be
  63. - standard- or user-defined and
  64. - either non-hierarchical (e.g., indicating the type of a variable-node) or hierarchical (e.g., indicating a parent-child relationship).
  65. OPC UA, a protocol
  66. ------------------
  67. The OPC UA protocol (both binary and XML-based) is based on 25 *built-in* datatypes. In open62541, these
  68. are defined in ua_types.h.
  69. <table>
  70. <tr> <td>Boolean</td> <td>Float</td> <td>StatusCode</td> </tr>
  71. <tr> <td>SByte</td> <td>Double</td> <td>QualifiedName</td> </tr>
  72. <tr> <td>Byte</td> <td>String</td> <td>LocalizedText</td> </tr>
  73. <tr> <td>Int16</td> <td>DateTime</td> <td>ExtensionObject</td> </tr>
  74. <tr> <td>UInt16</td> <td>Guid</td> <td>DataValue</td> </tr>
  75. <tr> <td>Int32</td> <td>ByteString</td> <td>Variant</td> </tr>
  76. <tr> <td>UInt32</td> <td>XmlElement</td> <td>DiagnosticInfo</td> </tr>
  77. <tr> <td>Int64</td> <td>NodeId</td> <td> </td> </tr>
  78. <tr> <td>UInt64</td> <td>ExpandedNodeId</td> <td> </td> </tr>
  79. </table>
  80. The builtin datatypes are combined to more complex structures. When the structure contains an array,
  81. then the size of the array is stored in an Int32 value just before the array itself. A size of -1
  82. indicates an undefined array. Positive size (and zero) have the usual semantics.
  83. Most importantly, every service has a request and a response message defined as such a data
  84. structure. Their exact definitions can be looked up here:
  85. https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml. In open62541, we autogenerate the
  86. C-structs to handle the standard-defined structures automatically. See ua_types_generated.h for
  87. comparison. The entire OPC UA protocol revolves around the exchange of these request and response messages.
  88. */