@@ -69,7 +69,7 | |||
|
69 | 69 | datarpta = self.__getConnectionStatus(cmd = cmd, rx_buffer = rx_buffer) |
|
70 | 70 | |
|
71 | 71 | if cmd == "MNTR": |
|
72 |
datarpta = self.__getControlModuleStatus_new(cmd = cmd, |
|
|
72 | datarpta = self.__getControlModuleStatus_new(cmd = cmd, type = rx_buffer) | |
|
73 | 73 | |
|
74 | 74 | self.commServerObj.sendData(cmd=cmd, data=datarpta, ipDestino = ipSource) |
|
75 | 75 | |
@@ -286,40 +286,50 | |||
|
286 | 286 | |
|
287 | 287 | return self.bits |
|
288 | 288 | |
|
289 |
def __getControlModuleStatus_new(self, cmd, |
|
|
290 | ||
|
291 | all_mnt = [] | |
|
292 | for id in range(1,65): | |
|
293 | if id not in self.enaModules: | |
|
294 | continue | |
|
295 | ||
|
296 | mnt = self.__ConnectionWithControlModules(rx_buffer,cmd,id) | |
|
297 | all_mnt.append(mnt) | |
|
298 | ||
|
299 | __function1(type = rx_buffer, in_lst = all_mnt) | |
|
300 | #return "".join(all_mnt) | |
|
301 | ||
|
302 | def __function1(self, type, in_lst): | |
|
303 | ||
|
304 | if type == "0": | |
|
305 | out_str = "".join(in_lst) | |
|
306 | elif type == "1": | |
|
307 | out_str = "".join(in_lst) | |
|
308 | elif type == "2": | |
|
309 | out_str = "".join(in_lst) | |
|
289 | def __getControlModuleStatus_new(self, cmd, type): | |
|
290 | ||
|
291 | cm_lst = self.__gettingDataFromControlModules(self, cmd, rx_buffer = type) | |
|
292 | out_lst = self.__processingCMdata(in_data = cm_lst, type = type) | |
|
293 | ||
|
294 | return "".join(lst_out) | |
|
295 | ||
|
296 | def __gettingDataFromControlModules(self, cmd, rx_buffer): | |
|
297 | ||
|
298 | for id in range(1,65): | |
|
299 | if id not in self.enaModules: | |
|
300 | continue | |
|
301 | ||
|
302 | cm = self.__ConnectionWithControlModules(rx_buffer,cmd,id) | |
|
303 | del self.test[id-1] | |
|
304 | self.test.insert(id-1, cm) | |
|
305 | ||
|
306 | return self.test | |
|
307 | ||
|
308 | def __processingCMdata(self,in_data, type): | |
|
309 | ||
|
310 | if (type == "0") or (type == "1") or (type == "2"): | |
|
311 | out_str = "".join(in_data) | |
|
310 | 312 | elif type == "3": |
|
311 |
TwoComparation(in_lst = in_ |
|
|
313 | out_str = TwoComparation(in_lst = in_data) | |
|
312 | 314 | else: |
|
313 |
ThreeComparation(in_lst = in_ |
|
|
315 | out_str = ThreeComparation(in_lst = in_data) | |
|
314 | 316 | |
|
315 | 317 | return out_str |
|
316 | 318 | |
|
317 | 319 | def __TwoComparation(self, in_lst): |
|
320 | ||
|
318 | 321 | cm_up =[] |
|
319 | 322 | cm_dw =[] |
|
320 | 323 | relay_up =[] |
|
321 | 324 | relay_dw =[] |
|
325 | ||
|
322 | 326 | for i in in_lst: |
|
327 | if len(i) == 8: | |
|
328 | relay_up.append("-") | |
|
329 | relay_dw.append("-") | |
|
330 | cm_up.append("-") | |
|
331 | cm_dw.append("-") | |
|
332 | continue | |
|
323 | 333 | relay_up.append(i[14:17]) |
|
324 | 334 | relay_dw.append(i[17:20]) |
|
325 | 335 | cm_up.append(i[21:24]) |
@@ -328,22 +338,25 | |||
|
328 | 338 | comp_up = [] |
|
329 | 339 | comp_dw = [] |
|
330 | 340 | |
|
331 |
for i in range( |
|
|
332 |
if |
|
|
333 |
comp_up.append( |
|
|
341 | for i in range(64): | |
|
342 | if len(relay_up == 1): | |
|
343 | comp_up.append('x') | |
|
334 | 344 | else: |
|
335 | comp_up.append(1) | |
|
345 | if cmp(relay_up[i], cm_up[i]) == 0: | |
|
346 | comp_up.append('0') | |
|
347 | else: | |
|
348 | comp_up.append('1') | |
|
336 | 349 | |
|
337 | 350 | for i in range(len(relay_dw)): |
|
351 | comp_dw.append('x') | |
|
338 | 352 | if cmp(relay_dw[i], cm_dw[i]) == 0: |
|
339 | comp_dw.append(0) | |
|
353 | comp_dw.append('0') | |
|
340 | 354 | else: |
|
341 | comp_dw.append(1) | |
|
355 | comp_dw.append('1') | |
|
342 | 356 | |
|
343 | 357 | print comp_up |
|
344 | 358 | print comp_dw |
|
345 | ||
|
346 | ||
|
359 | ||
|
347 | 360 | |
|
348 | 361 | def __ThreeComparation(self, in_lst): |
|
349 | 362 | pass |
@@ -453,6 +466,7 | |||
|
453 | 466 | self.rxFile = list("------\n------\n------\n" for i in range(64)) |
|
454 | 467 | self.bits = list("------\n------\n------\n" for i in range(64)) |
|
455 | 468 | self.phase = list("----- -----\n----- -----\n----- -----\n" for i in range(64)) |
|
469 | self.test = list("------\n" for i in range(64)) | |
|
456 | 470 | |
|
457 | 471 | def __AutomaticControlModules(self): |
|
458 | 472 |
General Comments 0
You need to be logged in to leave comments.
Login now