##// END OF EJS Templates
Review & fix ABS module
Juan C. Espinoza -
r307:678cf1e292ab
parent child
Show More
This diff has been collapsed as it changes many lines, (643 lines changed) Show them Hide them
@@ -76,20 +76,10 rx_default = json.dumps({
76 76 [0,0,0,0,1,1,1,1]],
77 77 })
78 78
79 conf_default = {}
80 status_default = {}
79 status_default = '0000000000000000000000000000000000000000000000000000000000000000'
81 80 default_messages = {}
82 default_modulemode = {"1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0, "10": 0,
83 "11": 0, "12": 0, "13": 0, "14": 0, "15": 0, "16": 0, "17": 0, "18": 0, "19": 0, "20": 0,
84 "21": 0, "22": 0, "23": 0, "24": 0, "25": 0, "26": 0, "27": 0, "28": 0, "29": 0, "30": 0,
85 "31": 0, "32": 0, "33": 0, "34": 0, "35": 0, "36": 0, "37": 0, "38": 0, "39": 0, "40": 0,
86 "41": 0, "42": 0, "43": 0, "44": 0, "45": 0, "46": 0, "47": 0, "48": 0, "49": 0, "50": 0,
87 "51": 0, "52": 0, "53": 0, "54": 0, "55": 0, "56": 0, "57": 0, "58": 0, "59": 0, "60": 0,
88 "61": 0, "62": 0, "63": 0, "64": 0} # 0 : Socket // 1: API Rest
89 81
90 82 for i in range(1,65):
91 conf_default[str(i)] = ""
92 status_default[str(i)] = 0
93 83 default_messages[str(i)] = "Module "+str(i)
94 84
95 85
@@ -219,12 +209,11 OPERATION_MODES = (
219 209
220 210
221 211 class ABSConfiguration(Configuration):
222 active_beam = models.CharField(verbose_name='Active Beam', max_length=20000, default="{}")
212 active_beam = models.PositiveSmallIntegerField(verbose_name='Active Beam', default=0)
223 213 module_status = models.CharField(verbose_name='Module Status', max_length=10000, default=json.dumps(status_default))
224 214 operation_mode = models.PositiveSmallIntegerField(verbose_name='Operation Mode', choices=OPERATION_MODES, default = 0)
225 215 operation_value = models.FloatField(verbose_name='Periodic (seconds)', default="10", null=True, blank=True)
226 216 module_messages = models.CharField(verbose_name='Modules Messages', max_length=10000, default=json.dumps(default_messages))
227 module_mode = models.CharField(verbose_name='Modules Mode', max_length=10000, default=json.dumps(default_modulemode))
228 217
229 218 class Meta:
230 219 db_table = 'abs_configurations'
@@ -332,11 +321,8 class ABSConfiguration(Configuration):
332 321 beam.clone(abs_conf=self)
333 322
334 323 #-----For Active Beam-----
335 active_beam = json.loads(self.active_beam)
336 324 new_beams = ABSBeam.objects.filter(abs_conf=self)
337 active_beam['active_beam'] = new_beams[0].id
338
339 self.active_beam = json.dumps(active_beam)
325 self.active_beam = new_beams[0].id
340 326 self.save()
341 327 #-----For Active Beam-----
342 328 #-----For Device Status---
@@ -376,69 +362,6 class ABSConfiguration(Configuration):
376 362
377 363 return True
378 364
379 def monitoring_device(self):
380
381 monitoreo_tx = 'JROABSClnt_01CeCnMod000000MNTR10'
382 beam_tx = 'JROABSCeCnModCnMod01000001CHGB10'
383
384 beam_pos = 1
385 module_address = ('192.168.1.63', 5500)
386
387 message_tx = monitoreo_tx
388 # Create the datagram socket
389 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
390 sock.connect(module_address)
391
392 sock.send(message_tx)
393 t = sock.recv(1024)
394 print 'Respuesta: \n',t
395 sock.close()
396 sock = None
397
398 return True
399
400
401 def module_conf(self, module_num, beams):
402 """
403 This function creates beam configurations for one abs module.
404 """
405 ip_address = self.device.ip_address
406 ip_address = ip_address.split('.')
407 module_seq = (ip_address[0],ip_address[1],ip_address[2])
408 dot = '.'
409 module_ip = dot.join(module_seq)+'.'+str(module_num)
410 module_port = self.device.port_address
411 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
412
413 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
414 #module = 'ABS_'+str(module_num)
415 bs = '' #{}
416 i=1
417
418 for beam in beams:
419 #bs[i] = fromBinary2Char(beam.module_6bits(module_num))
420 bs = bs + fromBinary2Char(beam.module_6bits(module_num))
421 i=i+1
422
423 beams = bs
424
425 parameters = {}
426 parameters['beams'] = beams #json.dumps(beams)
427 print parameters
428 answer = ''
429
430 try:
431 #r_write = requests.post(write_route, parameters, timeout=0.5)
432 r_write = requests.post(write_route, json = parameters, timeout=0.7)
433 answer = r_write.json()
434 #self.message = answer['message']
435 except:
436 #self.message = "Could not write ABS parameters"
437 return False
438
439 return answer
440
441
442 365
443 366 def write_device(self):
444 367
@@ -448,62 +371,51 class ABSConfiguration(Configuration):
448 371 """
449 372
450 373 beams = ABSBeam.objects.filter(abs_conf=self)
451 connected_modules = ast.literal_eval(self.module_status)
452 suma_connected_modules = 0
453
454 for c in connected_modules:
455 suma_connected_modules = suma_connected_modules+connected_modules[c]
456 if not suma_connected_modules > 0 :
374 nbeams = len(beams)
375 if self.connected_modules() == 0 :
457 376 self.message = "No ABS Module detected."
458 377 return False
459 378
460 379 #-------------Write each abs module-----------
461 380 if beams:
462 beams_status = ast.literal_eval(self.module_status)
463 disconnected_modules = 0
464 for i in range(1,65): #(62,65)
465 #--------------JUEVES-------------
466 if beams_status[str(i)] != 0:
467 try:
468 answer = self.module_conf(i,beams)
469 if answer:
470 if answer['status']:
471 beams_status[str(i)] = 3
472 print answer
473
474 except:
475 beams_status[str(i)] = 1
476
477 pass
478 else:
479 disconnected_modules += 1
381 message = 'SNDF{:02d}'.format(nbeams)
382 for i, status in enumerate(self.module_status):
383 message += ''.join([fromBinary2Char(beam.module_6bits(i)) for beam in beams])
384 status = ['0'] * 64
385 n = 0
386
387 sock = self.send_multicast(message)
480 388
389 for i in range(64):
390 try:
391 data, address = sock.recvfrom(1024)
392 if data == '1':
393 status[int(address[0][10:])-1] = '3'
394 elif data == '0':
395 status[int(address[0][10:])-1] = '1'
396 except:
397 n += 1
398 sock.close()
481 399 else:
482 400 self.message = "ABS Configuration does not have beams"
483 401 return False
484 402
485 #self.device.status = 1
486 ##
487 #-------------Jueves-------------
488 if disconnected_modules == 64:
403 if n == 64:
489 404 self.message = "Could not write ABS Modules"
490 405 self.device.status = 0
406 self.module_status = ''.join(status)
407 self.save()
491 408 return False
492 409 else:
493 410 self.message = "ABS Beams List have been sent to ABS Modules"
494 411 beams[0].set_as_activebeam()
495 412
496 413 self.device.status = 3
497 self.module_status = json.dumps(beams_status)
498
499
500
414 self.module_status = ''.join(status)
501 415 self.save()
502 416 return True
503 417
504 418
505
506
507 419 def read_module(self, module):
508 420
509 421 """
@@ -560,240 +472,66 class ABSConfiguration(Configuration):
560 472 return parms
561 473
562 474
563 def absmodule_status(self):
564 """
565 This function gets the status of each abs module. It sends GET method to Web Application
566 in Python Bottle.
567 This function updates "module_status" field from ABSconfiguration.
568 """
569 ip_address = self.device.ip_address
570 ip_address = ip_address.split('.')
571 module_seq = (ip_address[0],ip_address[1],ip_address[2])
572 dot = '.'
573 module_port = self.device.port_address
574
575 modules_status = json.loads(self.module_status)
576 module_messages = json.loads(self.module_messages)
577
578 for i in range(1,65):
579 module_ip = dot.join(module_seq)+'.'+str(i)
580 print module_ip
581
582 route = 'http://'+module_ip+':'+str(module_port)+'/status'
583
584 try:
585 r = requests.get(route, timeout=0.8)#, timeout=0.7)
586 answer = r.json()
587 modules_status[str(i)] = answer['status']
588 module_messages[str(i)] = answer['message']
589 except:
590 modules_status[str(i)] = 0
591 pass
592
593
594 self.module_status = json.dumps(modules_status)
595 self.module_messages = json.dumps(module_messages)
596 self.save()
597
598 print 'Termino (='
599
600 return
601
602
603 475 def connected_modules(self):
604 476 """
605 477 This function returns the number of connected abs-modules without updating.
606 478 """
607 modules_status = json.loads(self.module_status)
608 479 num = 0
609 for status in modules_status:
610 if modules_status[status] != 0:
480 print(self.module_status)
481 for i, status in enumerate(self.module_status):
482 if status != '0':
611 483 num += 1
612
484 print('status {}:{}'.format(i+1, status))
613 485 return num
614 486
487 def send_multicast(self, message):
488
489 multicast_group = ('224.3.29.71', 10000)
490 # Create the datagram socket
491 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
492 sock.settimeout(0.01)
493 local_ip = "0.0.0.0"
494 sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(local_ip))
495 sent = sock.sendto(message, multicast_group)
496 print('Sending ' + message)
497 return sock
615 498
616 499 def status_device(self):
617 500 """
618 501 This function returns the status of all abs-modules as one.
619 502 If at least one module is connected, its answer is "1"
620 503 """
621 #self.absmodule_status()
622 send_task('status_absdevice', [self.id],)
623 connected_modules = self.connected_modules()
624 if connected_modules>0:
504
505 sock = self.send_multicast('MNTR')
506
507 n = 0
508 status = ['0'] * 64
509 for i in range(64):
510 try:
511 data, address = sock.recvfrom(1024)
512 if data == '1':
513 status[int(address[0][10:])-1] = '3'
514 elif data == '0':
515 status[int(address[0][10:])-1] = '1'
516 n += 1
517 print('Module: {} connected'.format(address))
518 except:
519 pass
520 sock.close()
521
522 if n > 0:
625 523 self.message = 'ABS modules Status have been updated.'
626 return 1
524 self.device.status = 1
627 525 else:
628 self.device.status=0
629
630 self.message = 'No ABS module is connected.'
526 self.device.status = 0
527 self.message = 'No ABS module is connected.'
528 self.module_status = ''.join(status)
631 529 self.save()
632 return 0
633
634
635
636 def write_module(self, module):
637
638 """
639 Send configuration to one abs module
640 """
641
642 parameters = {}
643 ip_address = self.device.ip_address
644 ip_address = ip_address.split('.')
645 module_seq = (ip_address[0],ip_address[1],ip_address[2])
646 dot = '.'
647 module_ip = dot.join(module_seq)+'.'+str(module)
648 module_port = self.device.port_address
649 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
650
651 #print write_route
652
653 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
654 #module = 'ABS_'+str(module)
655 beams = '!`*3<ENW'#{1: '001000', 2: '010001', 3: '010010', 4: '000011', 5: '101100', 6: '101101',
656 # 7: '110110', 8: '111111', 9: '000000', 10: '001001', 11: '010010', 12: '011011'}
657
658 #parameters['header'] = header
659 parameters['module'] = module
660 parameters['beams'] = json.dumps(beams)
661
662 answer = ''
663
664 try:
665 r_write = requests.post(write_route, parameters, timeout=0.5)
666 answer = r_write.json()
667 self.message = answer['message']
668 except:
669 self.message = "Could not write ABS parameters"
670 return 0
671 530
531 return self.device.status
672 532
673 #self.device.status = int(answer['status'])
674 533
675 return 1
676
677
678 def write_module_socket(self, module):
679 """
680 This function sends beams list to one abs-module to TCP_Control_Module using sockets
681 """
682
683 ip_address = self.device.ip_address
684 ip_address = ip_address.split('.')
685 module_seq = (ip_address[0],ip_address[1],ip_address[2])
686 dot = '.'
687 module_ip = dot.join(module_seq)+'.'+str(module)
688 module_port = self.device.port_address
689
690 header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
691 abs_module = 'ABS_'+str(module)
692
693 beams = self.get_beams()
694 beams_text = ''
695 for beam in beams:
696 modules_conf=json.loads(beam.modules_conf)
697 beams_text = beams_text + modules_conf[str(module)] + '\n'
698
699 message_tx = header + '\n' + abs_module + '\n' + beams_text + '0'
700 print "Send: ", message_tx
701
702 # Create the datagram socket
703 module_address = (module_ip, 5500)
704 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
705 try:
706 sock.connect(module_address)
707 sock.send(message_tx)
708 t = sock.recv(1024)
709 print 'Respuesta: \n',t
710
711 except Exception as e:
712 print str(e)
713 sock.close()
714 sock = None
715 return False
716
717 sock.close()
718 sock = None
719
720 return True
721
722 def write_device_socket(self):
723 """
724 This function sends beams list to every connected abs-module to TCP_Control_Module using sockets
725 """
726 module_mode = json.loads(self.module_mode)
727 module_status = json.loads(self.module_status)
728
729 for i in range(1,65):
730 if module_mode[str(i)] == 0 and module_status[str(i)] == 1: # 0: Sockets + Cserver & 1: Connected
731 try:
732 self.write_module_socket(i)
733 except Exception as e:
734 print 'Error ABS '+str(i)+': '+str(e)
735
736 return True
737
738
739 def beam_selector(self, module, beam_pos):
740 """
741 This function selects the beam number for one absmodule.
742 """
743
744 if beam_pos > 0:
745 beam_pos = beam_pos - 1
746 else:
747 beam_pos = 0
748
749 #El indice del apunte debe ser menor que el numero total de apuntes
750 #El servidor tcp en el embebido comienza a contar desde 0
751 beams_list = ABSBeam.objects.filter(abs_conf=self)
752 if len(beams_list) < beam_pos:
753 return 0
754
755 flag = 1
756 if beam_pos>9:
757 flag = 2
758
759 module_address = ('192.168.1.'+str(module), 5500)
760 header = 'JROABSCeCnModCnMod0100000'
761 numbers = len(str(beam_pos))
762 function = 'CHGB'
763
764 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
765
766 # Create the datagram socket
767 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
768 #sock.connect(module_address)
769 try:
770 sock.connect(module_address)
771 sock.send(message_tx)
772 sock.close()
773 print("Writing abs module:"+module_address[0]+"...")
774 except:
775 sock = None
776 print("Problem writing abs module:"+module_address[0])
777 return 0
778
779 return 1
780
781
782 def change_beam(self, beam_pos):
783 """
784 This function selects the beam number for all absmodules.
785 """
786 for i in range(1,65):
787 try:
788 self.beam_selector(i,beam_pos)
789 except:
790 print("Problem with module: 192.168.1."+str(i))
791 self.message = "Problem with module: 192.168.1."+str(i)
792 #return 0
793 return 1
794
795
796 def send_beam_num(self, beam_pos):
534 def send_beam(self, beam_pos):
797 535 """
798 536 This function connects to a multicast group and sends the beam number
799 537 to all abs modules.
@@ -833,52 +571,22 class ABSConfiguration(Configuration):
833 571
834 572 #El indice del apunte debe ser menor que el numero total de apuntes
835 573 #El servidor tcp en el embebido comienza a contar desde 0
836 beams_list = ABSBeam.objects.filter(abs_conf=self)
837 if len(beams_list) < beam_pos:
838 return 0
839
840 flag = 1
841 if beam_pos>9:
842 flag = 2
843
844 header = 'JROABSCeCnModCnMod0100000'
845 flag = str(flag)
846 function = 'CHGB'
847 message_tx = header+flag+function+str(beam_pos)+'0'
848 print message_tx
849 multicast_group = '224.3.29.71'
850 server_address = ('',10000)
851 #Specific Netwrok Interface
852 local_ip='192.168.1.153'
853 # Create the socket
854 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
855 # Bind to the server address
856 sock.bind(server_address)
857 # Telling the OS add the socket to the multicast on all interfaces
858 group = socket.inet_aton(multicast_group)
859 mreq = struct.pack('4sL', group, 1) #socket.INADDR_ANY
574 status = ['0'] * 64
575 message = 'CHGB{}'.format(beam_pos)
576 sock = self.send_multicast(message)
860 577
861 try:
862 #sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
863 sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(local_ip)) #Specific Netwrok Interface
864 except Exception as e:
865 self.message = str(e)
866 print str(e)
867 sock.close()
868 sock = None
869 return False
578 for i in range(64):
579 try:
580 data, address = sock.recvfrom(1024)
581 print address, data
582 if data == '1':
583 status[int(address[0][10:])-1] = '3'
584 elif data == '0':
585 status[int(address[0][10:])-1] = '1'
586 except:
587 pass
870 588
871 #print 'sending acknowledgement to all: \n' + message_tx
872 try:
873 sock.sendto(message_tx, (multicast_group, 10000))
874 except Exception as e:
875 self.message = str(e)
876 print str(e)
877 sock.close()
878 sock = None
879 return False
880 589 sock.close()
881 sock = None
882 590
883 591 #Start DDS-RC-JARS
884 592 if confdds:
@@ -890,171 +598,15 class ABSConfiguration(Configuration):
890 598 confjars.start_device()
891 599
892 600 self.message = "ABS Beam has been changed"
893 print self.message
894
601 self.module_status = ''.join(status)
602 self.save()
895 603 return True
896 604
897 def test1(self):
898 t1 = time.time()
899 t2 = 0
900 while (t2-t1)<100:#300
901 t2 = time.time()
902 self.send_beam_num(2)
903 time.sleep(0.04)
904 self.send_beam_num(1)
905 time.sleep(0.04)
906 return
907
908 def change_procs_test1(self, module):
909
910 for i in range (1,300):#300
911 beam_pos = 1
912 module_address = ('192.168.1.'+str(module), 5500)
913 header = 'JROABSCeCnModCnMod0100000'
914 numbers = len(str(beam_pos))
915 function = 'CHGB'
916
917 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
918
919 # Create the datagram socket
920 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
921 sock.connect(module_address)
922
923 sock.send(message_tx)
924 #t = sock.recv(1024)
925 sock.close()
926 sock = None
927
928
929 time.sleep(0.04)
930
931
932 beam_pos = 0
933 numbers = len(str(beam_pos))
934
935 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
936
937 # Create the datagram socket
938 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
939 sock.connect(module_address)
940 sock.send(message_tx)
941 sock.close()
942 sock = None
943
944 time.sleep(0.04)
945
946
947 def multi_procs_test1(self):
948
949 """
950 This function sends the beam number to all abs modules using multiprocessing.
951 """
952
953 #if __name__ == "__main__":
954 size = 10000000 # Number of random numbers to add
955 procs = 65 # (Number-1) of processes to create (absmodule)
956
957 # Create a list of jobs and then iterate through
958 # the number of processes appending each process to
959 # the job list
960 jobs = []
961 for i in range(1, procs):
962
963 process = multiprocessing.Process(target=self.change_procs_test1,args=(i,))
964 jobs.append(process)
965 #print jobs
966
967 # Start the processes (i.e. calculate the random number lists)
968 for j in jobs:
969 #time.sleep(0.4)
970 #print j
971 j.start()
972
973 # Ensure all of the processes have finished
974 for j in jobs:
975 j.join()
976
977 print("List processing complete.")
978 return 1
979
980
981
982 def multi_procs_test2(self):
983 """
984 This function use multiprocessing python library. Importing Pool we can select
985 the number of cores we want to use
986 After 'nproc' linux command, we know how many cores computer has.
987 NOT WORKING
988 """
989 import multiprocessing
990 pool = multiprocessing.Pool(3) # cores
991
992 tasks = []
993 procs = 65
994 for i in range(62, procs):
995 tasks.append( (i,))
996 #print tasks
997 #pool.apply_async(self.change_procs_test1, 62)
998 results = [pool.apply( self.change_procs_test1, t ) for t in tasks]
999 #for result in results:
1000 #result.get()
1001 #(plotNum, plotFilename) = result.get()
1002 #print("Result: plot %d written to %s" % (plotNum, plotFilename) )
1003
1004 return 1
1005
1006
1007 def multi_procs_test3(self):
1008 """
1009 This function use multiprocessing python library. Importing Pool we can select
1010 the number of cores we want to use
1011 After 'nproc' linux command, we know how many cores computer has.
1012 """
1013 from multiprocessing import Pool
1014 import time
1015
1016 def f(x):
1017 return x*x
1018
1019 tasks = []
1020 procs = 65
1021 pool = Pool(processes=4)
1022
1023 #for i in range(62, procs):
1024 #result = pool.map(f, range(62,65))
1025 it = pool.imap(self.change_procs_test1, range(62,65))
1026 #result.get(timeout=5)
1027
1028 return 1
1029
1030
1031 def multi_procs_test4(self):
1032 import multiprocessing as mp
1033
1034
1035 num_workers = mp.cpu_count()
1036
1037 pool = mp.Pool(num_workers)
1038 procs = 65
1039 for i in range(62, procs):
1040 #for task in tasks:
1041 pool.apply_async(self.f, args = (i,))
1042
1043 pool.close()
1044 pool.join()
1045
1046 return 1
1047
1048 605
1049 606 def get_absolute_url_import(self):
1050 607 return reverse('url_import_abs_conf', args=[str(self.id)])
1051 608
1052 609
1053 def get_absolute_url_status(self):
1054 return reverse('url_status_abs_conf', args=[str(self.id)])
1055
1056
1057
1058 610 class ABSBeam(models.Model):
1059 611
1060 612 name = models.CharField(max_length=60, default='Beam')
@@ -1064,7 +616,6 class ABSBeam(models.Model):
1064 616 rx = models.CharField(verbose_name='Rx', max_length=1000, default=rx_default)
1065 617 s_time = models.TimeField(verbose_name='Star Time', default='00:00:00')
1066 618 e_time = models.TimeField(verbose_name='End Time', default='23:59:59')
1067 modules_conf = models.CharField(verbose_name='Modules', max_length=2000, default=json.dumps(conf_default))
1068 619 ues = models.CharField(verbose_name='Ues', max_length=100, default=ues_default)
1069 620 only_rx = models.CharField(verbose_name='Only RX', max_length=40, default=onlyrx_default)
1070 621
@@ -1076,11 +627,7 class ABSBeam(models.Model):
1076 627
1077 628 def parms_to_dict(self):
1078 629
1079 #Update data
1080 self.modules_6bits()
1081
1082 630 parameters = {}
1083
1084 631 parameters['name'] = self.name
1085 632 parameters['antenna'] = ast.literal_eval(self.antenna)
1086 633 parameters['abs_conf'] = self.abs_conf.name
@@ -1088,7 +635,6 class ABSBeam(models.Model):
1088 635 parameters['rx'] = ast.literal_eval(self.rx)
1089 636 parameters['s_time'] = self.s_time.strftime("%H:%M:%S")
1090 637 parameters['e_time'] = self.e_time.strftime("%H:%M:%S")
1091 parameters['configuration'] = ast.literal_eval(self.modules_conf)
1092 638 parameters['ues'] = ast.literal_eval(self.ues)
1093 639 parameters['only_rx'] = json.loads(self.only_rx)
1094 640
@@ -1105,8 +651,6 class ABSBeam(models.Model):
1105 651 #self.e_time = parameters['e_time']
1106 652 self.ues = json.dumps(parameters['ues'])
1107 653 self.only_rx = json.dumps(parameters['only_rx'])
1108
1109 self.modules_6bits()
1110 654 self.save()
1111 655
1112 656
@@ -1122,7 +666,6 class ABSBeam(models.Model):
1122 666 return self
1123 667
1124 668
1125
1126 669 def module_6bits(self, module):
1127 670 """
1128 671 This function reads antenna pattern and choose 6bits (upbits-downbits) for one abs module
@@ -1145,30 +688,6 class ABSBeam(models.Model):
1145 688
1146 689 return beam_bits
1147 690
1148 def modules_6bits(self):
1149 """
1150 This function returns 6bits from every abs module (1-64) in a dict
1151 """
1152 modules_configuration = ast.literal_eval(self.modules_conf)
1153
1154 for i in range(1,65):
1155 modules_configuration[str(i)] = self.module_6bits(i)
1156
1157 self.modules_conf = json.dumps(modules_configuration)
1158 self.save()
1159
1160 return self.modules_conf
1161
1162
1163 def set_as_activebeam(self):
1164 """
1165 This function set this beam as the active beam of its ABS Configuration.
1166 """
1167 self.abs_conf.active_beam = json.dumps({'active_beam': self.id})
1168 self.abs_conf.save()
1169
1170 return
1171
1172 691
1173 692 @property
1174 693 def get_upvalues(self):
This diff has been collapsed as it changes many lines, (854 lines changed) Show them Hide them
@@ -1,550 +1,476
1 {% extends "dev_conf.html" %}
2
3 {% load static %}
4 {% load bootstrap3 %}
5 {% load main_tags %}
6
7 {% block extra-menu-actions %}
8 <li><a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> View Patterns </a></li>
9 {% endblock %}
10
11 {% block extra-content %}
1 {% extends "dev_conf.html" %} {% load static %} {% load bootstrap3 %} {% load main_tags %}
2 {% block extra-head %}
12 3 <style>
13
14 .abs {
4 .abs {
15 5 border: 2px solid #00334d;
16 6 vertical-align: center;
17 7 display: inline-block;
18 }
19 .abs tr:nth-child(1){
8 }
9
10 .abs tr:nth-child(1) {
20 11 border-bottom: 1px dashed #00334d;
21 }
22 .abs tr{
12 }
13
14 .abs tr {
23 15 border-bottom: 0px solid #00334d;
24 }
25 .abs td {
16 }
17
18 .abs td {
26 19 border-right: 1px dashed #00334d;
27 20 text-align: center;
28 21 padding: 5px;
29 }
22 }
30 23
31 24
32 .legend {
25 .legend {
33 26 margin-left: 15px;
34 27 display: inline-block;
35 28 border: 2px solid #00334d;
36 29 vertical-align: top;
37 }
38 .legend th{
30 }
31
32 .legend th {
39 33 border-bottom: 1px dashed #00334d;
40 34 font-weight: bold;
41 35 vertical-align: center;
42 36 text-align: center;
43 }
44 .legend td {
37 }
38
39 .legend td {
45 40 padding: 2px;
46 41 text-align: center;
47 }
42 }
48 43
49 44
50 .north {
45 .north {
51 46 border: 2px solid #00334d;
52 47 vertical-align: center;
53 48 font-weight: bold;
54 }
55 .north tr{
49 }
50
51 .north tr {
56 52 border: 1px solid #ffffff;
57 53
58 }
59 .north td{
54 }
55
56 .north td {
60 57 border: 2px solid #e2e2e7;
61 58 text-align: center;
62 59 padding: 1px 15px 1px 15px;
63 }
64 .north tr:nth-child(even) td:nth-child(n){
60 }
61
62 .north tr:nth-child(even) td:nth-child(n) {
65 63 border-bottom: 12px solid #e2e2e7;
66 }
67 .north td:nth-child(n) {
64 }
65
66 .north td:nth-child(n) {
68 67 border-right: 12px solid #e2e2e7;
69 }
70 .north td:nth-last-child(4n+1) {
71 border-right: 2px solid #e2e2e7;
72 }
73 .north tr:nth-last-child(1) td:nth-child(n){
74 border-bottom: 3px solid #e2e2e7;
75 }
68 }
76 69
70 .north td:nth-last-child(4n+1) {
71 border-right: 2px solid #e2e2e7;
72 }
77 73
74 .north tr:nth-last-child(1) td:nth-child(n) {
75 border-bottom: 3px solid #e2e2e7;
76 }
78 77
79 .east {
78 .east {
80 79 border: 2px solid #00334d;
81 80 vertical-align: center;
82 81 font-weight: bold;
83 }
84 .east tr{
82 }
83
84 .east tr {
85 85 border: 1px solid #ffffff;
86 }
87 .east td{
86 }
87
88 .east td {
88 89 border: 2px solid #e2e2e7;
89 90 text-align: center;
90 91 padding: 1px 15px 1px 15px;
91 }
92 .east tr:nth-child(even) td:nth-child(n){
92 }
93
94 .east tr:nth-child(even) td:nth-child(n) {
93 95 border-bottom: 12px solid #e2e2e7;
94 }
95 .east td:nth-child(n) {
96 border-right: 12px solid #e2e2e7;
97 }
98 .east td:nth-last-child(4n+1) {
99 border-right: 2px solid #e2e2e7;
100 }
101 .east tr:nth-last-child(1) td:nth-child(n){
102 border-bottom: 3px solid #e2e2e7;
103 }
96 }
104 97
98 .east td:nth-child(n) {
99 border-right: 12px solid #e2e2e7;
100 }
105 101
102 .east td:nth-last-child(4n+1) {
103 border-right: 2px solid #e2e2e7;
104 }
106 105
106 .east tr:nth-last-child(1) td:nth-child(n) {
107 border-bottom: 3px solid #e2e2e7;
108 }
107 109
108 .west {
110 .west {
109 111 border: 2px solid #00334d;
110 112 vertical-align: center;
111 113 font-weight: bold;
112 }
113 .west tr{
114 }
115
116 .west tr {
114 117 border: 1px solid #ffffff;
115 }
116 .west td{
118 }
119
120 .west td {
117 121 border: 2px solid #e2e2e7;
118 122 text-align: center;
119 123 padding: 1px 15px 1px 15px;
120 }
121 .west tr:nth-child(even) td:nth-child(n){
124 }
125
126 .west tr:nth-child(even) td:nth-child(n) {
122 127 border-bottom: 12px solid #e2e2e7;
123 }
124 .west td:nth-child(n) {
125 border-right: 12px solid #e2e2e7;
126 }
127 .west td:nth-last-child(4n+1) {
128 border-right: 2px solid #e2e2e7;
129 }
130 .west tr:nth-last-child(1) td:nth-child(n){
131 border-bottom: 3px solid #e2e2e7;
132 }
128 }
133 129
130 .west td:nth-child(n) {
131 border-right: 12px solid #e2e2e7;
132 }
134 133
134 .west td:nth-last-child(4n+1) {
135 border-right: 2px solid #e2e2e7;
136 }
135 137
138 .west tr:nth-last-child(1) td:nth-child(n) {
139 border-bottom: 3px solid #e2e2e7;
140 }
136 141
137 .south {
142 .south {
138 143 border: 2px solid #00334d;
139 144 vertical-align: center;
140 145 font-weight: bold;
141 }
142 .south tr{
146 }
147
148 .south tr {
143 149 border: 1px solid #ffffff;
144 }
145 .south td{
150 }
151
152 .south td {
146 153 border: 2px solid #e2e2e7;
147 154 text-align: center;
148 155 padding: 1px 15px 1px 15px;
149 }
150 .south tr:nth-child(even) td:nth-child(n){
151 border-bottom: 12px solid #e2e2e7;
152 }
153 .south td:nth-child(n) {
154 border-right: 12px solid #e2e2e7;
155 }
156 .south td:nth-last-child(4n+1) {
157 border-right: 2px solid #e2e2e7;
158 }
159 .south tr:nth-last-child(1) td:nth-child(n){
160 border-bottom: 3px solid #e2e2e7;
161 }
156 }
162 157
158 .south tr:nth-child(even) td:nth-child(n) {
159 border-bottom: 12px solid #e2e2e7;
160 }
163 161
162 .south td:nth-child(n) {
163 border-right: 12px solid #e2e2e7;
164 }
164 165
166 .south td:nth-last-child(4n+1) {
167 border-right: 2px solid #e2e2e7;
168 }
165 169
170 .south tr:nth-last-child(1) td:nth-child(n) {
171 border-bottom: 3px solid #e2e2e7;
172 }
166 173 </style>
167
168 {% if status_request %}
169 <img id="loading" src="{% static 'images/loader.gif' %}">
170 {% endif %}
171
172
174 {% endblock %}
175 {% block extra-menu-actions %}
176 <li>
177 <a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank">
178 <span class="glyphicon glyphicon-picture" aria-hidden="true"></span> View Patterns </a>
179 </li>
180 {% endblock %}
181 {% block extra-content %}
173 182 {% if beams %}
174
175
176
177 <h4>Beams:</h4>
178 <div class="container">
179 <ul class="nav nav-pills">
180 {% for beam in beams %}
181 <li {% if active_beam.id == beam.id %} class="active" {% endif %} >
182 <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a>
183 </li>
184 {% endfor %}
185 </ul>
186
187
188 <div class="tab-content">
189 <div id="home" class="tab-pane fade in active">
190 <!---->
191 {% if active_beam %}
192 <h3>Active Beam: {{active_beam.name}}</h3>
193
194 <table id="abs_pattern" class="abs">
195 <tr>
196 <td> <b>North Quarter</b>
197 <table class="north ">
198 <tr>
199 <td {{color_status.1}} title='{{module_messages.1}}'>{{active_beam.get_upvalues.0}}</td> <td {{color_status.2}} title='{{module_messages.2}}'>{{active_beam.get_upvalues.1}}</td> <td {{color_status.3}} title='{{module_messages.3}}'>{{active_beam.get_upvalues.2}}</td> <td {{color_status.4}} title='{{module_messages.4}}'>{{active_beam.get_upvalues.3}}</td>
200 </tr>
201 <tr>
202 <td {{color_status.1}} title='{{module_messages.1}}'>{{active_beam.get_downvalues.0}}</td> <td {{color_status.2}} title='{{module_messages.2}}'>{{active_beam.get_downvalues.1}}</td> <td {{color_status.3}} title='{{module_messages.3}}'>{{active_beam.get_downvalues.2}}</td> <td {{color_status.4}} title='{{module_messages.4}}'>{{active_beam.get_downvalues.3}}</td>
203 </tr>
204 <tr>
205 <td {{color_status.9}} title='{{module_messages.9}}'>{{active_beam.get_upvalues.8}}</td> <td {{color_status.10}} title='{{module_messages.10}}'>{{active_beam.get_upvalues.9}}</td> <td {{color_status.11}} title='{{module_messages.11}}'>{{active_beam.get_upvalues.10}}</td> <td {{color_status.12}} title='{{module_messages.12}}'>{{active_beam.get_upvalues.11}}</td>
206 </tr>
207 <tr>
208 <td {{color_status.9}} title='{{module_messages.9}}'>{{active_beam.get_downvalues.8}}</td> <td {{color_status.10}} title='{{module_messages.10}}'>{{active_beam.get_downvalues.9}}</td> <td {{color_status.11}} title='{{module_messages.11}}'>{{active_beam.get_downvalues.10}}</td> <td {{color_status.12}} title='{{module_messages.12}}'>{{active_beam.get_downvalues.11}}</td>
209 </tr>
210 <tr>
211 <td {{color_status.17}} title='{{module_messages.17}}'>{{active_beam.get_upvalues.16}}</td> <td {{color_status.18}} title='{{module_messages.18}}'>{{active_beam.get_upvalues.17}}</td> <td {{color_status.19}} title='{{module_messages.19}}'>{{active_beam.get_upvalues.18}}</td> <td {{color_status.20}} title='{{module_messages.20}}'>{{active_beam.get_upvalues.19}}</td>
212 </tr>
213 <tr>
214 <td {{color_status.17}} title='{{module_messages.17}}'>{{active_beam.get_downvalues.16}}</td> <td {{color_status.18}} title='{{module_messages.18}}'>{{active_beam.get_downvalues.17}}</td> <td {{color_status.19}} title='{{module_messages.19}}'>{{active_beam.get_downvalues.18}}</td> <td {{color_status.20}} title='{{module_messages.20}}'>{{active_beam.get_downvalues.19}}</td>
215 </tr>
216 <tr>
217 <td {{color_status.25}} title='{{module_messages.25}}'>{{active_beam.get_upvalues.24}}</td> <td {{color_status.26}} title='{{module_messages.26}}'>{{active_beam.get_upvalues.25}}</td> <td {{color_status.27}} title='{{module_messages.27}}'>{{active_beam.get_upvalues.26}}</td> <td {{color_status.28}} title='{{module_messages.28}}'>{{active_beam.get_upvalues.27}}</td>
218 </tr>
219 <tr>
220 <td {{color_status.25}} title='{{module_messages.25}}'>{{active_beam.get_downvalues.24}}</td> <td {{color_status.26}} title='{{module_messages.26}}'>{{active_beam.get_downvalues.25}}</td> <td {{color_status.27}} title='{{module_messages.27}}'>{{active_beam.get_downvalues.26}}</td> <td {{color_status.28}} title='{{module_messages.28}}'>{{active_beam.get_downvalues.27}}</td>
221 </tr>
222 </table>
223 </td>
224 <td> <b>East Quarter</b>
225 <table class="east ">
226 <tr>
227 <td {{color_status.5}} title='{{module_messages.5}}'>{{active_beam.get_upvalues.4}}</td> <td {{color_status.6}} title='{{module_messages.6}}'>{{active_beam.get_upvalues.5}}</td> <td {{color_status.7}} title='{{module_messages.7}}'>{{active_beam.get_upvalues.6}}</td> <td {{color_status.8}} title='{{module_messages.8}}'>{{active_beam.get_upvalues.7}}</td>
228 </tr>
229 <tr>
230 <td {{color_status.5}} title='{{module_messages.5}}'>{{active_beam.get_downvalues.4}}</td> <td {{color_status.6}} title='{{module_messages.6}}'>{{active_beam.get_downvalues.5}}</td> <td {{color_status.7}} title='{{module_messages.7}}'>{{active_beam.get_downvalues.6}}</td> <td {{color_status.8}} title='{{module_messages.8}}'>{{active_beam.get_downvalues.7}}</td>
231 </tr>
232 <tr>
233 <td {{color_status.13}} title='{{module_messages.13}}'>{{active_beam.get_upvalues.12}}</td> <td {{color_status.14}} title='{{module_messages.14}}'>{{active_beam.get_upvalues.13}}</td> <td {{color_status.15}} title='{{module_messages.15}}'>{{active_beam.get_upvalues.14}}</td> <td {{color_status.16}} title='{{module_messages.16}}'>{{active_beam.get_upvalues.15}}</td>
234 </tr>
235 <tr>
236 <td {{color_status.13}} title='{{module_messages.13}}'>{{active_beam.get_downvalues.12}}</td> <td {{color_status.14}} title='{{module_messages.14}}'>{{active_beam.get_downvalues.13}}</td> <td {{color_status.15}} title='{{module_messages.15}}'>{{active_beam.get_downvalues.14}}</td> <td {{color_status.16}} title='{{module_messages.16}}'>{{active_beam.get_downvalues.15}}</td>
237 </tr>
238 <tr>
239 <td {{color_status.21}} title='{{module_messages.21}}'>{{active_beam.get_upvalues.20}}</td> <td {{color_status.22}} title='{{module_messages.22}}'>{{active_beam.get_upvalues.21}}</td> <td {{color_status.23}} title='{{module_messages.23}}'>{{active_beam.get_upvalues.22}}</td> <td {{color_status.24}} title='{{module_messages.24}}'>{{active_beam.get_upvalues.23}}</td>
240 </tr>
241 <tr>
242 <td {{color_status.21}} title='{{module_messages.21}}'>{{active_beam.get_downvalues.20}}</td> <td {{color_status.22}} title='{{module_messages.22}}'>{{active_beam.get_downvalues.21}}</td> <td {{color_status.23}} title='{{module_messages.23}}'>{{active_beam.get_downvalues.22}}</td> <td {{color_status.24}} title='{{module_messages.24}}'>{{active_beam.get_downvalues.23}}</td>
243 </tr>
244 <tr>
245 <td {{color_status.29}} title='{{module_messages.29}}'>{{active_beam.get_upvalues.28}}</td> <td {{color_status.30}} title='{{module_messages.30}}'>{{active_beam.get_upvalues.29}}</td> <td {{color_status.31}} title='{{module_messages.31}}'>{{active_beam.get_upvalues.30}}</td> <td {{color_status.32}} title='{{module_messages.32}}'>{{active_beam.get_upvalues.31}}</td>
246 </tr>
247 <tr>
248 <td {{color_status.29}} title='{{module_messages.29}}'>{{active_beam.get_downvalues.28}}</td> <td {{color_status.30}} title='{{module_messages.30}}'>{{active_beam.get_downvalues.29}}</td> <td {{color_status.31}} title='{{module_messages.31}}'>{{active_beam.get_downvalues.30}}</td> <td {{color_status.32}} title='{{module_messages.32}}'>{{active_beam.get_downvalues.31}}</td>
249 </tr>
250 </table>
251 </td>
252 </tr>
253 <tr>
254 <td> <b>West Quarter</b>
255 <table class="west ">
256 <tr>
257 <td {{color_status.33}} title='{{module_messages.33}}'>{{active_beam.get_upvalues.32}}</td> <td {{color_status.34}} title='{{module_messages.34}}'>{{active_beam.get_upvalues.33}}</td> <td {{color_status.35}} title='{{module_messages.35}}'>{{active_beam.get_upvalues.34}}</td> <td {{color_status.36}} title='{{module_messages.36}}'>{{active_beam.get_upvalues.35}}</td>
258 </tr>
259 <tr>
260 <td {{color_status.33}} title='{{module_messages.33}}'>{{active_beam.get_downvalues.32}}</td> <td {{color_status.34}} title='{{module_messages.34}}'>{{active_beam.get_downvalues.33}}</td> <td {{color_status.35}} title='{{module_messages.35}}'>{{active_beam.get_downvalues.34}}</td> <td {{color_status.36}} title='{{module_messages.36}}'>{{active_beam.get_downvalues.35}}</td>
261 </tr>
262 <tr>
263 <td {{color_status.41}} title='{{module_messages.41}}'>{{active_beam.get_upvalues.40}}</td> <td {{color_status.42}} title='{{module_messages.42}}'>{{active_beam.get_upvalues.41}}</td> <td {{color_status.43}} title='{{module_messages.43}}'>{{active_beam.get_upvalues.42}}</td> <td {{color_status.44}} title='{{module_messages.44}}'>{{active_beam.get_upvalues.43}}</td>
264 </tr>
265 <tr>
266 <td {{color_status.41}} title='{{module_messages.41}}'>{{active_beam.get_downvalues.40}}</td> <td {{color_status.42}} title='{{module_messages.42}}'>{{active_beam.get_downvalues.41}}</td> <td {{color_status.43}} title='{{module_messages.43}}'>{{active_beam.get_downvalues.42}}</td> <td {{color_status.44}} title='{{module_messages.44}}'>{{active_beam.get_downvalues.43}}</td>
267 </tr>
268 <tr>
269 <td {{color_status.49}} title='{{module_messages.49}}'>{{active_beam.get_upvalues.48}}</td> <td {{color_status.50}} title='{{module_messages.50}}'>{{active_beam.get_upvalues.49}}</td> <td {{color_status.51}} title='{{module_messages.51}}'>{{active_beam.get_upvalues.50}}</td> <td {{color_status.52}} title='{{module_messages.52}}'>{{active_beam.get_upvalues.51}}</td>
270 </tr>
271 <tr>
272 <td {{color_status.49}} title='{{module_messages.49}}'>{{active_beam.get_downvalues.48}}</td> <td {{color_status.50}} title='{{module_messages.50}}'>{{active_beam.get_downvalues.49}}</td> <td {{color_status.51}} title='{{module_messages.51}}'>{{active_beam.get_downvalues.50}}</td> <td {{color_status.52}} title='{{module_messages.52}}'>{{active_beam.get_downvalues.51}}</td>
273 </tr>
274 <tr>
275 <td {{color_status.57}} title='{{module_messages.57}}'>{{active_beam.get_upvalues.56}}</td> <td {{color_status.58}} title='{{module_messages.58}}'>{{active_beam.get_upvalues.57}}</td> <td {{color_status.59}} title='{{module_messages.59}}'>{{active_beam.get_upvalues.58}}</td> <td {{color_status.60}} title='{{module_messages.60}}'>{{active_beam.get_upvalues.59}}</td>
276 </tr>
277 <tr>
278 <td {{color_status.57}} title='{{module_messages.57}}'>{{active_beam.get_downvalues.56}}</td> <td {{color_status.58}} title='{{module_messages.58}}'>{{active_beam.get_downvalues.57}}</td> <td {{color_status.59}} title='{{module_messages.59}}'>{{active_beam.get_downvalues.58}}</td> <td {{color_status.60}} title='{{module_messages.60}}'>{{active_beam.get_downvalues.59}}</td>
279 </tr>
280 </table>
281 </td>
282 <td> <b>South Quarter</b>
283 <table class="south ">
284 <tr>
285 <td {{color_status.37}} title='{{module_messages.37}}'>{{active_beam.get_upvalues.36}}</td> <td {{color_status.38}} title='{{module_messages.38}}'>{{active_beam.get_upvalues.37}}</td> <td {{color_status.39}} title='{{module_messages.39}}'>{{active_beam.get_upvalues.38}}</td> <td {{color_status.40}} title='{{module_messages.40}}'>{{active_beam.get_upvalues.39}}</td>
286 </tr>
287 <tr>
288 <td {{color_status.37}} title='{{module_messages.37}}'>{{active_beam.get_downvalues.36}}</td> <td {{color_status.38}} title='{{module_messages.38}}'>{{active_beam.get_downvalues.37}}</td> <td {{color_status.39}} title='{{module_messages.39}}'>{{active_beam.get_downvalues.38}}</td> <td {{color_status.40}} title='{{module_messages.40}}'>{{active_beam.get_downvalues.39}}</td>
289 </tr>
290 <tr>
291 <td {{color_status.45}} title='{{module_messages.45}}'>{{active_beam.get_upvalues.44}}</td> <td {{color_status.46}} title='{{module_messages.46}}'>{{active_beam.get_upvalues.45}}</td> <td {{color_status.47}} title='{{module_messages.47}}'>{{active_beam.get_upvalues.46}}</td> <td {{color_status.48}} title='{{module_messages.48}}'>{{active_beam.get_upvalues.47}}</td>
292 </tr>
293 <tr>
294 <td {{color_status.45}} title='{{module_messages.45}}'>{{active_beam.get_downvalues.44}}</td> <td {{color_status.46}} title='{{module_messages.46}}'>{{active_beam.get_downvalues.45}}</td> <td {{color_status.47}} title='{{module_messages.47}}'>{{active_beam.get_downvalues.46}}</td> <td {{color_status.48}} title='{{module_messages.48}}'>{{active_beam.get_downvalues.47}}</td>
295 </tr>
296 <tr>
297 <td {{color_status.53}} title='{{module_messages.53}}'>{{active_beam.get_upvalues.52}}</td> <td {{color_status.54}} title='{{module_messages.54}}'>{{active_beam.get_upvalues.53}}</td> <td {{color_status.55}} title='{{module_messages.55}}'>{{active_beam.get_upvalues.54}}</td> <td {{color_status.56}} title='{{module_messages.56}}'>{{active_beam.get_upvalues.55}}</td>
298 </tr>
299 <tr>
300 <td {{color_status.53}} title='{{module_messages.53}}'>{{active_beam.get_downvalues.52}}</td> <td {{color_status.54}} title='{{module_messages.54}}'>{{active_beam.get_downvalues.53}}</td> <td {{color_status.55}} title='{{module_messages.55}}'>{{active_beam.get_downvalues.54}}</td> <td {{color_status.56}} title='{{module_messages.56}}'>{{active_beam.get_downvalues.55}}</td>
301 </tr>
302 <tr>
303 <td {{color_status.61}} title='{{module_messages.61}}'>{{active_beam.get_upvalues.60}}</td> <td {{color_status.62}} title='{{module_messages.62}}'>{{active_beam.get_upvalues.61}}</td> <td {{color_status.63}} title='{{module_messages.63}}'>{{active_beam.get_upvalues.62}}</td> <td {{color_status.64}} title='{{module_messages.64}}'>{{active_beam.get_upvalues.63}}</td>
304 </tr>
305 <tr>
306 <td {{color_status.61}} title='{{module_messages.61}}'>{{active_beam.get_downvalues.60}}</td> <td {{color_status.62}} title='{{module_messages.62}}'>{{active_beam.get_downvalues.61}}</td> <td {{color_status.63}} title='{{module_messages.63}}'>{{active_beam.get_downvalues.62}}</td> <td {{color_status.64}} title='{{module_messages.64}}'>{{active_beam.get_downvalues.63}}</td>
307 </tr>
308 </table>
309 </td>
310 </tr>
311 </table>
312
313
314
315 <table class="legend">
316 <tr>
317 <th colspan="2">Legend</th>
318 </tr>
319 <tr>
320 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
321 </tr>
322 <tr>
323 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
324 </tr>
325 <tr>
326 <td class="text-success"><i>GREEN</i></td><td>Running </td>
327 </tr>
328 <!--
329 <tr>
330 <td colspan="2">
331 <button style="margin: 10px;" id="sendbeam" type="button" class="btn btn-default">
332 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
333 Change Beam</button>
334 </td>
335 </tr>
336 -->
337 </table>
338
339
340
341
342 {% else %}
343 <p><i>This ABS Configuration does not have a current active ABS Beam...<br>
344 Please send Beam List to ABS modules. </i></p>
345
346 {% endif %}
347
348
183 <h4>Beams:</h4>
184 <div class="container">
185 <ul class="nav nav-pills">
186 {% for beam in beams %}
187 <li {%if beam.pk == active_beam %} class="active" {% endif %}>
188 <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a>
189 </li>
190 {% endfor %}
191 </ul>
192
193 <div class="tab-content">
194 {% for beam in beams %}
195 <div id="menu{{forloop.counter}}" class="tab-pane fade {%if beam.pk == active_beam %}active in{% endif %}">
196 <h3>{%if beam.pk == active_beam %}Active Beam: {%endif%}{{beam.name}}</h3>
197 <table id="abs_pattern{{forloop.counter}}" class="abs">
198 <tr>
199 <td>
200 <b>North Quarter</b>
201 <table class="north ">
202 <tr>
203 <td {%if beam.pk == active_beam %} {{color_status.1}} t{%endif%} itle='{{module_messages.1}}'>{{beam.get_upvalues.0}}</td>
204 <td {%if beam.pk == active_beam %} {{color_status.2}} t{%endif%} itle='{{module_messages.2}}'>{{beam.get_upvalues.1}}</td>
205 <td {%if beam.pk == active_beam %} {{color_status.3}} t{%endif%} itle='{{module_messages.3}}'>{{beam.get_upvalues.2}}</td>
206 <td {%if beam.pk == active_beam %} {{color_status.4}} t{%endif%} itle='{{module_messages.4}}'>{{beam.get_upvalues.3}}</td>
207 </tr>
208 <tr>
209 <td {%if beam.pk == active_beam %} {{color_status.1}} t{%endif%} itle='{{module_messages.1}}'>{{beam.get_downvalues.0}}</td>
210 <td {%if beam.pk == active_beam %} {{color_status.2}} t{%endif%} itle='{{module_messages.2}}'>{{beam.get_downvalues.1}}</td>
211 <td {%if beam.pk == active_beam %} {{color_status.3}} t{%endif%} itle='{{module_messages.3}}'>{{beam.get_downvalues.2}}</td>
212 <td {%if beam.pk == active_beam %} {{color_status.4}} t{%endif%} itle='{{module_messages.4}}'>{{beam.get_downvalues.3}}</td>
213 </tr>
214 <tr>
215 <td {%if beam.pk == active_beam %} {{color_status.9}} t{%endif%} itle='{{module_messages.9}}'>{{beam.get_upvalues.8}}</td>
216 <td {%if beam.pk == active_beam %} {{color_status.10}} {%endif%} title='{{module_messages.10}}'>{{beam.get_upvalues.9}}</td>
217 <td {%if beam.pk == active_beam %} {{color_status.11}} {%endif%} title='{{module_messages.11}}'>{{beam.get_upvalues.10}}</td>
218 <td {%if beam.pk == active_beam %} {{color_status.12}} {%endif%} title='{{module_messages.12}}'>{{beam.get_upvalues.11}}</td>
219 </tr>
220 <tr>
221 <td {%if beam.pk == active_beam %} {{color_status.9}} t{%endif%} itle='{{module_messages.9}}'>{{beam.get_downvalues.8}}</td>
222 <td {%if beam.pk == active_beam %} {{color_status.10}} {%endif%} title='{{module_messages.10}}'>{{beam.get_downvalues.9}}</td>
223 <td {%if beam.pk == active_beam %} {{color_status.11}} {%endif%} title='{{module_messages.11}}'>{{beam.get_downvalues.10}}</td>
224 <td {%if beam.pk == active_beam %} {{color_status.12}} {%endif%} title='{{module_messages.12}}'>{{beam.get_downvalues.11}}</td>
225 </tr>
226 <tr>
227 <td {%if beam.pk == active_beam %} {{color_status.17}} {%endif%} title='{{module_messages.17}}'>{{beam.get_upvalues.16}}</td>
228 <td {%if beam.pk == active_beam %} {{color_status.18}} {%endif%} title='{{module_messages.18}}'>{{beam.get_upvalues.17}}</td>
229 <td {%if beam.pk == active_beam %} {{color_status.19}} {%endif%} title='{{module_messages.19}}'>{{beam.get_upvalues.18}}</td>
230 <td {%if beam.pk == active_beam %} {{color_status.20}} {%endif%} title='{{module_messages.20}}'>{{beam.get_upvalues.19}}</td>
231 </tr>
232 <tr>
233 <td {%if beam.pk == active_beam %} {{color_status.17}} {%endif%} title='{{module_messages.17}}'>{{beam.get_downvalues.16}}</td>
234 <td {%if beam.pk == active_beam %} {{color_status.18}} {%endif%} title='{{module_messages.18}}'>{{beam.get_downvalues.17}}</td>
235 <td {%if beam.pk == active_beam %} {{color_status.19}} {%endif%} title='{{module_messages.19}}'>{{beam.get_downvalues.18}}</td>
236 <td {%if beam.pk == active_beam %} {{color_status.20}} {%endif%} title='{{module_messages.20}}'>{{beam.get_downvalues.19}}</td>
237 </tr>
238 <tr>
239 <td {%if beam.pk == active_beam %} {{color_status.25}} {%endif%} title='{{module_messages.25}}'>{{beam.get_upvalues.24}}</td>
240 <td {%if beam.pk == active_beam %} {{color_status.26}} {%endif%} title='{{module_messages.26}}'>{{beam.get_upvalues.25}}</td>
241 <td {%if beam.pk == active_beam %} {{color_status.27}} {%endif%} title='{{module_messages.27}}'>{{beam.get_upvalues.26}}</td>
242 <td {%if beam.pk == active_beam %} {{color_status.28}} {%endif%} title='{{module_messages.28}}'>{{beam.get_upvalues.27}}</td>
243 </tr>
244 <tr>
245 <td {%if beam.pk == active_beam %} {{color_status.25}} {%endif%} title='{{module_messages.25}}'>{{beam.get_downvalues.24}}</td>
246 <td {%if beam.pk == active_beam %} {{color_status.26}} {%endif%} title='{{module_messages.26}}'>{{beam.get_downvalues.25}}</td>
247 <td {%if beam.pk == active_beam %} {{color_status.27}} {%endif%} title='{{module_messages.27}}'>{{beam.get_downvalues.26}}</td>
248 <td {%if beam.pk == active_beam %} {{color_status.28}} {%endif%} title='{{module_messages.28}}'>{{beam.get_downvalues.27}}</td>
249 </tr>
250 </table>
251 </td>
252 <td>
253 <b>East Quarter</b>
254 <table class="east ">
255 <tr>
256 <td {%if beam.pk == active_beam %} {{color_status.5}} t{%endif%} itle='{{module_messages.5}}'>{{beam.get_upvalues.4}}</td>
257 <td {%if beam.pk == active_beam %} {{color_status.6}} t{%endif%} itle='{{module_messages.6}}'>{{beam.get_upvalues.5}}</td>
258 <td {%if beam.pk == active_beam %} {{color_status.7}} t{%endif%} itle='{{module_messages.7}}'>{{beam.get_upvalues.6}}</td>
259 <td {%if beam.pk == active_beam %} {{color_status.8}} t{%endif%} itle='{{module_messages.8}}'>{{beam.get_upvalues.7}}</td>
260 </tr>
261 <tr>
262 <td {%if beam.pk == active_beam %} {{color_status.5}} t{%endif%} itle='{{module_messages.5}}'>{{beam.get_downvalues.4}}</td>
263 <td {%if beam.pk == active_beam %} {{color_status.6}} t{%endif%} itle='{{module_messages.6}}'>{{beam.get_downvalues.5}}</td>
264 <td {%if beam.pk == active_beam %} {{color_status.7}} t{%endif%} itle='{{module_messages.7}}'>{{beam.get_downvalues.6}}</td>
265 <td {%if beam.pk == active_beam %} {{color_status.8}} t{%endif%} itle='{{module_messages.8}}'>{{beam.get_downvalues.7}}</td>
266 </tr>
267 <tr>
268 <td {%if beam.pk == active_beam %} {{color_status.13}} {%endif%} title='{{module_messages.13}}'>{{beam.get_upvalues.12}}</td>
269 <td {%if beam.pk == active_beam %} {{color_status.14}} {%endif%} title='{{module_messages.14}}'>{{beam.get_upvalues.13}}</td>
270 <td {%if beam.pk == active_beam %} {{color_status.15}} {%endif%} title='{{module_messages.15}}'>{{beam.get_upvalues.14}}</td>
271 <td {%if beam.pk == active_beam %} {{color_status.16}} {%endif%} title='{{module_messages.16}}'>{{beam.get_upvalues.15}}</td>
272 </tr>
273 <tr>
274 <td {%if beam.pk == active_beam %} {{color_status.13}} {%endif%} title='{{module_messages.13}}'>{{beam.get_downvalues.12}}</td>
275 <td {%if beam.pk == active_beam %} {{color_status.14}} {%endif%} title='{{module_messages.14}}'>{{beam.get_downvalues.13}}</td>
276 <td {%if beam.pk == active_beam %} {{color_status.15}} {%endif%} title='{{module_messages.15}}'>{{beam.get_downvalues.14}}</td>
277 <td {%if beam.pk == active_beam %} {{color_status.16}} {%endif%} title='{{module_messages.16}}'>{{beam.get_downvalues.15}}</td>
278 </tr>
279 <tr>
280 <td {%if beam.pk == active_beam %} {{color_status.21}} {%endif%} title='{{module_messages.21}}'>{{beam.get_upvalues.20}}</td>
281 <td {%if beam.pk == active_beam %} {{color_status.22}} {%endif%} title='{{module_messages.22}}'>{{beam.get_upvalues.21}}</td>
282 <td {%if beam.pk == active_beam %} {{color_status.23}} {%endif%} title='{{module_messages.23}}'>{{beam.get_upvalues.22}}</td>
283 <td {%if beam.pk == active_beam %} {{color_status.24}} {%endif%} title='{{module_messages.24}}'>{{beam.get_upvalues.23}}</td>
284 </tr>
285 <tr>
286 <td {%if beam.pk == active_beam %} {{color_status.21}} {%endif%} title='{{module_messages.21}}'>{{beam.get_downvalues.20}}</td>
287 <td {%if beam.pk == active_beam %} {{color_status.22}} {%endif%} title='{{module_messages.22}}'>{{beam.get_downvalues.21}}</td>
288 <td {%if beam.pk == active_beam %} {{color_status.23}} {%endif%} title='{{module_messages.23}}'>{{beam.get_downvalues.22}}</td>
289 <td {%if beam.pk == active_beam %} {{color_status.24}} {%endif%} title='{{module_messages.24}}'>{{beam.get_downvalues.23}}</td>
290 </tr>
291 <tr>
292 <td {%if beam.pk == active_beam %} {{color_status.29}} {%endif%} title='{{module_messages.29}}'>{{beam.get_upvalues.28}}</td>
293 <td {%if beam.pk == active_beam %} {{color_status.30}} {%endif%} title='{{module_messages.30}}'>{{beam.get_upvalues.29}}</td>
294 <td {%if beam.pk == active_beam %} {{color_status.31}} {%endif%} title='{{module_messages.31}}'>{{beam.get_upvalues.30}}</td>
295 <td {%if beam.pk == active_beam %} {{color_status.32}} {%endif%} title='{{module_messages.32}}'>{{beam.get_upvalues.31}}</td>
296 </tr>
297 <tr>
298 <td {%if beam.pk == active_beam %} {{color_status.29}} {%endif%} title='{{module_messages.29}}'>{{beam.get_downvalues.28}}</td>
299 <td {%if beam.pk == active_beam %} {{color_status.30}} {%endif%} title='{{module_messages.30}}'>{{beam.get_downvalues.29}}</td>
300 <td {%if beam.pk == active_beam %} {{color_status.31}} {%endif%} title='{{module_messages.31}}'>{{beam.get_downvalues.30}}</td>
301 <td {%if beam.pk == active_beam %} {{color_status.32}} {%endif%} title='{{module_messages.32}}'>{{beam.get_downvalues.31}}</td>
302 </tr>
303 </table>
304 </td>
305 </tr>
306 <tr>
307 <td>
308 <b>West Quarter</b>
309 <table class="west ">
310 <tr>
311 <td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} title='{{module_messages.33}}'>{{beam.get_upvalues.32}}</td>
312 <td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} title='{{module_messages.34}}'>{{beam.get_upvalues.33}}</td>
313 <td {%if beam.pk == active_beam %} {{color_status.35}} {%endif%} title='{{module_messages.35}}'>{{beam.get_upvalues.34}}</td>
314 <td {%if beam.pk == active_beam %} {{color_status.36}} {%endif%} title='{{module_messages.36}}'>{{beam.get_upvalues.35}}</td>
315 </tr>
316 <tr>
317 <td {%if beam.pk == active_beam %} {{color_status.33}} {%endif%} title='{{module_messages.33}}'>{{beam.get_downvalues.32}}</td>
318 <td {%if beam.pk == active_beam %} {{color_status.34}} {%endif%} title='{{module_messages.34}}'>{{beam.get_downvalues.33}}</td>
319 <td {%if beam.pk == active_beam %} {{color_status.35}} {%endif%} title='{{module_messages.35}}'>{{beam.get_downvalues.34}}</td>
320 <td {%if beam.pk == active_beam %} {{color_status.36}} {%endif%} title='{{module_messages.36}}'>{{beam.get_downvalues.35}}</td>
321 </tr>
322 <tr>
323 <td {%if beam.pk == active_beam %} {{color_status.41}} {%endif%} title='{{module_messages.41}}'>{{beam.get_upvalues.40}}</td>
324 <td {%if beam.pk == active_beam %} {{color_status.42}} {%endif%} title='{{module_messages.42}}'>{{beam.get_upvalues.41}}</td>
325 <td {%if beam.pk == active_beam %} {{color_status.43}} {%endif%} title='{{module_messages.43}}'>{{beam.get_upvalues.42}}</td>
326 <td {%if beam.pk == active_beam %} {{color_status.44}} {%endif%} title='{{module_messages.44}}'>{{beam.get_upvalues.43}}</td>
327 </tr>
328 <tr>
329 <td {%if beam.pk == active_beam %} {{color_status.41}} {%endif%} title='{{module_messages.41}}'>{{beam.get_downvalues.40}}</td>
330 <td {%if beam.pk == active_beam %} {{color_status.42}} {%endif%} title='{{module_messages.42}}'>{{beam.get_downvalues.41}}</td>
331 <td {%if beam.pk == active_beam %} {{color_status.43}} {%endif%} title='{{module_messages.43}}'>{{beam.get_downvalues.42}}</td>
332 <td {%if beam.pk == active_beam %} {{color_status.44}} {%endif%} title='{{module_messages.44}}'>{{beam.get_downvalues.43}}</td>
333 </tr>
334 <tr>
335 <td {%if beam.pk == active_beam %} {{color_status.49}} {%endif%} title='{{module_messages.49}}'>{{beam.get_upvalues.48}}</td>
336 <td {%if beam.pk == active_beam %} {{color_status.50}} {%endif%} title='{{module_messages.50}}'>{{beam.get_upvalues.49}}</td>
337 <td {%if beam.pk == active_beam %} {{color_status.51}} {%endif%} title='{{module_messages.51}}'>{{beam.get_upvalues.50}}</td>
338 <td {%if beam.pk == active_beam %} {{color_status.52}} {%endif%} title='{{module_messages.52}}'>{{beam.get_upvalues.51}}</td>
339 </tr>
340 <tr>
341 <td {%if beam.pk == active_beam %} {{color_status.49}} {%endif%} title='{{module_messages.49}}'>{{beam.get_downvalues.48}}</td>
342 <td {%if beam.pk == active_beam %} {{color_status.50}} {%endif%} title='{{module_messages.50}}'>{{beam.get_downvalues.49}}</td>
343 <td {%if beam.pk == active_beam %} {{color_status.51}} {%endif%} title='{{module_messages.51}}'>{{beam.get_downvalues.50}}</td>
344 <td {%if beam.pk == active_beam %} {{color_status.52}} {%endif%} title='{{module_messages.52}}'>{{beam.get_downvalues.51}}</td>
345 </tr>
346 <tr>
347 <td {%if beam.pk == active_beam %} {{color_status.57}} {%endif%} title='{{module_messages.57}}'>{{beam.get_upvalues.56}}</td>
348 <td {%if beam.pk == active_beam %} {{color_status.58}} {%endif%} title='{{module_messages.58}}'>{{beam.get_upvalues.57}}</td>
349 <td {%if beam.pk == active_beam %} {{color_status.59}} {%endif%} title='{{module_messages.59}}'>{{beam.get_upvalues.58}}</td>
350 <td {%if beam.pk == active_beam %} {{color_status.60}} {%endif%} title='{{module_messages.60}}'>{{beam.get_upvalues.59}}</td>
351 </tr>
352 <tr>
353 <td {%if beam.pk == active_beam %} {{color_status.57}} {%endif%} title='{{module_messages.57}}'>{{beam.get_downvalues.56}}</td>
354 <td {%if beam.pk == active_beam %} {{color_status.58}} {%endif%} title='{{module_messages.58}}'>{{beam.get_downvalues.57}}</td>
355 <td {%if beam.pk == active_beam %} {{color_status.59}} {%endif%} title='{{module_messages.59}}'>{{beam.get_downvalues.58}}</td>
356 <td {%if beam.pk == active_beam %} {{color_status.60}} {%endif%} title='{{module_messages.60}}'>{{beam.get_downvalues.59}}</td>
357 </tr>
358 </table>
359 </td>
360 <td>
361 <b>South Quarter</b>
362 <table class="south ">
363 <tr>
364 <td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} title='{{module_messages.37}}'>{{beam.get_upvalues.36}}</td>
365 <td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} title='{{module_messages.38}}'>{{beam.get_upvalues.37}}</td>
366 <td {%if beam.pk == active_beam %} {{color_status.39}} {%endif%} title='{{module_messages.39}}'>{{beam.get_upvalues.38}}</td>
367 <td {%if beam.pk == active_beam %} {{color_status.40}} {%endif%} title='{{module_messages.40}}'>{{beam.get_upvalues.39}}</td>
368 </tr>
369 <tr>
370 <td {%if beam.pk == active_beam %} {{color_status.37}} {%endif%} title='{{module_messages.37}}'>{{beam.get_downvalues.36}}</td>
371 <td {%if beam.pk == active_beam %} {{color_status.38}} {%endif%} title='{{module_messages.38}}'>{{beam.get_downvalues.37}}</td>
372 <td {%if beam.pk == active_beam %} {{color_status.39}} {%endif%} title='{{module_messages.39}}'>{{beam.get_downvalues.38}}</td>
373 <td {%if beam.pk == active_beam %} {{color_status.40}} {%endif%} title='{{module_messages.40}}'>{{beam.get_downvalues.39}}</td>
374 </tr>
375 <tr>
376 <td {%if beam.pk == active_beam %} {{color_status.45}} {%endif%} title='{{module_messages.45}}'>{{beam.get_upvalues.44}}</td>
377 <td {%if beam.pk == active_beam %} {{color_status.46}} {%endif%} title='{{module_messages.46}}'>{{beam.get_upvalues.45}}</td>
378 <td {%if beam.pk == active_beam %} {{color_status.47}} {%endif%} title='{{module_messages.47}}'>{{beam.get_upvalues.46}}</td>
379 <td {%if beam.pk == active_beam %} {{color_status.48}} {%endif%} title='{{module_messages.48}}'>{{beam.get_upvalues.47}}</td>
380 </tr>
381 <tr>
382 <td {%if beam.pk == active_beam %} {{color_status.45}} {%endif%} title='{{module_messages.45}}'>{{beam.get_downvalues.44}}</td>
383 <td {%if beam.pk == active_beam %} {{color_status.46}} {%endif%} title='{{module_messages.46}}'>{{beam.get_downvalues.45}}</td>
384 <td {%if beam.pk == active_beam %} {{color_status.47}} {%endif%} title='{{module_messages.47}}'>{{beam.get_downvalues.46}}</td>
385 <td {%if beam.pk == active_beam %} {{color_status.48}} {%endif%} title='{{module_messages.48}}'>{{beam.get_downvalues.47}}</td>
386 </tr>
387 <tr>
388 <td {%if beam.pk == active_beam %} {{color_status.53}} {%endif%} title='{{module_messages.53}}'>{{beam.get_upvalues.52}}</td>
389 <td {%if beam.pk == active_beam %} {{color_status.54}} {%endif%} title='{{module_messages.54}}'>{{beam.get_upvalues.53}}</td>
390 <td {%if beam.pk == active_beam %} {{color_status.55}} {%endif%} title='{{module_messages.55}}'>{{beam.get_upvalues.54}}</td>
391 <td {%if beam.pk == active_beam %} {{color_status.56}} {%endif%} title='{{module_messages.56}}'>{{beam.get_upvalues.55}}</td>
392 </tr>
393 <tr>
394 <td {%if beam.pk == active_beam %} {{color_status.53}} {%endif%} title='{{module_messages.53}}'>{{beam.get_downvalues.52}}</td>
395 <td {%if beam.pk == active_beam %} {{color_status.54}} {%endif%} title='{{module_messages.54}}'>{{beam.get_downvalues.53}}</td>
396 <td {%if beam.pk == active_beam %} {{color_status.55}} {%endif%} title='{{module_messages.55}}'>{{beam.get_downvalues.54}}</td>
397 <td {%if beam.pk == active_beam %} {{color_status.56}} {%endif%} title='{{module_messages.56}}'>{{beam.get_downvalues.55}}</td>
398 </tr>
399 <tr>
400 <td {%if beam.pk == active_beam %} {{color_status.61}} {%endif%} title='{{module_messages.61}}'>{{beam.get_upvalues.60}}</td>
401 <td {%if beam.pk == active_beam %} {{color_status.62}} {%endif%} title='{{module_messages.62}}'>{{beam.get_upvalues.61}}</td>
402 <td {%if beam.pk == active_beam %} {{color_status.63}} {%endif%} title='{{module_messages.63}}'>{{beam.get_upvalues.62}}</td>
403 <td {%if beam.pk == active_beam %} {{color_status.64}} {%endif%} title='{{module_messages.64}}'>{{beam.get_upvalues.63}}</td>
404 </tr>
405 <tr>
406 <td {%if beam.pk == active_beam %} {{color_status.61}} {%endif%} title='{{module_messages.61}}'>{{beam.get_downvalues.60}}</td>
407 <td {%if beam.pk == active_beam %} {{color_status.62}} {%endif%} title='{{module_messages.62}}'>{{beam.get_downvalues.61}}</td>
408 <td {%if beam.pk == active_beam %} {{color_status.63}} {%endif%} title='{{module_messages.63}}'>{{beam.get_downvalues.62}}</td>
409 <td {%if beam.pk == active_beam %} {{color_status.64}} {%endif%} title='{{module_messages.64}}'>{{beam.get_downvalues.63}}</td>
410 </tr>
411 </table>
412 </td>
413 </tr>
414 </table>
415
416 {% if beam.id == active_beam %}
417 <table class="legend">
418 <tr>
419 <th colspan="2">Legend</th>
420 </tr>
421 <tr>
422 <td class="text-danger">
423 <i>RED</i>
424 </td>
425 <td>Disconnected</td>
426 </tr>
427 <tr>
428 <td class="text-warning">
429 <i>ORANGE</i>
430 </td>
431 <td>Connected</td>
432 </tr>
433 <tr>
434 <td class="text-success">
435 <i>GREEN</i>
436 </td>
437 <td>Running
438 </td>
439 </tr>
440 </table>
441 {% else %}
442 <div style="vertical-align: top; display:inline-block;">
443 <button id="send_beam{{forloop.counter}}" type="button" class="btn btn-default">
444 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
445 Change Beam</button>
349 446 </div>
350
351
352
353 {% for beam in beams %}
354 <div id="menu{{forloop.counter}}" class="tab-pane fade">
355 <h3>{%if active_beam.id == beam.id%}Active Beam: {%endif%}{{beam.name}}</h3>
356 <!--<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>-->
357 <table id="abs_pattern{{forloop.counter}}" class="abs">
358 <tr>
359 <td> <b>North Quarter</b>
360 <table class="north ">
361 <tr>
362 <td {{beam.color_status.1}} title='{{beam.module_messages.1}}'>{{beam.get_upvalues.0}}</td> <td {{beam.color_status.2}} title='{{beam.module_messages.2}}'>{{beam.get_upvalues.1}}</td> <td {{beam.color_status.3}} title='{{beam.module_messages.3}}'>{{beam.get_upvalues.2}}</td> <td {{beam.color_status.4}} title='{{beam.module_messages.4}}'>{{beam.get_upvalues.3}}</td>
363 </tr>
364 <tr>
365 <td {{beam.color_status.1}} title='{{beam.module_messages.1}}'>{{beam.get_downvalues.0}}</td> <td {{beam.color_status.2}} title='{{beam.module_messages.2}}'>{{beam.get_downvalues.1}}</td> <td {{beam.color_status.3}} title='{{beam.module_messages.3}}'>{{beam.get_downvalues.2}}</td> <td {{beam.color_status.4}} title='{{beam.module_messages.4}}'>{{beam.get_downvalues.3}}</td>
366 </tr>
367 <tr>
368 <td {{beam.color_status.9}} title='{{beam.module_messages.9}}'>{{beam.get_upvalues.8}}</td> <td {{beam.color_status.10}} title='{{beam.module_messages.10}}'>{{beam.get_upvalues.9}}</td> <td {{beam.color_status.11}} title='{{beam.module_messages.11}}'>{{beam.get_upvalues.10}}</td> <td {{beam.color_status.12}} title='{{beam.module_messages.12}}'>{{beam.get_upvalues.11}}</td>
369 </tr>
370 <tr>
371 <td {{beam.color_status.9}} title='{{beam.module_messages.9}}'>{{beam.get_downvalues.8}}</td> <td {{beam.color_status.10}} title='{{beam.module_messages.10}}'>{{beam.get_downvalues.9}}</td> <td {{beam.color_status.11}} title='{{beam.module_messages.11}}'>{{beam.get_downvalues.10}}</td> <td {{beam.color_status.12}} title='{{beam.module_messages.12}}'>{{beam.get_downvalues.11}}</td>
372 </tr>
373 <tr>
374 <td {{beam.color_status.17}} title='{{beam.module_messages.17}}'>{{beam.get_upvalues.16}}</td> <td {{beam.color_status.18}} title='{{beam.module_messages.18}}'>{{beam.get_upvalues.17}}</td> <td {{beam.color_status.19}} title='{{beam.module_messages.19}}'>{{beam.get_upvalues.18}}</td> <td {{beam.color_status.20}} title='{{beam.module_messages.20}}'>{{beam.get_upvalues.19}}</td>
375 </tr>
376 <tr>
377 <td {{beam.color_status.17}} title='{{beam.module_messages.17}}'>{{beam.get_downvalues.16}}</td> <td {{beam.color_status.18}} title='{{beam.module_messages.18}}'>{{beam.get_downvalues.17}}</td> <td {{beam.color_status.19}} title='{{beam.module_messages.19}}'>{{beam.get_downvalues.18}}</td> <td {{beam.color_status.20}} title='{{beam.module_messages.20}}'>{{beam.get_downvalues.19}}</td>
378 </tr>
379 <tr>
380 <td {{beam.color_status.25}} title='{{beam.module_messages.25}}'>{{beam.get_upvalues.24}}</td> <td {{beam.color_status.26}} title='{{beam.module_messages.26}}'>{{beam.get_upvalues.25}}</td> <td {{beam.color_status.27}} title='{{beam.module_messages.27}}'>{{beam.get_upvalues.26}}</td> <td {{beam.color_status.28}} title='{{beam.module_messages.28}}'>{{beam.get_upvalues.27}}</td>
381 </tr>
382 <tr>
383 <td {{beam.color_status.25}} title='{{beam.module_messages.25}}'>{{beam.get_downvalues.24}}</td> <td {{beam.color_status.26}} title='{{beam.module_messages.26}}'>{{beam.get_downvalues.25}}</td> <td {{beam.color_status.27}} title='{{beam.module_messages.27}}'>{{beam.get_downvalues.26}}</td> <td {{beam.color_status.28}} title='{{beam.module_messages.28}}'>{{beam.get_downvalues.27}}</td>
384 </tr>
385 </table>
386 </td>
387 <td> <b>East Quarter</b>
388 <table class="east ">
389 <tr>
390 <td {{beam.color_status.5}} title='{{beam.module_messages.5}}'>{{beam.get_upvalues.4}}</td> <td {{beam.color_status.6}} title='{{beam.module_messages.6}}'>{{beam.get_upvalues.5}}</td> <td {{beam.color_status.7}} title='{{beam.module_messages.7}}'>{{beam.get_upvalues.6}}</td> <td {{beam.color_status.8}} title='{{beam.module_messages.8}}'>{{beam.get_upvalues.7}}</td>
391 </tr>
392 <tr>
393 <td {{beam.color_status.5}} title='{{beam.module_messages.5}}'>{{beam.get_downvalues.4}}</td> <td {{beam.color_status.6}} title='{{beam.module_messages.6}}'>{{beam.get_downvalues.5}}</td> <td {{beam.color_status.7}} title='{{beam.module_messages.7}}'>{{beam.get_downvalues.6}}</td> <td {{beam.color_status.8}} title='{{beam.module_messages.8}}'>{{beam.get_downvalues.7}}</td>
394 </tr>
395 <tr>
396 <td {{beam.color_status.13}} title='{{beam.module_messages.13}}'>{{beam.get_upvalues.12}}</td> <td {{beam.color_status.14}} title='{{beam.module_messages.14}}'>{{beam.get_upvalues.13}}</td> <td {{beam.color_status.15}} title='{{beam.module_messages.15}}'>{{beam.get_upvalues.14}}</td> <td {{beam.color_status.16}} title='{{beam.module_messages.16}}'>{{beam.get_upvalues.15}}</td>
397 </tr>
398 <tr>
399 <td {{beam.color_status.13}} title='{{beam.module_messages.13}}'>{{beam.get_downvalues.12}}</td> <td {{beam.color_status.14}} title='{{beam.module_messages.14}}'>{{beam.get_downvalues.13}}</td> <td {{beam.color_status.15}} title='{{beam.module_messages.15}}'>{{beam.get_downvalues.14}}</td> <td {{beam.color_status.16}} title='{{beam.module_messages.16}}'>{{beam.get_downvalues.15}}</td>
400 </tr>
401 <tr>
402 <td {{beam.color_status.21}} title='{{beam.module_messages.21}}'>{{beam.get_upvalues.20}}</td> <td {{beam.color_status.22}} title='{{beam.module_messages.22}}'>{{beam.get_upvalues.21}}</td> <td {{beam.color_status.23}} title='{{beam.module_messages.23}}'>{{beam.get_upvalues.22}}</td> <td {{beam.color_status.24}} title='{{beam.module_messages.24}}'>{{beam.get_upvalues.23}}</td>
403 </tr>
404 <tr>
405 <td {{beam.color_status.21}} title='{{beam.module_messages.21}}'>{{beam.get_downvalues.20}}</td> <td {{beam.color_status.22}} title='{{beam.module_messages.22}}'>{{beam.get_downvalues.21}}</td> <td {{beam.color_status.23}} title='{{beam.module_messages.23}}'>{{beam.get_downvalues.22}}</td> <td {{beam.color_status.24}} title='{{beam.module_messages.24}}'>{{beam.get_downvalues.23}}</td>
406 </tr>
407 <tr>
408 <td {{beam.color_status.29}} title='{{beam.module_messages.29}}'>{{beam.get_upvalues.28}}</td> <td {{beam.color_status.30}} title='{{beam.module_messages.30}}'>{{beam.get_upvalues.29}}</td> <td {{beam.color_status.31}} title='{{beam.module_messages.31}}'>{{beam.get_upvalues.30}}</td> <td {{beam.color_status.32}} title='{{beam.module_messages.32}}'>{{beam.get_upvalues.31}}</td>
409 </tr>
410 <tr>
411 <td {{beam.color_status.29}} title='{{beam.module_messages.29}}'>{{beam.get_downvalues.28}}</td> <td {{beam.color_status.30}} title='{{beam.module_messages.30}}'>{{beam.get_downvalues.29}}</td> <td {{beam.color_status.31}} title='{{beam.module_messages.31}}'>{{beam.get_downvalues.30}}</td> <td {{beam.color_status.32}} title='{{beam.module_messages.32}}'>{{beam.get_downvalues.31}}</td>
412 </tr>
413 </table>
414 </td>
415 </tr>
416 <tr>
417 <td> <b>West Quarter</b>
418 <table class="west ">
419 <tr>
420 <td {{beam.color_status.33}} title='{{beam.module_messages.33}}'>{{beam.get_upvalues.32}}</td> <td {{beam.color_status.34}} title='{{beam.module_messages.34}}'>{{beam.get_upvalues.33}}</td> <td {{beam.color_status.35}} title='{{beam.module_messages.35}}'>{{beam.get_upvalues.34}}</td> <td {{beam.color_status.36}} title='{{beam.module_messages.36}}'>{{beam.get_upvalues.35}}</td>
421 </tr>
422 <tr>
423 <td {{beam.color_status.33}} title='{{beam.module_messages.33}}'>{{beam.get_downvalues.32}}</td> <td {{beam.color_status.34}} title='{{beam.module_messages.34}}'>{{beam.get_downvalues.33}}</td> <td {{beam.color_status.35}} title='{{beam.module_messages.35}}'>{{beam.get_downvalues.34}}</td> <td {{beam.color_status.36}} title='{{beam.module_messages.36}}'>{{beam.get_downvalues.35}}</td>
424 </tr>
425 <tr>
426 <td {{beam.color_status.41}} title='{{beam.module_messages.41}}'>{{beam.get_upvalues.40}}</td> <td {{beam.color_status.42}} title='{{beam.module_messages.42}}'>{{beam.get_upvalues.41}}</td> <td {{beam.color_status.43}} title='{{beam.module_messages.43}}'>{{beam.get_upvalues.42}}</td> <td {{beam.color_status.44}} title='{{beam.module_messages.44}}'>{{beam.get_upvalues.43}}</td>
427 </tr>
428 <tr>
429 <td {{beam.color_status.41}} title='{{beam.module_messages.41}}'>{{beam.get_downvalues.40}}</td> <td {{beam.color_status.42}} title='{{beam.module_messages.42}}'>{{beam.get_downvalues.41}}</td> <td {{beam.color_status.43}} title='{{beam.module_messages.43}}'>{{beam.get_downvalues.42}}</td> <td {{beam.color_status.44}} title='{{beam.module_messages.44}}'>{{beam.get_downvalues.43}}</td>
430 </tr>
431 <tr>
432 <td {{beam.color_status.49}} title='{{beam.module_messages.49}}'>{{beam.get_upvalues.48}}</td> <td {{beam.color_status.50}} title='{{beam.module_messages.50}}'>{{beam.get_upvalues.49}}</td> <td {{beam.color_status.51}} title='{{beam.module_messages.51}}'>{{beam.get_upvalues.50}}</td> <td {{beam.color_status.52}} title='{{beam.module_messages.52}}'>{{beam.get_upvalues.51}}</td>
433 </tr>
434 <tr>
435 <td {{beam.color_status.49}} title='{{beam.module_messages.49}}'>{{beam.get_downvalues.48}}</td> <td {{beam.color_status.50}} title='{{beam.module_messages.50}}'>{{beam.get_downvalues.49}}</td> <td {{beam.color_status.51}} title='{{beam.module_messages.51}}'>{{beam.get_downvalues.50}}</td> <td {{beam.color_status.52}} title='{{beam.module_messages.52}}'>{{beam.get_downvalues.51}}</td>
436 </tr>
437 <tr>
438 <td {{beam.color_status.57}} title='{{beam.module_messages.57}}'>{{beam.get_upvalues.56}}</td> <td {{beam.color_status.58}} title='{{beam.module_messages.58}}'>{{beam.get_upvalues.57}}</td> <td {{beam.color_status.59}} title='{{beam.module_messages.59}}'>{{beam.get_upvalues.58}}</td> <td {{beam.color_status.60}} title='{{beam.module_messages.60}}'>{{beam.get_upvalues.59}}</td>
439 </tr>
440 <tr>
441 <td {{beam.color_status.57}} title='{{beam.module_messages.57}}'>{{beam.get_downvalues.56}}</td> <td {{beam.color_status.58}} title='{{beam.module_messages.58}}'>{{beam.get_downvalues.57}}</td> <td {{beam.color_status.59}} title='{{beam.module_messages.59}}'>{{beam.get_downvalues.58}}</td> <td {{beam.color_status.60}} title='{{beam.module_messages.60}}'>{{beam.get_downvalues.59}}</td>
442 </tr>
443 </table>
444 </td>
445 <td> <b>South Quarter</b>
446 <table class="south ">
447 <tr>
448 <td {{beam.color_status.37}} title='{{beam.module_messages.37}}'>{{beam.get_upvalues.36}}</td> <td {{beam.color_status.38}} title='{{beam.module_messages.38}}'>{{beam.get_upvalues.37}}</td> <td {{beam.color_status.39}} title='{{beam.module_messages.39}}'>{{beam.get_upvalues.38}}</td> <td {{beam.color_status.40}} title='{{beam.module_messages.40}}'>{{beam.get_upvalues.39}}</td>
449 </tr>
450 <tr>
451 <td {{beam.color_status.37}} title='{{beam.module_messages.37}}'>{{beam.get_downvalues.36}}</td> <td {{beam.color_status.38}} title='{{beam.module_messages.38}}'>{{beam.get_downvalues.37}}</td> <td {{beam.color_status.39}} title='{{beam.module_messages.39}}'>{{beam.get_downvalues.38}}</td> <td {{beam.color_status.40}} title='{{beam.module_messages.40}}'>{{beam.get_downvalues.39}}</td>
452 </tr>
453 <tr>
454 <td {{beam.color_status.45}} title='{{beam.module_messages.45}}'>{{beam.get_upvalues.44}}</td> <td {{beam.color_status.46}} title='{{beam.module_messages.46}}'>{{beam.get_upvalues.45}}</td> <td {{beam.color_status.47}} title='{{beam.module_messages.47}}'>{{beam.get_upvalues.46}}</td> <td {{beam.color_status.48}} title='{{beam.module_messages.48}}'>{{beam.get_upvalues.47}}</td>
455 </tr>
456 <tr>
457 <td {{beam.color_status.45}} title='{{beam.module_messages.45}}'>{{beam.get_downvalues.44}}</td> <td {{beam.color_status.46}} title='{{beam.module_messages.46}}'>{{beam.get_downvalues.45}}</td> <td {{beam.color_status.47}} title='{{beam.module_messages.47}}'>{{beam.get_downvalues.46}}</td> <td {{beam.color_status.48}} title='{{beam.module_messages.48}}'>{{beam.get_downvalues.47}}</td>
458 </tr>
459 <tr>
460 <td {{beam.color_status.53}} title='{{beam.module_messages.53}}'>{{beam.get_upvalues.52}}</td> <td {{beam.color_status.54}} title='{{beam.module_messages.54}}'>{{beam.get_upvalues.53}}</td> <td {{beam.color_status.55}} title='{{beam.module_messages.55}}'>{{beam.get_upvalues.54}}</td> <td {{beam.color_status.56}} title='{{beam.module_messages.56}}'>{{beam.get_upvalues.55}}</td>
461 </tr>
462 <tr>
463 <td {{beam.color_status.53}} title='{{beam.module_messages.53}}'>{{beam.get_downvalues.52}}</td> <td {{beam.color_status.54}} title='{{beam.module_messages.54}}'>{{beam.get_downvalues.53}}</td> <td {{beam.color_status.55}} title='{{beam.module_messages.55}}'>{{beam.get_downvalues.54}}</td> <td {{beam.color_status.56}} title='{{beam.module_messages.56}}'>{{beam.get_downvalues.55}}</td>
464 </tr>
465 <tr>
466 <td {{beam.color_status.61}} title='{{beam.module_messages.61}}'>{{beam.get_upvalues.60}}</td> <td {{beam.color_status.62}} title='{{beam.module_messages.62}}'>{{beam.get_upvalues.61}}</td> <td {{beam.color_status.63}} title='{{beam.module_messages.63}}'>{{beam.get_upvalues.62}}</td> <td {{beam.color_status.64}} title='{{beam.module_messages.64}}'>{{beam.get_upvalues.63}}</td>
467 </tr>
468 <tr>
469 <td {{beam.color_status.61}} title='{{beam.module_messages.61}}'>{{beam.get_downvalues.60}}</td> <td {{beam.color_status.62}} title='{{beam.module_messages.62}}'>{{beam.get_downvalues.61}}</td> <td {{beam.color_status.63}} title='{{beam.module_messages.63}}'>{{beam.get_downvalues.62}}</td> <td {{beam.color_status.64}} title='{{beam.module_messages.64}}'>{{beam.get_downvalues.63}}</td>
470 </tr>
471 </table>
472 </td>
473 </tr>
474 </table>
475
476 {% if active_beam.id != beam.id %}
477 <div style="vertical-align: top; display:inline-block;">
478 <button style="" id="send_beam{{forloop.counter}}" type="button" class="btn btn-default">
479 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
480 Change Beam</button>
481 </div>
482 {% endif %}
483
484
485
486
487 {% if active_beam %}
488 {% if active_beam.id == beam.id %}
489 <table class="legend">
490 <tr>
491 <th colspan="2">Legend</th>
492 </tr>
493 <tr>
494 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
495 </tr>
496 <tr>
497 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
498 </tr>
499 <tr>
500 <td class="text-success"><i>GREEN</i></td><td>Running
501 </td>
502 </tr>
503 </table>
504
505 {% endif %}
506 {% endif %}
507
508
509 </div>
510
511
512 {% endfor %}
513
514
515
447 {% endif %}
516 448 </div>
449 {% endfor %}
517 450 </div>
451 </div>
518 452
519 453
520 {% else %}
521 <p style="color:#b4bcc2; margin-left: 5%;"><i>No Beams...</i></p>
522 {% endif %}
523
524 {% endblock extra-content %}
525
526
527
528 {% block extra-js%}
454 {% else %}
455 <p style="color:#b4bcc2; margin-left: 5%;">
456 <i>No Beams...</i>
457 </p>
458 {% endif %} {% endblock extra-content %} {% block extra-js%}
529 459 <script>
530 $(document).ready(function() {
460 $(document).ready(function () {
531 461
532 {% for beam in beams %}
462 {% for beam in beams %}
533 463
534 {% if dev_conf.operation_mode == 1 %}
464 {% if dev_conf.operation_mode == 1 %}
535 465 $("#send_beam{{forloop.counter}}").prop('disabled', true)
536 {% else %}
537 $("#send_beam{{forloop.counter}}").click(function() {
538 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
466 {% else %}
467 $("#send_beam{{forloop.counter}}").click(function () {
468 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
539 469 });
540 {% endif %}
470 {% endif %}
541 471
542 {% endfor %}
472 {% endfor %}
543 473
544 {% if status_request %}
545 setTimeout("location.href = '{% url 'url_abs_conf' dev_conf.id %}'",53000);
546 {% endif %}
547 474
548 });
549 </script>
550 {% endblock %}
475 });
476 </script> {% endblock %} No newline at end of file
@@ -6,7 +6,7 urlpatterns = (
6 6 url(r'^(?P<id_conf>-?\d+)/$', views.abs_conf, name='url_abs_conf'),
7 7 url(r'^(?P<id_conf>-?\d+)/edit/$', views.abs_conf_edit, name='url_edit_abs_conf'),
8 8 url(r'^(?P<id_conf>-?\d+)/import/$', views.import_file, name='url_import_abs_conf'),
9 url(r'^(?P<id_conf>-?\d+)/status/', views.abs_conf, {'status_request':True},name='url_status_abs_conf'),
9 #url(r'^(?P<id_conf>-?\d+)/status/', views.abs_conf, {'status_request':True},name='url_status_abs_conf'),
10 10 url(r'^(?P<id_conf>-?\d+)/change_beam/(?P<id_beam>-?\d+)/$', views.send_beam, name='url_send_beam'),
11 11 url(r'^(?P<id_conf>-?\d+)/plot/$', views.plot_patterns, name='url_plot_abs_patterns'),
12 12 url(r'^(?P<id_conf>-?\d+)/plot/(?P<id_beam>-?\d+)/$', views.plot_patterns, name='url_plot_abs_patterns'),
@@ -119,32 +119,31 def get_values_from_form(form_data):
119 119 return beam_data
120 120
121 121
122 def abs_conf(request, id_conf):
122 123
123 def abs_conf(request, id_conf, status_request=None):
124
125 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
126 beams = ABSBeam.objects.filter(abs_conf=conf)
127 active_beam_id = json.loads(conf.active_beam)
128
124 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
125 beams = ABSBeam.objects.filter(abs_conf=conf)
129 126 #------------Colors for Active Beam:-------------
130 modules_status = json.loads(conf.module_status)
127 all_status = {}
131 128 module_messages = json.loads(conf.module_messages)
132 129
133 130 color_status = {}
134 for status in modules_status:
135 if modules_status[status] == 3: #Running background-color: #00cc00;
136 color_status[status] = 'class=text-success'#'bgcolor=#00cc00'
137 elif modules_status[status] == 1: #Connected background-color: #ee902c;
138 color_status[status] = 'class=text-warning'#'bgcolor=#ee902c'
139 else: #Disconnected background-color: #ff0000;
140 color_status[status] = 'class=text-danger'#'bgcolor=#FF0000'
131 for i, status in enumerate(conf.module_status):
132 if status == '3': #Running background-color: #00cc00;
133 all_status['{}'.format(i+1)] = 2
134 color_status['{}'.format(i+1)] = 'class=text-success'#'bgcolor=#00cc00'
135 elif status == '1': #Connected background-color: #ee902c;
136 all_status['{}'.format(i+1)] = 1
137 color_status['{}'.format(i+1)] = 'class=text-warning'#'bgcolor=#ee902c'
138 else: #Disconnected background-color: #ff0000;
139 all_status['{}'.format(i+1)] = 0
140 color_status['{}'.format(i+1)] = 'class=text-danger'#'bgcolor=#FF0000'
141 141 #------------------------------------------------
142 142
143 143 kwargs = {}
144 #kwargs['status'] = conf.device.get_status_display()
145 144 kwargs['connected_modules'] = str(conf.connected_modules())+'/64'
146
147 145 kwargs['dev_conf'] = conf
146
148 147 if conf.operation_mode == 0:
149 148 kwargs['dev_conf_keys'] = ['name', 'operation_mode']
150 149 else:
@@ -152,42 +151,18 def abs_conf(request, id_conf, status_request=None):
152 151
153 152 kwargs['title'] = 'ABS Configuration'
154 153 kwargs['suptitle'] = 'Details'
155 #kwargs['no_play'] = True
156
157 154 kwargs['button'] = 'Edit Configuration'
158 #------------------Active Beam-----------------------
159 try:
160 active_beam_id = active_beam_id['active_beam']
161 active_beam = ABSBeam.objects.get(pk=active_beam_id)
162 kwargs['active_beam'] = active_beam
163 for beam in beams:
164 if beam.id == active_beam.id:
165 beam.color_status = color_status
166 beam.module_messages = module_messages
167 except:
168 active_beam = ''
169 #----------------------------------------------------
170 kwargs['beams'] = beams
171 kwargs['modules_status'] = modules_status
155
156 if conf.active_beam != 0:
157 kwargs['active_beam'] = int(conf.active_beam)
158
159 kwargs['beams'] = beams
160 kwargs['modules_status'] = all_status
172 161 kwargs['color_status'] = color_status
173 162 kwargs['module_messages'] = module_messages
174
175 #if conf.device.status in [0,1]:
176 if conf.connected_modules() == 0:
177 conf.device.status = 0
178 messages.error(request, 'No ABS module is connected.')#conf.message)
179 conf.device.save()
180 else:
181 messages.success(request, 'ABS modules are connected.')#conf.message)
182
183 163 ###### SIDEBAR ######
184 164 kwargs.update(sidebar(conf=conf))
185 165
186 if status_request:
187 conf.status_device()
188 kwargs['status_request'] = True
189 return render(request, 'abs_conf.html', kwargs)
190
191 166 return render(request, 'abs_conf.html', kwargs)
192 167
193 168
@@ -196,7 +171,6 def abs_conf_edit(request, id_conf):
196 171 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
197 172
198 173 beams = ABSBeam.objects.filter(abs_conf=conf)
199 print beams
200 174
201 175 if request.method=='GET':
202 176 form = ABSConfigurationForm(instance=conf)
@@ -262,9 +236,8 def send_beam(request, id_conf, id_beam):
262 236 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
263 237 beam = get_object_or_404(ABSBeam, pk=id_beam)
264 238 beams_list = ABSBeam.objects.filter(abs_conf=conf)
265 #To set this beam as an Active Beam
266 beam.set_as_activebeam()
267 #To send beam position to abs-modules
239 conf.active_beam = id_beam
240
268 241 i = 0
269 242 for b in beams_list:
270 243 if b.id == int(id_beam):
@@ -273,7 +246,7 def send_beam(request, id_conf, id_beam):
273 246 i += 1
274 247 beam_pos = i + 1 #Estandarizar
275 248 print '%s Position: %s' % (beam.name, str(beam_pos))
276 conf.send_beam_num(beam_pos)
249 conf.send_beam(beam_pos)
277 250
278 251 return redirect('url_abs_conf', conf.id)
279 252
@@ -284,7 +257,6 def add_beam(request, id_conf):
284 257 confs = Configuration.objects.all()
285 258
286 259 if request.method=='GET':
287 #form = ABSBeamEditForm()
288 260 form = ABSBeamAddForm()
289 261
290 262 if request.method=='POST':
@@ -293,18 +265,15 def add_beam(request, id_conf):
293 265 beam_data = get_values_from_form(request.POST)
294 266
295 267 new_beam = ABSBeam(
296 name =beam_data['name'],
297 antenna =json.dumps(beam_data['antenna']),
298 abs_conf=conf,
299 tx =json.dumps(beam_data['tx']),
300 rx =json.dumps(beam_data['rx']),
301 ues =json.dumps(beam_data['ues']),
302 only_rx =json.dumps(beam_data['only_rx'])
268 name = beam_data['name'],
269 antenna = json.dumps(beam_data['antenna']),
270 abs_conf = conf,
271 tx = json.dumps(beam_data['tx']),
272 rx = json.dumps(beam_data['rx']),
273 ues = json.dumps(beam_data['ues']),
274 only_rx = json.dumps(beam_data['only_rx'])
303 275 )
304 276 new_beam.save()
305 #---Update 6bits configuration and add beam to abs configuration beams list.
306 new_beam.modules_6bits()
307 #new_beam.add_beam2list()
308 277 messages.success(request, 'Beam: "%s" has been added.' % new_beam.name)
309 278
310 279 return redirect('url_edit_abs_conf', conf.id)
General Comments 0
You need to be logged in to leave comments. Login now