blob: b5367c7b07e0c09d0e74314e2e82a4e0dd44eff3 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>PLC4X &#x2013; </title>
<script src="../../js/jquery.slim.min.js" type="text/javascript"></script>
<!--script src="../../js/popper.min.js" type="javascript"></script-->
<script src="../../js/bootstrap.bundle.min.js" type="text/javascript"></script>
<!-- The tooling for adding images and links to Apache events -->
<script src="https://www.apachecon.com/event-images/snippet.js" type="text/javascript"></script>
<!-- FontAwesome -->
<link rel="stylesheet" href="../../css/all.min.css" type="text/css"/>
<!-- Bootstrap -->
<link rel="stylesheet" href="../../css/bootstrap.min.css" type="text/css"/>
<!-- Some Maven Site defaults -->
<link rel="stylesheet" href="../../css/maven-base.css" type="text/css"/>
<link rel="stylesheet" href="../../css/maven-theme.css" type="text/css"/>
<!-- The PLC4X version of a bootstrap theme -->
<link rel="stylesheet" href="../../css/themes/plc4x.css" type="text/css" id="pagestyle"/>
<!-- A custom style for printing content -->
<link rel="stylesheet" href="../../css/print.css" type="text/css" media="print"/>
<meta http-equiv="Content-Language" content="en"/>
</head>
<body class="composite">
<nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center border-bottom">
<!--a href="/" class="navbar-brand d-flex w-50 mr-auto">Navbar 3</a-->
<a href="https://plc4x.apache.org/" id="bannerLeft"><img src="../../images/apache_plc4x_logo_small.png" alt="Apache PLC4X"/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100" id="collapsingNavbar3">
<ul class="navbar-nav w-100 justify-content-center">
<li class="nav-item">
<a class="nav-link" href="../../index.html">Home</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="../../users/index.html">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../developers/index.html">Developers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../apache/index.html">Apache</a>
</li>
</ul>
<ul class="nav navbar-nav ml-auto justify-content-end">
<li class="nav-item row valign-middle">
<a class="acevent" data-format="wide" data-mode="light" data-event="random" style="width:240px;height:60px;"></a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row h-100">
<nav class="col-sm-push col-md-2 pt-3 sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a href="../../users/index.html" class="nav-link">Section Home</a>
</li>
<li class="nav-item">
<a href="../../users/download.html" class="nav-link">Download</a>
</li>
<li class="nav-item">
<a href="../../users/adopters.html" class="nav-link">Adopters</a>
</li>
<li class="nav-item">
<a href="../../users/commercial-support.html" class="nav-link">Commercial support</a>
</li>
<li class="nav-item">
<a href="../../users/gettingstarted.html" class="nav-link">Getting Started</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../../users/getting-started/plc4go.html" class="nav-link">Go</a>
</li>
<li class="nav-item">
<a href="../../users/getting-started/plc4j.html" class="nav-link">Java</a>
</li>
<li class="nav-item">
<a href="../../users/getting-started/using-snapshots.html" class="nav-link">Using SNAPSHOTS</a>
</li>
<li class="nav-item">
<a href="../../users/getting-started/general-concepts.html" class="nav-link">General Concepts</a>
</li>
<li class="nav-item">
<a href="../../users/getting-started/virtual-modbus.html" class="nav-link">Virtual Modbus</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../../users/blogs-videos-and-slides.html" class="nav-link">Blogs, Videos and Slides</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/index.html" class="nav-link">Protocols</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../../users/protocols/ab-eth.html" class="nav-link">AB-ETH</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/ads.html" class="nav-link">ADS/AMS</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/bacnetip.html" class="nav-link">BACnet/IP</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/canopen.html" class="nav-link">CANopen</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/deltav.html" class="nav-link">DeltaV</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/df1.html" class="nav-link">DF1</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/ethernet-ip.html" class="nav-link">EtherNet/IP</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/firmata.html" class="nav-link">Firmata</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/knxnetip.html" class="nav-link">KNXnet/IP</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/modbus.html" class="nav-link">Modbus</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/opc-ua.html" class="nav-link">OPC UA</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/plc4x.html" class="nav-link">PLC4X (Proxy)</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/s7.html" class="nav-link">S7 (Step7)</a>
</li>
<li class="nav-item">
<a href="../../users/protocols/simulated.html" class="nav-link">Simulated</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../../users/transports/index.html" class="nav-link">Transports</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../../users/transports/tcp.html" class="nav-link">TCP</a>
</li>
<li class="nav-item">
<a href="../../users/transports/udp.html" class="nav-link">UDP</a>
</li>
<li class="nav-item">
<a href="../../users/transports/serial.html" class="nav-link">Serial</a>
</li>
<li class="nav-item">
<a href="../../users/transports/socketcan.html" class="nav-link">SocketCAN</a>
</li>
<li class="nav-item">
<a href="../../users/transports/raw-socket.html" class="nav-link">Raw Socket</a>
</li>
<li class="nav-item">
<a href="../../users/transports/pcap-replay.html" class="nav-link">PCAP Replay</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../../users/integrations/index.html" class="nav-link">Integrations</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../../users/integrations/apache-calcite.html" class="nav-link">Apache Calcite</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-camel.html" class="nav-link">Apache Camel</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-edgent.html" class="nav-link">Apache Edgent</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-iotdb.html" class="nav-link">Apache IoTDB</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-kafka.html" class="nav-link">Apache Kafka</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-nifi.html" class="nav-link">Apache NiFi</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/apache-streampipes.html" class="nav-link">Apache StreamPipes</a>
</li>
<li class="nav-item">
<a href="../../users/integrations/eclipse-ditto.html" class="nav-link">Eclipse Ditto</a>
</li>
<li class="nav-item">
<strong class="nav-link">Eclipse Milo OPC UA Server</strong>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../../users/tools/index.html" class="nav-link">Tools</a>
<ul class="flex-column pl-4 nav">
<li class="nav-item">
<a href="../../users/tools/capture-replay.html" class="nav-link">Capture Replay</a>
</li>
<li class="nav-item">
<a href="../../users/tools/connection-pool.html" class="nav-link">Connection Pool</a>
</li>
<li class="nav-item">
<a href="../../users/tools/connection-cache.html" class="nav-link">Connection Cache</a>
</li>
<li class="nav-item">
<a href="../../users/tools/opm.html" class="nav-link">Object PLC Mapping (OPM)</a>
</li>
<li class="nav-item">
<a href="../../users/tools/scraper.html" class="nav-link">Scraper</a>
</li>
<li class="nav-item">
<a href="../../users/tools/testing.html" class="nav-link">PLC4X without a PLC and Unit Testing</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="../../users/industry40.html" class="nav-link">Industry 4.0 with Apache</a>
</li>
<li class="nav-item">
<a href="../../users/security.html" class="nav-link">Security</a>
</li>
</ul>
</div>
</nav>
<main role="main" class="ml-sm-auto px-4 col-sm-pull col-md-9 col-lg-10 h-100">
<div class="sect1">
<h2 id="introduction">Introduction</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The PLC4X OPC UA server integration is based around the Eclipse Milo OPC UA server. It uses PLC4X to communicate with
industrial devices effectively acting as a industrial OPC UA gateway.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="building_the_server">Building the server</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The OPC UA server can be built using maven as part of the PLC4X build.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code>mvn install</code></pre>
</div>
</div>
<div class="paragraph">
<p>This creates a target directory within plc4x/plc4j/integrations/opcua-server containing a jar file which is the main java
executable.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="configuration_file">Configuration File</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The config.yml file is used to configure the server. The following root level settings should be configured.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>version:</strong> The version is just an internal check to confirm that the right version of the configuration file
is being used.</p>
</li>
<li>
<p><strong>dir:</strong> This is the directory to the security directory. This is where all configuration is stored including certificates.
Be sure to secure this directory with the correct permissions.</p>
</li>
<li>
<p><strong>name:</strong> This is the name of the OPC UA server. It can be anything but shouldn&#8217;t contain spaces.</p>
</li>
<li>
<p><strong>disableInsecureEndpoint:</strong> This is used to disable the remote insecure OPC UA endpoint.</p>
</li>
<li>
<p><strong>tcpPort:</strong> this can be used to change the opc.tcp port.</p>
</li>
<li>
<p><strong>httpPort:</strong> this can be used to change the http.tcp port.</p>
</li>
<li>
<p><strong>devices:</strong> is a list of PLC&#8217;s or devices that the server should communicate with. Each device should include a
name:, connectionString:, and a list of tags:.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For each device within devices the following settings should be configured.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>name:</strong> This is the name of the device. It can anything as long as it doesn&#8217;t contain spaces.</p>
</li>
<li>
<p><strong>connectionString:</strong> Can be any valid PLC4X connection string.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For each tag with tags the following settings should be configured:-</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>alias:</strong> This is the name of tag it can be anything but shouldn&#8217;t have spaces. This will be shown as the tag name within
the OPC UA server tree. Be sure that this is unique within the configuration file.</p>
</li>
<li>
<p><strong>address:</strong> This is any valid PLC4X address that matches the connection type.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>An example configuration file is shown below.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code>---
version: "0.8"
dir: {path-to-security-dir}
name: "Plc4xOPCUAServer"
disableInsecureEndpoint: true
devices:
- name: "ModbusDevice"
connectionString: "modbus-tcp://127.0.0.1:502"
tags:
- alias: "TemporaryBOOLARRAY"
address: "000001:BOOL[10]"
- alias: "TemporaryWORD2"
address: "400002:WORD"
- alias: "TemporaryUINT3"
address: "400003:UINT"
- alias: "TemporaryINT4"
address: "400004:INT"
- alias: "TemporaryDINT5"
address: "400005:DINT[4]"
- alias: "TemporaryREAL6"
address: "400006:REAL"
- alias: "TemporaryREAL7"
address: "400007:REAL"
- alias: "TemporaryREAL8"
address: "400008:REAL"
- name: "SimulationDevice"
connectionString: "simulated://127.0.0.1"
tags:
- alias: "Temporary"
address: "RANDOM/Temporary:Integer"
tcpPort: 12687
httpPort: 8445</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="running">Running</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To run the java executable execute:-</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code>java -jar plc4x-opcua-server-0.8.0-uber-jar.jar -c {path-to-config-file} -i</code></pre>
</div>
</div>
<div class="paragraph">
<p>This will start the OPC UA server with the interactive switch (-i). This prompts the server to ask for usernames and
passwords upon startup. However, during normal operation the -i switch should be left out.</p>
</div>
<div class="paragraph">
<p>If a certificate isn&#8217;t available at <strong>{path-to-security-dir}/security/plc4x-opcuaserver.pfx</strong> then a self signed is
created. This certificate is password protected with the security password given during startup.</p>
</div>
<div class="paragraph">
<p>If you place another certificate here make sure it is password protected and set the password by running the server
again with --set-password switch.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code>java -jar plc4x-opcua-server-0.8.0-uber-jar.jar -c {path-to-config-file} -i -s</code></pre>
</div>
</div>
<div class="paragraph">
<p>Once the OPC UA server is running you are able to connect to it from your favorite OPC UA client using the connection
string.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code>opc.tcp://{ip.address}:12687/plc4x</code></pre>
</div>
</div>
<div class="paragraph">
<p>Replacing the {ip.address} with the servers IP address.</p>
</div>
<div class="paragraph">
<p>If you want to use an encrypted connection be sure to move the client certificate created in
<strong>{path-to-security-dir}/security/pki/rejected</strong> to the trusted directory. Otherwise the client will receive a security error
when trying to connect.</p>
</div>
</div>
</div>
</main>
<footer class="pt-4 my-md-5 pt-md-5 w-100 border-top">
<div class="row justify-content-md-center" style="font-size: 13px">
<div class="col col-6 text-center">
Copyright &#169; 2017&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved.<br/>
Apache PLC4X, PLC4X, Apache, the Apache feather logo, and the Apache PLC4X project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
<br/><div style="text-align:center;">Home screen image taken from <a
href="https://flic.kr/p/chEftd">Flickr</a>, "Tesla Robot Dance" by Steve Jurvetson, licensed
under <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0 Generic</a>, image cropped
and blur effect added.</div>
</div>
</div>
</footer>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../js/jquery.slim.min.js"></script>
<script src="../../js/popper.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script type="text/javascript">
$('.carousel .carousel-item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
for (let i = 0; i < 3; i++) {
next=next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
</script>
</body>
</html>