equal
deleted
inserted
replaced
32 from EthercatCIA402Slave import _EthercatCIA402SlaveCTN |
32 from EthercatCIA402Slave import _EthercatCIA402SlaveCTN |
33 HAS_MCL = True |
33 HAS_MCL = True |
34 except Exception: |
34 except Exception: |
35 HAS_MCL = False |
35 HAS_MCL = False |
36 |
36 |
37 #-------------------------------------------------- |
37 # -------------------------------------------------- |
38 # Remote Exec Etherlab Commands |
38 # Remote Exec Etherlab Commands |
39 #-------------------------------------------------- |
39 # -------------------------------------------------- |
40 |
40 |
41 SCAN_COMMAND = """ |
41 SCAN_COMMAND = """ |
42 import commands |
42 import commands |
43 result = commands.getoutput("ethercat slaves") |
43 result = commands.getoutput("ethercat slaves") |
44 slaves = [] |
44 slaves = [] |
62 break |
62 break |
63 slaves.append(slave) |
63 slaves.append(slave) |
64 returnVal = slaves |
64 returnVal = slaves |
65 """ |
65 """ |
66 |
66 |
67 #-------------------------------------------------- |
67 # -------------------------------------------------- |
68 # Etherlab Specific Blocks Library |
68 # Etherlab Specific Blocks Library |
69 #-------------------------------------------------- |
69 # -------------------------------------------------- |
70 |
70 |
71 def GetLocalPath(filename): |
71 def GetLocalPath(filename): |
72 return os.path.join(os.path.split(__file__)[0], filename) |
72 return os.path.join(os.path.split(__file__)[0], filename) |
73 |
73 |
74 class EtherlabLibrary(POULibrary): |
74 class EtherlabLibrary(POULibrary): |
87 |
87 |
88 runtimefile_path = os.path.join(os.path.split(__file__)[0], "runtime_etherlab.py") |
88 runtimefile_path = os.path.join(os.path.split(__file__)[0], "runtime_etherlab.py") |
89 return ((["etherlab_ext"], [(Gen_etherlabfile_path, IECCFLAGS)], True), "", |
89 return ((["etherlab_ext"], [(Gen_etherlabfile_path, IECCFLAGS)], True), "", |
90 ("runtime_etherlab.py", file(GetLocalPath("runtime_etherlab.py")))) |
90 ("runtime_etherlab.py", file(GetLocalPath("runtime_etherlab.py")))) |
91 |
91 |
92 #-------------------------------------------------- |
92 # -------------------------------------------------- |
93 # Ethercat MASTER |
93 # Ethercat MASTER |
94 #-------------------------------------------------- |
94 # -------------------------------------------------- |
95 |
95 |
96 EtherCATConfigParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd")) |
96 EtherCATConfigParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATConfig.xsd")) |
97 |
97 |
98 def sort_commands(x, y): |
98 def sort_commands(x, y): |
99 if x["Index"] == y["Index"]: |
99 if x["Index"] == y["Index"]: |
569 if slave is not None: |
569 if slave is not None: |
570 type_infos = slave.getType() |
570 type_infos = slave.getType() |
571 device, module_extra_params = self.GetModuleInfos(type_infos) |
571 device, module_extra_params = self.GetModuleInfos(type_infos) |
572 if device is not None: |
572 if device is not None: |
573 entries = device.GetEntriesList(limits) |
573 entries = device.GetEntriesList(limits) |
574 #print entries |
|
575 entries_list = entries.items() |
574 entries_list = entries.items() |
576 entries_list.sort() |
575 entries_list.sort() |
577 entries = [] |
576 entries = [] |
578 current_index = None |
577 current_index = None |
579 current_entry = None |
578 current_entry = None |
768 self.FileGenerator.DeclareVariable( |
767 self.FileGenerator.DeclareVariable( |
769 slave_pos, loc[1], loc[2], location["IEC_TYPE"], location["DIR"], location["NAME"]) |
768 slave_pos, loc[1], loc[2], location["IEC_TYPE"], location["DIR"], location["NAME"]) |
770 |
769 |
771 return [],"",False |
770 return [],"",False |
772 |
771 |
773 #------------------------------------------------------------------------------- |
772 # ------------------------------------------------------------------------------- |
774 # Current Buffering Management Functions |
773 # Current Buffering Management Functions |
775 #------------------------------------------------------------------------------- |
774 # ------------------------------------------------------------------------------- |
776 |
775 |
777 """ |
776 """ |
778 Return a copy of the config |
777 Return a copy of the config |
779 """ |
778 """ |
780 def Copy(self, model): |
779 def Copy(self, model): |