tests/logging/plc.xml
author Sergey Surkov <surkovsv93@gmail.com>
Tue, 18 Oct 2016 17:44:08 +0300
changeset 1544 2969c2123105
parent 1525 36e912fac70f
child 2296 a2ab363f9e90
permissions -rw-r--r--
Fix bug with two or more wires connected to one input. Now only one wire can be connected to one input, except BOOLean signals in LD and SFC. If user trying to connect wire with already connected input, wire highlight will become red.
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
<?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.&#10;Here are shown two ways of logging:&#10;- from IEC PLC program;&#10;- from python extension.&#10;"/>
  <contentHeader name="Logging example" modificationDateTime="2016-09-09T17:54:15">
    <coordinateInfo>
      <fbd>
        <scaling x="0" y="0"/>
      </fbd>
      <ld>
        <scaling x="0" y="0"/>
      </ld>
      <sfc>
        <scaling x="0" y="0"/>
      </sfc>
    </coordinateInfo>
  </contentHeader>
  <types>
    <dataTypes/>
    <pous>
      <pou name="program0" pouType="program">
        <interface>
          <localVars>
            <variable name="beat">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="count">
              <type>
                <INT/>
              </type>
            </variable>
            <variable name="LOGGER0">
              <type>
                <derived name="LOGGER"/>
              </type>
            </variable>
            <variable name="lvl">
              <type>
                <derived name="LOGLEVEL"/>
              </type>
              <initialValue>
                <simpleValue value="INFO"/>
              </initialValue>
            </variable>
            <variable name="Timer">
              <type>
                <derived name="TOF"/>
              </type>
            </variable>
          </localVars>
        </interface>
        <body>
          <FBD>
            <inVariable localId="2" height="30" width="170" executionOrderId="0" negated="false">
              <position x="507" y="347"/>
              <connectionPointOut>
                <relPosition x="170" y="15"/>
              </connectionPointOut>
              <expression>'IEC side logging: beat #'</expression>
            </inVariable>
            <block localId="3" width="59" height="40" typeName="NOT" executionOrderId="0">
              <position x="241" y="269"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="14" formalParameter="Q">
                      <position x="241" y="299"/>
                      <position x="195" y="299"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="59" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inOutVariable localId="4" height="27" width="51" executionOrderId="0" negatedOut="false" negatedIn="false">
              <position x="66" y="286"/>
              <connectionPointIn>
                <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"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="51" y="13"/>
              </connectionPointOut>
              <expression>beat</expression>
            </inOutVariable>
            <block localId="5" width="68" height="98" typeName="ADD" executionOrderId="0">
              <position x="463" y="385"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <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"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="78"/>
                    <connection refLocalId="6">
                      <position x="463" y="463"/>
                      <position x="444" y="463"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="68" y="39"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inOutVariable localId="6" height="27" width="103" executionOrderId="0" negatedOut="false" negatedIn="false">
              <position x="341" y="450"/>
              <connectionPointIn>
                <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"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="103" y="13"/>
              </connectionPointOut>
              <expression>count</expression>
            </inOutVariable>
            <block localId="8" width="67" height="144" typeName="CONCAT" executionOrderId="0">
              <position x="727" y="311"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="51"/>
                    <connection refLocalId="2">
                      <position x="727" y="362"/>
                      <position x="677" y="362"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="113"/>
                    <connection refLocalId="9" formalParameter="OUT">
                      <position x="727" y="424"/>
                      <position x="677" y="424"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="67" y="51"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="9" width="116" height="40" typeName="INT_TO_STRING" executionOrderId="0">
              <position x="561" y="394"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="5" formalParameter="OUT">
                      <position x="561" y="424"/>
                      <position x="531" y="424"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="116" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="10" width="105" height="40" typeName="BOOL_TO_INT" executionOrderId="0">
              <position x="339" y="394"/>
              <inputVariables>
                <variable formalParameter="IN" edge="rising">
                  <connectionPointIn>
                    <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"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="105" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="11" width="65" height="209" typeName="LOGGER" instanceName="LOGGER0" executionOrderId="0">
              <position x="907" y="248"/>
              <inputVariables>
                <variable formalParameter="TRIG">
                  <connectionPointIn>
                    <relPosition x="0" y="52"/>
                    <connection refLocalId="3" formalParameter="OUT">
                      <position x="907" y="300"/>
                      <position x="300" y="300"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="MSG">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="8" formalParameter="OUT">
                      <position x="907" y="360"/>
                      <position x="794" y="360"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="LEVEL">
                  <connectionPointIn>
                    <relPosition x="0" y="177"/>
                    <connection refLocalId="12">
                      <position x="907" y="425"/>
                      <position x="879" y="425"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="12" height="27" width="79" executionOrderId="0" negated="false">
              <position x="800" y="412"/>
              <connectionPointOut>
                <relPosition x="79" y="13"/>
              </connectionPointOut>
              <expression>lvl</expression>
            </inVariable>
            <block localId="14" typeName="TOF" instanceName="Timer" executionOrderId="0" height="98" width="45">
              <position x="150" y="260"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="39"/>
                    <connection refLocalId="4">
                      <position x="150" y="299"/>
                      <position x="117" y="299"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="PT">
                  <connectionPointIn>
                    <relPosition x="0" y="78"/>
                    <connection refLocalId="1">
                      <position x="150" y="338"/>
                      <position x="117" y="338"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="Q">
                  <connectionPointOut>
                    <relPosition x="45" y="39"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="ET">
                  <connectionPointOut>
                    <relPosition x="45" y="78"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="1" executionOrderId="0" height="24" width="52" negated="false">
              <position x="65" y="326"/>
              <connectionPointOut>
                <relPosition x="52" y="12"/>
              </connectionPointOut>
              <expression>T#3s</expression>
            </inVariable>
            <comment localId="15" height="212" width="675">
              <position x="27" y="16"/>
              <content>
                <xhtml:p><![CDATA[This example shows logging functionality in Beremiz.
Here are shown two ways of logging:
- from IEC PLC program;
- from python extension.

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. 
]]></xhtml:p>
              </content>
            </comment>
          </FBD>
        </body>
      </pou>
    </pous>
  </types>
  <instances>
    <configurations>
      <configuration name="config">
        <resource name="resource1">
          <task name="task0" priority="0" interval="T#100ms">
            <pouInstance name="prg" typeName="program0"/>
          </task>
        </resource>
      </configuration>
    </configurations>
  </instances>
</project>