PLCControler.py
changeset 53 4988262d03e3
parent 47 2b2f8d88e6d3
child 56 7187e1c00975
--- a/PLCControler.py	Sat Jul 21 01:17:02 2007 +0200
+++ b/PLCControler.py	Sat Jul 21 01:20:00 2007 +0200
@@ -611,6 +611,8 @@
                 tempvar.setInitialValue(value)
             if var["Location"] != "":
                 tempvar.setAddress(var["Location"])
+            else:
+                tempvar.setAddress(None)
             # Add variable to varList
             current_varlist.appendVariable(tempvar)
         return varlist_list
@@ -635,13 +637,17 @@
             # Extract variables from every varLists
             for varlist in configuration.getGlobalVars():
                 for var in varlist.getVariable():
-                    tempvar = {"Name":var.getName(),"Class":"Global","Type":var.getType().getValue(),
-                        "Location":var.getAddress()}
+                    tempvar = {"Name":var.getName(),"Class":"Global","Type":var.getType().getValue()}
                     initial = var.getInitialValue()
                     if initial:
                         tempvar["Initial Value"] = initial.getValue()
                     else:
                         tempvar["Initial Value"] = ""
+                    address = var.getAddress()
+                    if address:
+                        tempvar["Location"] = address
+                    else:
+                        tempvar["Location"] = ""
                     if varlist.getRetain():
                         tempvar["Retain"] = "Yes"
                     else:
@@ -673,13 +679,17 @@
             # Extract variables from every varLists
             for varlist in resource.getGlobalVars():
                 for var in varlist.getVariable():
-                    tempvar = {"Name":var.getName(),"Class":"Global","Type":var.getType().getValue(),
-                        "Location":var.getAddress()}
+                    tempvar = {"Name":var.getName(),"Class":"Global","Type":var.getType().getValue()}
                     initial = var.getInitialValue()
                     if initial:
                         tempvar["Initial Value"] = initial.getValue()
                     else:
                         tempvar["Initial Value"] = ""
+                    address = var.getAddress()
+                    if address:
+                        tempvar["Location"] = address
+                    else:
+                        tempvar["Location"] = ""
                     if varlist.getRetain():
                         tempvar["Retain"] = "Yes"
                     else:
@@ -704,13 +714,17 @@
             # Extract variables from every varLists
             for type, varlist in pou.getVars():
                 for var in varlist.getVariable():
-                    tempvar = {"Name":var.getName(),"Class":type,"Type":var.getType().getValue(),
-                        "Location":var.getAddress()}
+                    tempvar = {"Name":var.getName(),"Class":type,"Type":var.getType().getValue()}
                     initial = var.getInitialValue()
                     if initial:
                         tempvar["Initial Value"] = initial.getValue()
                     else:
                         tempvar["Initial Value"] = ""
+                    address = var.getAddress()
+                    if address:
+                        tempvar["Location"] = address
+                    else:
+                        tempvar["Location"] = ""
                     if varlist.getRetain():
                         tempvar["Retain"] = "Yes"
                     else: