<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.plcopen.org/xml/tc6.xsd"
xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<fileHeader companyName="beremiz"
creationDateTime="2008-12-14T16:21:19"/>
<contentHeader name="Beremiz Python Support Tests"
modificationDateTime="2012-10-23T00:54:38">
<pageSize x="1024" y="1024"/>
<dataType name="CPLX_TYPE">
<variable name="FIRSTBYTE">
<variable name="SECONDBYTE">
<pou name="main_pytest" pouType="program">
<variable name="pytest_var1">
<variable name="pytest_var2">
<derived name="python_eval"/>
<derived name="python_eval"/>
<derived name="python_eval"/>
<derived name="python_eval"/>
<variable name="pytest_var3">
<variable name="C_Pragma0">
<derived name="C_Pragma"/>
<variable name="TestInput" address="%IB1.0">
<variable name="TestOutput" address="%QB1.0">
<variable name="FromInput">
<inVariable localId="4" height="30" width="160">
<position x="295" y="230"/>
<relPosition x="160" y="15"/>
<expression>'time.sleep(1)'</expression>
<block localId="5" width="125" height="80" typeName="python_eval" instanceName="py1">
<position x="650" y="180"/>
<variable formalParameter="TRIG">
<relPosition x="0" y="35"/>
<connection refLocalId="7" formalParameter="OUT">
<position x="650" y="215"/>
<position x="285" y="215"/>
<position x="285" y="260"/>
<position x="250" y="260"/>
<variable formalParameter="CODE">
<relPosition x="0" y="65"/>
<connection refLocalId="4">
<position x="650" y="245"/>
<position x="455" y="245"/>
<variable formalParameter="ACK">
<relPosition x="125" y="35"/>
<variable formalParameter="RESULT">
<relPosition x="125" y="65"/>
<block localId="7" width="70" height="45" typeName="NOT">
<position x="180" y="230"/>
<variable formalParameter="IN">
<relPosition x="0" y="30"/>
<connection refLocalId="3">
<position x="180" y="260"/>
<position x="155" y="260"/>
<variable formalParameter="OUT">
<relPosition x="70" y="30"/>
<inOutVariable localId="3" height="30" width="120">
<position x="35" y="245"/>
<relPosition x="0" y="15"/>
<connection refLocalId="7" formalParameter="OUT">
<position x="35" y="260"/>
<position x="25" y="260"/>
<position x="25" y="220"/>
<position x="270" y="220"/>
<position x="270" y="260"/>
<position x="250" y="260"/>
<relPosition x="120" y="15"/>
<expression>pytest_var2</expression>
<block localId="8" width="125" height="80" typeName="python_eval" instanceName="Block1">
<position x="650" y="295"/>
<variable formalParameter="TRIG">
<relPosition x="0" y="35"/>
<connection refLocalId="7" formalParameter="OUT">
<position x="650" y="330"/>
<position x="285" y="330"/>
<position x="285" y="260"/>
<position x="250" y="260"/>
<variable formalParameter="CODE">
<relPosition x="0" y="65"/>
<connection refLocalId="9">
<position x="650" y="360"/>
<position x="585" y="360"/>
<variable formalParameter="ACK">
<relPosition x="125" y="35"/>
<variable formalParameter="RESULT">
<relPosition x="125" y="65"/>
<inVariable localId="9" height="30" width="290">
<position x="295" y="345"/>
<relPosition x="290" y="15"/>
<expression>'sys.stdout.write("FBID :"+str(FBID)+"\n")'</expression>
<inVariable localId="11" height="30" width="290">
<position x="295" y="465"/>
<relPosition x="290" y="15"/>
<expression>'PLCBinary.Simple_C_Call(5678)'</expression>
<block localId="12" width="125" height="80" typeName="python_eval" instanceName="Block2">
<position x="650" y="417"/>
<variable formalParameter="TRIG">
<relPosition x="0" y="33"/>
<connection refLocalId="7" formalParameter="OUT">
<position x="650" y="450"/>
<position x="285" y="450"/>
<position x="285" y="260"/>
<position x="250" y="260"/>
<variable formalParameter="CODE">
<relPosition x="0" y="63"/>
<connection refLocalId="11">
<position x="650" y="480"/>
<position x="585" y="480"/>
<variable formalParameter="ACK">
<relPosition x="125" y="33"/>
<variable formalParameter="RESULT">
<relPosition x="125" y="63"/>
<inVariable localId="14" height="30" width="290">
<position x="290" y="590"/>
<relPosition x="290" y="15"/>
<expression>'MyPythonFunc(42)'</expression>
<block localId="15" width="125" height="80" typeName="python_eval" instanceName="Block3">
<position x="650" y="542"/>
<variable formalParameter="TRIG">
<relPosition x="0" y="33"/>
<connection refLocalId="7" formalParameter="OUT">
<position x="650" y="575"/>
<position x="285" y="575"/>
<position x="285" y="260"/>
<position x="250" y="260"/>
<variable formalParameter="CODE">
<relPosition x="0" y="63"/>
<connection refLocalId="14">
<position x="650" y="605"/>
<position x="580" y="605"/>
<variable formalParameter="ACK">
<relPosition x="125" y="33"/>
<variable formalParameter="RESULT">
<relPosition x="125" y="63"/>
<comment localId="16" height="90" width="680">
<position x="50" y="25"/>
<![CDATA[This example test that, despite of 2T period clock stimulating TRIG pin of pyth_eval blocks, blocks keep executing one after the other, in respect of execution order.]]>
<block localId="17" width="80" height="120" typeName="MUX">
<position x="1065" y="495"/>
<variable formalParameter="K">
<relPosition x="0" y="30"/>
<connection refLocalId="18">
<position x="1065" y="525"/>
<position x="1030" y="525"/>
<variable formalParameter="IN0">
<relPosition x="0" y="50"/>
<connection refLocalId="5" formalParameter="RESULT">
<position x="1065" y="545"/>
<position x="905" y="545"/>
<position x="905" y="245"/>
<position x="775" y="245"/>
<variable formalParameter="IN1">
<relPosition x="0" y="70"/>
<connection refLocalId="8" formalParameter="RESULT">
<position x="1065" y="565"/>
<position x="890" y="565"/>
<position x="890" y="360"/>
<position x="775" y="360"/>
<variable formalParameter="IN2">
<relPosition x="0" y="90"/>
<connection refLocalId="12" formalParameter="RESULT">
<position x="1065" y="585"/>
<position x="875" y="585"/>
<position x="875" y="480"/>
<position x="775" y="480"/>
<variable formalParameter="IN3">
<relPosition x="0" y="110"/>
<connection refLocalId="15" formalParameter="RESULT">
<position x="1065" y="605"/>
<position x="775" y="605"/>
<variable formalParameter="OUT">
<relPosition x="80" y="30"/>
<inVariable localId="18" height="30" width="20">
<position x="1010" y="510"/>
<relPosition x="20" y="15"/>
<expression>3</expression>
<outVariable localId="19" height="35" width="125">
<position x="1185" y="510"/>
<relPosition x="0" y="15"/>
<connection refLocalId="17" formalParameter="OUT">
<position x="1185" y="525"/>
<position x="1145" y="525"/>
<expression>pytest_var1</expression>
<block localId="21" width="80" height="120" typeName="MUX">
<position x="985" y="165"/>
<variable formalParameter="K">
<relPosition x="0" y="30"/>
<connection refLocalId="22">
<position x="985" y="195"/>
<position x="950" y="195"/>
<variable formalParameter="IN0">
<relPosition x="0" y="50"/>
<connection refLocalId="5" formalParameter="ACK">
<position x="985" y="215"/>
<position x="775" y="215"/>
<variable formalParameter="IN1">
<relPosition x="0" y="70"/>
<connection refLocalId="8" formalParameter="ACK">
<position x="985" y="235"/>
<position x="805" y="235"/>
<position x="805" y="330"/>
<position x="775" y="330"/>
<variable formalParameter="IN2">
<relPosition x="0" y="90"/>
<connection refLocalId="12" formalParameter="ACK">
<position x="985" y="255"/>
<position x="820" y="255"/>
<position x="820" y="450"/>
<position x="775" y="450"/>
<variable formalParameter="IN3">
<relPosition x="0" y="110"/>
<connection refLocalId="15" formalParameter="ACK">
<position x="985" y="275"/>
<position x="835" y="275"/>
<position x="835" y="575"/>
<position x="775" y="575"/>
<variable formalParameter="OUT">
<relPosition x="80" y="30"/>
<inVariable localId="22" height="30" width="20">
<position x="930" y="180"/>
<relPosition x="20" y="15"/>
<expression>3</expression>
<outVariable localId="23" height="35" width="125">
<position x="1150" y="180"/>
<relPosition x="0" y="15"/>
<connection refLocalId="21" formalParameter="OUT">
<position x="1150" y="195"/>
<position x="1065" y="195"/>
<expression>pytest_var3</expression>
<outVariable localId="25" height="30" width="60">
<position x="520" y="655"/>
<relPosition x="0" y="15"/>
<connection refLocalId="26" formalParameter="OUT">
<position x="520" y="670"/>
<position x="465" y="670"/>
<expression>FromC</expression>
<inVariable localId="1" height="30" width="30">
<position x="305" y="655"/>
<relPosition x="30" y="15"/>
<expression>23</expression>
<block localId="26" width="80" height="45" typeName="C_Pragma" instanceName="C_Pragma0">
<position x="385" y="640"/>
<variable formalParameter="IN">
<relPosition x="0" y="30"/>
<connection refLocalId="1">
<position x="385" y="670"/>
<position x="335" y="670"/>
<variable formalParameter="OUT">
<relPosition x="80" y="30"/>
<inVariable localId="27" height="30" width="75">
<position x="305" y="770"/>
<relPosition x="75" y="15"/>
<expression>TestInput</expression>
<outVariable localId="28" height="30" width="90">
<position x="395" y="705"/>
<relPosition x="0" y="15"/>
<connection refLocalId="2">
<position x="395" y="720"/>
<position x="340" y="720"/>
<expression>TestOutput</expression>
<outVariable localId="29" height="30" width="85">
<position x="415" y="770"/>
<relPosition x="0" y="15"/>
<connection refLocalId="27">
<position x="415" y="785"/>
<position x="380" y="785"/>
<expression>FromInput</expression>
<inVariable localId="2" height="30" width="30">
<position x="310" y="705"/>
<relPosition x="30" y="15"/>
<expression>10</expression>
<comment localId="30" height="90" width="405">
<position x="245" y="825"/>
<![CDATA[You will be ready to use beremiz with C and Python when you will understand why "FromInput" is equal to 75.
<comment localId="31" height="60" width="345">
<position x="295" y="265"/>
<![CDATA[Sleep here is bad. It blocks other py_eval instances. Whith a wxGlade GUI, GUI freeze for a second.]]>
<comment localId="6" height="60" width="345">
<position x="295" y="380"/>
<![CDATA[Prints FBID to stdout of PLC runtime. FBID is a unique reference to py_eval instance.]]>
<comment localId="10" height="60" width="345">
<position x="295" y="500"/>
<![CDATA[Simple_C_Call is declared in C_File "1.x:c_code". See python ctypes manual for details on typing.]]>
<comment localId="32" height="105" width="235">
<position x="25" y="285"/>
<![CDATA[Fast clock, at least faster that sleep(1). See what happens when python takes time to answer : PLC continues.]]>
<pou name="C_Pragma" pouType="functionBlock">
<dimension lower="0" upper="5"/>
<simpleValue value="54"/>
<simpleValue value="55"/>
<simpleValue value="56"/>
<simpleValue value="57"/>
<simpleValue value="58"/>
<simpleValue value="59"/>
<derived name="CPLX_TYPE"/>
<![CDATA[(* hereafter is a C pragma accessing FB interface in a clean way *)
char fromPLC = GetFbVar(IN);
if(PLC_C_Call(fromPLC, &toPLC)){
/* that code demonstrate C access to complex types */
char somebyte = GetFbVar(COORDS, .table[3]);
SetFbVar(SMURF, somebyte, .FIRSTBYTE);
SetFbVar(COORDS, somebyte, .table[4]);
(* If you do not use __GET_VAR and _SET_VAR macro, expect unexpected *)
<configuration name="conf_pytest">
<resource name="res_pytest">
<task name="pytest_task" interval="t#100ms" priority="0"/>
<pouInstance name="pytest_instance" typeName="main_pytest"/>