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