index.rst 8.0 KB

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