Edouard@1401: <?xml version='1.0' encoding='utf-8'?> Edouard@1401: <project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201"> andrej@1541: <fileHeader companyName="" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:21:19" contentDescription="This example shows many features in Beremiz: 1. How to implement python extensions. 2. How to implement basic C extension. 3. How to use C code in IEC POUs. 4. How to call C functions from python code. 5. How to avoid race conditions between IEC, C and python code. 6. How to convert betweet different IEC types. "/> Edouard@2626: <contentHeader name="Beremiz Python Support Tests" modificationDateTime="2019-09-24T11:49:14"> etisserant@280: <coordinateInfo> etisserant@280: <pageSize x="1024" y="1024"/> etisserant@280: <fbd> etisserant@280: <scaling x="5" y="5"/> etisserant@280: </fbd> etisserant@280: <ld> etisserant@280: <scaling x="5" y="5"/> etisserant@280: </ld> etisserant@280: <sfc> etisserant@280: <scaling x="5" y="5"/> etisserant@280: </sfc> etisserant@280: </coordinateInfo> etisserant@280: </contentHeader> etisserant@280: <types> Edouard@861: <dataTypes> Edouard@861: <dataType name="CPLX_TYPE"> Edouard@861: <baseType> Edouard@861: <struct> Edouard@861: <variable name="FIRSTBYTE"> Edouard@861: <type> Edouard@861: <SINT/> Edouard@861: </type> Edouard@861: </variable> Edouard@861: <variable name="SECONDBYTE"> Edouard@861: <type> Edouard@861: <SINT/> Edouard@861: </type> Edouard@861: </variable> Edouard@861: </struct> Edouard@861: </baseType> Edouard@861: </dataType> Laurent@881: <dataType name="StateMachine"> Laurent@881: <baseType> Laurent@881: <enum> Laurent@881: <values> Laurent@881: <value name="STANDBY"/> Laurent@881: <value name="START"/> Laurent@881: <value name="STOP"/> Laurent@881: </values> Laurent@881: </enum> Laurent@881: </baseType> Laurent@881: </dataType> Edouard@1419: <dataType name="datatype0"> Edouard@1419: <baseType> Edouard@1419: <BOOL/> Edouard@1419: </baseType> Edouard@1419: </dataType> Edouard@2626: <dataType name="blups"> Edouard@2626: <baseType> Edouard@2626: <array> Edouard@2626: <dimension lower="0" upper="31"/> Edouard@2626: <baseType> Edouard@2626: <derived name="CPLX_TYPE"/> Edouard@2626: </baseType> Edouard@2626: </array> Edouard@2626: </baseType> Edouard@2626: </dataType> Edouard@861: </dataTypes> etisserant@280: <pous> etisserant@280: <pou name="main_pytest" pouType="program"> etisserant@280: <interface> etisserant@280: <localVars> andrej@1541: <variable name="mux1_sel"> andrej@1541: <type> andrej@1541: <INT/> andrej@1541: </type> andrej@1541: <initialValue> andrej@1541: <simpleValue value="3"/> andrej@1541: </initialValue> Edouard@2626: <documentation> Edouard@2626: <xhtml:p><![CDATA[blah]]></xhtml:p> Edouard@2626: </documentation> andrej@1541: </variable> andrej@1541: <variable name="mux2_sel"> andrej@1541: <type> andrej@1541: <INT/> andrej@1541: </type> andrej@1541: <initialValue> andrej@1541: <simpleValue value="3"/> andrej@1541: </initialValue> andrej@1541: </variable> etisserant@280: <variable name="pytest_var1"> etisserant@280: <type> etisserant@280: <string/> etisserant@280: </type> etisserant@280: </variable> Edouard@1419: <variable name="fefvsd"> Edouard@1419: <type> Edouard@1419: <derived name="datatype0"/> Edouard@1419: </type> Edouard@1419: </variable> etisserant@280: <variable name="pytest_var2"> etisserant@280: <type> etisserant@280: <BOOL/> etisserant@280: </type> etisserant@280: </variable> etisserant@280: <variable name="py1"> etisserant@280: <type> etisserant@280: <derived name="python_eval"/> etisserant@280: </type> etisserant@280: </variable> etisserant@282: <variable name="Block1"> etisserant@282: <type> etisserant@282: <derived name="python_eval"/> etisserant@282: </type> etisserant@282: </variable> etisserant@282: <variable name="Block2"> etisserant@282: <type> etisserant@282: <derived name="python_eval"/> etisserant@282: </type> etisserant@282: </variable> etisserant@282: <variable name="Block3"> etisserant@282: <type> etisserant@282: <derived name="python_eval"/> etisserant@282: </type> etisserant@282: </variable> etisserant@283: <variable name="pytest_var3"> etisserant@283: <type> etisserant@283: <BOOL/> etisserant@283: </type> etisserant@283: </variable> Edouard@859: <variable name="FromC"> Edouard@859: <type> Edouard@859: <SINT/> Edouard@859: </type> Edouard@859: </variable> Edouard@859: <variable name="C_Pragma0"> Edouard@859: <type> Edouard@859: <derived name="C_Pragma"/> Edouard@859: </type> Edouard@859: </variable> etisserant@280: </localVars> Laurent@1099: <externalVars> Laurent@1099: <variable name="TestInput"> Edouard@860: <type> Edouard@860: <SINT/> Edouard@860: </type> Edouard@860: </variable> Laurent@1099: <variable name="TestOutput"> Edouard@860: <type> Edouard@860: <SINT/> Edouard@860: </type> Edouard@860: </variable> Laurent@1099: </externalVars> Edouard@860: <localVars> Edouard@860: <variable name="FromInput"> Edouard@860: <type> Edouard@860: <SINT/> Edouard@860: </type> Edouard@860: </variable> Laurent@881: <variable name="Test_BCD"> Laurent@881: <type> Laurent@881: <WORD/> Laurent@881: </type> Laurent@881: <initialValue> andrej@1541: <simpleValue value="151"/> Laurent@881: </initialValue> Laurent@881: </variable> andrej@1541: <variable name="Test_BCD_WRONG"> andrej@1541: <type> andrej@1541: <WORD/> andrej@1541: </type> andrej@1541: <initialValue> andrej@1541: <simpleValue value="154"/> andrej@1541: </initialValue> andrej@1541: </variable> andrej@1541: <variable name="Test_BCD_CONVERTED"> andrej@1541: <type> andrej@1541: <BOOL/> andrej@1541: </type> andrej@1541: </variable> Laurent@881: <variable name="Test_BCD_RESULT"> Laurent@881: <type> Laurent@881: <UINT/> Laurent@881: </type> Laurent@881: </variable> andrej@1541: <variable name="Test_BCD_WRONG_RESULT"> andrej@1541: <type> andrej@1541: <UINT/> Laurent@941: </type> Laurent@941: </variable> Laurent@881: <variable name="Test_DT"> Laurent@881: <type> Laurent@881: <DT/> Laurent@881: </type> Laurent@881: <initialValue> Laurent@941: <simpleValue value="DT#2013-02-23-22:35:46"/> Laurent@881: </initialValue> Laurent@881: </variable> Laurent@881: <variable name="Test_TOD"> Laurent@881: <type> Laurent@881: <TOD/> Laurent@881: </type> Laurent@881: </variable> Laurent@941: <variable name="Test_TOD_STRING"> Laurent@941: <type> Laurent@941: <string/> Laurent@941: </type> Laurent@941: </variable> Laurent@881: <variable name="Test_Date"> Laurent@881: <type> Laurent@881: <DATE/> Laurent@881: </type> Laurent@881: </variable> Laurent@881: <variable name="Test_String"> Laurent@881: <type> Laurent@881: <string/> Laurent@881: </type> Laurent@918: <initialValue> Laurent@918: <simpleValue value="test"/> Laurent@918: </initialValue> Laurent@881: </variable> Laurent@881: <variable name="Test_Bool"> Laurent@881: <type> Laurent@881: <BOOL/> Laurent@881: </type> Laurent@881: </variable> Edouard@860: </localVars> Laurent@881: <externalVars> Laurent@881: <variable name="Global_RS"> Laurent@881: <type> Laurent@881: <derived name="RS"/> Laurent@881: </type> Laurent@881: </variable> Edouard@1013: <variable name="TUTU"> Edouard@1013: <type> Edouard@1013: <INT/> Edouard@1013: </type> Edouard@1013: </variable> Edouard@1013: <variable name="TOTO"> Edouard@1013: <type> Edouard@1013: <INT/> Edouard@1013: </type> Edouard@1013: </variable> Edouard@1145: <variable name="Test_Python_Var"> Edouard@1145: <type> Edouard@1145: <INT/> Edouard@1145: </type> Edouard@1145: </variable> Edouard@1145: <variable name="Second_Python_Var"> Edouard@1145: <type> Edouard@1145: <INT/> Edouard@1145: </type> Edouard@1145: </variable> Laurent@881: </externalVars> etisserant@280: </interface> etisserant@280: <body> etisserant@280: <FBD> andrej@1541: <inVariable localId="4" height="30" width="160" executionOrderId="0" negated="false"> andrej@1541: <position x="295" y="450"/> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="160" y="15"/> etisserant@282: </connectionPointOut> etisserant@282: <expression>'time.sleep(1)'</expression> etisserant@280: </inVariable> andrej@1541: <block localId="5" width="125" height="80" typeName="python_eval" instanceName="py1" executionOrderId="0"> andrej@2346: <position x="686" y="400"/> etisserant@280: <inputVariables> etisserant@280: <variable formalParameter="TRIG"> etisserant@280: <connectionPointIn> etisserant@280: <relPosition x="0" y="35"/> etisserant@280: <connection refLocalId="7" formalParameter="OUT"> andrej@2346: <position x="686" y="435"/> andrej@1541: <position x="285" y="435"/> andrej@1541: <position x="285" y="480"/> andrej@1541: <position x="250" y="480"/> etisserant@280: </connection> etisserant@280: </connectionPointIn> etisserant@280: </variable> etisserant@280: <variable formalParameter="CODE"> etisserant@280: <connectionPointIn> etisserant@280: <relPosition x="0" y="65"/> etisserant@280: <connection refLocalId="4"> andrej@2346: <position x="686" y="465"/> andrej@1541: <position x="455" y="465"/> etisserant@280: </connection> etisserant@280: </connectionPointIn> etisserant@280: </variable> etisserant@280: </inputVariables> etisserant@280: <inOutVariables/> etisserant@280: <outputVariables> etisserant@280: <variable formalParameter="ACK"> etisserant@280: <connectionPointOut> etisserant@280: <relPosition x="125" y="35"/> etisserant@280: </connectionPointOut> etisserant@280: </variable> etisserant@280: <variable formalParameter="RESULT"> etisserant@280: <connectionPointOut> etisserant@280: <relPosition x="125" y="65"/> etisserant@280: </connectionPointOut> etisserant@280: </variable> etisserant@280: </outputVariables> etisserant@280: </block> andrej@1541: <block localId="7" width="70" height="45" typeName="NOT" executionOrderId="0"> andrej@1541: <position x="180" y="450"/> etisserant@280: <inputVariables> etisserant@280: <variable formalParameter="IN"> etisserant@280: <connectionPointIn> etisserant@280: <relPosition x="0" y="30"/> etisserant@280: <connection refLocalId="3"> andrej@1541: <position x="180" y="480"/> andrej@1541: <position x="155" y="480"/> etisserant@280: </connection> etisserant@280: </connectionPointIn> etisserant@280: </variable> etisserant@280: </inputVariables> etisserant@280: <inOutVariables/> etisserant@280: <outputVariables> etisserant@280: <variable formalParameter="OUT"> etisserant@280: <connectionPointOut> etisserant@280: <relPosition x="70" y="30"/> etisserant@280: </connectionPointOut> etisserant@280: </variable> etisserant@280: </outputVariables> etisserant@280: </block> andrej@1541: <inOutVariable localId="3" height="30" width="120" executionOrderId="0" negatedOut="false" negatedIn="false"> andrej@1541: <position x="35" y="465"/> etisserant@280: <connectionPointIn> etisserant@280: <relPosition x="0" y="15"/> etisserant@280: <connection refLocalId="7" formalParameter="OUT"> andrej@1541: <position x="35" y="480"/> andrej@1541: <position x="25" y="480"/> andrej@1541: <position x="25" y="440"/> andrej@1541: <position x="270" y="440"/> andrej@1541: <position x="270" y="480"/> andrej@1541: <position x="250" y="480"/> etisserant@280: </connection> etisserant@280: </connectionPointIn> etisserant@280: <connectionPointOut> etisserant@280: <relPosition x="120" y="15"/> etisserant@280: </connectionPointOut> etisserant@280: <expression>pytest_var2</expression> etisserant@280: </inOutVariable> andrej@1541: <block localId="8" width="125" height="80" typeName="python_eval" instanceName="Block1" executionOrderId="0"> andrej@2346: <position x="686" y="545"/> etisserant@282: <inputVariables> etisserant@282: <variable formalParameter="TRIG"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="35"/> etisserant@282: <connection refLocalId="7" formalParameter="OUT"> andrej@2346: <position x="686" y="580"/> andrej@2296: <position x="285" y="580"/> andrej@1541: <position x="285" y="480"/> andrej@1541: <position x="250" y="480"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: <variable formalParameter="CODE"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="65"/> etisserant@282: <connection refLocalId="9"> andrej@2346: <position x="686" y="610"/> andrej@2346: <position x="665" y="610"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: </inputVariables> etisserant@282: <inOutVariables/> etisserant@282: <outputVariables> etisserant@282: <variable formalParameter="ACK"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="35"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: <variable formalParameter="RESULT"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="65"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: </outputVariables> etisserant@282: </block> andrej@2346: <inVariable localId="9" height="30" width="370" executionOrderId="0" negated="false"> andrej@2296: <position x="295" y="595"/> etisserant@282: <connectionPointOut> andrej@2346: <relPosition x="370" y="15"/> etisserant@282: </connectionPointOut> Edouard@862: <expression>'sys.stdout.write("FBID :"+str(FBID)+"\n")'</expression> etisserant@282: </inVariable> andrej@1541: <inVariable localId="11" height="30" width="290" executionOrderId="0" negated="false"> andrej@2296: <position x="295" y="735"/> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="290" y="15"/> etisserant@282: </connectionPointOut> Edouard@859: <expression>'PLCBinary.Simple_C_Call(5678)'</expression> etisserant@282: </inVariable> andrej@1541: <block localId="12" width="125" height="80" typeName="python_eval" instanceName="Block2" executionOrderId="0"> andrej@2346: <position x="686" y="687"/> etisserant@282: <inputVariables> etisserant@282: <variable formalParameter="TRIG"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="33"/> etisserant@282: <connection refLocalId="7" formalParameter="OUT"> andrej@2346: <position x="686" y="720"/> andrej@2296: <position x="285" y="720"/> andrej@1541: <position x="285" y="480"/> andrej@1541: <position x="250" y="480"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: <variable formalParameter="CODE"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="63"/> etisserant@282: <connection refLocalId="11"> andrej@2346: <position x="686" y="750"/> andrej@2296: <position x="585" y="750"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: </inputVariables> etisserant@282: <inOutVariables/> etisserant@282: <outputVariables> etisserant@282: <variable formalParameter="ACK"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="33"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: <variable formalParameter="RESULT"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="63"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: </outputVariables> etisserant@282: </block> andrej@1541: <inVariable localId="14" height="30" width="290" executionOrderId="0" negated="false"> andrej@2296: <position x="290" y="885"/> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="290" y="15"/> etisserant@282: </connectionPointOut> Edouard@734: <expression>'MyPythonFunc(42)'</expression> etisserant@282: </inVariable> andrej@1541: <block localId="15" width="125" height="80" typeName="python_eval" instanceName="Block3" executionOrderId="0"> andrej@2346: <position x="686" y="837"/> etisserant@282: <inputVariables> etisserant@282: <variable formalParameter="TRIG"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="33"/> etisserant@282: <connection refLocalId="7" formalParameter="OUT"> andrej@2346: <position x="686" y="870"/> andrej@2296: <position x="285" y="870"/> andrej@1541: <position x="285" y="480"/> andrej@1541: <position x="250" y="480"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: <variable formalParameter="CODE"> etisserant@282: <connectionPointIn> etisserant@282: <relPosition x="0" y="63"/> etisserant@282: <connection refLocalId="14"> andrej@2346: <position x="686" y="900"/> andrej@2296: <position x="580" y="900"/> etisserant@282: </connection> etisserant@282: </connectionPointIn> etisserant@282: </variable> etisserant@282: </inputVariables> etisserant@282: <inOutVariables/> etisserant@282: <outputVariables> etisserant@282: <variable formalParameter="ACK"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="33"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: <variable formalParameter="RESULT"> etisserant@282: <connectionPointOut> etisserant@282: <relPosition x="125" y="63"/> etisserant@282: </connectionPointOut> etisserant@282: </variable> etisserant@282: </outputVariables> etisserant@282: </block> etisserant@282: <comment localId="16" height="90" width="680"> andrej@1541: <position x="35" y="275"/> etisserant@282: <content> andrej@1541: <xhtml:p><![CDATA[This part of the 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.]]></xhtml:p> etisserant@282: </content> etisserant@282: </comment> andrej@1541: <block localId="17" width="80" height="120" typeName="MUX" executionOrderId="0"> andrej@2346: <position x="1101" y="790"/> etisserant@283: <inputVariables> etisserant@283: <variable formalParameter="K"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="30"/> etisserant@283: <connection refLocalId="18"> andrej@2346: <position x="1101" y="820"/> andrej@2346: <position x="1076" y="820"/> andrej@2346: <position x="1076" y="810"/> andrej@2346: <position x="1060" y="810"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN0"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="50"/> etisserant@283: <connection refLocalId="5" formalParameter="RESULT"> andrej@2346: <position x="1101" y="840"/> andrej@2346: <position x="941" y="840"/> andrej@2346: <position x="941" y="465"/> andrej@2346: <position x="811" y="465"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN1"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="70"/> etisserant@283: <connection refLocalId="8" formalParameter="RESULT"> andrej@2346: <position x="1101" y="860"/> andrej@2346: <position x="926" y="860"/> andrej@2346: <position x="926" y="610"/> andrej@2346: <position x="811" y="610"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN2"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="90"/> etisserant@283: <connection refLocalId="12" formalParameter="RESULT"> andrej@2346: <position x="1101" y="880"/> andrej@2346: <position x="911" y="880"/> andrej@2346: <position x="911" y="750"/> andrej@2346: <position x="811" y="750"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN3"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="110"/> etisserant@283: <connection refLocalId="15" formalParameter="RESULT"> andrej@2346: <position x="1101" y="900"/> andrej@2346: <position x="811" y="900"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: </inputVariables> etisserant@283: <inOutVariables/> etisserant@283: <outputVariables> etisserant@283: <variable formalParameter="OUT"> etisserant@283: <connectionPointOut> etisserant@283: <relPosition x="80" y="30"/> etisserant@283: </connectionPointOut> etisserant@283: </variable> etisserant@283: </outputVariables> etisserant@283: </block> andrej@1541: <outVariable localId="19" height="35" width="125" executionOrderId="0" negated="false"> andrej@2346: <position x="1271" y="805"/> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="15"/> etisserant@283: <connection refLocalId="17" formalParameter="OUT"> andrej@2346: <position x="1271" y="820"/> andrej@2346: <position x="1181" y="820"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: <expression>pytest_var1</expression> etisserant@283: </outVariable> andrej@1541: <block localId="21" width="80" height="120" typeName="MUX" executionOrderId="0"> andrej@2346: <position x="1106" y="385"/> etisserant@283: <inputVariables> etisserant@283: <variable formalParameter="K"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="30"/> etisserant@283: <connection refLocalId="22"> andrej@2346: <position x="1106" y="415"/> andrej@2346: <position x="1076" y="415"/> andrej@2346: <position x="1076" y="405"/> andrej@2346: <position x="1055" y="405"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN0"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="50"/> etisserant@283: <connection refLocalId="5" formalParameter="ACK"> andrej@2346: <position x="1106" y="435"/> andrej@2346: <position x="811" y="435"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN1"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="70"/> etisserant@283: <connection refLocalId="8" formalParameter="ACK"> andrej@2346: <position x="1106" y="455"/> andrej@2346: <position x="841" y="455"/> andrej@2346: <position x="841" y="580"/> andrej@2346: <position x="811" y="580"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN2"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="90"/> etisserant@283: <connection refLocalId="12" formalParameter="ACK"> andrej@2346: <position x="1106" y="475"/> andrej@2346: <position x="856" y="475"/> andrej@2346: <position x="856" y="720"/> andrej@2346: <position x="811" y="720"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: <variable formalParameter="IN3"> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="110"/> etisserant@283: <connection refLocalId="15" formalParameter="ACK"> andrej@2346: <position x="1106" y="495"/> andrej@2346: <position x="871" y="495"/> andrej@2346: <position x="871" y="870"/> andrej@2346: <position x="811" y="870"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: </variable> etisserant@283: </inputVariables> etisserant@283: <inOutVariables/> etisserant@283: <outputVariables> etisserant@283: <variable formalParameter="OUT"> etisserant@283: <connectionPointOut> etisserant@283: <relPosition x="80" y="30"/> etisserant@283: </connectionPointOut> etisserant@283: </variable> etisserant@283: </outputVariables> etisserant@283: </block> andrej@2346: <inVariable localId="22" height="30" width="74" executionOrderId="0" negated="false"> andrej@2346: <position x="981" y="390"/> andrej@2346: <connectionPointOut> andrej@2346: <relPosition x="74" y="15"/> andrej@1541: </connectionPointOut> andrej@1541: <expression>mux1_sel</expression> andrej@1541: </inVariable> andrej@1541: <outVariable localId="23" height="35" width="125" executionOrderId="0" negated="false"> andrej@2346: <position x="1271" y="400"/> etisserant@283: <connectionPointIn> etisserant@283: <relPosition x="0" y="15"/> etisserant@283: <connection refLocalId="21" formalParameter="OUT"> andrej@2346: <position x="1271" y="415"/> andrej@2346: <position x="1186" y="415"/> etisserant@283: </connection> etisserant@283: </connectionPointIn> etisserant@283: <expression>pytest_var3</expression> etisserant@283: </outVariable> andrej@1541: <outVariable localId="25" height="30" width="60" executionOrderId="0" negated="false"> andrej@1541: <position x="320" y="1075"/> Edouard@859: <connectionPointIn> Edouard@859: <relPosition x="0" y="15"/> Edouard@859: <connection refLocalId="26" formalParameter="OUT"> andrej@1541: <position x="320" y="1090"/> andrej@1541: <position x="265" y="1090"/> Edouard@859: </connection> Edouard@859: </connectionPointIn> Edouard@859: <expression>FromC</expression> Edouard@859: </outVariable> andrej@1541: <inVariable localId="1" height="30" width="30" executionOrderId="0" negated="false"> andrej@1541: <position x="105" y="1075"/> Edouard@859: <connectionPointOut> Edouard@859: <relPosition x="30" y="15"/> Edouard@859: </connectionPointOut> Edouard@859: <expression>23</expression> Edouard@859: </inVariable> andrej@1541: <block localId="26" width="80" height="45" typeName="C_Pragma" instanceName="C_Pragma0" executionOrderId="0"> andrej@1541: <position x="185" y="1060"/> Edouard@859: <inputVariables> Edouard@859: <variable formalParameter="IN"> Edouard@859: <connectionPointIn> Edouard@859: <relPosition x="0" y="30"/> Edouard@859: <connection refLocalId="1"> andrej@1541: <position x="185" y="1090"/> andrej@1541: <position x="135" y="1090"/> Edouard@859: </connection> Edouard@859: </connectionPointIn> Edouard@859: </variable> Edouard@859: </inputVariables> Edouard@859: <inOutVariables/> Edouard@859: <outputVariables> Edouard@859: <variable formalParameter="OUT"> Edouard@859: <connectionPointOut> Edouard@859: <relPosition x="80" y="30"/> Edouard@859: </connectionPointOut> Edouard@859: </variable> Edouard@859: </outputVariables> Edouard@859: </block> andrej@1541: <inVariable localId="27" height="30" width="90" executionOrderId="0" negated="false"> andrej@1541: <position x="100" y="1190"/> Laurent@1099: <connectionPointOut> Laurent@1099: <relPosition x="90" y="15"/> Edouard@860: </connectionPointOut> Edouard@860: <expression>TestInput</expression> Edouard@860: </inVariable> andrej@1541: <outVariable localId="28" height="30" width="105" executionOrderId="0" negated="false"> andrej@1541: <position x="195" y="1125"/> Edouard@860: <connectionPointIn> Edouard@860: <relPosition x="0" y="15"/> Edouard@860: <connection refLocalId="2"> andrej@1541: <position x="195" y="1140"/> andrej@1541: <position x="140" y="1140"/> Edouard@860: </connection> Edouard@860: </connectionPointIn> Edouard@860: <expression>TestOutput</expression> Edouard@860: </outVariable> andrej@1541: <outVariable localId="29" height="30" width="85" executionOrderId="0" negated="false"> andrej@1541: <position x="215" y="1190"/> Edouard@860: <connectionPointIn> Edouard@860: <relPosition x="0" y="15"/> Edouard@860: <connection refLocalId="27"> andrej@1541: <position x="215" y="1205"/> andrej@1541: <position x="190" y="1205"/> Edouard@860: </connection> Edouard@860: </connectionPointIn> Edouard@860: <expression>FromInput</expression> Edouard@860: </outVariable> andrej@1541: <inVariable localId="2" height="30" width="30" executionOrderId="0" negated="false"> andrej@1541: <position x="110" y="1125"/> Edouard@860: <connectionPointOut> Edouard@860: <relPosition x="30" y="15"/> Edouard@860: </connectionPointOut> Edouard@860: <expression>10</expression> Edouard@860: </inVariable> andrej@2296: <comment localId="30" height="105" width="465"> andrej@2296: <position x="50" y="925"/> Edouard@860: <content> Edouard@1401: <xhtml:p><![CDATA[You will be ready to use beremiz with C and Python when you will understand why "FromInput" is equal to 75. andrej@1541: Happy hacking! ]]></xhtml:p> Edouard@860: </content> Edouard@860: </comment> andrej@2296: <comment localId="31" height="90" width="345"> andrej@1541: <position x="295" y="485"/> Edouard@862: <content> Edouard@1401: <xhtml:p><![CDATA[Sleep here is bad. It blocks other py_eval instances. Whith a wxGlade GUI, GUI freeze for a second.]]></xhtml:p> Edouard@862: </content> Edouard@862: </comment> andrej@2296: <comment localId="6" height="80" width="345"> andrej@2296: <position x="295" y="630"/> Edouard@862: <content> Edouard@1401: <xhtml:p><![CDATA[Prints FBID to stdout of PLC runtime. FBID is a unique reference to py_eval instance.]]></xhtml:p> Edouard@862: </content> Edouard@862: </comment> andrej@2296: <comment localId="10" height="85" width="345"> andrej@2296: <position x="295" y="770"/> Edouard@862: <content> Edouard@1401: <xhtml:p><![CDATA[Simple_C_Call is declared in C_File "1.x:c_code". See python ctypes manual for details on typing.]]></xhtml:p> Edouard@862: </content> Edouard@862: </comment> andrej@2296: <comment localId="32" height="145" width="235"> andrej@1541: <position x="25" y="505"/> Edouard@862: <content> Edouard@1401: <xhtml:p><![CDATA[Fast clock, at least faster that sleep(1). See what happens when python takes time to answer : PLC continues.]]></xhtml:p> Edouard@862: </content> Edouard@862: </comment> andrej@2296: <outVariable localId="33" height="30" width="133" executionOrderId="0" negated="false"> andrej@1541: <position x="580" y="1564"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@881: <connection refLocalId="35" formalParameter="OUT"> andrej@1541: <position x="580" y="1580"/> andrej@2296: <position x="371" y="1580"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Test_BCD_RESULT</expression> Laurent@881: </outVariable> andrej@1541: <inVariable localId="34" height="30" width="75" executionOrderId="0" negated="false"> andrej@1541: <position x="60" y="1564"/> andrej@1541: <connectionPointOut> andrej@1541: <relPosition x="75" y="16"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>Test_BCD</expression> Laurent@881: </inVariable> andrej@2296: <block localId="35" width="106" height="60" typeName="BCD_TO_UINT" executionOrderId="0"> andrej@1541: <position x="265" y="1539"/> andrej@1541: <inputVariables> Laurent@881: <variable formalParameter="IN"> Laurent@881: <connectionPointIn> andrej@1541: <relPosition x="0" y="41"/> Laurent@881: <connection refLocalId="34"> andrej@1541: <position x="265" y="1580"/> andrej@1541: <position x="135" y="1580"/> andrej@1541: </connection> andrej@1541: </connectionPointIn> andrej@1541: </variable> andrej@1541: </inputVariables> andrej@1541: <inOutVariables/> andrej@1541: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> andrej@2296: <relPosition x="106" y="41"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: </outputVariables> andrej@1541: </block> andrej@2346: <inVariable localId="36" height="30" width="66" executionOrderId="0" negated="false"> andrej@1541: <position x="60" y="1774"/> andrej@1541: <connectionPointOut> andrej@2346: <relPosition x="66" y="16"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>Test_DT</expression> Laurent@881: </inVariable> andrej@1541: <block localId="37" width="255" height="45" typeName="DATE_AND_TIME_TO_TIME_OF_DAY" executionOrderId="0"> andrej@1541: <position x="265" y="1759"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN"> Laurent@881: <connectionPointIn> andrej@1541: <relPosition x="0" y="31"/> Laurent@881: <connection refLocalId="36"> andrej@1541: <position x="265" y="1790"/> andrej@1541: <position x="125" y="1790"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> andrej@1541: <relPosition x="255" y="31"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: </outputVariables> andrej@1541: </block> andrej@1541: <block localId="38" width="195" height="45" typeName="DATE_AND_TIME_TO_DATE" executionOrderId="0"> andrej@1541: <position x="265" y="1834"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN"> Laurent@881: <connectionPointIn> andrej@1541: <relPosition x="0" y="31"/> Laurent@881: <connection refLocalId="36"> andrej@1541: <position x="265" y="1865"/> andrej@1541: <position x="242" y="1865"/> andrej@1541: <position x="242" y="1790"/> andrej@1541: <position x="125" y="1790"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> andrej@1541: <relPosition x="195" y="31"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: </outputVariables> andrej@1541: </block> andrej@2346: <outVariable localId="40" height="30" width="82" executionOrderId="0" negated="false"> andrej@1541: <position x="580" y="1849"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@881: <connection refLocalId="38" formalParameter="OUT"> andrej@1541: <position x="580" y="1865"/> andrej@1541: <position x="460" y="1865"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Test_Date</expression> Laurent@881: </outVariable> andrej@2346: <outVariable localId="42" height="30" width="98" executionOrderId="0" negated="false"> andrej@1541: <position x="465" y="1944"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@881: <connection refLocalId="46" formalParameter="OUT"> andrej@1541: <position x="465" y="1960"/> andrej@1541: <position x="395" y="1960"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Test_String</expression> Laurent@881: </outVariable> andrej@2346: <outVariable localId="43" height="30" width="82" executionOrderId="0" negated="false"> andrej@1541: <position x="465" y="2014"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@881: <connection refLocalId="44" formalParameter="OUT"> andrej@1541: <position x="465" y="2030"/> andrej@1541: <position x="400" y="2030"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Test_Bool</expression> Laurent@881: </outVariable> andrej@1541: <block localId="44" width="135" height="45" typeName="STRING_TO_BOOL" executionOrderId="0"> andrej@1541: <position x="265" y="1999"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN"> Laurent@881: <connectionPointIn> andrej@1541: <relPosition x="0" y="31"/> Laurent@881: <connection refLocalId="45"> andrej@1541: <position x="265" y="2030"/> andrej@1541: <position x="115" y="2030"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> andrej@1541: <relPosition x="135" y="31"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: </outputVariables> andrej@1541: </block> andrej@2346: <inVariable localId="45" height="30" width="58" executionOrderId="0" negated="false"> andrej@1541: <position x="60" y="2014"/> andrej@1541: <connectionPointOut> andrej@2346: <relPosition x="58" y="16"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>'True'</expression> Laurent@881: </inVariable> andrej@1541: <block localId="46" width="130" height="45" typeName="INT_TO_STRING" executionOrderId="0"> andrej@1541: <position x="265" y="1929"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN"> Laurent@881: <connectionPointIn> andrej@1541: <relPosition x="0" y="31"/> Edouard@1145: <connection refLocalId="58"> andrej@1541: <position x="265" y="1960"/> andrej@1541: <position x="205" y="1960"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> andrej@1541: <relPosition x="130" y="31"/> Laurent@881: </connectionPointOut> Laurent@881: </variable> Laurent@881: </outputVariables> Laurent@881: </block> andrej@2346: <inVariable localId="50" height="30" width="106" executionOrderId="0" negated="false"> andrej@1541: <position x="75" y="2275"/> Laurent@881: <connectionPointOut> andrej@2346: <relPosition x="106" y="15"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>Global_RS.Q1</expression> Laurent@881: </inVariable> Edouard@1401: <block localId="51" width="70" height="85" typeName="AND" executionOrderId="0"> andrej@1541: <position x="240" y="2255"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN1" negated="true"> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="35"/> Edouard@1419: <connection refLocalId="50"> andrej@1541: <position x="240" y="2290"/> andrej@1541: <position x="180" y="2290"/> Edouard@1419: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: <variable formalParameter="IN2"> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="70"/> Laurent@881: <connection refLocalId="52"> andrej@1541: <position x="240" y="2325"/> andrej@1541: <position x="180" y="2325"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> Laurent@881: <relPosition x="70" y="35"/> Laurent@881: </connectionPointOut> Laurent@881: </variable> Laurent@881: </outputVariables> Laurent@881: </block> andrej@1541: <inVariable localId="52" height="30" width="105" executionOrderId="0" negated="false"> andrej@1541: <position x="75" y="2310"/> andrej@1541: <connectionPointOut> andrej@1541: <relPosition x="105" y="15"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>BOOL#TRUE</expression> Laurent@881: </inVariable> Edouard@1401: <outVariable localId="13" height="30" width="105" executionOrderId="0" negated="false"> andrej@1541: <position x="385" y="2275"/> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="15"/> Edouard@1419: <connection refLocalId="51" formalParameter="OUT"> andrej@1541: <position x="385" y="2290"/> andrej@1541: <position x="310" y="2290"/> Edouard@1419: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Global_RS.S</expression> Laurent@881: </outVariable> andrej@2346: <outVariable localId="20" height="30" width="106" executionOrderId="0" negated="false"> andrej@1541: <position x="385" y="2390"/> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="15"/> Edouard@1419: <connection refLocalId="41" formalParameter="OUT"> andrej@1541: <position x="385" y="2405"/> andrej@1541: <position x="310" y="2405"/> Edouard@1419: </connection> Laurent@881: </connectionPointIn> Laurent@881: <expression>Global_RS.R1</expression> Laurent@881: </outVariable> andrej@2346: <inVariable localId="24" height="30" width="106" executionOrderId="0" negated="false"> andrej@1541: <position x="75" y="2390"/> Laurent@881: <connectionPointOut> andrej@2346: <relPosition x="106" y="15"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>Global_RS.Q1</expression> Laurent@881: </inVariable> Edouard@1401: <block localId="41" width="70" height="85" typeName="OR" executionOrderId="0"> andrej@1541: <position x="240" y="2370"/> Laurent@881: <inputVariables> Laurent@881: <variable formalParameter="IN1"> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="35"/> Edouard@1419: <connection refLocalId="24"> andrej@1541: <position x="240" y="2405"/> andrej@1541: <position x="180" y="2405"/> Edouard@1419: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: <variable formalParameter="IN2"> Laurent@881: <connectionPointIn> Laurent@881: <relPosition x="0" y="70"/> Laurent@881: <connection refLocalId="48"> andrej@1541: <position x="240" y="2440"/> andrej@1541: <position x="180" y="2440"/> Laurent@881: </connection> Laurent@881: </connectionPointIn> Laurent@881: </variable> Laurent@881: </inputVariables> Laurent@881: <inOutVariables/> Laurent@881: <outputVariables> Laurent@881: <variable formalParameter="OUT"> Laurent@881: <connectionPointOut> Laurent@881: <relPosition x="70" y="35"/> Laurent@881: </connectionPointOut> Laurent@881: </variable> Laurent@881: </outputVariables> Laurent@881: </block> andrej@1541: <inVariable localId="48" height="30" width="105" executionOrderId="0" negated="false"> andrej@1541: <position x="75" y="2425"/> andrej@1541: <connectionPointOut> andrej@1541: <relPosition x="105" y="15"/> Laurent@881: </connectionPointOut> Laurent@881: <expression>BOOL#FALSE</expression> Laurent@881: </inVariable> andrej@1541: <outVariable localId="54" height="30" width="135" executionOrderId="0" negated="false"> andrej@1541: <position x="930" y="1774"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@941: <connection refLocalId="55" formalParameter="OUT"> andrej@1541: <position x="930" y="1790"/> andrej@1541: <position x="855" y="1790"/> Laurent@941: </connection> Laurent@941: </connectionPointIn> Laurent@941: <expression>Test_TOD_STRING</expression> Laurent@941: </outVariable> andrej@1541: <block localId="55" width="125" height="45" typeName="TOD_TO_STRING" executionOrderId="0"> andrej@1541: <position x="730" y="1759"/> Laurent@941: <inputVariables> Laurent@941: <variable formalParameter="IN"> Laurent@941: <connectionPointIn> andrej@1541: <relPosition x="0" y="31"/> Laurent@941: <connection refLocalId="39"> andrej@1541: <position x="730" y="1790"/> andrej@1541: <position x="655" y="1790"/> Laurent@941: </connection> Laurent@941: </connectionPointIn> Laurent@941: </variable> Laurent@941: </inputVariables> Laurent@941: <inOutVariables/> Laurent@941: <outputVariables> Laurent@941: <variable formalParameter="OUT"> Laurent@941: <connectionPointOut> andrej@1541: <relPosition x="125" y="31"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: </outputVariables> andrej@1541: </block> andrej@1541: <inOutVariable localId="39" height="30" width="75" executionOrderId="0" negatedOut="false" negatedIn="false"> andrej@1541: <position x="580" y="1774"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="16"/> Laurent@941: <connection refLocalId="37" formalParameter="OUT"> andrej@1541: <position x="580" y="1790"/> andrej@1541: <position x="520" y="1790"/> andrej@1541: </connection> andrej@1541: </connectionPointIn> andrej@1541: <connectionPointOut> andrej@1541: <relPosition x="75" y="16"/> Laurent@941: </connectionPointOut> Laurent@941: <expression>Test_TOD</expression> Laurent@941: </inOutVariable> andrej@1541: <inVariable localId="49" height="30" width="30" executionOrderId="0" negated="false"> andrej@1541: <position x="160" y="2510"/> Edouard@1013: <connectionPointOut> Edouard@1013: <relPosition x="30" y="15"/> Edouard@1013: </connectionPointOut> Edouard@1013: <expression>42</expression> Edouard@1013: </inVariable> andrej@1541: <outVariable localId="57" height="30" width="50" executionOrderId="0" negated="false"> andrej@1541: <position x="240" y="2510"/> Edouard@1013: <connectionPointIn> Edouard@1013: <relPosition x="0" y="15"/> Edouard@1013: <connection refLocalId="49"> andrej@1541: <position x="240" y="2525"/> andrej@1541: <position x="190" y="2525"/> Edouard@1013: </connection> Edouard@1013: </connectionPointIn> Edouard@1013: <expression>TOTO</expression> Edouard@1013: </outVariable> andrej@1541: <outVariable localId="56" height="30" width="50" executionOrderId="0" negated="false"> andrej@1541: <position x="240" y="2550"/> Edouard@1013: <connectionPointIn> Edouard@1013: <relPosition x="0" y="15"/> Edouard@1013: <connection refLocalId="49"> andrej@1541: <position x="240" y="2565"/> andrej@1541: <position x="215" y="2565"/> andrej@1541: <position x="215" y="2525"/> andrej@1541: <position x="190" y="2525"/> Edouard@1013: </connection> Edouard@1013: </connectionPointIn> Edouard@1013: <expression>TUTU</expression> Edouard@1013: </outVariable> andrej@2346: <inVariable localId="58" height="30" width="146" executionOrderId="0" negated="false"> andrej@1541: <position x="60" y="1944"/> andrej@1541: <connectionPointOut> andrej@2346: <relPosition x="146" y="16"/> Edouard@1145: </connectionPointOut> Edouard@1145: <expression>Second_Python_Var</expression> Edouard@1145: </inVariable> andrej@2346: <outVariable localId="47" height="30" width="130" executionOrderId="0" negated="false"> andrej@1541: <position x="200" y="1385"/> Edouard@1145: <connectionPointIn> Edouard@1145: <relPosition x="0" y="15"/> Edouard@1145: <connection refLocalId="59"> andrej@1541: <position x="200" y="1400"/> andrej@1541: <position x="130" y="1400"/> Edouard@1145: </connection> Edouard@1145: </connectionPointIn> Edouard@1145: <expression>Test_Python_Var</expression> Edouard@1145: </outVariable> andrej@1541: <inVariable localId="59" height="30" width="30" executionOrderId="0" negated="false"> andrej@1541: <position x="100" y="1385"/> Edouard@1145: <connectionPointOut> Edouard@1145: <relPosition x="30" y="15"/> Edouard@1145: </connectionPointOut> Edouard@1145: <expression>23</expression> Edouard@1145: </inVariable> andrej@2346: <block localId="61" typeName="function0" executionOrderId="0" height="45" width="111"> andrej@1541: <position x="760" y="1170"/> Edouard@1419: <inputVariables> Edouard@1419: <variable formalParameter="LocalVar0"> Edouard@1419: <connectionPointIn> Edouard@1419: <relPosition x="0" y="30"/> Edouard@1419: <connection refLocalId="62"> andrej@1541: <position x="760" y="1200"/> andrej@2346: <position x="723" y="1200"/> Edouard@1419: </connection> Edouard@1419: </connectionPointIn> Edouard@1419: </variable> Edouard@1419: </inputVariables> Edouard@1419: <inOutVariables/> Edouard@1419: <outputVariables> Edouard@1419: <variable formalParameter="OUT"> Edouard@1419: <connectionPointOut> andrej@2346: <relPosition x="111" y="30"/> andrej@2346: </connectionPointOut> andrej@2346: </variable> andrej@2346: </outputVariables> andrej@2346: </block> andrej@2346: <inVariable localId="62" executionOrderId="0" height="30" width="58" negated="false"> andrej@1541: <position x="665" y="1185"/> Edouard@1419: <connectionPointOut> andrej@2346: <relPosition x="58" y="15"/> Edouard@1419: </connectionPointOut> Edouard@1419: <expression>fefvsd</expression> Edouard@1419: </inVariable> andrej@2346: <outVariable localId="63" executionOrderId="0" height="30" width="58" negated="false"> andrej@1541: <position x="905" y="1185"/> Edouard@1419: <connectionPointIn> Edouard@1419: <relPosition x="0" y="15"/> Edouard@1419: <connection refLocalId="61" formalParameter="OUT"> andrej@1541: <position x="905" y="1200"/> andrej@2346: <position x="871" y="1200"/> Edouard@1419: </connection> Edouard@1419: </connectionPointIn> Edouard@1419: <expression>fefvsd</expression> Edouard@1419: </outVariable> andrej@2296: <comment localId="53" height="80" width="420"> andrej@1541: <position x="75" y="2160"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[Shows global variables access from resource configuration (res_pytest) and from project's configuration.]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> andrej@2346: <inVariable localId="18" height="30" width="74" executionOrderId="0" negated="false"> andrej@2346: <position x="986" y="795"/> andrej@2346: <connectionPointOut> andrej@2346: <relPosition x="74" y="15"/> andrej@1541: </connectionPointOut> andrej@1541: <expression>mux2_sel</expression> andrej@1541: </inVariable> andrej@1541: <comment localId="60" height="45" width="930"> andrej@1541: <position x="60" y="1480"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[Here is shown how to convert values between different types (BCD, DT, TOD, STRING and others) using standard functions.]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> andrej@1541: <comment localId="64" height="55" width="300"> andrej@1541: <position x="665" y="1095"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[Example of usage of user-defined function.]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> andrej@1541: <comment localId="65" height="45" width="410"> andrej@1541: <position x="55" y="1315"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[Shows access variable defined in python extension. ]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> andrej@2296: <inVariable localId="66" height="30" width="137" executionOrderId="0" negated="false"> andrej@1541: <position x="60" y="1685"/> andrej@1541: <connectionPointOut> andrej@2296: <relPosition x="137" y="15"/> andrej@1541: </connectionPointOut> andrej@1541: <expression>Test_BCD_WRONG</expression> andrej@1541: </inVariable> andrej@2296: <block localId="67" width="106" height="100" typeName="BCD_TO_UINT" executionOrderId="0"> andrej@1541: <position x="265" y="1620"/> andrej@1541: <inputVariables> andrej@1541: <variable formalParameter="EN"> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="40"/> andrej@1541: </connectionPointIn> andrej@1541: </variable> andrej@1541: <variable formalParameter="IN"> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="80"/> andrej@1541: <connection refLocalId="66"> andrej@1541: <position x="265" y="1700"/> andrej@1541: <position x="255" y="1700"/> andrej@1541: <position x="255" y="1700"/> andrej@1541: <position x="345" y="1700"/> andrej@1541: <position x="345" y="1700"/> andrej@2296: <position x="197" y="1700"/> andrej@1541: </connection> andrej@1541: </connectionPointIn> andrej@1541: </variable> andrej@1541: </inputVariables> andrej@1541: <inOutVariables/> andrej@1541: <outputVariables> andrej@1541: <variable formalParameter="ENO"> andrej@1541: <connectionPointOut> andrej@2296: <relPosition x="106" y="40"/> andrej@1541: </connectionPointOut> andrej@1541: </variable> andrej@1541: <variable formalParameter="OUT"> andrej@1541: <connectionPointOut> andrej@2296: <relPosition x="106" y="80"/> andrej@2296: </connectionPointOut> andrej@2296: </variable> andrej@2296: </outputVariables> andrej@2296: </block> andrej@2296: <outVariable localId="68" height="30" width="196" executionOrderId="0" negated="false"> andrej@1541: <position x="580" y="1685"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="15"/> andrej@1541: <connection refLocalId="67" formalParameter="OUT"> andrej@1541: <position x="580" y="1700"/> andrej@2296: <position x="371" y="1700"/> andrej@1541: </connection> andrej@1541: </connectionPointIn> andrej@1541: <expression>Test_BCD_WRONG_RESULT</expression> andrej@1541: </outVariable> andrej@2296: <comment localId="69" height="165" width="375"> andrej@1541: <position x="795" y="1590"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[Incorrect BCD number is not converted to UINT. andrej@1541: andrej@1541: 151 (16#97) is good BCD number , but andrej@1541: 154 (16#9A) is not. andrej@1541: andrej@1541: Try this out and look at value of Test_BCD_CONVERTED variable. andrej@1541: andrej@1541: andrej@1541: ]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> andrej@1541: <outVariable localId="70" height="30" width="185" executionOrderId="0" negated="false"> andrej@1541: <position x="580" y="1645"/> andrej@1541: <connectionPointIn> andrej@1541: <relPosition x="0" y="15"/> andrej@1541: <connection refLocalId="67" formalParameter="ENO"> andrej@1541: <position x="580" y="1660"/> andrej@1541: <position x="370" y="1660"/> andrej@1541: </connection> andrej@1541: </connectionPointIn> andrej@1541: <expression>Test_BCD_CONVERTED</expression> andrej@1541: </outVariable> andrej@2296: <comment localId="71" height="215" width="680"> andrej@1541: <position x="35" y="30"/> andrej@1541: <content> andrej@1541: <xhtml:p><![CDATA[This example shows many features in Beremiz: andrej@1541: andrej@1541: 1. How to implement python extensions. andrej@1541: 2. How to implement basic C extension. andrej@1541: 3. How to use C code in IEC POUs. andrej@1541: 4. How to call C functions from python code. andrej@1541: 5. How to avoid race conditions between IEC, C and python code. andrej@1541: 6. How to convert betweet different IEC types. andrej@1541: ]]></xhtml:p> andrej@1541: </content> andrej@1541: </comment> etisserant@280: </FBD> etisserant@280: </body> etisserant@280: </pou> Edouard@859: <pou name="C_Pragma" pouType="functionBlock"> Edouard@859: <interface> Edouard@859: <outputVars> Edouard@859: <variable name="OUT"> Edouard@859: <type> Edouard@859: <SINT/> Edouard@859: </type> Edouard@859: </variable> Edouard@859: </outputVars> Edouard@859: <inputVars> Edouard@859: <variable name="IN"> Edouard@859: <type> Edouard@859: <SINT/> Edouard@859: </type> Edouard@859: </variable> Edouard@859: </inputVars> Edouard@861: <localVars> Edouard@861: <variable name="COORDS"> Edouard@861: <type> Edouard@861: <array> Edouard@861: <dimension lower="0" upper="5"/> Edouard@861: <baseType> Edouard@861: <SINT/> Edouard@861: </baseType> Edouard@861: </array> Edouard@861: </type> Edouard@861: <initialValue> Edouard@861: <arrayValue> Edouard@861: <value> Edouard@861: <simpleValue value="54"/> Edouard@861: </value> Edouard@861: <value> Edouard@861: <simpleValue value="55"/> Edouard@861: </value> Edouard@861: <value> Edouard@861: <simpleValue value="56"/> Edouard@861: </value> Edouard@861: <value> Edouard@861: <simpleValue value="57"/> Edouard@861: </value> Edouard@861: <value> Edouard@861: <simpleValue value="58"/> Edouard@861: </value> Edouard@861: <value> Edouard@861: <simpleValue value="59"/> Edouard@861: </value> Edouard@861: </arrayValue> Edouard@861: </initialValue> Edouard@861: </variable> Edouard@861: <variable name="SMURF"> Edouard@861: <type> Edouard@861: <derived name="CPLX_TYPE"/> Edouard@861: </type> Edouard@861: </variable> Edouard@861: </localVars> Laurent@881: <externalVars> Laurent@881: <variable name="Global_RS"> Laurent@881: <type> Laurent@881: <derived name="RS"/> Laurent@881: </type> Laurent@881: </variable> Edouard@2626: <variable name="Dudiduda"> Edouard@2626: <type> Edouard@2626: <derived name="blups"/> Edouard@2626: </type> Edouard@2626: </variable> Laurent@881: </externalVars> Edouard@859: </interface> Edouard@859: <body> Edouard@859: <ST> Edouard@1401: <xhtml:p><![CDATA[(* hereafter is a C pragma accessing FB interface in a clean way *) Edouard@861: {{ Edouard@861: char toPLC; Edouard@861: char fromPLC = GetFbVar(IN); Laurent@1086: extern int PLC_C_Call(char, char *); Edouard@861: if(PLC_C_Call(fromPLC, &toPLC)){ Edouard@861: SetFbVar(OUT, toPLC); Edouard@861: } Edouard@861: if(0){ Edouard@861: /* that code demonstrate C access to complex types */ Edouard@861: char somebyte = GetFbVar(COORDS, .table[3]); Edouard@861: SetFbVar(SMURF, somebyte, .FIRSTBYTE); Edouard@861: SetFbVar(COORDS, somebyte, .table[4]); Edouard@861: } Edouard@861: }} andrej@1541: (* If you do not use GetFbVar and SetFbVar macros, expect unexpected behaviour*) Laurent@881: Global_RS(); Edouard@2626: Edouard@2626: (* testing access to global struct array *) Edouard@2626: Dudiduda[2].FIRSTBYTE := 0; Edouard@1401: ]]></xhtml:p> Edouard@859: </ST> Edouard@859: </body> Edouard@859: </pou> Laurent@918: <pou name="norm" pouType="function"> Laurent@918: <interface> Laurent@918: <returnType> Laurent@918: <REAL/> Laurent@918: </returnType> Laurent@918: <inputVars> Laurent@918: <variable name="IN1"> Laurent@918: <type> Laurent@918: <REAL/> Laurent@918: </type> Laurent@918: </variable> Laurent@918: <variable name="IN2"> Laurent@918: <type> Laurent@918: <REAL/> Laurent@918: </type> Laurent@918: </variable> Laurent@918: </inputVars> Laurent@918: </interface> Laurent@918: <body> Laurent@918: <ST> Edouard@1401: <xhtml:p><![CDATA[NORM := SQRT(IN1 * IN1 + IN2 * IN2);]]></xhtml:p> Laurent@918: </ST> Laurent@918: </body> Laurent@918: </pou> Edouard@1419: <pou name="function0" pouType="function"> Edouard@1419: <interface> Edouard@1419: <returnType> Edouard@1419: <derived name="datatype0"/> Edouard@1419: </returnType> Edouard@1419: <inputVars> Edouard@1419: <variable name="LocalVar0"> Edouard@1419: <type> Edouard@1419: <derived name="datatype0"/> Edouard@1419: </type> Edouard@1419: </variable> Edouard@1419: </inputVars> Edouard@1419: </interface> Edouard@1419: <body> Edouard@1419: <ST> Edouard@1419: <xhtml:p><![CDATA[function0 := LocalVar0; Edouard@1419: ]]></xhtml:p> Edouard@1419: </ST> Edouard@1419: </body> Edouard@1419: </pou> etisserant@280: </pous> etisserant@280: </types> etisserant@280: <instances> etisserant@280: <configurations> Edouard@1452: <configuration name="config"> etisserant@280: <resource name="res_pytest"> Laurent@881: <task name="pytest_task" interval="T#1ms" priority="0"/> Laurent@918: <globalVars> Laurent@918: <variable name="TOTO"> Laurent@918: <type> Laurent@918: <INT/> Laurent@918: </type> Laurent@918: </variable> Laurent@918: </globalVars> laurent@366: <pouInstance name="pytest_instance" typeName="main_pytest"/> etisserant@280: </resource> Laurent@881: <globalVars> Laurent@881: <variable name="Global_RS"> Laurent@881: <type> Laurent@881: <derived name="RS"/> Laurent@881: </type> Laurent@881: </variable> Edouard@2626: <variable name="Dudiduda"> Edouard@2626: <type> Edouard@2626: <derived name="blups"/> Edouard@2626: </type> Edouard@2626: </variable> Edouard@1013: <variable name="TUTU"> Edouard@1013: <type> Edouard@1013: <INT/> Edouard@1013: </type> Edouard@1013: </variable> Laurent@881: </globalVars> etisserant@280: </configuration> etisserant@280: </configurations> etisserant@280: </instances> etisserant@280: </project>