##// END OF EJS Templates
Se agrego el ID de identificacion para cada clase del controlador....
Miguel Valdez -
r195:7a77d1c4b33f
parent child
Show More
@@ -40,7 +40,7 class Controller():
40 40
41 41 def addReadBranch(self, dpath, dataformat, readMode, startDate='', endDate='', startTime='', endTime=''):
42 42
43 id = len(self.readBranchObjList) + 1
43 id = self.getNewId()
44 44
45 45 readBranchObj = ReadBranch()
46 46 readBranchObj.setup(id, dpath, dataformat, readMode, startDate, endDate, startTime, endTime)
@@ -51,7 +51,7 class Controller():
51 51
52 52 def addProcBranch(self, name):
53 53
54 id = len(self.procBranchObjList) + 1
54 id = self.getNewId()
55 55
56 56 procBranchObj = ProcBranch()
57 57 procBranchObj.setup(id, name)
@@ -60,6 +60,11 class Controller():
60 60
61 61 return procBranchObj
62 62
63 def getNewId(self):
64
65 id = int(self.id)*10 + len(self.readBranchObjList) + len(self.procBranchObjList) + 1
66 return id
67
63 68 def makeXml(self):
64 69
65 70 projectElement = Element('Controller')
@@ -156,7 +161,7 class ReadBranch():
156 161
157 162 def addParameter(self, name, value):
158 163
159 id = len(self.parmObjList) + 1
164 id = int(self.id)*10 + len(self.parmObjList) + 1
160 165
161 166 parmObj = ParameterConf()
162 167 parmObj.setup(id, name, value)
@@ -219,12 +224,12 class ProcBranch():
219 224
220 225 self.upObjList = []
221 226
222 def addUP(self, name, type):
227 def addUP(self, name, type, inputId):
223 228
224 id = len(self.upObjList) + 1
229 id = int(self.id)*10 + len(self.upObjList) + 1
225 230
226 231 upObj = UPConf()
227 upObj.setup(id, name, type)
232 upObj.setup(id, name, type, inputId)
228 233
229 234 self.upObjList.append(upObj)
230 235
@@ -273,7 +278,7 class UPConf():
273 278 def __init__(self):
274 279 pass
275 280
276 def setup(self, id, name, type, inputId=0):
281 def setup(self, id, name, type, inputId):
277 282
278 283 self.id = id
279 284 self.name = name
@@ -284,7 +289,7 class UPConf():
284 289
285 290 def addOperation(self, name, priority, type='self'):
286 291
287 id = len(self.opObjList) + 1
292 id = int(self.id)*10 + len(self.opObjList) + 1
288 293
289 294 opObj = OperationConf()
290 295 opObj.setup(id, name, priority, type)
@@ -357,7 +362,7 class OperationConf():
357 362
358 363 def addParameter(self, name, value):
359 364
360 id = len(self.parmObjList) + 1
365 id = int(self.id)*10 + len(self.parmObjList) + 1
361 366
362 367 parmObj = ParameterConf()
363 368 parmObj.setup(id, name, value)
@@ -451,13 +456,13 if __name__ == '__main__':
451 456 procBranchObj = projectObj.addProcBranch(name='Branch1')
452 457
453 458 procBranchObj1 = projectObj.addProcBranch(name='Branch2')
454 upObj1 = procBranchObj.addUP(name='UP1', type='Voltage')
455 upObj2 = procBranchObj.addUP(name='UP2', type='Voltage')
459
460 upObj1 = procBranchObj.addUP(name='UP1', type='Voltage', inputId=readBranchObj.id)
461 upObj2 = procBranchObj.addUP(name='UP2', type='Voltage', inputId=upObj1.id)
456 462
457 463 opObj11 = upObj1.addOperation(name='removeDC', priority=1)
458 464 opObj11.addParameter(name='type', value='1')
459 465
460
461 466 opObj12 = upObj1.addOperation(name='decoder', priority=2)
462 467 opObj12.addParameter(name='ncode', value='2')
463 468 opObj12.addParameter(name='nbauds', value='8')
General Comments 0
You need to be logged in to leave comments. Login now