<?xml version='1.0' encoding='utf-8'?>
<project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Generic PLC" productVersion="1" creationDateTime="2013-01-29T14:01:00" contentDescription="This example shows logging functionality in Beremiz. Here are shown two ways of logging: - from IEC PLC program; - from python extension. "/>
<contentHeader name="Logging example" modificationDateTime="2016-09-09T17:54:15">
<pou name="program0" pouType="program">
<variable name="LOGGER0">
<derived name="LOGLEVEL"/>
<simpleValue value="INFO"/>
<inVariable localId="2" height="30" width="170" executionOrderId="0" negated="false">
<position x="507" y="347"/>
<relPosition x="170" y="15"/>
<expression>'IEC side logging: beat #'</expression>
<block localId="3" width="59" height="40" typeName="NOT" executionOrderId="0">
<position x="241" y="269"/>
<variable formalParameter="IN">
<relPosition x="0" y="30"/>
<connection refLocalId="14" formalParameter="Q">
<position x="241" y="299"/>
<position x="195" y="299"/>
<variable formalParameter="OUT">
<relPosition x="59" y="30"/>
<inOutVariable localId="4" height="27" width="51" executionOrderId="0" negatedOut="false" negatedIn="false">
<position x="66" y="286"/>
<relPosition x="0" y="13"/>
<connection refLocalId="3" formalParameter="OUT">
<position x="66" y="299"/>
<position x="37" y="299"/>
<position x="37" y="372"/>
<position x="314" y="372"/>
<position x="314" y="299"/>
<position x="300" y="299"/>
<relPosition x="51" y="13"/>
<expression>beat</expression>
<block localId="5" width="68" height="98" typeName="ADD" executionOrderId="0">
<position x="463" y="385"/>
<variable formalParameter="IN1">
<relPosition x="0" y="39"/>
<connection refLocalId="10" formalParameter="OUT">
<position x="463" y="424"/>
<position x="452" y="424"/>
<position x="452" y="424"/>
<position x="454" y="424"/>
<position x="454" y="424"/>
<position x="444" y="424"/>
<variable formalParameter="IN2">
<relPosition x="0" y="78"/>
<connection refLocalId="6">
<position x="463" y="463"/>
<position x="444" y="463"/>
<variable formalParameter="OUT">
<relPosition x="68" y="39"/>
<inOutVariable localId="6" height="27" width="103" executionOrderId="0" negatedOut="false" negatedIn="false">
<position x="341" y="450"/>
<relPosition x="0" y="13"/>
<connection refLocalId="5" formalParameter="OUT">
<position x="341" y="463"/>
<position x="320" y="463"/>
<position x="320" y="500"/>
<position x="544" y="500"/>
<position x="544" y="424"/>
<position x="531" y="424"/>
<relPosition x="103" y="13"/>
<expression>count</expression>
<block localId="8" width="67" height="144" typeName="CONCAT" executionOrderId="0">
<position x="727" y="311"/>
<variable formalParameter="IN1">
<relPosition x="0" y="51"/>
<connection refLocalId="2">
<position x="727" y="362"/>
<position x="677" y="362"/>
<variable formalParameter="IN2">
<relPosition x="0" y="113"/>
<connection refLocalId="9" formalParameter="OUT">
<position x="727" y="424"/>
<position x="677" y="424"/>
<variable formalParameter="OUT">
<relPosition x="67" y="51"/>
<block localId="9" width="116" height="40" typeName="INT_TO_STRING" executionOrderId="0">
<position x="561" y="394"/>
<variable formalParameter="IN">
<relPosition x="0" y="30"/>
<connection refLocalId="5" formalParameter="OUT">
<position x="561" y="424"/>
<position x="531" y="424"/>
<variable formalParameter="OUT">
<relPosition x="116" y="30"/>
<block localId="10" width="105" height="40" typeName="BOOL_TO_INT" executionOrderId="0">
<position x="339" y="394"/>
<variable formalParameter="IN" edge="rising">
<relPosition x="0" y="30"/>
<connection refLocalId="3" formalParameter="OUT">
<position x="339" y="424"/>
<position x="314" y="424"/>
<position x="314" y="299"/>
<position x="300" y="299"/>
<variable formalParameter="OUT">
<relPosition x="105" y="30"/>
<block localId="11" width="65" height="209" typeName="LOGGER" instanceName="LOGGER0" executionOrderId="0">
<position x="907" y="248"/>
<variable formalParameter="TRIG">
<relPosition x="0" y="52"/>
<connection refLocalId="3" formalParameter="OUT">
<position x="907" y="300"/>
<position x="300" y="300"/>
<variable formalParameter="MSG">
<relPosition x="0" y="112"/>
<connection refLocalId="8" formalParameter="OUT">
<position x="907" y="360"/>
<position x="794" y="360"/>
<variable formalParameter="LEVEL">
<relPosition x="0" y="177"/>
<connection refLocalId="12">
<position x="907" y="425"/>
<position x="879" y="425"/>
<inVariable localId="12" height="27" width="79" executionOrderId="0" negated="false">
<position x="800" y="412"/>
<relPosition x="79" y="13"/>
<expression>lvl</expression>
<block localId="14" typeName="TOF" instanceName="Timer" executionOrderId="0" height="98" width="45">
<position x="150" y="260"/>
<variable formalParameter="IN">
<relPosition x="0" y="39"/>
<connection refLocalId="4">
<position x="150" y="299"/>
<position x="117" y="299"/>
<variable formalParameter="PT">
<relPosition x="0" y="78"/>
<connection refLocalId="1">
<position x="150" y="338"/>
<position x="117" y="338"/>
<variable formalParameter="Q">
<relPosition x="45" y="39"/>
<variable formalParameter="ET">
<relPosition x="45" y="78"/>
<inVariable localId="1" executionOrderId="0" height="24" width="52" negated="false">
<position x="65" y="326"/>
<relPosition x="52" y="12"/>
<expression>T#3s</expression>
<comment localId="15" height="212" width="675">
<position x="27" y="16"/>
<xhtml:p><![CDATA[This example shows logging functionality in Beremiz.
Here are shown two ways of logging:
In IEC PLC program every third second (beat) new message is generated and put in PLC log.
See function blocks below.
Every 15 seconds status of PLC program is put in PLC log from python extension.
For more information about logging from python look at 0.x: py_ext_0 implementation in project tree.
<configuration name="config">
<resource name="resource1">
<task name="task0" priority="0" interval="T#100ms">
<pouInstance name="prg" typeName="program0"/>