index.rst 8.0 KB

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