{"id":748,"date":"2016-07-18T12:48:31","date_gmt":"2016-07-18T10:48:31","guid":{"rendered":"http:\/\/www.rocworks.at\/wordpress\/?p=748"},"modified":"2016-08-03T08:33:45","modified_gmt":"2016-08-03T06:33:45","slug":"streaming-complex-event-processing-cep-eplcql-with-wincc-oa","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=748","title":{"rendered":"Streaming &#038; Complex Event Processing (CEP) &#038; EPL\/CQL with WinCC OA&#8230;"},"content":{"rendered":"<p>Complex Event Processing (CEP) and event series analysis are used for detecting situations among events. EsperTech provides the Event Processing Language (EPL) designed for concisely expressing situations and fast execution against both historical and currently-arriving events (<a href=\"http:\/\/www.espertech.com\/\">Espertech.com<\/a>).<\/p>\n<p>The Esper EPL is quite powerful \u2013 details can be found in the Esper <a href=\"http:\/\/www.espertech.com\/esper\/release-5.4.0\/esper-reference\/html\/epl_clauses.html\">documentation<\/a>. Found also some <a href=\"https:\/\/www.uio.no\/studier\/emner\/matnat\/ifi\/INF5100\/h10\/undervisningsmateriale\/Complex%20Event%20Processing%20in%20Esper.pdf\">slides <\/a>about Esper. The EPL is a CQL (continuous query language), after a statement is created it is running coninously and\u00a0results are streamed\u00a0to\u00a0listeners &#8211; in this prototype\u00a0a listener is sending\u00a0the results back to WinCC OA datapoints.<\/p>\n<p>A WinCCOA API-Frontend-Manager gathers all\u00a0value changes from WinCC OA and publishes it by ZeroMQ. The<span style=\"line-height: 1.5;\">\u00a0WinCC OA CEP Manager, with the open source Esper-Engine, subscribes to the Frontend-Manager to get the value changes. The advantage is that many subscribers can be connected to the Frontend-Manager, without increasing the load on the WinCC OA system (based on the ideas from CERN).<\/span><\/p>\n<p>With the WinCC OA CEP Manager we can define\u00a0EPL \/ CQL statements in WinCC OA and the result streams are passed back to WinCC OA on datapoints, where the results can be processed further.<\/p>\n<p>Some simple EPL examples:<\/p>\n<p>Calculate 5 minute <strong>average values<\/strong> with intermediate results every 1 minute:<\/p>\n<pre>select avg(value), min(value), max(value) \r\nfrom event(tag='System1:Meter_Input.Watt').win:time(5 min) \r\noutput snapshot at (*\/1, *, *, *, *)<\/pre>\n<p>With pattern matching complex <strong>event sequences<\/strong> can be observed with EPL. A simple example is: detect if datapoint B is set after datapoint A (A-&gt;B), and its value is higher than the value of A.<\/p>\n<pre>select a.value, b.value\r\nfrom pattern [a=Event(tag='System1:Analog1.Input') -&gt; every b=Event(tag='System1:ExampleDP_Trend1.' and b.value&gt;a.value)]<\/pre>\n<p>Get a notification when a datapoint <strong>is changing more than<\/strong> 100 times within 10 seconds:<\/p>\n<pre>select tag, count(value) \r\nfrom Event.win:time_batch(10 sec) \r\ngroup by tag having count(*) &gt; 100<\/pre>\n<p>Get a notification when a datapoint changes and there is no <strong>following value<\/strong> change within the next 10 seconds. For example: if meters are normally changing every 5 seconds, possible broken meters\/interfaces can be detected with EPL:<\/p>\n<pre>select a.tag, count(*) from pattern \r\n[every a=Event -&gt; (timer:interval(10 sec) and not Event(tag=a.tag))] \r\ngroup by a.tag<\/pre>\n<p>Other examples can be found <a href=\"https:\/\/dzone.com\/articles\/complex-event-processing-made\">here<\/a>.<\/p>\n<p>Attached is a screenshot of a simple panel where EPL statements can be defined and observed.<\/p>\n<p><a href=\"http:\/\/www.rocworks.at\/wordpress\/?attachment_id=749\" rel=\"attachment wp-att-749\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-749\" src=\"http:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2016\/07\/WinCCOA-CEP.png\" alt=\"WinCCOA CEP Panel\" width=\"631\" height=\"626\" srcset=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2016\/07\/WinCCOA-CEP.png 631w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2016\/07\/WinCCOA-CEP-150x150.png 150w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2016\/07\/WinCCOA-CEP-300x298.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/a><\/p>\n<p>Other examples for CEP with Esper:\u00a0<a href=\"http:\/\/www.adrianmilne.com\/complex-event-processing-made-easy\/\">http:\/\/www.adrianmilne.com\/complex-event-processing-made-easy\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Complex Event Processing (CEP) and event series analysis are used for detecting situations among events. EsperTech provides the Event Processing Language (EPL) designed for concisely expressing situations and fast execution against both historical and currently-arriving events (Espertech.com). The Esper EPL is quite powerful \u2013 details can be found in the Esper documentation. Found also some &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=748\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Streaming &#038; Complex Event Processing (CEP) &#038; EPL\/CQL with WinCC OA&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,3],"tags":[],"class_list":["post-748","post","type-post","status-publish","format-standard","hentry","category-bigdatanosql","category-wincc-oa"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=748"}],"version-history":[{"count":7,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions\/760"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}