This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/plc4x-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new a8c2efd  Site checkin for project PLC4X: Jenkins Tools
a8c2efd is described below

commit a8c2efdd4cb55bb1cb88717ad5ee76ad1f1ea521
Author: jenkins <[email protected]>
AuthorDate: Fri May 8 10:09:33 2020 +0000

    Site checkin for project PLC4X: Jenkins Tools
---
 users/protocols/opc-ua.html | 149 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 146 insertions(+), 3 deletions(-)

diff --git a/users/protocols/opc-ua.html b/users/protocols/opc-ua.html
index 3dd4e8d..73c7153 100644
--- a/users/protocols/opc-ua.html
+++ b/users/protocols/opc-ua.html
@@ -295,7 +295,11 @@
 <td class="tableblock halign-left valign-top"><p class="tableblock">Maven 
Dependency</p></td>
 <td class="tableblock halign-left valign-top" colspan="2"><div 
class="content"><div class="listingblock">
 <div class="content">
-<pre>to be updated (tbu)</pre>
+<pre>&lt;dependency&gt;
+  &lt;groupId&gt;org.apache.plc4x&lt;/groupId&gt;
+  &lt;artifactId&gt;plc4j-driver-opcua&lt;/artifactId&gt;
+  &lt;version&gt;{current-last-released-version}&lt;/version&gt;
+&lt;/dependency&gt;</pre>
 </div>
 </div></div></td>
 </tr>
@@ -319,19 +323,155 @@
 <td class="tableblock halign-left valign-top" colspan="3"><p 
class="tableblock">Supported Operations</p></td>
 </tr>
 <tr>
-<td class="tableblock halign-left valign-top"></td>
+<td class="tableblock halign-left valign-top"><p 
class="tableblock">read</p></td>
 <td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
-<p><code>tbu</code></p>
+<p>The read interface allows to read the full range of supported PLC4X types 
in single and bulk requests</p>
+</div></div></td>
+<td class="tableblock halign-left valign-top"><div class="content"></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p 
class="tableblock">write</p></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>The write interface is capable of writting the overhanded base type. At the 
moment there are some issues with unsigned
+types because they represent the wrong datatype to write which will conflict 
with the corresponding target variable type.</p>
+</div></div></td>
+<td class="tableblock halign-left valign-top"><div class="content"></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p 
class="tableblock">subscribe</p></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>Subscriptions are possible with events on event- and cyclic-basis</p>
 </div></div></td>
 <td class="tableblock halign-left valign-top"><div class="content"></div></td>
 </tr>
 <tr>
 <td class="tableblock halign-left valign-top" colspan="3"><p 
class="tableblock">Options</p></td>
 </tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p 
class="tableblock">Key</p></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>Type [default]</p>
+</div></div></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>Description</p>
+</div></div></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p 
class="tableblock"><code>discovery</code></p></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>boolean [<code>true</code>]</p>
+</div></div></td>
+<td class="tableblock halign-left valign-top"><div class="content"><div 
class="paragraph">
+<p>Controls the feature of the discovery endpoint of an OPC UA server which 
every server will propagate over an '&lt;address&gt;/discovery' endpoint. The 
most common issue here ist that the most servers are not correct configured and 
propagate the wrong external IP- or URL-addresses. If that is the case you can 
disable the discovery by configuring it with an 'false' value.</p>
+</div></div></td>
+</tr>
 </tbody>
 </table>
 </div>
 <div class="sect2">
+<h3 id="address_format">Address Format</h3>
+<div class="paragraph">
+<p>To read, write and subscribe data to a PLC4X device, the OPC UA driver uses 
the OPC variable declaration string.
+It includes the namespace(ns) of the hierarchy tree followed by the type of 
identifier string(s), numeric(i), binary(b) or guid(g) and its address.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>ns={namespace-index};[s|i|g|b]={Identifier}</pre>
+</div>
+</div>
+<div class="sect3">
+<h4 id="example_of_a_valid_opc_ua_address">Example of a valid OPC UA 
address:</h4>
+<div class="paragraph">
+<p>String address:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>ns=2;s=HelloWorld/ScalarTypes/Boolean</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Numeric address</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>ns=1;i=1337</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>GUID address:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a</pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="example_operations_with_plc4j">Example operations with PLC4J</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="read_value_of_an_plc_value">Read value of an PLC value</h3>
+<div class="listingblock">
+<div class="content">
+<pre>String BOOL_IDENTIFIER = "ns=2;s=HelloWorld/ScalarTypes/Boolean"; // 
String in opc ua format to describe target value
+String fieldName = "Bool"; // local unique key for the requested variable
+String connectionString = "opcua:tcp://127.0.0.1:12686/milo?discovery=false"; 
// Address of the opc ua server
+
+PlcConnection opcuaReadConnection =  new 
PlcDriverManager().getConnection(connectionString); // build connection
+PlcReadRequest.Builder builder = opcuaReadConnection.readRequestBuilder();
+builder.addItem(fieldName, BOOL_IDENTIFIER);
+PlcReadRequest request = builder.build();
+PlcReadResponse response = opcuaConnection.read(request).get();
+
+if(response.getResponseCode(fieldName) == PlcResponseCode.OK){
+    Boolean plcBooleanValue = response.getBoolean();
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="write_value_of_an_plc_value">Write value of an PLC value</h3>
+<div class="listingblock">
+<div class="content">
+<pre>String BOOL_IDENTIFIER = "ns=2;s=HelloWorld/ScalarTypes/Boolean"; // 
String in opc ua format to describe target value
+String fieldName = "Bool"; // local unique key for the requested variable
+String connectionString = "opcua:tcp://127.0.0.1:12686/milo?discovery=false"; 
// Address of the opc ua server
+
+PlcConnection opcuaReadConnection =  new 
PlcDriverManager().getConnection(connectionString); // build connection
+PlcWriteRequest.Builder wBuilder = opcuaConnection.writeRequestBuilder();
+wBuilder.addItem(fieldName, BOOL_IDENTIFIER, true);
+PlcWriteRequest writeRequest = wBuilder.build();
+PlcWriteResponse wResponse = opcuaConnection.write(writeRequest).get();
+
+if(wResponse.getResponseCode(fieldName) == PlcResponseCode.OK){
+    // Todo ...
+}</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="subscribe_plc_events">Subscribe PLC events</h3>
+<div class="listingblock">
+<div class="content">
+<pre>String fieldAddress = "ns=2;s=HelloWorld/ScalarTypes/String"; // String 
in opc ua format to describe target value
+String fieldName = "field1"; // local unique key for the requested variable
+String connectionString = "opcua:tcp://127.0.0.1:12686/milo?discovery=false"; 
// Address of the opc ua server
+
+PlcConnection opcuaSubConnection =  new 
PlcDriverManager().getConnection(connectionString); // build connection
+PlcSubscriptionRequest.Builder subBuilder =  
opcuaSubConnection.subscriptionRequestBuilder(); // get builder
+subBuilder.addChangeOfStateField(fieldName, fieldAddress); // add the tuple of 
fieldName and Address to the request
+PlcSubscriptionRequest subReq = subBuilder.build(); // build the request
+PlcSubscriptionResponse subResp = subReq.execute().get(); // execute the build 
up of a subscription
+Consumer&lt;PlcSubscriptionEvent&gt; consumer = plcSubscriptionEvent -&gt; 
System.out.println("Your Information"); // create a consumer function for the 
subscription
+PlcConsumerRegistration registration = 
subResp.getSubscriptionHandle(fieldName).register(consumer); // add the 
consumer to the created subscription  of the request and access it over the  
SubscriptionHandler
+registration.unregister(); // Unsubscribe</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
 <h3 id="more_details_on_opc_ua">More details on OPC UA</h3>
 <div class="paragraph">
 <p><a href="https://opcfoundation.org/about/opc-technologies/opc-ua/";>OPC 
UA</a>
@@ -363,6 +503,9 @@ The OPC Unified Architecture (UA), released in 2008, is a 
platform independent s
 <div class="sect2">
 <h3 id="more_details">More details</h3>
 <div class="paragraph">
+<p>At the moment, the underlying stack to accomplish the OPC UA functionallity 
is the eclipse project milo which is a powerfull server-side and client-side 
driver to enable the OPC UA capabilties. The Milo server SDK is also used to 
implement the bridge server functionallity inside of the sandbox.</p>
+</div>
+<div class="paragraph">
 <p><a href="https://projects.eclipse.org/projects/iot.milo";>Eclipse Milo - 
Project</a></p>
 </div>
 <table class="tableblock frame-all grid-all stretch">

Reply via email to