PLCControler.py
changeset 1322 0a9227f743b3
parent 1321 83f41ea00b97
child 1324 884477877e53
equal deleted inserted replaced
1321:83f41ea00b97 1322:0a9227f743b3
  1375             return_type = pou.interface.getreturnType()
  1375             return_type = pou.interface.getreturnType()
  1376             if return_type is not None:
  1376             if return_type is not None:
  1377                 return_type_infos_xslt_tree = etree.XSLT(
  1377                 return_type_infos_xslt_tree = etree.XSLT(
  1378                     variables_infos_xslt, extensions = {
  1378                     variables_infos_xslt, extensions = {
  1379                           ("var_infos_ns", "var_tree"): VarTree(self)})
  1379                           ("var_infos_ns", "var_tree"): VarTree(self)})
  1380             return [extract_param(el) 
  1380                 return [extract_param(el) 
  1381                    for el in return_type_infos_xslt_tree(return_type).getroot()]
  1381                        for el in return_type_infos_xslt_tree(return_type).getroot()]
  1382                 
  1382                 
  1383         return [None, ([], [])] 
  1383         return [None, ([], [])] 
  1384 
  1384 
  1385     # Function that add a new confnode to the confnode list
  1385     # Function that add a new confnode to the confnode list
  1386     def AddConfNodeTypesList(self, typeslist):
  1386     def AddConfNodeTypesList(self, typeslist):
  2484             variable = element.getinstance(id)
  2484             variable = element.getinstance(id)
  2485             if variable is None:
  2485             if variable is None:
  2486                 return 
  2486                 return 
  2487             for param, value in infos.items():
  2487             for param, value in infos.items():
  2488                 if param == "name":
  2488                 if param == "name":
  2489                     expression = PLCOpenParser.CreateElement("expression", variable.getLocalTag())
  2489                     variable.setexpression(value)
  2490                     expression.text = value
       
  2491                     variable.setexpression(expression)
       
  2492                 elif param == "executionOrder" and variable.getexecutionOrderId() != value:
  2490                 elif param == "executionOrder" and variable.getexecutionOrderId() != value:
  2493                     element.setelementExecutionOrder(variable, value)
  2491                     element.setelementExecutionOrder(variable, value)
  2494                 elif param == "height":
  2492                 elif param == "height":
  2495                     variable.setheight(value)
  2493                     variable.setheight(value)
  2496                 elif param == "width":
  2494                 elif param == "width":
  2637             contact = element.getinstance(id)
  2635             contact = element.getinstance(id)
  2638             if contact is None:
  2636             if contact is None:
  2639                 return
  2637                 return
  2640             for param, value in infos.items():
  2638             for param, value in infos.items():
  2641                 if param == "name":
  2639                 if param == "name":
  2642                     variable = PLCOpenParser.CreateElement("variable", "contact")
  2640                     contact.setvariable(value)
  2643                     variable.text = value
       
  2644                     contact.setvariable(variable)
       
  2645                 elif param == "type":
  2641                 elif param == "type":
  2646                     negated, edge = {
  2642                     negated, edge = {
  2647                         CONTACT_NORMAL: (False, "none"),
  2643                         CONTACT_NORMAL: (False, "none"),
  2648                         CONTACT_REVERSE: (True, "none"),
  2644                         CONTACT_REVERSE: (True, "none"),
  2649                         CONTACT_RISING: (False, "rising"),
  2645                         CONTACT_RISING: (False, "rising"),
  2682             coil = element.getinstance(id)
  2678             coil = element.getinstance(id)
  2683             if coil is None:
  2679             if coil is None:
  2684                 return
  2680                 return
  2685             for param, value in infos.items():
  2681             for param, value in infos.items():
  2686                 if param == "name":
  2682                 if param == "name":
  2687                     variable = PLCOpenParser.CreateElement("variable", "coil")
  2683                     coil.setvariable(value)
  2688                     variable.text = value
       
  2689                     coil.setvariable(variable)
       
  2690                 elif param == "type":
  2684                 elif param == "type":
  2691                     negated, storage, edge = {
  2685                     negated, storage, edge = {
  2692                         COIL_NORMAL: (False, "none", "none"),
  2686                         COIL_NORMAL: (False, "none", "none"),
  2693                         COIL_REVERSE: (True, "none", "none"),
  2687                         COIL_REVERSE: (True, "none", "none"),
  2694                         COIL_SET: (False, "set", "none"),
  2688                         COIL_SET: (False, "set", "none"),