SVGHMI: make a reasonably basic test svghmi
authorEdouard Tisserant
Wed, 14 Aug 2019 13:06:03 +0200
branchsvghmi
changeset 2759 7345bd8a98eb
parent 2758 5f79b194fa63
child 2760 42a7ef43a0d8
SVGHMI: make a reasonably basic test
tests/svghmi/plc.xml
tests/svghmi/svghmi_0@svghmi/gui.svg
--- a/tests/svghmi/plc.xml	Wed Aug 14 11:05:17 2019 +0200
+++ b/tests/svghmi/plc.xml	Wed Aug 14 13:06:03 2019 +0200
@@ -1,7 +1,7 @@
 <?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="2019-08-14T10:55:12">
+  <contentHeader name="Unnamed" modificationDateTime="2019-08-14T11:10:01">
     <coordinateInfo>
       <fbd>
         <scaling x="5" y="5"/>
@@ -17,10 +17,10 @@
   <types>
     <dataTypes/>
     <pous>
-      <pou name="program0" pouType="program">
+      <pou name="MainStuff" pouType="program">
         <interface>
           <localVars>
-            <variable name="LocalVar0">
+            <variable name="TargetPressure">
               <type>
                 <derived name="HMI_INT"/>
               </type>
@@ -67,23 +67,23 @@
                 </variable>
               </outputVariables>
             </block>
-            <inOutVariable localId="1" executionOrderId="0" height="26" width="82" negatedOut="false" negatedIn="false">
+            <inOutVariable localId="1" executionOrderId="0" height="26" width="122" negatedOut="false" negatedIn="false">
               <position x="120" y="190"/>
               <connectionPointIn>
-                <relPosition x="0" y="10"/>
+                <relPosition x="0" y="15"/>
                 <connection refLocalId="2" formalParameter="OUT">
-                  <position x="120" y="200"/>
-                  <position x="100" y="200"/>
+                  <position x="120" y="205"/>
+                  <position x="100" y="205"/>
                   <position x="100" y="140"/>
                   <position x="328" y="140"/>
-                  <position x="328" y="200"/>
-                  <position x="318" y="200"/>
+                  <position x="328" y="205"/>
+                  <position x="318" y="205"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>
-                <relPosition x="82" y="10"/>
-              </connectionPointOut>
-              <expression>LocalVar0</expression>
+                <relPosition x="122" y="15"/>
+              </connectionPointOut>
+              <expression>TargetPressure</expression>
             </inOutVariable>
             <inVariable localId="3" executionOrderId="0" height="25" width="60" negated="false">
               <position x="130" y="225"/>
@@ -92,12 +92,29 @@
               </connectionPointOut>
               <expression>1</expression>
             </inVariable>
-            <block localId="4" typeName="PumpControl" instanceName="Pump0" executionOrderId="0" height="20" width="98">
+            <block localId="4" typeName="PumpControl" instanceName="Pump0" executionOrderId="0" height="40" width="127">
               <position x="595" y="50"/>
-              <inputVariables/>
+              <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>
           </FBD>
         </body>
       </pou>
@@ -114,6 +131,15 @@
                 <derived name="HMI_INT"/>
               </type>
             </variable>
+          </localVars>
+          <inputVars>
+            <variable name="TargetPressure">
+              <type>
+                <INT/>
+              </type>
+            </variable>
+          </inputVars>
+          <localVars>
             <variable name="AddOut">
               <type>
                 <derived name="HMI_INT"/>
@@ -206,15 +232,8 @@
       <configuration name="config">
         <resource name="resource1">
           <task name="task0" priority="0" interval="T#20ms">
-            <pouInstance name="instance0" typeName="program0"/>
+            <pouInstance name="instance0" typeName="MainStuff"/>
           </task>
-          <globalVars>
-            <variable name="LocalVar0">
-              <type>
-                <derived name="HMI_LABEL"/>
-              </type>
-            </variable>
-          </globalVars>
         </resource>
       </configuration>
     </configurations>
--- a/tests/svghmi/svghmi_0@svghmi/gui.svg	Wed Aug 14 11:05:17 2019 +0200
+++ b/tests/svghmi/svghmi_0@svghmi/gui.svg	Wed Aug 14 13:06:03 2019 +0200
@@ -14,7 +14,7 @@
    viewBox="0 0 1280 720"
    version="1.1"
    id="hmi0"
-   sodipodi:docname="default.svg"
+   sodipodi:docname="gui.svg"
    inkscape:version="0.92.3 (2405546, 2018-03-11)">
   <metadata
      id="metadata4542">
@@ -42,8 +42,8 @@
      showgrid="false"
      units="px"
      inkscape:zoom="0.7"
-     inkscape:cx="576.80864"
-     inkscape:cy="330.28432"
+     inkscape:cx="586.09435"
+     inkscape:cy="381.71289"
      inkscape:window-width="1600"
      inkscape:window-height="886"
      inkscape:window-x="0"
@@ -57,36 +57,61 @@
      x="0"
      y="0">
     <desc
-       id="desc_page0">This is description for page 0
-
-all lines in the form &quot;name: value&quot; 
-are used as js object definition initializer
-
-role: &quot;page&quot;
-name: &quot;Home&quot;
-
-after triple opening braces is global JavaScript code
-
-{{{
-/* JS style Comment */
-alert(&quot;Hello World&quot;);
-}}}
-
-after triple closing braces is back to description
+       id="desc_page0">=HMI=
+role = Page;
+name = &quot;Home&quot;;
 </desc>
   </rect>
   <text
      xml:space="preserve"
      style="font-style:normal;font-weight:normal;font-size:160px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-     x="436.32812"
+     x="136.32812"
      y="418.24219"
      id="text5151"
      inkscape:label="count"><desc
-       id="desc5153">path: &quot;count&quot;
-format: &quot;%4.4d&quot;</desc><tspan
+       id="desc5153">=HMI=
+role = Input;
+path = &quot;/PRESSURETARGET&quot;;
+/* Don't forget to press the &quot;Set&quot; button ! */</desc><tspan
        sodipodi:role="line"
        id="tspan5149"
-       x="436.32812"
+       x="136.32812"
        y="418.24219"
        style="stroke-width:1px">8888</tspan></text>
+  <text
+     inkscape:label="count"
+     id="text823"
+     y="418.24219"
+     x="756.32812"
+     style="font-style:normal;font-weight:normal;font-size:160px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     xml:space="preserve"><desc
+       id="desc819">=HMI=
+role = Display;
+path = &quot;/PUMP/PRESSURE&quot;;
+/* Don't forget to press the &quot;Set&quot; button ! */</desc><tspan
+       style="stroke-width:1px"
+       y="418.24219"
+       x="756.32812"
+       id="tspan821"
+       sodipodi:role="line">8888</tspan></text>
+  <text
+     xml:space="preserve"
+     style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
+     x="242.85715"
+     y="197.14285"
+     id="text827"><tspan
+       sodipodi:role="line"
+       id="tspan825"
+       x="242.85715"
+       y="197.14285">SetPoint</tspan></text>
+  <text
+     id="text831"
+     y="197.14285"
+     x="882.85718"
+     style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
+     xml:space="preserve"><tspan
+       y="197.14285"
+       x="882.85718"
+       id="tspan829"
+       sodipodi:role="line">Actual</tspan></text>
 </svg>