plugger.py
changeset 670 fb03cb6da95c
parent 669 472469f4d5ad
child 672 f97f207d027b
equal deleted inserted replaced
669:472469f4d5ad 670:fb03cb6da95c
  1285         CSV file generated by IEC2C compiler.
  1285         CSV file generated by IEC2C compiler.
  1286         """
  1286         """
  1287         self._ProgramList = None
  1287         self._ProgramList = None
  1288         self._VariablesList = None
  1288         self._VariablesList = None
  1289         self._IECPathToIdx = {}
  1289         self._IECPathToIdx = {}
       
  1290         self._Ticktime = 0
  1290         self.TracedIECPath = []
  1291         self.TracedIECPath = []
  1291 
  1292 
  1292     def GetIECProgramsAndVariables(self):
  1293     def GetIECProgramsAndVariables(self):
  1293         """
  1294         """
  1294         Parse CSV-like file  VARIABLES.csv resulting from IEC2C compiler.
  1295         Parse CSV-like file  VARIABLES.csv resulting from IEC2C compiler.
  1339                     self._VariablesList.append(attrs)
  1340                     self._VariablesList.append(attrs)
  1340                     # Fill in IEC<->C translation dicts
  1341                     # Fill in IEC<->C translation dicts
  1341                     IEC_path=attrs["IEC_path"]
  1342                     IEC_path=attrs["IEC_path"]
  1342                     Idx=int(attrs["num"])
  1343                     Idx=int(attrs["num"])
  1343                     self._IECPathToIdx[IEC_path]=(Idx, attrs["type"])
  1344                     self._IECPathToIdx[IEC_path]=(Idx, attrs["type"])
       
  1345                 
       
  1346                 # third section contains ticktime
       
  1347                 if len(ListGroup) > 2:
       
  1348                     self._Ticktime = int(ListGroup[2][0]) 
       
  1349                 
  1344             except Exception,e:
  1350             except Exception,e:
  1345                 self.logger.write_error(_("Cannot open/parse VARIABLES.csv!\n"))
  1351                 self.logger.write_error(_("Cannot open/parse VARIABLES.csv!\n"))
  1346                 self.logger.write_error(traceback.format_exc())
  1352                 self.logger.write_error(traceback.format_exc())
  1347                 self.ResetIECProgramsAndVariables()
  1353                 self.ResetIECProgramsAndVariables()
  1348                 return False
  1354                 return False
  1760                     if status == "Forced" and cargs[1] == fvalue:
  1766                     if status == "Forced" and cargs[1] == fvalue:
  1761                         function(*(cargs + (True,) + args), **kwargs)
  1767                         function(*(cargs + (True,) + args), **kwargs)
  1762                     else:
  1768                     else:
  1763                         function(*(cargs + args), **kwargs)
  1769                         function(*(cargs + args), **kwargs)
  1764                 # This will block thread if more than one call is waiting
  1770                 # This will block thread if more than one call is waiting
       
  1771 
       
  1772     def GetTicktime(self):
       
  1773         return self._Ticktime
  1765 
  1774 
  1766     def DebugThreadProc(self):
  1775     def DebugThreadProc(self):
  1767         """
  1776         """
  1768         This thread waid PLC debug data, and dispatch them to subscribers
  1777         This thread waid PLC debug data, and dispatch them to subscribers
  1769         """
  1778         """