| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2017, 2018 fortiss GmbH |
| |
| This program and the accompanying materials are made available under the |
| terms of the Eclipse Public License 2.0 which is available at |
| http://www.eclipse.org/legal/epl-2.0. |
| |
| SPDX-License-Identifier: EPL-2.0 |
| |
| Contributors: |
| Stefan Profanter, Jose Cabral, Kirill Dorofeev |
| - initial API and implementation and/or initial documentation |
| --> |
| <html lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <title>OPC UA with IEC 61499 Tutorial</title> |
| <link rel="stylesheet" type="text/css" href="../help.css"> |
| </head> |
| <body> |
| <h1 id="topOfPage">OPC UA with IEC 61499 Tutorial</h1> |
| <p>This tutorial shows how you can use <a href="https://en.wikipedia.org/wiki/OPC_Unified_Architecture" target="_blank">OPC UA</a> in an IEC 61499 Application using available FBs. You should first complete the <a href="../../html/4diacIDE/use4diacLocally.html" target="_blank">First Steps in 4DIAC Tutorial</a> to get familiar with the 4diac IDE. FORTE uses the <a href="http://open62541.org/" target="_blank">open62541</a> OPC UA stack which is open source and can also be used in commercial projects free of charge.</p> |
| |
| <p>Tasks in this tutorial:</p> |
| <ol> |
| <li><a href="#build">Build FORTE with open62541 (Release: v0.3.0)</a></li> |
| <li><a href="#variables">Provide OPC UA variables to clients</a></li> |
| <li><a href="#methods">Offer an OPC UA method to be called by clients</a></li> |
| <li><a href="#client">Create an OPC UA client in an IEC 61499 Application</a></li> |
| <li><a href="#subscriptions">Create an OPC UA subscription from OPC UA Client to OPC UA Server in an IEC 61499 Application</a></li> |
| </ol> |
| |
| <p>Prerequisites:</p> |
| <ul> |
| <li>4DIAC-IDE</li> |
| </ul> |
| |
| <h2 id="build">Build FORTE with open62541</h2> |
| <p>OPC UA is not enabled by default in FORTE. To enable it, you need to build FORTE with the open62541 source code yourself.</p> |
| |
| <p class="attention"><span class="inlineTitle">Attention</span>: You need <a href="https://www.python.org/" target="_blank">python</a> installed on your computer in order to compile the OPCUA library.</p> |
| |
| <h3>Linux</h3> |
| <ol> |
| <li>Download the FORTE source from <a href="http://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git" target="_blank">http://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git</a>: |
| <div class="code">$ mkdir ~/4diac && cd "$_" |
| $ git clone -b develop https://git.eclipse.org/r/4diac/org.eclipse.4diac.forte forte |
| $ cd forte && mkdir build</div> |
| </li> |
| <li>Download the source for open62541 from <a href="https://github.com/open62541/open62541" target="_blank">https://github.com/open62541/open62541</a>: |
| <div class="code">$ cd ~/4diac |
| $ git clone https://github.com/open62541/open62541.git --branch=v0.3.0 open62541</div> |
| </li> |
| <li>Build open62541. If you are running the code on production devices we suggest setting the build type to <span class="specificText">Release</span>. |
| <div class="code">$ cd ~/4diac/open62541 && mkdir build && cd $_ |
| $ cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DUA_ENABLE_AMALGAMATION=ON .. |
| $ make -j</div> |
| </li> |
| <li>Set FORTE to include open62541. If you are running the code on production devices we suggesst setting the build type to <span class="specificText">Release</span>. |
| If you are using the 0.2 branch of open62541 make sure that you set the correct value for <span class="specificText">FORTE_COM_OPC_UA_VERSION=0.2</span> |
| <div class="code">$ cd ~/4diac/forte/build |
| $ cmake -DCMAKE_BUILD_TYPE=Debug -DFORTE_ARCHITECTURE=Posix -DFORTE_MODULE_CONVERT=ON \ |
| -DFORTE_COM_ETH=ON -DFORTE_MODULE_IEC61131=ON -DFORTE_COM_OPC_UA=ON \ |
| -DFORTE_COM_OPC_UA_INCLUDE_DIR=$HOME/4diac/open62541/build \ |
| -DFORTE_COM_OPC_UA_LIB_DIR=$HOME/4diac/open62541/build/bin \ |
| -DFORTE_COM_OPC_UA_LIB=libopen62541.so |
| $ make -j</div> |
| </li> |
| </ol> |
| |
| <h3>Windows with Visual Studio</h3> |
| <ol> |
| <li>Use a Git tool under Windows and download the FORTE source from <a href="http://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git" target="_blank">http://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git</a> and use the develop branch. The following steps show the commands for <a href="https://git-for-windows.github.io/" target="_blank">Git Bash</a>: |
| <div class="code">$ mkdir "$HOME/4diac" && cd "$HOME/4diac" |
| $ git clone https://github.com/open62541/open62541.git --branch=v0.3.0 open62541 |
| $ mkdir build && cd "build"</div> |
| </li> |
| <li>Use CMake to generate all the build files. Download and install: <a href="https://cmake.org/download/" target="_blank">https://cmake.org/download/</a> |
| </li> |
| <li>Open the <span class="folderLocation">$HOME/4diac/forte</span> folder in CMake, and set the output for the build binaries to the <span class="folderLocation">forte/build</span> |
| folder. |
| </li> |
| <li>Press <span class="button4diac">Configure</span> and select your Visual Studio Version. (Make sure you select your installed VS version. Otherwise CMake does not find the C/C++ compiler. Activate <span class="specificText">Use default native compilers</span></li> |
| <li>Set <span class="specificText">FORTE_ARCHITECTURE</span> to <span class="specificText">Win32</span>, <span class="specificText">FORTE_MODULE_CONVERT=ON</span>, <span class="specificText">FORTE_MODULE_IEC61131=ON</span>, and press two times on cofigure. All red entries should now be gone. |
| </li> |
| <li>Download the source for open62541 from <a href="https://github.com/open62541/open62541" target="_blank">https://github.com/open62541/open62541</a>. In Git Bash: |
| <div class="code">$ cd "$HOME/4diac" |
| $ git clone -b master https://github.com/open62541/open62541.git open62541 |
| $ cd open62541 && mkdir build</div> |
| </li> |
| <li>Build open62541. If you are running the code on production devices we suggest setting the build type to <span class="specificText">Release</span>. Open a new CMake window and open the <span class="folderLocation">$HOME/4diac/open62541</span> folder as source code directory, <span class="folderLocation">$HOME/4diac/open62541/build</span> as the binaries directory. |
| </li> |
| <li>Press <span class="button4diac">Configure</span> and select your Visual Studio Version. (Make sure you select your installed VS version. Otherwise CMake does not find the C/C++ compiler. Activate <span class="specificText">Use default native compilers</span></li> |
| <li>Activate <span class="specificText">BUILD_SHARED_LIBS</span> and <span class="specificText">UA_ENABLE_AMALGAMATION</span></li> |
| <li>Press <span class="button4diac">Configure</span>, then <span class="button4diac">Generate</span> and then <span class="button4diac">Open Project</span></li> |
| <li>Go to <span class="menu4diac">Build → Build Solution</span>. You may need to execute the command multiple times until all projects are build successfully. This will create the open62541 library under <span class="folderLocation">$HOME/4diac/open62541/build/bin/Release</span> and the amalgamated header file <span class="fileLocation">open62541.h</span> in <span class="folderLocation">$HOME/4diac/open62541/build/</span> |
| </li> |
| <li>Switch to the FORTE CMake window to include open62541. |
| <ul> |
| <li>FORTE_COM_OPC_UA=ON</li> |
| <li>FORTE_COM_OPC_UA_INCLUDE_DIR=C:\Users\USER\4diac\open62541\build</li> |
| <li>FORTE_COM_OPC_UA_LIB_DIR=C:\Users\USER\4diac\open62541\build\bin\Release</li> |
| </ul> |
| </li> |
| <li>Press <span class="button4diac">Configure</span> and make sure that <span class="specificText">FORTE_COM_OPC_UA_LIB</span> is set to <span class="fileLocation">open62541.dll</span></li> |
| <li>Press <span class="button4diac">Configure</span>, then <span class="button4diac">Generate</span> and then <span class="button4diac">Open Project</span></li> |
| <li>Go to <span class="menu4diac">Build → Build Solution</span>. You may need to execute the command multiple times until all projects are built successfully. This will create <span class="folderLocation">$HOME/4diac/forte/build/Debug/forte.exe</span></li> |
| <li>In the forte VS Project, Set the PATH variable to include the path to the open62541.dll. Go to properties of <span class="specificText">forte</span>, <span class="specificText">Configuration Properties | Debugging | Environment</span> and add <span class="specificText">PATH=C:\Users\USER\4diac\open62541\build\bin\Release;%PATH%</span> (Set the correct user path!) |
| </li> |
| </ol> |
| |
| |
| <h2 id="variables">OPC UA variables</h2> |
| |
| <h3 id="variables_flipflop">Flip-Flop Application using Variables</h3> |
| |
| <p>In this step you will create a simple Flip-Flop <span class="element61499">Application</span>, which uses Publisher and Subscriber function blocks to create Variables in the address space of the OPC UA Server. Clients can then read from those variables or write new values.</p> |
| |
| <p> Follow the steps in the <a href="../../html/4diacIDE/use4diacLocally.html" target="_blank">Blinking Tutorial</a> to create a new <span class="element61499">System</span>, <span class="element61499">Application</span>, and <span class="element61499">Device</span>. When you have created the empty Application, continue with the following steps.</p> |
| |
| <p> In the following steps we create a Flip-Flop application where a boolean value is read from an OPC UA Variable and then its negated value published as another variable. To achieve this, we make use of SUBSCRIBE and PUBLISH function blocks. The SUBSCRIBE function block is used for subscribing to one or multiple OPC UA Variables, i.e., the value of the variable will be available in the Application. The PUBLISH function block is used to publish a value from within the Application so that it can be read by clients. </p> |
| |
| <p> When the INIT event of those function blocks is triggered, the OPC UA server is initialized and started on the default endpoint url: <span class="address">opc.tcp://localhost:4840</span>. Note that only one OPC UA server will be created and the address model is shared between all the function blocks.</p> |
| |
| |
| <ol> |
| <li>Drag the following function blocks from the Type Library into the Application Editor: |
| <ul> |
| <li>events/E_SWITCH</li> |
| <li>events/E_SR</li> |
| <li>net/SUBSCRIBE_1</li> |
| <li>net/PUBLISH_1</li> |
| </ul> |
| </li> |
| <li>Connect the function blocks in the following way: |
| <div><img src="../../html/communication/img/opc_ua_flipFlop_FB.png" alt="OPC UA Flip-Flop Application"/></div> |
| </li> |
| <li>Map the function blocks to the device</li> |
| <li>Rename the E_SWITCH and E_SR function blocks, e.g. to <span class="specificText">Flipper</span> and <span class="specificText">Flopper</span></li> |
| <li>To configure where the variable nodes are created in the address space, you can use the ID fields of the SUBSCRIBE/PUBLISH function blocks. We want to create the variables under <span class="specificText">/Objects/FlipFlop</span>, whereas the node <span class="specificText">FlipFlop</span> should be created in cd namespace 1. Therefore we set the ID to <span class="address">opc_ua[/Objects/1:FlipFlop]</span>. If you don't indicate the namespace explicitly (the <span class="specificText">1:</span>), then it will take the namespace <span class="specificText">1</span> as default. QI has to be set to 1 to enable the function block.</li> |
| <li>Open the System Editor and connect the COLD and WARM ports to the two INIT ports. So finally it should look like this: |
| <div><img src="../../html/communication/img/opc_ua_flipFlop_FB_full.png" alt="OPC UA Flip-Flop Application connected"/></div> |
| </li> |
| <li>Deploy the Application to FORTE</li> |
| <li>Open UaExpert (you can get it from <a href="https://www.unified-automation.com/de/downloads/opc-ua-clients.html" target="_blank">here</a>) and connect to the OPC UA server running on FORTE: <span class="address">opc.tcp://localhost:4840</span></li> |
| <li>You should see the two variables which have been created by the SUBSCRIBE and PUBLISH function blocks: |
| <div><img src="../../html/communication/img/opc_ua_flipFlop_uaExpert.png" alt="OPC UA Flip-Flop in UaExpert"/></div> |
| As you can see, below <span class="specificText">Objects</span> there's a <span class="specificText">FolderObjectNode</span> with the name <span class="specificText">FlipFlop</span>. This name comes from the ID configuration of the function block. The two <span class="specificText">ObjectNode</span>s <span class="specificText">Flipper</span> and <span class="specificText">Flopper</span> are created out of the connection of the function blocks: The SUBSCRIBE FB is connected through RD_1 with the G port of the Flipper FB. Therefore there's a <span class="specificText">VariableNode</span> called <span class="specificText">G</span> in <span class="specificText">Flipper</span> ObjectNode. The same was created for the PUBLISH FB. The data type of the variables is derived from the FB's port datatype.<br/> |
| <span class="inlineTitle">Note:</span> You can change the name of the <span class="specificText">ObjectNode</span> (i.e., Flipper, Flopper) by renaming the function blocks. Currently it is not possible to change the names of the <span class="specificText">VariableNode</span>s. They will always have the name of the port. |
| </li> |
| <li>Optionally you can now monitor the Application in FORTE, e.g., watch the values of SUBSCRIBE and PUBLISH FB. See <a href="../../html/4diacIDE/use4diacLocally.html#monitoringApplication" target="_blank">Use 4DIAC locally Tutorial - Monitor</a> on how to do that. |
| </li> |
| <li>In UaExpert drag the two variables <span class="specificText">G</span> and <span class="specificText">Q</span> into the Data Access View. Here you can now change the value of |
| <span class="specificText">G</span>. This will cause the IND port of SUBSCRIBE to fire an event and FORTE will read the new variable value, negate it and set <span class="specificText">Q</span> to the negated value. The REQ event of the PUBLISH FB has to be triggered to set the new value from SD_1 in the address model of OPC UA. Note that in the beginning both values will be <span class="specificText">false</span> since no event has been triggered yet. |
| </li> |
| <li>In FORTE check the monitored application to see what happens there if you change a variable.</li> |
| </ol> |
| |
| <h3 id="variables_adder">Adder Application using Variables</h3> |
| |
| <p>Here you can see another example how to use SUBSCRIBE and PUBLISH to create an IEC 61499 application which adds two values, by reading the values from an OPC UA variable and providing the result.</p> |
| <p>If you followed the steps before you should be able to create a new Application which looks like this:</p> |
| <img src="../../html/communication/img/opc_ua_adder_full.png" alt="OPC UA Adder Application"/> |
| |
| <p>The F_ADD function block is a generic type which can have any supported data type for the IN1, IN2 and OUT ports. On the other hand the SUBSCRIBE and PUBLISH FBs need to now which datatype the created variables should have. To introduce this information into the application model, you can use the INT2INT converter function block. This will create the following nodes in the OPC UA Server:</p> |
| |
| <img src="../../html/communication/img/opc_ua_adder_uaExpert.png" alt="OPC UA Adder in UA Expert"/> |
| |
| <p>Try to understand from where the names for <span class="specificText">Num1</span>, <span class="specificText">Num2</span>, and <span class="specificText">Result</span> come from.</p> |
| |
| <p>You can then drag the variables into UaExpert's Data Access View and change the value of <span class="specificText">Num1/IN</span> and <span class="specificText">Num2/IN</span>. The value of <span class="specificText">Result/OUT</span> should then be the sum of those two values.</p> |
| |
| <h3 id="variables_remote">Read and Write OPC UA variables on a remote server</h3> |
| |
| <p>This example shows you how you can use a <span class="element4diac">PUBLISH</span> function block to write to an OPC UA variable on a remote server, and how to use a <span class="element4diac">CLIENT</span> function block to read a variable value from a remote server.</p> |
| <p>Create a new System which includes two System Configurations: One for the remote server, and one for the local variable read/write. By running two FORTE instances on you local PC, it is possible to simulate the use-case where the server and client are in separate FORTE instances. The server could for example run on a device offering the variables, the client is then another device which requests information of the previous one.<br />To start two FORTE instances on the same PC, you can pass the port on the command line, e.g., <span class="specificText">./forte -c localhost:61500</span></p> |
| <p>The system configuration should then look like this:</p> |
| |
| <img src="../../html/communication/img/opc_ua_variable_read_write_system.png" alt="OPC UA Variable Read/Write System"/> |
| |
| <p>Then we create the follwing application. On the server side we create an OPC UA variable <span class="specificText">/Objects/1:Incrementer/Increment/IN</span> (<span class="element4diac">SUBSCRIBE_1</span>). When a client writes to this variable, it will be incremented (F_ADD) and then written to another OPC UA variable at <span class="specificText">/Objects/1:Incrementer/Incremented/OUT</span> (<span class="element4diac">PUBLISH_1</span>).</p> |
| <p>On the client side we create a <span class="element4diac">PUBLISH</span> FB (<span class="element4diac">WRITE_INCREMENT</span>) which should write a number to the variable on the remote server. To read the incremented value from the server, we use a <span class="element4diac">CLIENT</span> FB (<span class="element4diac">READ_INCREMENTED</span>), which reads the variable's value as soon as the REQ event is triggered.</p> |
| <p>Do not forget to connect the <span class="element4diac">COLD/WARM</span> events in the ressource view to the <span class="element4diac">INIT</span> event ports of the corresponding function blocks.</p> |
| |
| <img src="../../html/communication/img/opc_ua_variable_read_write_app.png" alt="OPC UA Variable Read/Write Application"/> |
| |
| <p>You can see that there are two <span class="element4diac">PUBLISH</span> function blocks in this APP: <span class="element4diac">PUBLISH_1</span> and <span class="element4diac">WRITE_INCREMENT</span>. Depending on the ID parameter, they differ in their functionality. For <span class="element4diac">PUBLISH_1</span> the ID does not include the OPC UA encpoint <span class="specificText">opc.tcp://localhost:4840</span> therefore the result will be an OPC UA server which offers a variable. <span class="element4diac">WRITE_INCREMENT</span> includes the encpoint in its ID field, therefore this FB will write the value from <span class="element4diac">SD_1</span> to the variable indicated by the ID on the remote server.</p> |
| <p>The client FB supports calling methods (see following section) and reading variable values. Depending on the OPC UA node given by the ID parameter it will be automatically determined if the remote node is a Variable where the client should read from, or if it is a method which should be called.</p> |
| <p><span class="inlineTitle">NOTE:</span> Currently open62541 does not support data change events, therefore you need to use polling to see if a variable has changed on the remote server. When data change events are supported, we will add support for that on <span class="element4diac">SUBSCRIBE</span> FBs.</p> |
| |
| <h2 id="methods">OPC UA Methods</h2> |
| |
| <p>In this step you will see how you can create OPC UA methods in an IEC 61499 application. It uses the SERVER function block which creates the corresponding OPC UA method automatically in the address model.</p> |
| <p> Follow the steps in the <a href="../../html/4diacIDE/use4diacLocally.html" target="_blank">First Steps in 4DIAC Tutorial</a> to create a new System, Application, and Device. When you have created the empty Application, continue with the following steps.</p> |
| |
| <ol> |
| <li>Drag the following function blocks from the Type Library into the Application Editor: |
| <ul> |
| <li>3x convert/INT2INT</li> |
| <li>IEC61131-3/Arithmetic/F_ADD</li> |
| <li>net/SERVER_1_2</li> |
| </ul> |
| </li> |
| <li>Map the function blocks to the device</li> |
| <li>Connect the function blocks and rename them in the following way: |
| <div><img src="../../html/communication/img/opc_ua_method_full.png" alt="OPC UA Method Application"/></div> |
| </li> |
| <li>The name of the SERVER FB, specified at its ID port, is at the same time the browse path of the Method which will be created in the OPC UA Server. The RD ports of the SERVER are the method's input arguments, the SD ports the output arguments. |
| </li> |
| <li>Deploy the Application to FORTE</li> |
| <li>Open UaExpert and you should see the following address model: |
| <div><img src="../../html/communication/img/opc_ua_method_uaExpert.png" alt="OPC UA Method in UaExpert"/></div> |
| </li> |
| <li>Optionally you can again monitor the application in 4diac</li> |
| <li>In UaExpert Right-Click on the Method Node <span class="specificText">AddValues</span> and select Call... You will be presented with the following window: |
| <div><img src="../../html/communication/img/opc_ua_method_call.png" alt="OPC UA Method Call"/></div> |
| </li> |
| <li>You can see that the name of the input and output arguments are the names of the connected function blocks. Enter values for <span class="specificText">Num1</span> and <span class="specificText">Num2</span> and press Call. FORTE will trigger the IND event of the SERVER FB, which causes the F_ADD FB to calculate the sum of the two numbers. When the sum is ready, the RSP event on SERVER is triggered and the result is returned to the calling OPC UA Client, which is in this case UaExpert.<br/> |
| <span class="inlineTitle">Note:</span> After the IND event is triggered, the result has to be ready (i.e., the RSP event has to be triggered) within 4 seconds. This is the default timeout for a method call. Otherwise the call will fail with a timeout error code.</li> |
| </ol> |
| |
| |
| <h2 id="client">OPC UA Client</h2> |
| |
| <p>In this step you will see how you can create an OPC UA client in an IEC 61499 application. A client is used to call methods on an OPC UA server and to write new values to variables. It uses the <span class="element4diac">CLIENT</span> function block which is able to call methods asynchronously.</p> |
| <p>We will create a client which calls the <span class="element4diac">AddValues</span> method from the previous example. Therefore we extend the OPC UA methods example by adding additional function blocks.</p> |
| |
| <ol> |
| <li>Drag the following additional function blocks from the Type Library into the already existing AddValues example from the previous step: |
| <ul> |
| <li>3x convert/INT2INT</li> |
| <li>net/CLIENT_2_1</li> |
| </ul> |
| </li> |
| <li>Map the function blocks to the device</li> |
| <li>Connect the function blocks and rename them in the following way: |
| <div><img src="../../html/communication/img/opc_ua_client_full.png" alt="OPC UA Client Application"/></div> |
| </li> |
| <li>The method to be called is indicated in the <span class="element4diac">ID</span> field of the <span class="element4diac">CLIENT</span> FB. The <span class="element4diac">SD</span> ports of the <span class="element4diac">CLIENT</span> are the method's input arguments, the <span class="element4diac">RD</span> ports the output arguments. <span class="element4diac">SD_1</span> is the first input argument for the method, and so on. The name of the INT2INT block is currently not used, so only the order is important. Additionaly, you need to make sure that the data type of the <span class="element4diac">SD</span> and <span class="element4diac">RD</span> ports matches the types from the OPC UA method you want to call. Use the corresponding <span class="element4diac">conv</span> FBs for that, as we did in this example. |
| </li> |
| <li>Deploy the Application to FORTE</li> |
| <li>Monitor the application in 4diac to be able to set the two arguments for the client and fire the event</li> |
| <li>Then set <span class="element4diac">IN</span> of <span class="element4diac">Arg1</span> to <span class="specificText">INT#3</span>, and for <span class="element4diac">Arg2</span> to <span class="specificText">INT#5</span>. Right-Click on <span class="element4diac">Arg1 → REQ</span> and select <span class="command4diac">Trigger Event</span></li> |
| <li>This will trigger the client to call the add method on the server and gives back the result of the addition as <span class="element4diac">RD_1</span> |
| <div><img src="../../html/communication/img/opc_ua_client_monitor.png" alt="OPC UA Client Monitoring"/></div> |
| </li> |
| </ol> |
| |
| |
| <h2 id="subscription">OPC UA Client Subscriptions</h2> |
| |
| <p>In this step you will see how you can create an OPC UA data subscription in an IEC 61499 application. A client is used to set up a data subscription to variables on an OPC UA server to get the value changes as they appear on the server. It uses the <span class="element4diac">SUBSCRIBE</span> function block which is able to remotely subscribe to the variable value changes.</p> |
| <p>We will create a client which subscribes to the <span class="element4diac">Incrementer/Incremented/OUT</span> value from <a href="#variables_remote">example</a> described above. Therefore we extend the OPC UA variables example by adding subscription function block to monitor the value change.</p> |
| |
| <ol> |
| <li>We change the <span class="element4diac">CLIENT</span> function block used to read variable in the previous example with a <span class="element4diac">SUBSCRIBE</span> function block, so that client gets the updated value automatically without a need to actively trigger read functionality |
| </li> |
| <li>Map the function blocks to the device</li> |
| <li>Connect the function blocks and rename them in the following way: |
| <div><img src="../../html/communication/img/opc_ua_subscriptions.PNG" alt="OPC UA Subscription Application"/></div> |
| </li> |
| <li>The browse path of the node, on which value the client needs to subscribe, is indicated in the <span class="element4diac">ID</span> field of the <span class="element4diac">SUBSCRIBE</span> FB. Note, that for the opc ua subscriptions only <span class="element4diac">SUBSCRIBE_1</span> FB can be used. The <span class="element4diac">RD_1</span> port of the <span class="element4diac">SUBSCRIBE</span> is the current value of the subscribed node. Additionaly, you need to make sure that the data type of the <span class="element4diac">RD</span> port matches the types from the OPC UA variable you want to subscribe to. Use the corresponding <span class="element4diac">conv</span> FBs for that, as shown in this example. |
| </li> |
| <li>Deploy the Application to FORTE</li> |
| <li>If the value you subscribed for has changed on the server, an updated value will appear at <span class="element4diac">RD_1</span> port</li> |
| </ol> |
| |
| <h1>Where to go from here?</h1> |
| |
| <p>Go back to Protocols index:</p> |
| |
| <p><a href="../../html/communication/communicationIndex.html">Communication Index</a></p> |
| |
| <p>If you want to go back to the Start Here page, we leave you here a fast access</p> |
| |
| <p><a href="../../html/startHere/startHere.html">Start Here page</a></p> |
| |
| <p class="goToTop">Or <a href="#topOfPage">Go to top</a></p> |
| |
| </body> |
| </html> |