etherlab/EthercatCIA402Slave.py
changeset 2380 b35bce45bc5a
parent 2375 cfa68a06a24d
child 2381 1c40e3976cc2
equal deleted inserted replaced
2379:015b724c30a5 2380:b35bce45bc5a
   147         return _EthercatSlaveCTN.SetParamsAttribute(self, path, value)
   147         return _EthercatSlaveCTN.SetParamsAttribute(self, path, value)
   148 
   148 
   149     def GetVariableLocationTree(self):
   149     def GetVariableLocationTree(self):
   150         axis_name = self.CTNName()
   150         axis_name = self.CTNName()
   151         current_location = self.GetCurrentLocation()
   151         current_location = self.GetCurrentLocation()
   152         children = [{"name": name_frmt % (axis_name),
   152         children = [
   153                      "type": LOCATION_VAR_INPUT,
   153             {
   154                      "size": "W",
   154                 "name": name_frmt % (axis_name),
   155                      "IEC_type": iec_type,
   155                 "type": LOCATION_VAR_INPUT,
   156                      "var_name": var_name_frmt % axis_name,
   156                 "size": "W",
   157                      "location": location_frmt % (
   157                 "IEC_type": iec_type,
   158                             ".".join(map(str, current_location))),
   158                 "var_name": var_name_frmt % axis_name,
   159                      "description": "",
   159                 "location": location_frmt % (".".join(map(str, current_location))),
   160                      "children": []}
   160                 "description": "",
   161                     for name_frmt, iec_type, var_name_frmt, location_frmt in
   161                 "children": []
   162                         [("%s Network Position", "UINT", "%s_pos", "%%IW%s"),
   162             }
   163                          ("%s Axis Ref", "AXIS_REF", "%s", "%%IW%s.402")]]
   163             for name_frmt, iec_type, var_name_frmt, location_frmt in [
       
   164                     ("%s Network Position", "UINT", "%s_pos", "%%IW%s"),
       
   165                     ("%s Axis Ref", "AXIS_REF", "%s", "%%IW%s.402")
       
   166             ]
       
   167         ]
   164         children.extend(self.CTNParent.GetDeviceLocationTree(
   168         children.extend(self.CTNParent.GetDeviceLocationTree(
   165                             self.GetSlavePos(), current_location, axis_name))
   169                             self.GetSlavePos(), current_location, axis_name))
   166         return {
   170         return {
   167             "name": axis_name,
   171             "name": axis_name,
   168             "type": LOCATION_CONFNODE,
   172             "type": LOCATION_CONFNODE,