blob: 670ca6c133f86fa68d6c5f06787e646fd5a574cd [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2017 - 2018 fortiss GmbH
2018 Johannes Kepler University Linz
2018 - 2019 Andrea Zoitl
2019 - Jan Holzweber
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:
Jose Cabral
- initial API and implementation and/or initial documentation
Andrea Zoitl - cleaning up tutorials for 1.10 release, fixing further issues, updated ToC
Bianca Wiesmayr - minor text corrections
Jan Holzweber - added tutorial Step 7
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Step 2 - Distribute 4diac Applications</title>
<link rel="stylesheet" type="text/css" href="../help.css" />
</head>
<body>
<!--********************************************************************************************-->
<h1 id="topOfPage">Step 2 - Distribute 4diac Applications</h1>
<p>This page is part of a guide that gives a walk-through over the major 4diac&nbsp;IDE features.</p>
<ol start="0">
<li><a href="../../html/4diacIDE/overview.html">4diac&nbsp;IDE Overview</a></li>
<li><a href="../../html/4diacIDE/use4diacLocally.html">Use 4diac Locally (Blinking tutorial)</a></li>
<li>Distribute 4diac Applications (YOU ARE HERE!)</li>
<li><a href="../../html/4diacIDE/use4diacRemotely.html">Deploy Applications Remotely</a></li>
<li><a href="../../html/4diacIDE/createOwnTypes.html">Create Your own Function Block Types</a></li>
<li><a href="../../html/4diacIDE/otherUseful.html">Other Basic Features</a></li>
<li><a href="../../html/4diacIDE/advancedFeatures.html">Advanced Features</a></li>
<li><a href="../../html/4diacIDE/dynamicTypeLoader.html">Deploying new FBs with the Dynamic Type Loader</a></li>
</ol>
<p>This guide extends the blinking application of <a href="../../html/4diacIDE/use4diacLocally.html" target="_blank">Step 1</a>.
We want to count how many times the light has turned on.
You will learn how to distribute a IEC&nbsp;61499 Application to several devices and set up the communication between them.
The example continues to run on the local computer.
The application will run on 2 devices.
The blinking part of the application will run on a 4diac&nbsp;FORTE and the count on another 4diac&nbsp;FORTE, see the architecture below.
The two different programs running on the local machine emulate two PLCs.
<br><img src="../../html/4diacIDE/img/distributedArchitecture.png" alt="architecture for the current step"/></p>
<!--********************************************************************************************-->
<h2 id="extendApplication">Extend the Application</h2>
<p>To count the blinking, we need to add 2 new Function Blocks (FBs) to the existing Application in the <i>BlinkTestApp</i> Application Editor.</p>
<ol>
<li>Drag and Drop the following FBs from the folder events of the Palette.
<ul>
<li>E_PERMIT </li>
<li>E_CTU</li>
</ul>
</li>
<li>Create the connections between the FBs.</li>
</ol>
<p>Remember, Event and Data connections can not be mixed.</p>
<img src="../../html/4diacIDE/img/Step2/counterFBs.png" alt="architecture for the current step" />
<!--********************************************************************************************-->
<h2 id="AddAnotherDevice">Add Another Device</h2>
<p>Change to the <i>BlinkTest</i> System Configuration Editor and add a second device from the Palette.
The counter will run on the new device.</p>
<ol>
<li>Drag and Drop a <b>FORTE_PC</b> device next to the existing one.</li>
<li>Rename the device to <b>Counter</b>.</li>
<li>Set the localhost to 61500. The devices need to have different localhosts, they can not have the same one.</li>
<li>Rename the resource to <b>Counter_RES</b>.</li>
</ol>
<img src="../../html/4diacIDE/img/Step2/addAnotherDevice.png" alt="Add another device to the system" />
<p>Change back to the <i>BlinkTestApp</i> Application Editor and map the two new FBs to the Resource <i>Counter_RES</i>.
You can see the dashed connections between the two devices.</p>
<img src="../../html/4diacIDE/img/Step2/mapToCounter.png" alt="Mapping of Function Block Instances within the Application Editor" />
<!--********************************************************************************************-->
<h2 id="SetUpCommunication">Set up the Communication Between Both Devices</h2>
<p>Change to the <i>Testee.Blinky_RES</i> or <i>Counter.Counter_RES</i> Resource Editor.
There you can see 2 incomplete FBs at the E_SR FB or E_PERMIT.
They symbolize the broken connections between the two devices.
Currently they have no opportunity to communicate with each other.
We fix it by adding special Communications FBs.
You can find more information about broken connections <a href="../../html/before4DIAC/iec61499.html#brokenConnection">here on our Homepage</a>.</p>
<img src="../../html/4diacIDE/img/Step2/incompleteFBs.png" alt="incomplete FBs show die broken connection beween two devices" />
<!--*********************-->
<h3 id="SetUpBlinking">Set up the Blinking Part of the Application</h3>
<p>Change to the <i>Testee.Blinky_RES</i> Resource Editor.</p>
<p>Drag and Drop a <b>PUBLISH_1</b> FB from the folder net of the Palette and set up the connections.
The PUBLISH FB must be initialized, so it is best to connect its INIT event directly to the START.</p>
<img src="../../html/4diacIDE/img/Step2/blinkyResourceComplete.png" alt="Blinky_RES completely connected" />
<p>Set the QI value to 1 and the set the ID input data of the PUBLISH_COUNT FB to 239.0.0.1:61000.</p>
<!--*********************-->
<h3 id="SetUpCounting">Set up the Counting Part of the Application</h3>
<p>Change to the <i>Counter.Counter_RES</i> Resource Editor.</p>
<p>Drag and Drop a <b>SUBSCRIBE_1</b> FB from the folder net of the Palette and set up the connections.
The SUBSCRIBE FB must also be initialized.</p>
<img src="../../html/4diacIDE/img/Step2/counterResourceComplete.png" alt="Counter_RES completely connected" />
<p>Set the QI value to 1 and the set the ID input data of the SUBSCRIBE_COUNT FB to 239.0.0.1:61000.</p>
<!--*********************-->
<h3 id="BackgroundCommunicationFBs">Background of the Communication FBs</h3>
<p>Here is what the last steps mean. The PUBLISH_X FB is used to send messages over the network which are received by an according SUBSCRIBE_X FB.
Every time a REQ is triggered, a message is sent according to the ID input.
With the value of the ID input you can specify what specific network protocol you would like to use (e.g., MQTT, OPC UA).
If you do not specify a dedicated protocol the default as defined in the <a href="https://www.holobloc.com/doc/ita/">"IEC 61499 Compliance Profile for Feasibility Demonstrations"</a> is used.
The number X in PUBLISH_X is the number of data elements that you want to send in the message.
Since we are only sending one value we used PUBLISH_1.</p>
<p>The used ID value specifies an IP:PORT pair.
The used "IEC&nbsp;61499 Compliance Profile for Feasibility Demonstrations" defines that this is an UDP multi-cast address in a certain address range.
The selected 239.0.0.1 and port 61000 have nothing to do with the localhost:61499 or localhost:61500 use for configuring the devices.
The first is a UDP multi-cast address use to send messages between devices, and the latter are TCP connections for deploying applications to devices and manage them.
Take care of not using the same UDP socket for different PUBLISH_X/SUBSCRIBE_X pairs.</p>
<!--********************************************************************************************-->
<h2 id="startDevices">Start Both Devices</h2>
<p>Change to the Deployment Perspective.</p>
<ol>
<li>Set the Port to 61499 (the same as defined before, remember localhost:61499 in the System Configuration Editor?).</li>
<li>Launch Local 4diac&nbsp;FORTE.</li>
<li>You should see the location of your 4diac&nbsp;FORTE and the Terminate button enabled in the Console.</li>
<li>Set the Port to 61500 (the same as defined before, remember localhost:61500 in the System Configuration?)</li>
<li>Launch Local 4diac&nbsp;FORTE</li>
<li>You should see the the location of your 4diac&nbsp;FORTE and the Terminate button enabled in the Console.</li>
<li>Select the elements to deploy.
For this tutorial select our devices <i>Counter</i> and <i>Testee</i>.</li>
<li>Click the <span class="button4diac">Deploy</span> button.</li>
<li>Check that the <i>Deployment Console</i> shows some output, and that no red warning appears on the right nor left of it.
If you get something red, something went wrong.</li>
</ol>
<img src="../../html/4diacIDE/img/Step2/deployCounter.png" alt="deploying of the application" />
<!--********************************************************************************************-->
<h2 id="testApplication">Test it!</h2>
<img src="../../html/4diacIDE/img/Step2/monitoringApp.png" alt="monitoring of the application" />
<!--********************************************************************************************-->
<h1>Where to go from here?</h1>
<p>In the next step you will see how 4diac&nbsp;FORTE runs in another machine.</p>
<p><a href="../../html/4diacIDE/use4diacRemotely.html">Step 3 - Deploy Applications Remotely</a></p>
<p>If you want to go back to the original Blinking application without buttons, here's a link</p>
<p><a href="../../html/4diacIDE/use4diacLocally.html">Step 1 - Use 4diac Locally (Blinking Tutorial)</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">Where to Start</a></p>
<p class="goToTop"><a href="#topOfPage">Go to top</a></p>
</body>
</html>