mainpage.dox 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. \mainpage Open62541 Developer Documentation
  3. <a href="http://en.wikipedia.org/wiki/OPC_Unified_Architecture">OPC UA</a> (short for OPC Unified
  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 <em>from the inside out</em>, 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 </em>open62541</em> implementation of the
  13. standard.
  14. <h2>OPC UA, a collection of services</h2>
  15. In OPC-UA, all communication is based on service calls, each consisting of a request and a response
  16. message. Be careful to note the difference between services and methods. Services are pre-defined in
  17. the standard and cannot be changed. But you can use the <em>Call</em> service to invoke user-defined
  18. methods on the server.
  19. For completeness, the following tables contain all services defined in the standard. Do not bother
  20. with their details yet. We will introduce the different services later in the text. In open62541,
  21. each service is implemented in a single function. See the \ref services section for details.
  22. <b>Establishing communication</b>
  23. <table>
  24. <tr> <th>Discovery Service Set </th><th>SecureChannel Service Set </th><th>Session Service Set </th></tr>
  25. <tr> <td>FindServers </td><td>OpenSecureChannel </td><td>CreateSession </td></tr>
  26. <tr> <td>GetEndpoints </td><td>CloseSecureChannel </td><td>ActivateSession </td></tr>
  27. <tr> <td>RegisterServer </td><td></td><td>CloseSession </td></tr>
  28. <tr> <td></td><td></td><td>Cancel </td></tr>
  29. </table>
  30. <b>Interaction with the information model</b>
  31. <table>
  32. <tr> <th>NodeManagement Service Set </th><th>View Service Set </th><th>Query Service Set </th><th>Attribute Service Set </th><th>Method Service Set </th></tr>
  33. <tr> <td>AddNodes </td><td>Browse </td><td>QueryFirst </td><td>Read </td><td>Call </td></tr>
  34. <tr> <td>AddReferences </td><td>BrowseNext </td><td>QueryNext </td><td>HistoryRead </td><td></td></tr>
  35. <tr> <td>DeleteNodes </td><td>TranslateBrowsePathsToNodeIds </td><td></td><td>Write </td><td></td></tr>
  36. <tr> <td>DeleteReferences </td><td>RegisterNodes </td><td></td><td>HistoryUpdate </td><td></td></tr>
  37. <tr> <td></td><td>UnregisterNodes </td><td></td><td></td><td></td></tr>
  38. </table>
  39. <b>Notifications</b>
  40. <table>
  41. <tr> <th>MonitoredItem Service Set </th><th>Subscription Service Set </th></tr>
  42. <tr> <td>CreateMonitoredItems </td><td>CreateSubscription </td></tr>
  43. <tr> <td>ModifyMonitoredItems </td><td>ModifySubscription </td></tr>
  44. <tr> <td>SetMonitoringMode </td><td>SetPublishingMode </td></tr>
  45. <tr> <td>SetTriggering </td><td>Publish </td></tr>
  46. <tr> <td>DeleteMonitoredItems </td><td>Republish </td></tr>
  47. <tr> <td></td><td>TransferSubscription </td></tr>
  48. <tr> <td></td><td>DeleteSubscription </td></tr>
  49. </table>
  50. <h2>OPC UA, a web of nodes</h2>
  51. The information model in each OPC UA server is a web of interconnected nodes. There are eight
  52. different types of nodes. Depending on its type, every node contains different attributes. Some
  53. attributes, such as the <em>NodeId</em> (unique identifier) and the <em>BrowseName</em>, are
  54. contained in all node types.
  55. <table>
  56. <tr> <td>ReferenceTypeNode</td> <td>MethodNode</td> </tr>
  57. <tr> <td>DataTypeNode</td> <td>ObjectTypeNode</td> </tr>
  58. <tr> <td>VariableTypeNode</td> <td>ObjectNode</td> </tr>
  59. <tr> <td>VariableNode</td> <td>ViewNode</td> </tr>
  60. </table>
  61. Nodes are interconnected by directed reference-triples of the form <dfn>(nodeid, referencetype,
  62. target-nodeid)</dfn>. Therefore an OPC UA information model is easiest imagined as a <em>web of nodes</em>.
  63. Reference types can be
  64. - standard- or user-defined and
  65. - either non-hierarchical (e.g., indicating the type of a variable-node) or hierarchical (e.g., indicating a parent-child relationship).
  66. <h2>OPC UA, a protocol</h2>
  67. The OPC UA protocol (both binary and XML-based) is based on 25 <em>built-in</em> datatypes. In
  68. open62541, these 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 sizes (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. The entire OPC UA protocol revolves around the exchange of these request and response
  85. messages. Their exact definitions can be looked up here:
  86. https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml. In open62541, we autogenerate the
  87. C-structs to handle the standard-defined structures automatically. See ua_types_generated.h for
  88. comparison.
  89. */