Fixed bug ForceVariableDialog when forcing DATETIME variables
authorLaurent Bessard
Tue, 26 Feb 2013 01:14:20 +0100
changeset 941 b6e93549de2e
parent 940 0c68d1af821d
child 942 2ba9d7e3be72
Fixed bug ForceVariableDialog when forcing DATETIME variables
dialogs/ForceVariableDialog.py
tests/python/plc.xml
--- a/dialogs/ForceVariableDialog.py	Sun Feb 24 00:28:49 2013 +0100
+++ b/dialogs/ForceVariableDialog.py	Tue Feb 26 01:14:20 2013 +0100
@@ -109,7 +109,7 @@
     if result is not None:
         year, month, day, hours, minutes, seconds = result.groups()
         try:
-            date = datetime.datetime(int(year), int(month), int(day), int(hours), int(minutes), int(float(seconds)), int((float(second) * SECOND) % SECOND))
+            date = datetime.datetime(int(year), int(month), int(day), int(hours), int(minutes), int(float(seconds)), int((float(seconds) * SECOND) % SECOND))
         except ValueError, e:
             return None
         base_date = datetime.datetime(1970, 1, 1)
--- a/tests/python/plc.xml	Sun Feb 24 00:28:49 2013 +0100
+++ b/tests/python/plc.xml	Tue Feb 26 01:14:20 2013 +0100
@@ -8,7 +8,7 @@
               productVersion="0.0"
               creationDateTime="2008-12-14T16:21:19"/>
   <contentHeader name="Beremiz Python Support Tests"
-                 modificationDateTime="2013-01-11T14:08:25">
+                 modificationDateTime="2013-02-23T23:37:47">
     <coordinateInfo>
       <pageSize x="1024" y="1024"/>
       <fbd>
@@ -125,7 +125,7 @@
                 <WORD/>
               </type>
               <initialValue>
-                <simpleValue value="342"/>
+                <simpleValue value="300"/>
               </initialValue>
             </variable>
             <variable name="Test_BCD_RESULT">
@@ -133,12 +133,17 @@
                 <UINT/>
               </type>
             </variable>
+            <variable name="Test_BCD_ENO">
+              <type>
+                <BOOL/>
+              </type>
+            </variable>
             <variable name="Test_DT">
               <type>
                 <DT/>
               </type>
               <initialValue>
-                <simpleValue value="DT#2012-11-08-12:17:00"/>
+                <simpleValue value="DT#2013-02-23-22:35:46"/>
               </initialValue>
             </variable>
             <variable name="Test_TOD">
@@ -146,6 +151,11 @@
                 <TOD/>
               </type>
             </variable>
+            <variable name="Test_TOD_STRING">
+              <type>
+                <string/>
+              </type>
+            </variable>
             <variable name="Test_Date">
               <type>
                 <DATE/>
@@ -690,12 +700,17 @@
               </connectionPointOut>
               <expression>Test_BCD</expression>
             </inVariable>
-            <block localId="35" width="105" height="45" typeName="BCD_TO_UINT">
-              <position x="900" y="725"/>
-              <inputVariables>
+            <block localId="35" width="105" height="60" typeName="BCD_TO_UINT">
+              <position x="900" y="705"/>
+              <inputVariables>
+                <variable formalParameter="EN">
+                  <connectionPointIn>
+                    <relPosition x="0" y="30"/>
+                  </connectionPointIn>
+                </variable>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="50"/>
                     <connection refLocalId="34">
                       <position x="900" y="755"/>
                       <position x="860" y="755"/>
@@ -705,9 +720,14 @@
               </inputVariables>
               <inOutVariables/>
               <outputVariables>
+                <variable formalParameter="ENO">
+                  <connectionPointOut>
+                    <relPosition x="105" y="30"/>
+                  </connectionPointOut>
+                </variable>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="105" y="30"/>
+                    <relPosition x="105" y="50"/>
                   </connectionPointOut>
                 </variable>
               </outputVariables>
@@ -765,17 +785,6 @@
                 </variable>
               </outputVariables>
             </block>
-            <outVariable localId="39" height="30" width="75">
-              <position x="1215" y="815"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
-                <connection refLocalId="37" formalParameter="OUT">
-                  <position x="1215" y="830"/>
-                  <position x="1155" y="830"/>
-                </connection>
-              </connectionPointIn>
-              <expression>Test_TOD</expression>
-            </outVariable>
             <outVariable localId="40" height="30" width="80">
               <position x="1215" y="890"/>
               <connectionPointIn>
@@ -979,6 +988,66 @@
               </connectionPointOut>
               <expression>BOOL#FALSE</expression>
             </inVariable>
+            <outVariable localId="53" height="30" width="115">
+              <position x="1060" y="700"/>
+              <connectionPointIn>
+                <relPosition x="0" y="15"/>
+                <connection refLocalId="35" formalParameter="ENO">
+                  <position x="1060" y="715"/>
+                  <position x="1032" y="715"/>
+                  <position x="1032" y="735"/>
+                  <position x="1005" y="735"/>
+                </connection>
+              </connectionPointIn>
+              <expression>Test_BCD_ENO</expression>
+            </outVariable>
+            <outVariable localId="54" height="30" width="135">
+              <position x="1565" y="815"/>
+              <connectionPointIn>
+                <relPosition x="0" y="15"/>
+                <connection refLocalId="55" formalParameter="OUT">
+                  <position x="1565" y="830"/>
+                  <position x="1490" y="830"/>
+                </connection>
+              </connectionPointIn>
+              <expression>Test_TOD_STRING</expression>
+            </outVariable>
+            <block localId="55" width="125" height="45" typeName="TOD_TO_STRING">
+              <position x="1365" y="800"/>
+              <inputVariables>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition x="0" y="30"/>
+                    <connection refLocalId="39">
+                      <position x="1365" y="830"/>
+                      <position x="1290" y="830"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition x="125" y="30"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inOutVariable localId="39" height="30" width="75">
+              <position x="1215" y="815"/>
+              <connectionPointIn>
+                <relPosition x="0" y="15"/>
+                <connection refLocalId="37" formalParameter="OUT">
+                  <position x="1215" y="830"/>
+                  <position x="1155" y="830"/>
+                </connection>
+              </connectionPointIn>
+              <connectionPointOut>
+                <relPosition x="75" y="15"/>
+              </connectionPointOut>
+              <expression>Test_TOD</expression>
+            </inOutVariable>
           </FBD>
         </body>
       </pou>