blob: dcc814398168eccf4c5ed8690e095096ba01fe90 [file] [log] [blame]
<!doctype html>
<html data-n-head-ssr data-n-head="">
<head data-n-head="">
<title data-n-head="true">Eclipse unide - PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="true" data-hid="description" name="description" content="Eclipse Unide: Understand Industry devices"><link data-n-head="true" rel="icon" type="image/x-icon" href="/unide/favicon.ico"><base href="/unide/"><link rel="stylesheet" href="/unide/files/1750fa95f99b26cdec14.css"><link rel="stylesheet" href="/unide/files/08ee945502042ce842dc.css">
</head>
<body data-n-head="">
<div data-server-rendered="true" id="__nuxt"><!----><div id="__layout"><div><header class="nav-header"><div class="container"><nav class="navbar"><div id="navMenu" class="navbar-menu"><div class="navbar-start"><a href="/unide/" class="navbar-item">
Home
</a> <a href="/unide/proposal" class="navbar-item">
Proposal
</a> <a href="/unide/specification" class="navbar-item">
Specification
</a> <a href="/unide/blog" class="navbar-item is-active">
Blog Archives
</a> <a href="/unide/faq" class="navbar-item">
FAQ
</a></div></div> <div class="navbar-brand"><div class="navbar-burger burger"><span></span> <span></span> <span></span></div> <a href="/unide/" class="navbar-item nuxt-link-active"><img src="logo.svg"></a></div></nav></div></header> <div class="container"><div class="header clearfix"></div> <div class="columns"><div class="article column is-8"><h1 class="title is-3">
PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed
</h1> <h2 class="subtitle is-6"><i class="fa fa-calendar"></i>  
02/13/18
</h2> <div class="content"><div><h2>Abstract</h2>
<p>In this blog post we present a real world condition monitoring scenario used in<br>
the <a href="https://iot.eclipse.org/testbeds/production-performance-management/#">Eclipse Production Performance Management Testbed</a>, where Unide and<br>
PPMP plays a crucial role. Moreover, we also provide a code repository and<br>
instructions so that you can recreate the scenario in your own computer and<br>
learn about its components and the communication with each other.</p>
<h2>Introduction</h2>
<p>In the context of the <a href="https://iot.eclipse.org/testbeds/production-performance-management/#">Eclipse Production Performance Management Testbed</a>, a<br>
real world condition monitoring scenario has been recreated, in which a<br>
grinding machine is being continuously monitored allowing to have real time<br>
health checks and prevent unexpected failures.</p>
<p>This scenario consists of the following building blocks: device, gateway,<br>
backend. The communication between them happens seamlessly thanks to the<br>
Production Performance management Protocol (PPMP).</p>
<ul>
<li>
<p>The device, i.e. the grinding machine, has been retrofitted with an<br>
acceleration sensor attached to one of its critical components. The data<br>
provided by this sensor is routed to the gateway in the form of a <a href="https://www.eclipse.org/unide/specification/measurement-message#messageDetail">PPMP<br>
Measurement Message</a>.</p>
</li>
<li>
<p>The gateway receives the raw acceleration measurements, calculates some<br>
statistical characteristics and and applies some machine learning techniques<br>
to them in order to evaluate the condition of the grinding machine. Then both<br>
the statistical values and the condition are routed to the backend, again in<br>
the form of a PPMP Measurement Message.</p>
</li>
<li>
<p>The backend, usually in the cloud, is any component that "speaks PPMP" and<br>
performs meaningful operations on the incoming messages. Most frequently it<br>
is responsible for storing the arriving data and making it available to apps<br>
that want to consume it. Common responsibilities of these apps are the<br>
representation or display of the data (e.g. dashboards), or workflows<br>
management (e.g. the grinding machine is in bad condition and an inspection<br>
must be carried out).</p>
<p>The backend can be swapped effortless with any entity adhering to PPMP standard.<br>
In the Eclipse PPM Testbed at least two different backends have been used:</p>
<ul>
<li>One directly based on <a href="https://github.com/eclipse/unide">Unide</a></li>
<li>One based on <a href="https://www.contact-software.com/en/products/elements-for-iot/">CONTACT Elements for IoT</a>.</li>
</ul>
</li>
</ul>
<h2>Hands-on demonstration</h2>
<p>In order to make this scenario more hands-on and interesting, within the<br>
<a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement">Production Performance Management Testbed repository</a> project in Github, we<br>
have set up a <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/grinding-machine">subproject for the grinding machine scenario</a>. There you can<br>
find a thorough description and code to simulate the device and the gateway,<br>
and route messages to a given backend. The only requirements are git and conda<br>
(the easiest way to get conda is to <a href="https://conda.io/miniconda.html">install miniconda</a>).</p>
<p>So, let's get started! First of all, open your terminal and clone the<br>
repository:</p>
<pre class="language-bash"><code class="language-bash">$ <span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement eclipse-testbed-ppm
$ <span class="token function">cd</span> eclipse-testbed-ppm/grinding-machine
</code></pre>
<p>Then move to the grinding machine subproject directory:</p>
<pre class="language-bash"><code class="language-bash">$ <span class="token function">cd</span> eclipse-testbed-ppm/grinding-machine
</code></pre>
<p>In that folder you will see two subfolders. The first one<br>
<code>unide-grinding-machine</code> contains a Python program that simulates grinding<br>
machine and the second one <code>unide-grinding-machine-gateway</code> simulates the<br>
gateway.</p>
<h3>Grinding Machine simulator</h3>
<p>Let's start with the first component. First <code>cd</code> to <code>unide-grinding-machine</code><br>
and then create the conda environment:</p>
<pre class="language-bash"><code class="language-bash">$ conda <span class="token function">env</span> create --prefix<span class="token operator">=</span>env
</code></pre>
<p>And then in order to use this environment, we need to activate it.</p>
<pre class="language-bash"><code class="language-bash">$ <span class="token function">source</span> activate <span class="token function">env</span> <span class="token comment"># or in windows: activate env </span>
</code></pre>
<p>Run <code>unide-grinding-machine -h</code> to get familiar with the CLI. With this<br>
executable we can generate some machine grinding data, and (for the moment)<br>
print messages to the console. To do so, run <code>unide-grinding-machine send random</code> and you should get a large message on the console. This is the PPMP<br>
message ought to be sent to the gateway.</p>
<p>We don't have a gateway so far, but don't worry, we will get to that in a<br>
minute. Don't close this console!</p>
<h3>Gateway simulator</h3>
<p>Open a new console, and similarly to the previous point, first <code>cd</code> to<br>
<code>unide-grinding-machine-gateway</code>, create the environment (<code>conda env create --prefix=env</code>) and activate it (<code>source activate env</code>).</p>
<p>The run the command <code>unide-grinding-machine-gateway -h</code> to test that everything<br>
is in place. You should get the CLI documentation.</p>
<p>Now, let's fire up the gateway by calling <code>unide-grinding-machine-gateway start_server</code>, and a message like this should show up:</p>
<pre class="language-bash"><code class="language-bash">Running <span class="token operator">&lt;</span>unide_grinding_machine_gateway.server.App object at 0x<span class="token punctuation">..</span><span class="token punctuation">..</span>.<span class="token operator">></span>
Listening on http://127.0.0.1:5000
Press Ctrl-C to stop<span class="token punctuation">..</span>.
</code></pre>
<p>We are getting closer. Leave the gateway running.</p>
<h3>Communication Device-Gateway</h3>
<p>Let's go back to the previous console where we had the <code>unide-grinding-machine</code><br>
environment and call again the <code>unide-grinding-machine</code> program, but this time<br>
passing the as an argument where the gateway is listening to messages.</p>
<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine send random --endpoint<span class="token operator">=</span>http://127.0.0.1:5000
</code></pre>
<p>If you take peek at the gateway output, you should see new information printed<br>
out, which is a PPMP message containing the result of the classification<br>
algorithms applied to the device data we just sent to it.</p>
<p>We are getting somewhere! But still, it is not extremely useful to print some<br>
characters into a console, is it?</p>
<h3>Communication Device-Gateway-Backend</h3>
<p>There is only a small but relevant point missing: the routing from the gateway<br>
to the backend. We need a backend and the Unide project provides a service that<br>
can be used as a playground for these purposes. So let's restart the gateway,<br>
this time passing the Unide endpoint:</p>
<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine-gateway start_server --endpoint<span class="token operator">=</span>https://unide.eclipse.org/rest/v2
</code></pre>
<p>Now we can use the <code>unide-grinding-machine</code> to send raw data to the gateway<br>
which in turn sends its results to the backend. In order to be able to<br>
identify this data later, we are going to define a proper device ID (argument<br>
<code>--device-id</code>), and also tell it to send data once each 10 seconds (argument<br>
<code>--period</code>):</p>
<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine send random --endpoint<span class="token operator">=</span>http://127.0.0.1:5000 --device-id<span class="token operator">=</span>IoT-000028--3 --period<span class="token operator">=</span>10
</code></pre>
<p>Once started, a continuous flow of data is pumped through each component until<br>
it reaches the backend, allowing us to use the applications that consume this<br>
data. For instance, the basic backend provided by Unide offers a <a href="https://grafana.com/">Grafana</a> based<br>
dashboard that offers live monitoring of the statistical values calculated in the<br>
gateway:</p>
<p><img src="/unide/images/blog/grinding-machine-grafana-dashboard.png" alt="Grafana based dashboard monitoring grinding machine"></p>
<p>If instead of that we use the the <a href="https://www.contact-software.com/en/products/elements-for-iot/">CONTACT Elements for IoT</a> based backend,<br>
we can see a different and richer dashboard: charts, 3D models, list of<br>
maintenance events, device master data and the Activity Stream, a place where<br>
different parties can exchange information related to the grinding machine:</p>
<p><img src="/unide/images/blog/grinding-machine-ce4iot-dashboard.png" alt="CONTACT Elements for IoT Dashboard"></p>
</div></div> <div class="columns pageNav"><div class="column"><a href="/unide/blog/2018/2/11/Transform-PPMP-with-camel" class="button is-fullwidth"><span class="icon"><i class="fa fa-chevron-left"></i></span> <span>PPMP Use Cases: Simple Transformation with Apache Camel</span></a></div> <div class="column"><a href="/unide/blog/2018/3/26/Release-0.2.0" class="button is-fullwidth"><span>Unide 0.2.0 released</span> <span class="icon"><i class="fa fa-chevron-right"></i></span></a></div></div></div> <div class="sidebar column is-3 is-offset-1"><div class="recentPosts"><h4 class="subtitle is-5">
Recent Posts
</h4> <ul><li><a href="/unide/blog/2019/3/1/Version-3">
PPMP Version 3 release candidate
</a></li><li><a href="/unide/blog/2018/9/4/Template-for-PPMP-transformation">
PPMP Use Cases: Template for PPMP transformation
</a></li><li><a href="/unide/blog/2018/3/26/Release-0.2.0">
Unide 0.2.0 released
</a></li><li><a href="/unide/blog/2018/2/13/grinding-machine-scenario" class="nuxt-link-exact-active nuxt-link-active">
PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed
</a></li><li><a href="/unide/blog/2018/2/11/Transform-PPMP-with-camel">
PPMP Use Cases: Simple Transformation with Apache Camel
</a></li></ul></div> <div class="blogArchives"><h4 class="subtitle is-5">
Blog Archives
</h4> <ul><li><a href="/unide/blog/2019/3">
April 2019
</a>
(1)
</li><li><a href="/unide/blog/2018/9">
October 2018
</a>
(1)
</li><li><a href="/unide/blog/2018/3">
April 2018
</a>
(1)
</li><li><a href="/unide/blog/2018/2" class="nuxt-link-active">
March 2018
</a>
(2)
</li><li><a href="/unide/blog/2018/1">
February 2018
</a>
(1)
</li><li><a href="/unide/blog/2017/10">
November 2017
</a>
(2)
</li><li><a href="/unide/blog/2017/6">
July 2017
</a>
(2)
</li><li><a href="/unide/blog/2017/3">
April 2017
</a>
(1)
</li><li><a href="/unide/blog/2016/9">
October 2016
</a>
(4)
</li></ul></div></div></div></div> <footer class="footer"><div class="container"><div class="columns is-mobile is-multiline is-centered"><div class="column is-narrow"><a href="http://www.eclipse.org">Eclipse Foundation</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></div> <div class="column is-narrow"><a href="https://eclipse.org/security/">Security reports</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/">Legal</a></div></div></div></footer></div></div></div><script>window.__NUXT__={layout:"sidebar",data:[{post:{name:"grinding-machine-scenario",content:'<h2>Abstract</h2>\n<p>In this blog post we present a real world condition monitoring scenario used in<br>\nthe <a href="https://iot.eclipse.org/testbeds/production-performance-management/#">Eclipse Production Performance Management Testbed</a>, where Unide and<br>\nPPMP plays a crucial role. Moreover, we also provide a code repository and<br>\ninstructions so that you can recreate the scenario in your own computer and<br>\nlearn about its components and the communication with each other.</p>\n<h2>Introduction</h2>\n<p>In the context of the <a href="https://iot.eclipse.org/testbeds/production-performance-management/#">Eclipse Production Performance Management Testbed</a>, a<br>\nreal world condition monitoring scenario has been recreated, in which a<br>\ngrinding machine is being continuously monitored allowing to have real time<br>\nhealth checks and prevent unexpected failures.</p>\n<p>This scenario consists of the following building blocks: device, gateway,<br>\nbackend. The communication between them happens seamlessly thanks to the<br>\nProduction Performance management Protocol (PPMP).</p>\n<ul>\n<li>\n<p>The device, i.e. the grinding machine, has been retrofitted with an<br>\nacceleration sensor attached to one of its critical components. The data<br>\nprovided by this sensor is routed to the gateway in the form of a <a href="https://www.eclipse.org/unide/specification/measurement-message#messageDetail">PPMP<br>\nMeasurement Message</a>.</p>\n</li>\n<li>\n<p>The gateway receives the raw acceleration measurements, calculates some<br>\nstatistical characteristics and and applies some machine learning techniques<br>\nto them in order to evaluate the condition of the grinding machine. Then both<br>\nthe statistical values and the condition are routed to the backend, again in<br>\nthe form of a PPMP Measurement Message.</p>\n</li>\n<li>\n<p>The backend, usually in the cloud, is any component that &quot;speaks PPMP&quot; and<br>\nperforms meaningful operations on the incoming messages. Most frequently it<br>\nis responsible for storing the arriving data and making it available to apps<br>\nthat want to consume it. Common responsibilities of these apps are the<br>\nrepresentation or display of the data (e.g. dashboards), or workflows<br>\nmanagement (e.g. the grinding machine is in bad condition and an inspection<br>\nmust be carried out).</p>\n<p>The backend can be swapped effortless with any entity adhering to PPMP standard.<br>\nIn the Eclipse PPM Testbed at least two different backends have been used:</p>\n<ul>\n<li>One directly based on <a href="https://github.com/eclipse/unide">Unide</a></li>\n<li>One based on <a href="https://www.contact-software.com/en/products/elements-for-iot/">CONTACT Elements for IoT</a>.</li>\n</ul>\n</li>\n</ul>\n<h2>Hands-on demonstration</h2>\n<p>In order to make this scenario more hands-on and interesting, within the<br>\n<a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement">Production Performance Management Testbed repository</a> project in Github, we<br>\nhave set up a <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/grinding-machine">subproject for the grinding machine scenario</a>. There you can<br>\nfind a thorough description and code to simulate the device and the gateway,<br>\nand route messages to a given backend. The only requirements are git and conda<br>\n(the easiest way to get conda is to <a href="https://conda.io/miniconda.html">install miniconda</a>).</p>\n<p>So, let\'s get started! First of all, open your terminal and clone the<br>\nrepository:</p>\n<pre class="language-bash"><code class="language-bash">$ <span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement eclipse-testbed-ppm\n$ <span class="token function">cd</span> eclipse-testbed-ppm/grinding-machine\n</code></pre>\n<p>Then move to the grinding machine subproject directory:</p>\n<pre class="language-bash"><code class="language-bash">$ <span class="token function">cd</span> eclipse-testbed-ppm/grinding-machine\n</code></pre>\n<p>In that folder you will see two subfolders. The first one<br>\n<code>unide-grinding-machine</code> contains a Python program that simulates grinding<br>\nmachine and the second one <code>unide-grinding-machine-gateway</code> simulates the<br>\ngateway.</p>\n<h3>Grinding Machine simulator</h3>\n<p>Let\'s start with the first component. First <code>cd</code> to <code>unide-grinding-machine</code><br>\nand then create the conda environment:</p>\n<pre class="language-bash"><code class="language-bash">$ conda <span class="token function">env</span> create --prefix<span class="token operator">=</span>env\n</code></pre>\n<p>And then in order to use this environment, we need to activate it.</p>\n<pre class="language-bash"><code class="language-bash">$ <span class="token function">source</span> activate <span class="token function">env</span> <span class="token comment"># or in windows: activate env </span>\n</code></pre>\n<p>Run <code>unide-grinding-machine -h</code> to get familiar with the CLI. With this<br>\nexecutable we can generate some machine grinding data, and (for the moment)<br>\nprint messages to the console. To do so, run <code>unide-grinding-machine send random</code> and you should get a large message on the console. This is the PPMP<br>\nmessage ought to be sent to the gateway.</p>\n<p>We don\'t have a gateway so far, but don\'t worry, we will get to that in a<br>\nminute. Don\'t close this console!</p>\n<h3>Gateway simulator</h3>\n<p>Open a new console, and similarly to the previous point, first <code>cd</code> to<br>\n<code>unide-grinding-machine-gateway</code>, create the environment (<code>conda env create --prefix=env</code>) and activate it (<code>source activate env</code>).</p>\n<p>The run the command <code>unide-grinding-machine-gateway -h</code> to test that everything<br>\nis in place. You should get the CLI documentation.</p>\n<p>Now, let\'s fire up the gateway by calling <code>unide-grinding-machine-gateway start_server</code>, and a message like this should show up:</p>\n<pre class="language-bash"><code class="language-bash">Running <span class="token operator">&lt;</span>unide_grinding_machine_gateway.server.App object at 0x<span class="token punctuation">..</span><span class="token punctuation">..</span>.<span class="token operator">></span>\nListening on http://127.0.0.1:5000\nPress Ctrl-C to stop<span class="token punctuation">..</span>.\n</code></pre>\n<p>We are getting closer. Leave the gateway running.</p>\n<h3>Communication Device-Gateway</h3>\n<p>Let\'s go back to the previous console where we had the <code>unide-grinding-machine</code><br>\nenvironment and call again the <code>unide-grinding-machine</code> program, but this time<br>\npassing the as an argument where the gateway is listening to messages.</p>\n<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine send random --endpoint<span class="token operator">=</span>http://127.0.0.1:5000\n</code></pre>\n<p>If you take peek at the gateway output, you should see new information printed<br>\nout, which is a PPMP message containing the result of the classification<br>\nalgorithms applied to the device data we just sent to it.</p>\n<p>We are getting somewhere! But still, it is not extremely useful to print some<br>\ncharacters into a console, is it?</p>\n<h3>Communication Device-Gateway-Backend</h3>\n<p>There is only a small but relevant point missing: the routing from the gateway<br>\nto the backend. We need a backend and the Unide project provides a service that<br>\ncan be used as a playground for these purposes. So let\'s restart the gateway,<br>\nthis time passing the Unide endpoint:</p>\n<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine-gateway start_server --endpoint<span class="token operator">=</span>https://unide.eclipse.org/rest/v2\n</code></pre>\n<p>Now we can use the <code>unide-grinding-machine</code> to send raw data to the gateway<br>\nwhich in turn sends its results to the backend. In order to be able to<br>\nidentify this data later, we are going to define a proper device ID (argument<br>\n<code>--device-id</code>), and also tell it to send data once each 10 seconds (argument<br>\n<code>--period</code>):</p>\n<pre class="language-bash"><code class="language-bash">$ unide-grinding-machine send random --endpoint<span class="token operator">=</span>http://127.0.0.1:5000 --device-id<span class="token operator">=</span>IoT-000028--3 --period<span class="token operator">=</span>10\n</code></pre>\n<p>Once started, a continuous flow of data is pumped through each component until<br>\nit reaches the backend, allowing us to use the applications that consume this<br>\ndata. For instance, the basic backend provided by Unide offers a <a href="https://grafana.com/">Grafana</a> based<br>\ndashboard that offers live monitoring of the statistical values calculated in the<br>\ngateway:</p>\n<p><img src="/unide/images/blog/grinding-machine-grafana-dashboard.png" alt="Grafana based dashboard monitoring grinding machine"></p>\n<p>If instead of that we use the the <a href="https://www.contact-software.com/en/products/elements-for-iot/">CONTACT Elements for IoT</a> based backend,<br>\nwe can see a different and richer dashboard: charts, 3D models, list of<br>\nmaintenance events, device master data and the Activity Stream, a place where<br>\ndifferent parties can exchange information related to the grinding machine:</p>\n<p><img src="/unide/images/blog/grinding-machine-ce4iot-dashboard.png" alt="CONTACT Elements for IoT Dashboard"></p>\n',url:"/blog/2018/2/13/grinding-machine-scenario",title:"PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed",date:new Date(151848e7),tags:["use cases"],prev:{url:"/blog/2018/2/11/Transform-PPMP-with-camel",title:"PPMP Use Cases: Simple Transformation with Apache Camel"},next:{url:"/blog/2018/3/26/Release-0.2.0",title:"Unide 0.2.0 released"}}}],error:null,serverRendered:!0}</script><script src="/unide/files/6077783c4c5d0f974706.js" defer></script><script src="/unide/files/c3e469380ccd51a92bb6.js" defer></script><script src="/unide/files/c01c4654e10f48ab3d43.js" defer></script><script src="/unide/files/77dcc0254c88ffffb5bd.js" defer></script>
</body>
</html>