tests/traffic_lights/plc.xml
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Apr 2016 13:05:57 +0300
changeset 1507 d7f474d10210
parent 1383 45935812f930
child 1546 f1840d27823d
permissions -rw-r--r--
fix issue with sometimes wrong return code of ProcessLogger


As a result of wrong return code Beremiz gives folowing traceback:
Traceback (most recent call last):
File "./Beremiz.py", line 850, in OnMenu
getattr(self.CTR, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 925, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 568, in _Generate_SoftPLC
return self._Compile_ST_to_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 661, in _Compile_ST_to_SoftPLC
C_files.remove("POUS.c")
ValueError: list.remove(x): x not in list

The problem is that both threads (for reading stdout and stderr) call self.Proc.poll(),
that updates internal returncode field. This call is done without any locking and the first thread gets correct result,
but other gets 0 as retval. If 0 gets thread, that afterwards calls callback finish, then wrong return code is returned
to the parent. Now only the thread with a callback polls for the return code, other thread just checked local value.

Additionally function spin() waits now until all threads finish reading their pipes, so the results are always correct.
<?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="Unnamed" productVersion="1" creationDateTime="2012-09-04T16:16:33"/>
  <contentHeader name="traffic_lights" modificationDateTime="2013-12-06T12:19:16">
    <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="traffic_light_sequence" pouType="functionBlock">
        <interface>
          <inputVars>
            <variable name="SWITCH_BUTTON">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="PEDESTRIAN_BUTTON">
              <type>
                <BOOL/>
              </type>
            </variable>
          </inputVars>
          <outputVars>
            <variable name="RED_LIGHT">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="ORANGE_LIGHT">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="GREEN_LIGHT">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="PEDESTRIAN_RED_LIGHT">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="PEDESTRIAN_GREEN_LIGHT">
              <type>
                <BOOL/>
              </type>
            </variable>
          </outputVars>
          <localVars>
            <variable name="TON1">
              <type>
                <derived name="TON"/>
              </type>
            </variable>
            <variable name="TON2">
              <type>
                <derived name="TON"/>
              </type>
            </variable>
            <variable name="ALLOW_CARS">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="WARN_CARS">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="STOP_CARS">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="ALLOW_PEDESTRIANS">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="STOP_PEDESTRIANS">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="TON3">
              <type>
                <derived name="TON"/>
              </type>
            </variable>
            <variable name="R_TRIG0">
              <type>
                <derived name="R_TRIG"/>
              </type>
            </variable>
            <variable name="R_TRIG1">
              <type>
                <derived name="R_TRIG"/>
              </type>
            </variable>
            <variable name="SR0">
              <type>
                <derived name="SR"/>
              </type>
            </variable>
          </localVars>
        </interface>
        <actions>
          <action name="BLINK_ORANGE_LIGHT">
            <body>
              <LD>
                <leftPowerRail localId="1" height="40" width="2">
                  <position x="54" y="123"/>
                  <connectionPointOut formalParameter="">
                    <relPosition x="2" y="20"/>
                  </connectionPointOut>
                </leftPowerRail>
                <contact localId="2" height="15" width="21" negated="true">
                  <position x="121" y="135"/>
                  <connectionPointIn>
                    <relPosition x="0" y="8"/>
                    <connection refLocalId="1">
                      <position x="121" y="143"/>
                      <position x="56" y="143"/>
                    </connection>
                  </connectionPointIn>
                  <connectionPointOut>
                    <relPosition x="21" y="8"/>
                  </connectionPointOut>
                  <variable>ORANGE_LIGHT</variable>
                </contact>
                <block localId="3" width="97" height="102" typeName="TON" instanceName="TON1">
                  <position x="216" y="103"/>
                  <inputVariables>
                    <variable formalParameter="IN">
                      <connectionPointIn>
                        <relPosition x="0" y="40"/>
                        <connection refLocalId="2">
                          <position x="216" y="143"/>
                          <position x="142" y="143"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                    <variable formalParameter="PT">
                      <connectionPointIn>
                        <relPosition x="0" y="81"/>
                        <connection refLocalId="4">
                          <position x="216" y="184"/>
                          <position x="151" y="184"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                  </inputVariables>
                  <inOutVariables/>
                  <outputVariables>
                    <variable formalParameter="Q">
                      <connectionPointOut>
                        <relPosition x="97" y="40"/>
                      </connectionPointOut>
                    </variable>
                    <variable formalParameter="ET">
                      <connectionPointOut>
                        <relPosition x="97" y="81"/>
                      </connectionPointOut>
                    </variable>
                  </outputVariables>
                </block>
                <inVariable localId="4" height="27" width="72">
                  <position x="79" y="171"/>
                  <connectionPointOut>
                    <relPosition x="72" y="13"/>
                  </connectionPointOut>
                  <expression>T#500ms</expression>
                </inVariable>
                <block localId="5" width="97" height="106" typeName="TON" instanceName="TON2">
                  <position x="216" y="251"/>
                  <inputVariables>
                    <variable formalParameter="IN">
                      <connectionPointIn>
                        <relPosition x="0" y="41"/>
                        <connection refLocalId="14">
                          <position x="216" y="292"/>
                          <position x="155" y="292"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                    <variable formalParameter="PT">
                      <connectionPointIn>
                        <relPosition x="0" y="84"/>
                        <connection refLocalId="15">
                          <position x="216" y="335"/>
                          <position x="162" y="335"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                  </inputVariables>
                  <inOutVariables/>
                  <outputVariables>
                    <variable formalParameter="Q">
                      <connectionPointOut>
                        <relPosition x="97" y="41"/>
                      </connectionPointOut>
                    </variable>
                    <variable formalParameter="ET">
                      <connectionPointOut>
                        <relPosition x="97" y="84"/>
                      </connectionPointOut>
                    </variable>
                  </outputVariables>
                </block>
                <coil localId="6" height="15" width="21" storage="reset">
                  <position x="517" y="284"/>
                  <connectionPointIn>
                    <relPosition x="0" y="8"/>
                    <connection refLocalId="10" formalParameter="Q">
                      <position x="517" y="292"/>
                      <position x="427" y="292"/>
                    </connection>
                  </connectionPointIn>
                  <connectionPointOut>
                    <relPosition x="21" y="8"/>
                  </connectionPointOut>
                  <variable>ORANGE_LIGHT</variable>
                </coil>
                <rightPowerRail localId="7" height="40" width="2">
                  <position x="598" y="123"/>
                  <connectionPointIn>
                    <relPosition x="0" y="20"/>
                    <connection refLocalId="8">
                      <position x="598" y="143"/>
                      <position x="530" y="143"/>
                    </connection>
                  </connectionPointIn>
                </rightPowerRail>
                <coil localId="8" height="15" width="21" storage="set">
                  <position x="509" y="135"/>
                  <connectionPointIn>
                    <relPosition x="0" y="8"/>
                    <connection refLocalId="11" formalParameter="Q">
                      <position x="509" y="143"/>
                      <position x="428" y="143"/>
                    </connection>
                  </connectionPointIn>
                  <connectionPointOut>
                    <relPosition x="21" y="8"/>
                  </connectionPointOut>
                  <variable>ORANGE_LIGHT</variable>
                </coil>
                <comment localId="9" height="39" width="308">
                  <position x="54" y="26"/>
                  <content>
                    <xhtml:p><![CDATA[This action makes the orange light blink]]></xhtml:p>
                  </content>
                </comment>
                <block localId="10" width="57" height="40" typeName="R_TRIG" instanceName="R_TRIG0">
                  <position x="370" y="262"/>
                  <inputVariables>
                    <variable formalParameter="CLK">
                      <connectionPointIn>
                        <relPosition x="0" y="30"/>
                        <connection refLocalId="5" formalParameter="Q">
                          <position x="370" y="292"/>
                          <position x="313" y="292"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                  </inputVariables>
                  <inOutVariables/>
                  <outputVariables>
                    <variable formalParameter="Q">
                      <connectionPointOut>
                        <relPosition x="57" y="30"/>
                      </connectionPointOut>
                    </variable>
                  </outputVariables>
                </block>
                <block localId="11" width="57" height="40" typeName="R_TRIG" instanceName="R_TRIG1">
                  <position x="371" y="113"/>
                  <inputVariables>
                    <variable formalParameter="CLK">
                      <connectionPointIn>
                        <relPosition x="0" y="30"/>
                        <connection refLocalId="3" formalParameter="Q">
                          <position x="371" y="143"/>
                          <position x="313" y="143"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                  </inputVariables>
                  <inOutVariables/>
                  <outputVariables>
                    <variable formalParameter="Q">
                      <connectionPointOut>
                        <relPosition x="57" y="30"/>
                      </connectionPointOut>
                    </variable>
                  </outputVariables>
                </block>
                <rightPowerRail localId="12" height="40" width="2">
                  <position x="597" y="272"/>
                  <connectionPointIn>
                    <relPosition x="0" y="20"/>
                    <connection refLocalId="6">
                      <position x="597" y="292"/>
                      <position x="538" y="292"/>
                    </connection>
                  </connectionPointIn>
                </rightPowerRail>
                <leftPowerRail localId="13" height="40" width="2">
                  <position x="67" y="272"/>
                  <connectionPointOut formalParameter="">
                    <relPosition x="2" y="20"/>
                  </connectionPointOut>
                </leftPowerRail>
                <contact localId="14" height="15" width="21">
                  <position x="134" y="284"/>
                  <connectionPointIn>
                    <relPosition x="0" y="8"/>
                    <connection refLocalId="13">
                      <position x="134" y="292"/>
                      <position x="69" y="292"/>
                    </connection>
                  </connectionPointIn>
                  <connectionPointOut>
                    <relPosition x="21" y="8"/>
                  </connectionPointOut>
                  <variable>ORANGE_LIGHT</variable>
                </contact>
                <inVariable localId="15" height="27" width="72">
                  <position x="90" y="322"/>
                  <connectionPointOut>
                    <relPosition x="72" y="13"/>
                  </connectionPointOut>
                  <expression>T#500ms</expression>
                </inVariable>
              </LD>
            </body>
          </action>
        </actions>
        <transitions>
          <transition name="STOP">
            <body>
              <FBD>
                <block localId="42" width="59" height="40" typeName="NOT">
                  <position x="230" y="40"/>
                  <inputVariables>
                    <variable formalParameter="IN">
                      <connectionPointIn>
                        <relPosition x="0" y="30"/>
                        <connection refLocalId="43">
                          <position x="230" y="70"/>
                          <position x="202" y="70"/>
                        </connection>
                      </connectionPointIn>
                    </variable>
                  </inputVariables>
                  <inOutVariables/>
                  <outputVariables>
                    <variable formalParameter="OUT">
                      <connectionPointOut>
                        <relPosition x="59" y="30"/>
                      </connectionPointOut>
                    </variable>
                  </outputVariables>
                </block>
                <inVariable localId="43" height="27" width="156">
                  <position x="46" y="57"/>
                  <connectionPointOut>
                    <relPosition x="156" y="13"/>
                  </connectionPointOut>
                  <expression>SWITCH_BUTTON</expression>
                </inVariable>
                <outVariable localId="44" height="27" width="46">
                  <position x="351" y="57"/>
                  <connectionPointIn>
                    <relPosition x="0" y="13"/>
                    <connection refLocalId="42" formalParameter="OUT">
                      <position x="351" y="70"/>
                      <position x="289" y="70"/>
                    </connection>
                  </connectionPointIn>
                  <expression>STOP</expression>
                </outVariable>
              </FBD>
            </body>
          </transition>
        </transitions>
        <body>
          <SFC>
            <step localId="1" height="37" width="78" name="Standstill" initialStep="true">
              <position x="530" y="31"/>
              <connectionPointIn>
                <relPosition x="39" y="0"/>
                <connection refLocalId="39">
                  <position x="569" y="31"/>
                  <position x="569" y="11"/>
                  <position x="1016" y="11"/>
                  <position x="1016" y="1151"/>
                  <position x="776" y="1151"/>
                  <position x="776" y="1097"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="39" y="37"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="78" y="18"/>
              </connectionPointOutAction>
            </step>
            <transition localId="2" height="2" width="20">
              <position x="559" y="225"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="1">
                  <position x="569" y="225"/>
                  <position x="569" y="68"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[SWITCH_BUTTON]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <step localId="3" height="27" width="69" name="ORANGE">
              <position x="535" y="252"/>
              <connectionPointIn>
                <relPosition x="34" y="0"/>
                <connection refLocalId="2">
                  <position x="569" y="252"/>
                  <position x="569" y="227"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="34" y="27"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="69" y="13"/>
              </connectionPointOutAction>
            </step>
            <transition localId="6" height="2" width="20">
              <position x="559" y="376"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="15">
                  <position x="569" y="376"/>
                  <position x="569" y="336"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[STOP_CARS]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <actionBlock localId="8" width="231" height="162">
              <position x="711" y="34"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="1">
                  <position x="711" y="49"/>
                  <position x="608" y="49"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="P">
                <relPosition x="0" y="0"/>
                <inline>
                  <ST>
                    <xhtml:p><![CDATA[ORANGE_LIGHT := 1;]]></xhtml:p>
                  </ST>
                </inline>
              </action>
              <action localId="0">
                <relPosition x="0" y="0"/>
                <reference name="BLINK_ORANGE_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_GREEN_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="GREEN_LIGHT"/>
              </action>
            </actionBlock>
            <actionBlock localId="9" width="219" height="125">
              <position x="711" y="250"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="3">
                  <position x="711" y="265"/>
                  <position x="604" y="265"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="GREEN_LIGHT"/>
              </action>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="ORANGE_LIGHT"/>
              </action>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="D" duration="T#2s">
                <relPosition x="0" y="0"/>
                <reference name="STOP_CARS"/>
              </action>
            </actionBlock>
            <step localId="10" height="34" width="37" name="RED">
              <position x="551" y="411"/>
              <connectionPointIn>
                <relPosition x="18" y="0"/>
                <connection refLocalId="6">
                  <position x="569" y="411"/>
                  <position x="569" y="378"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="18" y="34"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="37" y="17"/>
              </connectionPointOutAction>
            </step>
            <actionBlock localId="11" width="203" height="103">
              <position x="710" y="413"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="10">
                  <position x="710" y="428"/>
                  <position x="588" y="428"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="ORANGE_LIGHT"/>
              </action>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="D" duration="T#2s">
                <relPosition x="0" y="0"/>
                <reference name="ALLOW_PEDESTRIANS"/>
              </action>
            </actionBlock>
            <transition localId="12" height="2" width="20">
              <position x="559" y="533"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="7">
                  <position x="569" y="533"/>
                  <position x="569" y="487"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[ALLOW_PEDESTRIANS]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <selectionDivergence localId="15" height="1" width="154">
              <position x="415" y="335"/>
              <connectionPointIn>
                <relPosition x="154" y="0"/>
                <connection refLocalId="3">
                  <position x="569" y="335"/>
                  <position x="569" y="279"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="0" y="1"/>
              </connectionPointOut>
              <connectionPointOut formalParameter="">
                <relPosition x="154" y="1"/>
              </connectionPointOut>
            </selectionDivergence>
            <transition localId="16" height="2" width="20">
              <position x="405" y="377"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="15">
                  <position x="415" y="377"/>
                  <position x="415" y="336"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <reference name="STOP"/>
              </condition>
            </transition>
            <jumpStep localId="17" height="13" width="12" targetName="Standstill">
              <position x="409" y="418"/>
              <connectionPointIn>
                <relPosition x="6" y="0"/>
                <connection refLocalId="16">
                  <position x="415" y="418"/>
                  <position x="415" y="379"/>
                </connection>
              </connectionPointIn>
            </jumpStep>
            <transition localId="4" height="2" width="20">
              <position x="400" y="528"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="7">
                  <position x="410" y="528"/>
                  <position x="410" y="487"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <reference name="STOP"/>
              </condition>
            </transition>
            <jumpStep localId="5" height="13" width="12" targetName="Standstill">
              <position x="404" y="569"/>
              <connectionPointIn>
                <relPosition x="6" y="0"/>
                <connection refLocalId="4">
                  <position x="410" y="569"/>
                  <position x="410" y="530"/>
                </connection>
              </connectionPointIn>
            </jumpStep>
            <selectionDivergence localId="7" height="1" width="159">
              <position x="410" y="486"/>
              <connectionPointIn>
                <relPosition x="159" y="0"/>
                <connection refLocalId="10">
                  <position x="569" y="486"/>
                  <position x="569" y="445"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="0" y="1"/>
              </connectionPointOut>
              <connectionPointOut formalParameter="">
                <relPosition x="159" y="1"/>
              </connectionPointOut>
            </selectionDivergence>
            <step localId="18" height="27" width="148" name="PEDESTRIAN_GREEN">
              <position x="495" y="575"/>
              <connectionPointIn>
                <relPosition x="74" y="0"/>
                <connection refLocalId="12">
                  <position x="569" y="575"/>
                  <position x="569" y="535"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="74" y="27"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="148" y="13"/>
              </connectionPointOutAction>
            </step>
            <actionBlock localId="19" width="246" height="110">
              <position x="708" y="573"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="18">
                  <position x="708" y="588"/>
                  <position x="643" y="588"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_GREEN_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="D" duration="T#10s">
                <relPosition x="0" y="0"/>
                <reference name="STOP_PEDESTRIANS"/>
              </action>
            </actionBlock>
            <transition localId="20" height="2" width="20">
              <position x="400" y="653"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="22">
                  <position x="410" y="653"/>
                  <position x="410" y="626"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <reference name="STOP"/>
              </condition>
            </transition>
            <jumpStep localId="21" height="13" width="12" targetName="Standstill">
              <position x="404" y="694"/>
              <connectionPointIn>
                <relPosition x="6" y="0"/>
                <connection refLocalId="20">
                  <position x="410" y="694"/>
                  <position x="410" y="655"/>
                </connection>
              </connectionPointIn>
            </jumpStep>
            <selectionDivergence localId="22" height="1" width="159">
              <position x="410" y="625"/>
              <connectionPointIn>
                <relPosition x="159" y="0"/>
                <connection refLocalId="18">
                  <position x="569" y="625"/>
                  <position x="569" y="602"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="0" y="1"/>
              </connectionPointOut>
              <connectionPointOut formalParameter="">
                <relPosition x="159" y="1"/>
              </connectionPointOut>
            </selectionDivergence>
            <transition localId="23" height="2" width="20">
              <position x="559" y="709"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="22">
                  <position x="569" y="709"/>
                  <position x="569" y="626"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[STOP_PEDESTRIANS]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <step localId="24" height="27" width="148" name="PEDESTRIAN_RED">
              <position x="495" y="750"/>
              <connectionPointIn>
                <relPosition x="74" y="0"/>
                <connection refLocalId="23">
                  <position x="569" y="750"/>
                  <position x="569" y="711"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="74" y="27"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="148" y="13"/>
              </connectionPointOutAction>
            </step>
            <actionBlock localId="25" width="238" height="110">
              <position x="708" y="748"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="24">
                  <position x="708" y="763"/>
                  <position x="643" y="763"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="PEDESTRIAN_GREEN_LIGHT"/>
              </action>
              <action localId="0" qualifier="D" duration="T#2s">
                <relPosition x="0" y="0"/>
                <reference name="ALLOW_CARS"/>
              </action>
            </actionBlock>
            <transition localId="26" height="2" width="20">
              <position x="400" y="857"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="28">
                  <position x="410" y="857"/>
                  <position x="410" y="816"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <reference name="STOP"/>
              </condition>
            </transition>
            <jumpStep localId="27" height="13" width="12" targetName="Standstill">
              <position x="404" y="898"/>
              <connectionPointIn>
                <relPosition x="6" y="0"/>
                <connection refLocalId="26">
                  <position x="410" y="898"/>
                  <position x="410" y="859"/>
                </connection>
              </connectionPointIn>
            </jumpStep>
            <selectionDivergence localId="28" height="1" width="159">
              <position x="410" y="815"/>
              <connectionPointIn>
                <relPosition x="159" y="0"/>
                <connection refLocalId="24">
                  <position x="569" y="815"/>
                  <position x="569" y="777"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="0" y="1"/>
              </connectionPointOut>
              <connectionPointOut formalParameter="">
                <relPosition x="159" y="1"/>
              </connectionPointOut>
            </selectionDivergence>
            <transition localId="29" height="2" width="20">
              <position x="559" y="879"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="28">
                  <position x="569" y="879"/>
                  <position x="569" y="816"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[ALLOW_CARS]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <step localId="30" height="27" width="56" name="GREEN">
              <position x="541" y="933"/>
              <connectionPointIn>
                <relPosition x="28" y="0"/>
                <connection refLocalId="29">
                  <position x="569" y="933"/>
                  <position x="569" y="881"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="28" y="27"/>
              </connectionPointOut>
              <connectionPointOutAction formalParameter="">
                <relPosition x="56" y="13"/>
              </connectionPointOutAction>
            </step>
            <actionBlock localId="31" width="154" height="110">
              <position x="709" y="931"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="30">
                  <position x="709" y="946"/>
                  <position x="597" y="946"/>
                </connection>
              </connectionPointIn>
              <action localId="0" qualifier="S">
                <relPosition x="0" y="0"/>
                <reference name="GREEN_LIGHT"/>
              </action>
              <action localId="0" qualifier="R">
                <relPosition x="0" y="0"/>
                <reference name="RED_LIGHT"/>
              </action>
              <action localId="0" qualifier="D" duration="T#20s">
                <relPosition x="0" y="0"/>
                <reference name="WARN_CARS"/>
              </action>
            </actionBlock>
            <block localId="32" width="89" height="94" typeName="TON" instanceName="TON3">
              <position x="308" y="1053"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="44" formalParameter="Q1">
                      <position x="308" y="1091"/>
                      <position x="291" y="1091"/>
                      <position x="291" y="1065"/>
                      <position x="274" y="1065"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="PT">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="34">
                      <position x="308" y="1128"/>
                      <position x="270" y="1128"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="Q">
                  <connectionPointOut>
                    <relPosition x="89" y="38"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="ET">
                  <connectionPointOut>
                    <relPosition x="89" y="75"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="33" height="27" width="159">
              <position x="24" y="1052"/>
              <connectionPointOut>
                <relPosition x="159" y="13"/>
              </connectionPointOut>
              <expression>PEDESTRIAN_BUTTON</expression>
            </inVariable>
            <inVariable localId="34" height="27" width="43">
              <position x="227" y="1115"/>
              <connectionPointOut>
                <relPosition x="43" y="13"/>
              </connectionPointOut>
              <expression>T#2s</expression>
            </inVariable>
            <block localId="35" width="67" height="60" typeName="OR">
              <position x="459" y="1061"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="32" formalParameter="Q">
                      <position x="459" y="1091"/>
                      <position x="397" y="1091"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="36">
                      <position x="459" y="1111"/>
                      <position x="427" y="1111"/>
                      <position x="427" y="1195"/>
                      <position x="260" y="1195"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="67" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="36" height="27" width="97">
              <position x="163" y="1182"/>
              <connectionPointOut>
                <relPosition x="97" y="13"/>
              </connectionPointOut>
              <expression>WARN_CARS</expression>
            </inVariable>
            <transition localId="37" height="2" width="20">
              <position x="559" y="1090"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="38">
                  <position x="569" y="1090"/>
                  <position x="569" y="1060"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <connectionPointIn>
                  <connection refLocalId="35" formalParameter="OUT">
                    <position x="559" y="1091"/>
                    <position x="526" y="1091"/>
                  </connection>
                </connectionPointIn>
              </condition>
            </transition>
            <selectionDivergence localId="38" height="1" width="207">
              <position x="569" y="1059"/>
              <connectionPointIn>
                <relPosition x="0" y="0"/>
                <connection refLocalId="30">
                  <position x="569" y="1059"/>
                  <position x="569" y="960"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut formalParameter="">
                <relPosition x="0" y="1"/>
              </connectionPointOut>
              <connectionPointOut formalParameter="">
                <relPosition x="207" y="1"/>
              </connectionPointOut>
            </selectionDivergence>
            <transition localId="39" height="2" width="20">
              <position x="766" y="1095"/>
              <connectionPointIn>
                <relPosition x="10" y="0"/>
                <connection refLocalId="38">
                  <position x="776" y="1095"/>
                  <position x="776" y="1060"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="10" y="2"/>
              </connectionPointOut>
              <condition>
                <inline name="">
                  <ST>
                    <xhtml:p><![CDATA[NOT SWITCH_BUTTON]]></xhtml:p>
                  </ST>
                </inline>
              </condition>
            </transition>
            <jumpStep localId="41" height="13" width="12" targetName="ORANGE">
              <position x="563" y="1137"/>
              <connectionPointIn>
                <relPosition x="6" y="0"/>
                <connection refLocalId="37">
                  <position x="569" y="1137"/>
                  <position x="569" y="1092"/>
                </connection>
              </connectionPointIn>
            </jumpStep>
            <block localId="44" width="50" height="60" typeName="SR" instanceName="SR0">
              <position x="224" y="1035"/>
              <inputVariables>
                <variable formalParameter="S1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="33">
                      <position x="224" y="1065"/>
                      <position x="183" y="1065"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="R">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="32" formalParameter="Q">
                      <position x="224" y="1085"/>
                      <position x="203" y="1085"/>
                      <position x="203" y="1167"/>
                      <position x="416" y="1167"/>
                      <position x="416" y="1091"/>
                      <position x="397" y="1091"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="Q1">
                  <connectionPointOut>
                    <relPosition x="50" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
          </SFC>
        </body>
      </pou>
      <pou name="main_program" pouType="program">
        <interface>
          <localVars>
            <variable name="trafic_light_sequence0">
              <type>
                <derived name="traffic_light_sequence"/>
              </type>
            </variable>
            <variable name="SwitchButton">
              <type>
                <derived name="Button"/>
              </type>
            </variable>
            <variable name="PedestrianButton">
              <type>
                <derived name="Button"/>
              </type>
            </variable>
            <variable name="RedLight">
              <type>
                <derived name="Led"/>
              </type>
            </variable>
            <variable name="OrangeLight">
              <type>
                <derived name="Led"/>
              </type>
            </variable>
            <variable name="GreenLight">
              <type>
                <derived name="Led"/>
              </type>
            </variable>
            <variable name="PedestrianRedLight">
              <type>
                <derived name="Led"/>
              </type>
            </variable>
            <variable name="PedestrianGreenLight">
              <type>
                <derived name="Led"/>
              </type>
            </variable>
            <variable name="TEST_DATE">
              <type>
                <DATE/>
              </type>
              <initialValue>
                <simpleValue value="D#2012-12-03"/>
              </initialValue>
            </variable>
            <variable name="RESULT_STRING">
              <type>
                <string/>
              </type>
            </variable>
            <variable name="TEST_STRING">
              <type>
                <string/>
              </type>
              <initialValue>
                <simpleValue value="TOTO"/>
              </initialValue>
            </variable>
            <variable name="TEST_ULINT">
              <type>
                <ULINT/>
              </type>
            </variable>
            <variable name="RESULT_INT">
              <type>
                <INT/>
              </type>
            </variable>
            <variable name="RESULT_BYTE">
              <type>
                <BYTE/>
              </type>
            </variable>
          </localVars>
        </interface>
        <body>
          <FBD>
            <block localId="1" width="349" height="836" typeName="traffic_light_sequence" instanceName="trafic_light_sequence0">
              <position x="470" y="127"/>
              <inputVariables>
                <variable formalParameter="SWITCH_BUTTON">
                  <connectionPointIn>
                    <relPosition x="0" y="101"/>
                    <connection refLocalId="2" formalParameter="state_out">
                      <position x="470" y="228"/>
                      <position x="401" y="228"/>
                      <position x="401" y="177"/>
                      <position x="333" y="177"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="PEDESTRIAN_BUTTON">
                  <connectionPointIn>
                    <relPosition x="0" y="264"/>
                    <connection refLocalId="3" formalParameter="state_out">
                      <position x="470" y="391"/>
                      <position x="335" y="391"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="RED_LIGHT">
                  <connectionPointOut>
                    <relPosition x="349" y="101"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="ORANGE_LIGHT">
                  <connectionPointOut>
                    <relPosition x="349" y="264"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="GREEN_LIGHT">
                  <connectionPointOut>
                    <relPosition x="349" y="427"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="PEDESTRIAN_RED_LIGHT">
                  <connectionPointOut>
                    <relPosition x="349" y="590"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="PEDESTRIAN_GREEN_LIGHT">
                  <connectionPointOut>
                    <relPosition x="349" y="753"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="2" width="143" height="183" typeName="Button" instanceName="SwitchButton">
              <position x="190" y="141"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="36"/>
                    <connection refLocalId="5">
                      <position x="190" y="177"/>
                      <position x="136" y="177"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="68"/>
                    <connection refLocalId="6">
                      <position x="190" y="209"/>
                      <position x="136" y="209"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="toggle">
                  <connectionPointIn>
                    <relPosition x="0" y="100"/>
                    <connection refLocalId="4">
                      <position x="190" y="241"/>
                      <position x="136" y="241"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="set_state">
                  <connectionPointIn>
                    <relPosition x="0" y="132"/>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="164"/>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="state_out">
                  <connectionPointOut>
                    <relPosition x="143" y="36"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="3" width="143" height="198" typeName="Button" instanceName="PedestrianButton">
              <position x="192" y="354"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="37"/>
                    <connection refLocalId="7">
                      <position x="192" y="391"/>
                      <position x="159" y="391"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="72"/>
                    <connection refLocalId="8">
                      <position x="192" y="426"/>
                      <position x="159" y="426"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="toggle">
                  <connectionPointIn>
                    <relPosition x="0" y="107"/>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="set_state">
                  <connectionPointIn>
                    <relPosition x="0" y="142"/>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="177"/>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="state_out">
                  <connectionPointOut>
                    <relPosition x="143" y="37"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="4" height="27" width="18">
              <position x="118" y="228"/>
              <connectionPointOut>
                <relPosition x="18" y="13"/>
              </connectionPointOut>
              <expression>1</expression>
            </inVariable>
            <inVariable localId="5" height="27" width="105">
              <position x="31" y="164"/>
              <connectionPointOut>
                <relPosition x="105" y="13"/>
              </connectionPointOut>
              <expression>'SWITCH_OFF'</expression>
            </inVariable>
            <inVariable localId="6" height="27" width="105">
              <position x="31" y="196"/>
              <connectionPointOut>
                <relPosition x="105" y="13"/>
              </connectionPointOut>
              <expression>'SWITCH_ON'</expression>
            </inVariable>
            <inVariable localId="7" height="27" width="137">
              <position x="22" y="378"/>
              <connectionPointOut>
                <relPosition x="137" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_OFF'</expression>
            </inVariable>
            <inVariable localId="8" height="27" width="137">
              <position x="22" y="413"/>
              <connectionPointOut>
                <relPosition x="137" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_ON'</expression>
            </inVariable>
            <block localId="9" width="115" height="133" typeName="Led" instanceName="RedLight">
              <position x="1057" y="116"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="10">
                      <position x="1057" y="154"/>
                      <position x="1010" y="154"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="11">
                      <position x="1057" y="191"/>
                      <position x="1010" y="191"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="1" formalParameter="RED_LIGHT">
                      <position x="1057" y="228"/>
                      <position x="819" y="228"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="10" height="27" width="79">
              <position x="931" y="141"/>
              <connectionPointOut>
                <relPosition x="79" y="13"/>
              </connectionPointOut>
              <expression>'RED_OFF'</expression>
            </inVariable>
            <inVariable localId="11" height="27" width="79">
              <position x="931" y="178"/>
              <connectionPointOut>
                <relPosition x="79" y="13"/>
              </connectionPointOut>
              <expression>'RED_ON'</expression>
            </inVariable>
            <block localId="12" width="115" height="133" typeName="Led" instanceName="OrangeLight">
              <position x="1058" y="279"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="13">
                      <position x="1058" y="317"/>
                      <position x="1010" y="317"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="14">
                      <position x="1058" y="354"/>
                      <position x="1010" y="354"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="1" formalParameter="ORANGE_LIGHT">
                      <position x="1058" y="391"/>
                      <position x="819" y="391"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="13" height="27" width="111">
              <position x="899" y="304"/>
              <connectionPointOut>
                <relPosition x="111" y="13"/>
              </connectionPointOut>
              <expression>'ORANGE_OFF'</expression>
            </inVariable>
            <inVariable localId="14" height="27" width="106">
              <position x="904" y="341"/>
              <connectionPointOut>
                <relPosition x="106" y="13"/>
              </connectionPointOut>
              <expression>'ORANGE_ON'</expression>
            </inVariable>
            <block localId="15" width="115" height="133" typeName="Led" instanceName="GreenLight">
              <position x="1058" y="442"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="16">
                      <position x="1058" y="480"/>
                      <position x="1010" y="480"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="17">
                      <position x="1058" y="517"/>
                      <position x="1010" y="517"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="1" formalParameter="GREEN_LIGHT">
                      <position x="1058" y="554"/>
                      <position x="819" y="554"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="16" height="27" width="111">
              <position x="899" y="467"/>
              <connectionPointOut>
                <relPosition x="111" y="13"/>
              </connectionPointOut>
              <expression>'GREEN_OFF'</expression>
            </inVariable>
            <inVariable localId="17" height="27" width="106">
              <position x="904" y="504"/>
              <connectionPointOut>
                <relPosition x="106" y="13"/>
              </connectionPointOut>
              <expression>'GREEN_ON'</expression>
            </inVariable>
            <block localId="18" width="115" height="133" typeName="Led" instanceName="PedestrianRedLight">
              <position x="1059" y="605"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="19">
                      <position x="1059" y="643"/>
                      <position x="1020" y="643"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="20">
                      <position x="1059" y="680"/>
                      <position x="1020" y="680"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="1" formalParameter="PEDESTRIAN_RED_LIGHT">
                      <position x="1059" y="717"/>
                      <position x="819" y="717"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="19" height="27" width="171">
              <position x="849" y="630"/>
              <connectionPointOut>
                <relPosition x="171" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_RED_OFF'</expression>
            </inVariable>
            <inVariable localId="20" height="27" width="166">
              <position x="854" y="667"/>
              <connectionPointOut>
                <relPosition x="166" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_RED_ON'</expression>
            </inVariable>
            <block localId="21" width="115" height="133" typeName="Led" instanceName="PedestrianGreenLight">
              <position x="1059" y="768"/>
              <inputVariables>
                <variable formalParameter="back_id">
                  <connectionPointIn>
                    <relPosition x="0" y="38"/>
                    <connection refLocalId="22">
                      <position x="1059" y="806"/>
                      <position x="1035" y="806"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="sele_id">
                  <connectionPointIn>
                    <relPosition x="0" y="75"/>
                    <connection refLocalId="23">
                      <position x="1059" y="843"/>
                      <position x="1035" y="843"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="state_in">
                  <connectionPointIn>
                    <relPosition x="0" y="112"/>
                    <connection refLocalId="1" formalParameter="PEDESTRIAN_GREEN_LIGHT">
                      <position x="1059" y="880"/>
                      <position x="819" y="880"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="22" height="27" width="190">
              <position x="845" y="793"/>
              <connectionPointOut>
                <relPosition x="190" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_GREEN_OFF'</expression>
            </inVariable>
            <inVariable localId="23" height="27" width="185">
              <position x="850" y="830"/>
              <connectionPointOut>
                <relPosition x="185" y="13"/>
              </connectionPointOut>
              <expression>'PEDESTRIAN_GREEN_ON'</expression>
            </inVariable>
            <inVariable localId="24" height="27" width="84">
              <position x="289" y="1141"/>
              <connectionPointOut>
                <relPosition x="84" y="13"/>
              </connectionPointOut>
              <expression>TEST_DATE</expression>
            </inVariable>
            <block localId="25" width="128" height="40" typeName="DATE_TO_STRING">
              <position x="426" y="1124"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="24">
                      <position x="426" y="1154"/>
                      <position x="373" y="1154"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="128" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <outVariable localId="26" height="27" width="116">
              <position x="640" y="1141"/>
              <connectionPointIn>
                <relPosition x="0" y="13"/>
                <connection refLocalId="25" formalParameter="OUT">
                  <position x="640" y="1154"/>
                  <position x="554" y="1154"/>
                </connection>
              </connectionPointIn>
              <expression>RESULT_STRING</expression>
            </outVariable>
            <inVariable localId="27" height="27" width="90">
              <position x="294" y="1271"/>
              <connectionPointOut>
                <relPosition x="90" y="13"/>
              </connectionPointOut>
              <expression>TEST_ULINT</expression>
            </inVariable>
            <outVariable localId="28" height="27" width="89">
              <position x="630" y="1271"/>
              <connectionPointIn>
                <relPosition x="0" y="13"/>
                <connection refLocalId="29" formalParameter="OUT">
                  <position x="630" y="1284"/>
                  <position x="551" y="1284"/>
                </connection>
              </connectionPointIn>
              <expression>RESULT_INT</expression>
            </outVariable>
            <block localId="29" width="107" height="40" typeName="ULINT_TO_INT">
              <position x="444" y="1254"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="27">
                      <position x="444" y="1284"/>
                      <position x="384" y="1284"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="107" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="30" height="27" width="89">
              <position x="139" y="1032"/>
              <connectionPointOut>
                <relPosition x="89" y="13"/>
              </connectionPointOut>
              <expression>RESULT_INT</expression>
            </inVariable>
            <block localId="31" width="68" height="85" typeName="LIMIT">
              <position x="419" y="994"/>
              <inputVariables>
                <variable formalParameter="MN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="33">
                      <position x="419" y="1024"/>
                      <position x="390" y="1024"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="51"/>
                    <connection refLocalId="38" formalParameter="OUT">
                      <position x="419" y="1045"/>
                      <position x="335" y="1045"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="MX">
                  <connectionPointIn>
                    <relPosition x="0" y="72"/>
                    <connection refLocalId="34">
                      <position x="419" y="1066"/>
                      <position x="404" y="1066"/>
                      <position x="404" y="1067"/>
                      <position x="389" y="1067"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="68" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="33" height="27" width="20">
              <position x="370" y="1011"/>
              <connectionPointOut>
                <relPosition x="20" y="13"/>
              </connectionPointOut>
              <expression>0</expression>
            </inVariable>
            <inVariable localId="34" height="27" width="26">
              <position x="363" y="1054"/>
              <connectionPointOut>
                <relPosition x="26" y="13"/>
              </connectionPointOut>
              <expression>31</expression>
            </inVariable>
            <block localId="35" width="100" height="45" typeName="INT_TO_BYTE">
              <position x="529" y="992"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="32"/>
                    <connection refLocalId="31" formalParameter="OUT">
                      <position x="529" y="1024"/>
                      <position x="487" y="1024"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="100" y="32"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <outVariable localId="37" height="27" width="100">
              <position x="681" y="1011"/>
              <connectionPointIn>
                <relPosition x="0" y="13"/>
                <connection refLocalId="35" formalParameter="OUT">
                  <position x="681" y="1024"/>
                  <position x="629" y="1024"/>
                </connection>
              </connectionPointIn>
              <expression>RESULT_BYTE</expression>
            </outVariable>
            <block localId="38" width="67" height="60" typeName="MUL">
              <position x="268" y="1015"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="30">
                      <position x="268" y="1045"/>
                      <position x="228" y="1045"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="39">
                      <position x="268" y="1065"/>
                      <position x="248" y="1065"/>
                      <position x="248" y="1084"/>
                      <position x="229" y="1084"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="67" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="39" height="27" width="18">
              <position x="211" y="1071"/>
              <connectionPointOut>
                <relPosition x="18" y="13"/>
              </connectionPointOut>
              <expression>1</expression>
            </inVariable>
          </FBD>
        </body>
      </pou>
    </pous>
  </types>
  <instances>
    <configurations>
      <configuration name="config">
        <resource name="resource1">
          <task name="test_task" interval="T#100ms" priority="0">
            <pouInstance name="main_instance" typeName="main_program"/>
          </task>
        </resource>
      </configuration>
    </configurations>
  </instances>
</project>