tests/svghmi_v2/plc.xml
author Edouard Tisserant
Tue, 25 Aug 2020 14:32:39 +0200
branchsvghmi
changeset 3036 4930455428df
parent 3016 085a678715d0
child 3057 696301e869d5
permissions -rw-r--r--
SVGHMI: JsonTable now use intermediate variables again to address JSON data without duplicating code or referencing. Using intermediate variables also alows to check for availability of data and stop evaluating early if data is missing. Finally added complete roundtrip example to illustrate use of JSonTable to display "alarms" collected in python from changes on PLC boolean variables.
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
  <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
  <contentHeader name="Unnamed" modificationDateTime="2020-07-30T12:04:22">
    <coordinateInfo>
      <fbd>
        <scaling x="5" y="5"/>
      </fbd>
      <ld>
        <scaling x="0" y="0"/>
      </ld>
      <sfc>
        <scaling x="0" y="0"/>
      </sfc>
    </coordinateInfo>
  </contentHeader>
  <types>
    <dataTypes/>
    <pous>
      <pou name="MainStuff" pouType="program">
        <interface>
          <localVars>
            <variable name="TargetPressure">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
            <variable name="selection">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
            <variable name="Pump0">
              <type>
                <derived name="PumpControl"/>
              </type>
            </variable>
            <variable name="TestButton">
              <type>
                <derived name="HMI_BOOL"/>
              </type>
            </variable>
            <variable name="TestLocal">
              <type>
                <BOOL/>
              </type>
            </variable>
            <variable name="Multistate">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
            <variable name="Radiostate">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
            <variable name="MultistateExt">
              <type>
                <INT/>
              </type>
            </variable>
          </localVars>
        </interface>
        <body>
          <FBD>
            <block localId="4" typeName="PumpControl" instanceName="Pump0" executionOrderId="0" height="40" width="127">
              <position x="595" y="50"/>
              <inputVariables>
                <variable formalParameter="TargetPressure">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="5">
                      <position x="595" y="80"/>
                      <position x="570" y="80"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables/>
            </block>
            <inVariable localId="5" executionOrderId="0" height="30" width="125" negated="false">
              <position x="445" y="65"/>
              <connectionPointOut>
                <relPosition x="125" y="15"/>
              </connectionPointOut>
              <expression>TargetPressure</expression>
            </inVariable>
            <inVariable localId="6" executionOrderId="0" height="25" width="90" negated="false">
              <position x="155" y="220"/>
              <connectionPointOut>
                <relPosition x="90" y="10"/>
              </connectionPointOut>
              <expression>TestButton</expression>
            </inVariable>
            <outVariable localId="7" executionOrderId="0" height="25" width="85" negated="false">
              <position x="495" y="220"/>
              <connectionPointIn>
                <relPosition x="0" y="10"/>
                <connection refLocalId="6">
                  <position x="495" y="230"/>
                  <position x="245" y="230"/>
                </connection>
              </connectionPointIn>
              <expression>TestLocal</expression>
            </outVariable>
            <inVariable localId="1" executionOrderId="0" height="25" width="115" negated="false">
              <position x="175" y="355"/>
              <connectionPointOut>
                <relPosition x="115" y="10"/>
              </connectionPointOut>
              <expression>Multistate</expression>
            </inVariable>
            <outVariable localId="8" executionOrderId="0" height="25" width="115" negated="false">
              <position x="495" y="355"/>
              <connectionPointIn>
                <relPosition x="0" y="10"/>
                <connection refLocalId="1">
                  <position x="495" y="365"/>
                  <position x="290" y="365"/>
                </connection>
              </connectionPointIn>
              <expression>MultistateExt</expression>
            </outVariable>
          </FBD>
        </body>
      </pou>
      <pou name="PumpControl" pouType="functionBlock">
        <interface>
          <localVars>
            <variable name="Pump">
              <type>
                <derived name="HMI_NODE"/>
              </type>
            </variable>
            <variable name="Pressure">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
          </localVars>
          <inputVars>
            <variable name="TargetPressure">
              <type>
                <INT/>
              </type>
            </variable>
          </inputVars>
          <localVars>
            <variable name="Sloth">
              <type>
                <derived name="HMI_INT"/>
              </type>
            </variable>
            <variable name="boolout">
              <type>
                <derived name="HMI_BOOL"/>
              </type>
            </variable>
            <variable name="boolin">
              <type>
                <derived name="HMI_BOOL"/>
              </type>
              <initialValue>
                <simpleValue value="True"/>
              </initialValue>
            </variable>
            <variable name="strout">
              <type>
                <derived name="HMI_STRING"/>
              </type>
            </variable>
            <variable name="strin">
              <type>
                <derived name="HMI_STRING"/>
              </type>
              <initialValue>
                <simpleValue value="blup"/>
              </initialValue>
            </variable>
          </localVars>
        </interface>
        <body>
          <FBD>
            <inVariable localId="5" executionOrderId="0" height="30" width="125" negated="false">
              <position x="150" y="100"/>
              <connectionPointOut>
                <relPosition x="125" y="15"/>
              </connectionPointOut>
              <expression>TargetPressure</expression>
            </inVariable>
            <inOutVariable localId="4" executionOrderId="0" height="30" width="60" negatedOut="false" negatedIn="false">
              <position x="510" y="80"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="6" formalParameter="OUT">
                  <position x="510" y="95"/>
                  <position x="470" y="95"/>
                </connection>
              </connectionPointIn>
              <connectionPointOut>
                <relPosition x="60" y="15"/>
              </connectionPointOut>
              <expression>Sloth</expression>
            </inOutVariable>
            <block localId="6" typeName="ADD" executionOrderId="0" height="60" width="65">
              <position x="405" y="65"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="4">
                      <position x="405" y="95"/>
                      <position x="385" y="95"/>
                      <position x="385" y="50"/>
                      <position x="580" y="50"/>
                      <position x="580" y="95"/>
                      <position x="570" y="95"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="7" formalParameter="OUT">
                      <position x="405" y="115"/>
                      <position x="360" y="115"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="1" executionOrderId="0" height="30" width="75" negated="false">
              <position x="150" y="135"/>
              <connectionPointOut>
                <relPosition x="75" y="15"/>
              </connectionPointOut>
              <expression>Pressure</expression>
            </inVariable>
            <block localId="7" typeName="SUB" executionOrderId="0" height="60" width="65">
              <position x="295" y="85"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="5">
                      <position x="295" y="115"/>
                      <position x="275" y="115"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="1">
                      <position x="295" y="135"/>
                      <position x="285" y="135"/>
                      <position x="285" y="150"/>
                      <position x="225" y="150"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="2" executionOrderId="0" height="30" width="60" negated="false">
              <position x="240" y="190"/>
              <connectionPointOut>
                <relPosition x="60" y="15"/>
              </connectionPointOut>
              <expression>Sloth</expression>
            </inVariable>
            <outVariable localId="3" executionOrderId="0" height="30" width="75" negated="false">
              <position x="435" y="205"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="8" formalParameter="OUT">
                  <position x="435" y="220"/>
                  <position x="410" y="220"/>
                </connection>
              </connectionPointIn>
              <expression>Pressure</expression>
            </outVariable>
            <block localId="8" typeName="DIV" executionOrderId="0" height="60" width="65">
              <position x="345" y="190"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="2">
                      <position x="345" y="220"/>
                      <position x="335" y="220"/>
                      <position x="335" y="205"/>
                      <position x="300" y="205"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="9">
                      <position x="345" y="240"/>
                      <position x="300" y="240"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="9" executionOrderId="0" height="30" width="60" negated="false">
              <position x="240" y="225"/>
              <connectionPointOut>
                <relPosition x="60" y="15"/>
              </connectionPointOut>
              <expression>100</expression>
            </inVariable>
            <block localId="10" typeName="CONCAT" executionOrderId="0" height="60" width="65">
              <position x="360" y="345"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="13" formalParameter="OUT">
                      <position x="360" y="375"/>
                      <position x="330" y="375"/>
                      <position x="330" y="332"/>
                      <position x="440" y="332"/>
                      <position x="440" y="300"/>
                      <position x="430" y="300"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="14">
                      <position x="360" y="395"/>
                      <position x="322" y="395"/>
                      <position x="322" y="400"/>
                      <position x="285" y="400"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <outVariable localId="11" executionOrderId="0" height="30" width="58" negated="false">
              <position x="495" y="355"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="10" formalParameter="OUT">
                  <position x="495" y="370"/>
                  <position x="450" y="370"/>
                  <position x="450" y="375"/>
                  <position x="425" y="375"/>
                </connection>
              </connectionPointIn>
              <expression>strout</expression>
            </outVariable>
            <inVariable localId="12" executionOrderId="0" height="30" width="125" negated="false">
              <position x="145" y="285"/>
              <connectionPointOut>
                <relPosition x="125" y="15"/>
              </connectionPointOut>
              <expression>TargetPressure</expression>
            </inVariable>
            <block localId="13" typeName="INT_TO_STRING" executionOrderId="0" height="40" width="115">
              <position x="315" y="270"/>
              <inputVariables>
                <variable formalParameter="IN">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="12">
                      <position x="315" y="300"/>
                      <position x="270" y="300"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="115" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="14" executionOrderId="0" height="30" width="50" negated="false">
              <position x="235" y="385"/>
              <connectionPointOut>
                <relPosition x="50" y="15"/>
              </connectionPointOut>
              <expression>strin</expression>
            </inVariable>
            <inVariable localId="15" executionOrderId="0" height="30" width="60" negated="false">
              <position x="690" y="210"/>
              <connectionPointOut>
                <relPosition x="60" y="15"/>
              </connectionPointOut>
              <expression>boolin</expression>
            </inVariable>
            <outVariable localId="16" executionOrderId="0" height="30" width="70" negated="false">
              <position x="915" y="240"/>
              <connectionPointIn>
                <relPosition x="0" y="15"/>
                <connection refLocalId="17" formalParameter="OUT">
                  <position x="915" y="255"/>
                  <position x="880" y="255"/>
                </connection>
              </connectionPointIn>
              <expression>boolout</expression>
            </outVariable>
            <block localId="17" typeName="AND" executionOrderId="0" height="60" width="65">
              <position x="815" y="225"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="15">
                      <position x="815" y="255"/>
                      <position x="762" y="255"/>
                      <position x="762" y="225"/>
                      <position x="750" y="225"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="21" formalParameter="OUT">
                      <position x="815" y="275"/>
                      <position x="750" y="275"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="18" executionOrderId="0" height="30" width="75" negated="false">
              <position x="455" y="260"/>
              <connectionPointOut>
                <relPosition x="75" y="15"/>
              </connectionPointOut>
              <expression>Pressure</expression>
            </inVariable>
            <block localId="19" typeName="MOD" executionOrderId="0" height="60" width="65">
              <position x="585" y="245"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="18">
                      <position x="585" y="275"/>
                      <position x="530" y="275"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="20">
                      <position x="585" y="295"/>
                      <position x="555" y="295"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="20" executionOrderId="0" height="30" width="20" negated="false">
              <position x="535" y="280"/>
              <connectionPointOut>
                <relPosition x="20" y="15"/>
              </connectionPointOut>
              <expression>2</expression>
            </inVariable>
            <block localId="21" typeName="EQ" executionOrderId="0" height="60" width="65">
              <position x="685" y="245"/>
              <inputVariables>
                <variable formalParameter="IN1">
                  <connectionPointIn>
                    <relPosition x="0" y="30"/>
                    <connection refLocalId="19" formalParameter="OUT">
                      <position x="685" y="275"/>
                      <position x="650" y="275"/>
                    </connection>
                  </connectionPointIn>
                </variable>
                <variable formalParameter="IN2">
                  <connectionPointIn>
                    <relPosition x="0" y="50"/>
                    <connection refLocalId="22">
                      <position x="685" y="295"/>
                      <position x="670" y="295"/>
                      <position x="670" y="330"/>
                      <position x="650" y="330"/>
                    </connection>
                  </connectionPointIn>
                </variable>
              </inputVariables>
              <inOutVariables/>
              <outputVariables>
                <variable formalParameter="OUT">
                  <connectionPointOut>
                    <relPosition x="65" y="30"/>
                  </connectionPointOut>
                </variable>
              </outputVariables>
            </block>
            <inVariable localId="22" executionOrderId="0" height="30" width="20" negated="false">
              <position x="630" y="315"/>
              <connectionPointOut>
                <relPosition x="20" y="15"/>
              </connectionPointOut>
              <expression>0</expression>
            </inVariable>
          </FBD>
        </body>
      </pou>
    </pous>
  </types>
  <instances>
    <configurations>
      <configuration name="config">
        <resource name="resource1">
          <task name="task0" priority="0" interval="T#20ms">
            <pouInstance name="instance0" typeName="MainStuff"/>
          </task>
        </resource>
      </configuration>
    </configurations>
  </instances>
</project>