tests/motion/plc.xml
author greg
Mon, 16 Feb 2009 13:45:42 +0100
changeset 315 408dd4b44ec8
parent 293 b9ec99fab9fc
permissions -rw-r--r--
Dispatch wxGlade tests in linux and win32 folders
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.plcopen.org/xml/tc6.xsd"
         xmlns:xhtml="http://www.w3.org/1999/xhtml"
         xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd">
  <fileHeader companyName="Lolitech"
              productName="GenTraj"
              productVersion="1.0"
              creationDateTime="2009-01-13T12:15:00"/>
  <contentHeader name="GenTraj"
                 modificationDateTime="2009-01-14T20:10:13">
    <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="GenTraj" pouType="functionBlock">
        <interface>
          <inputVars>
            <variable name="Period">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Gmvt">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Vmvt">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="P0">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="V0">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Pf">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Vf">
              <type>
                <REAL/>
              </type>
            </variable>
          </inputVars>
          <outputVars>
            <variable name="Pn">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Vn">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Gn">
              <type>
                <REAL/>
              </type>
            </variable>
          </outputVars>
          <localVars>
            <variable name="P">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="F">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Ps2">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Fs3">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="delta">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Va">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Vb">
              <type>
                <REAL/>
              </type>
            </variable>
            <variable name="Vaut">
              <type>
                <REAL/>
              </type>
            </variable>
          </localVars>
        </interface>
        <body>
          <ST>
<![CDATA[IF Period <> P THEN
  P := Period;
  F := 1.0 / P;
  Ps2 := P / 2.0;
  Fs3 := F / 3.0;
END_IF;

IF Pf <> Pn THEN
  delta := Pf - P0 - V0 * P;
  
  Va := SQRT(ABS(2.0 * Gmvt * delta) + Vf * Vf);
  Vb := Vf + delta * Fs3;

  IF Va > ABS(Vb) THEN
    Vaut := MIN(ABS(Vb), Vmvt);
    IF Vb < 0.0 THEN
      Vaut := -Vaut;
    END_IF;
  ELSE
    Vaut := MIN(Va, Vmvt);
    IF Pf < P0 THEN
      Vaut := -Vaut;
    END_IF;    
  END_IF;

  Gn := MIN(ABS((Vaut - V0) * F), Gmvt);
  IF Vaut < V0 THEN
    Gn := -Gn;
  END_IF;

END_IF;

Vn := V0 + Gn * P;

Pn := P0 + (Vn + V0) * Ps2;

IF (P0 >= Pf) <> (Pn >= Pf) AND Vf <> 0.0 THEN
  Pn := Pf;
END_IF;

]]>
          </ST>
        </body>
      </pou>
      <pou name="TestMotion" pouType="program">
        <interface>
          <localVars>
            <variable name="GO">
              <type>
                <BOOL/>
              </type>
              <initialValue>
                <simpleValue value="TRUE"/>
              </initialValue>
            </variable>
            <variable name="TRIG">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="GenTraj1">
              <type>
                <derived name="GenTraj"/>
              </type>
            </variable>
            <variable name="py_eval">
              <type>
                <derived name="python_eval"/>
              </type>
            </variable>
            <variable name="RS1">
              <type>
                <derived name="RS"/>
              </type>
            </variable>
          </localVars>
        </interface>
        <body>
          <FBD>
            <inVariable localId="2" height="25" width="63">
              <position x="203" y="208"/>
              <connectionPointOut>
                <relPosition x="63" y="12"/>
              </connectionPointOut>
              <expression>GO</expression>
            </inVariable>
            <inVariable localId="4" height="25" width="100">
              <position x="295" y="312"/>
              <connectionPointOut>
                <relPosition x="100" y="12"/>
              </connectionPointOut>
              <expression>REAL#0.1</expression>
            </inVariable>
            <inVariable localId="6" height="25" width="100">
              <position x="294" y="345"/>
              <connectionPointOut>
                <relPosition x="100" y="12"/>
              </connectionPointOut>
              <expression>REAL#1.0</expression>
            </inVariable>
            <inVariable localId="7" height="25" width="99">
              <position x="294" y="378"/>
              <connectionPointOut>
                <relPosition x="99" y="12"/>
              </connectionPointOut>
              <expression>REAL#1.0</expression>
            </inVariable>
            <inVariable localId="8" height="25" width="100">
              <position x="292" y="477"/>
              <connectionPointOut>
                <relPosition x="100" y="12"/>
              </connectionPointOut>
              <expression>REAL#10.0</expression>
            </inVariable>
            <block localId="9" width="178" height="290" typeName="GenTraj" instanceName="GenTraj1">
              <position x="488" y="255"/>
              <inputVariables>
                <variable formalParameter="EN">
                  <connectionPointIn>
                    <relPosition x="0" y="36"/>
                    <connection refLocalId="13" formalParameter="Q1">
                      <position x="488" y="291"/>
                      <position x="442" y="291"/>
                      <position x="442" y="259"/>
                      <position x="396" y="259"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="Period">
                  <connectionPointIn>
                    <relPosition x="0" y="69"/>
                    <connection refLocalId="4">
                      <position x="488" y="324"/>
                      <position x="395" y="324"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="Gmvt">
                  <connectionPointIn>
                    <relPosition x="0" y="102"/>
                    <connection refLocalId="6">
                      <position x="488" y="357"/>
                      <position x="394" y="357"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="Vmvt">
                  <connectionPointIn>
                    <relPosition x="0" y="135"/>
                    <connection refLocalId="7">
                      <position x="488" y="390"/>
                      <position x="393" y="390"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="P0">
                  <connectionPointIn>
                    <relPosition x="0" y="168"/>
                    <connection refLocalId="9" formalParameter="Pn">
                      <position x="488" y="423"/>
                      <position x="430" y="423"/>
                      <position x="430" y="607"/>
                      <position x="724" y="607"/>
                      <position x="724" y="324"/>
                      <position x="666" y="324"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="V0">
                  <connectionPointIn>
                    <relPosition x="0" y="201"/>
                    <connection refLocalId="9" formalParameter="Vn">
                      <position x="488" y="456"/>
                      <position x="453" y="456"/>
                      <position x="453" y="577"/>
                      <position x="696" y="577"/>
                      <position x="696" y="357"/>
                      <position x="666" y="357"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="Pf">
                  <connectionPointIn>
                    <relPosition x="0" y="234"/>
                    <connection refLocalId="8">
                      <position x="488" y="489"/>
                      <position x="392" y="489"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="Vf">
                  <connectionPointIn>
                    <relPosition x="0" y="267"/>
                    <connection refLocalId="10">
                      <position x="488" y="522"/>
                      <position x="392" y="522"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="ENO">
                  <connectionPointOut>
                    <relPosition x="178" y="36"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="Pn">
                  <connectionPointOut>
                    <relPosition x="178" y="69"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="Vn">
                  <connectionPointOut>
                    <relPosition x="178" y="102"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="Gn">
                  <connectionPointOut>
                    <relPosition x="178" y="135"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="10" height="25" width="99">
              <position x="293" y="510"/>
              <connectionPointOut>
                <relPosition x="99" y="12"/>
              </connectionPointOut>
              <expression>REAL#0.0</expression>
            </inVariable>
            <block localId="11" width="75" height="70" typeName="EQ">
              <position x="197" y="247"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="32"/>
                    <connection refLocalId="9" formalParameter="Pn">
                      <position x="197" y="279"/>
                      <position x="145" y="279"/>
                      <position x="145" y="629"/>
                      <position x="724" y="629"/>
                      <position x="724" y="324"/>
                      <position x="666" y="324"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="57"/>
                    <connection refLocalId="8">
                      <position x="197" y="304"/>
                      <position x="176" y="304"/>
                      <position x="176" y="433"/>
                      <position x="409" y="433"/>
                      <position x="409" y="489"/>
                      <position x="392" y="489"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="75" y="32"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="12" width="120" height="87" typeName="python_eval" instanceName="py_eval">
              <position x="318" y="73"/>
              <inputVariables>
                <variable formalParameter="TRIG">
                  <connectionPointIn>
                    <relPosition x="0" y="36"/>
                    <connection refLocalId="15" formalParameter="OUT">
                      <position x="318" y="109"/>
                      <position x="225" y="109"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="CODE">
                  <connectionPointIn>
                    <relPosition x="0" y="69"/>
                    <connection refLocalId="14">
                      <position x="318" y="142"/>
                      <position x="280" y="142"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="ACK">
                  <connectionPointOut>
                    <relPosition x="120" y="36"/>
                  </connectionPointOut>
                </variable>
                <variable formalParameter="RESULT">
                  <connectionPointOut>
                    <relPosition x="120" y="69"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="13" width="55" height="60" typeName="RS" instanceName="RS1">
              <position x="341" y="229"/>
              <inputVariables>
                <variable formalParameter="S">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="2">
                      <position x="341" y="259"/>
                      <position x="303" y="259"/>
                      <position x="303" y="220"/>
                      <position x="266" y="220"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="R1">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="11" formalParameter="OUT">
                      <position x="341" y="279"/>
                      <position x="272" y="279"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="Q1">
                  <connectionPointOut>
                    <relPosition x="55" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="14" height="25" width="50">
              <position x="230" y="130"/>
              <connectionPointOut>
                <relPosition x="50" y="12"/>
              </connectionPointOut>
              <expression>'GO'</expression>
            </inVariable>
            <block localId="15" width="65" height="40" typeName="NOT">
              <position x="160" y="79"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="16">
                      <position x="160" y="109"/>
                      <position x="118" y="109"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inOutVariable localId="16" height="25" width="50">
              <position x="68" y="97"/>
              <connectionPointIn>
                <relPosition x="0" y="12"/>
                <connection refLocalId="15" formalParameter="OUT">
                  <position x="68" y="109"/>
                  <position x="42" y="109"/>
                  <position x="42" y="50"/>
                  <position x="262" y="50"/>
                  <position x="262" y="109"/>
                  <position x="225" y="109"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="50" y="12"/>
              </connectionPointOut>
              <expression>TRIG</expression>
            </inOutVariable>
            <block localId="17" width="140" height="40" typeName="STRING_TO_INT">
              <position x="486" y="112"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="12" formalParameter="RESULT">
                      <position x="486" y="142"/>
                      <position x="438" y="142"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="140" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <block localId="18" width="120" height="40" typeName="INT_TO_BOOL">
              <position x="671" y="112"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="17" formalParameter="OUT">
                      <position x="671" y="142"/>
                      <position x="626" y="142"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="120" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <outVariable localId="19" height="25" width="63">
              <position x="826" y="130"/>
              <connectionPointIn>
                <relPosition x="0" y="12"/>
                <connection refLocalId="18" formalParameter="OUT">
                  <position x="826" y="142"/>
                  <position x="791" y="142"/>
                </connection>
              </connectionPointIn>
              <expression>GO</expression>
            </outVariable>
          </FBD>
        </body>
      </pou>
    </pous>
  </types>
  <instances>
    <configurations>
      <configuration name="config">
        <resource name="ress">
          <task name="MAIN_TASK" interval="00:00:00.100000" priority="0">
            <pouInstance name="MAIN_INSTANCE" type="TestMotion"/>
          </task>
        </resource>
      </configuration>
    </configurations>
  </instances>
</project>