##// END OF EJS Templates
Task #961: Actualizar status de modulos ABS con subproceso...
Fiorella Quino -
r258:0e34c33380c6
parent child
Show More
@@ -1,1331 +1,1342
1 from django.db import models
1 from django.db import models
2 from apps.main.models import Configuration
2 from apps.main.models import Configuration
3 from django.core.urlresolvers import reverse
3 from django.core.urlresolvers import reverse
4 # Create your models here.
4 # Create your models here.
5 from celery.execute import send_task
5 from celery.execute import send_task
6 from datetime import datetime
6 from datetime import datetime
7 import ast
7 import ast
8 import socket
8 import socket
9 import json
9 import json
10 import requests
10 import requests
11 import struct
11 import struct
12 import sys, time
12 import sys, time
13
13
14 import multiprocessing
14 import multiprocessing
15
15
16
16
17 antenna_default = json.dumps({
17 antenna_default = json.dumps({
18 "antenna_up": [[0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
18 "antenna_up": [[0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
19 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
19 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
20 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
20 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
21 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
21 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
22 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
22 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
23 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
23 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
24 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
24 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0],
25 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0]
25 [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0]
26 ]
26 ]
27 ,
27 ,
28 "antenna_down": [[0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
28 "antenna_down": [[0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
29 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
29 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
30 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
30 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
31 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
31 [0.0,0.0,0.0,0.0,0.5,0.5,0.5,0.5],
32 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
32 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
33 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
33 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
34 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
34 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0],
35 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]],
35 [0.5,0.5,0.5,0.5,3.0,3.0,3.0,3.0]],
36 })
36 })
37
37
38
38
39 tx_default = json.dumps({
39 tx_default = json.dumps({
40 "up": [[1,1,1,1,0,0,0,0],
40 "up": [[1,1,1,1,0,0,0,0],
41 [1,1,1,1,0,0,0,0],
41 [1,1,1,1,0,0,0,0],
42 [1,1,1,1,0,0,0,0],
42 [1,1,1,1,0,0,0,0],
43 [1,1,1,1,0,0,0,0],
43 [1,1,1,1,0,0,0,0],
44 [0,0,0,0,1,1,1,1],
44 [0,0,0,0,1,1,1,1],
45 [0,0,0,0,1,1,1,1],
45 [0,0,0,0,1,1,1,1],
46 [0,0,0,0,1,1,1,1],
46 [0,0,0,0,1,1,1,1],
47 [0,0,0,0,1,1,1,1]],
47 [0,0,0,0,1,1,1,1]],
48
48
49 "down": [[1,1,1,1,0,0,0,0],
49 "down": [[1,1,1,1,0,0,0,0],
50 [1,1,1,1,0,0,0,0],
50 [1,1,1,1,0,0,0,0],
51 [1,1,1,1,0,0,0,0],
51 [1,1,1,1,0,0,0,0],
52 [1,1,1,1,0,0,0,0],
52 [1,1,1,1,0,0,0,0],
53 [0,0,0,0,1,1,1,1],
53 [0,0,0,0,1,1,1,1],
54 [0,0,0,0,1,1,1,1],
54 [0,0,0,0,1,1,1,1],
55 [0,0,0,0,1,1,1,1],
55 [0,0,0,0,1,1,1,1],
56 [0,0,0,0,1,1,1,1]],
56 [0,0,0,0,1,1,1,1]],
57 })
57 })
58
58
59 rx_default = json.dumps({
59 rx_default = json.dumps({
60 "up": [[1,1,1,1,0,0,0,0],
60 "up": [[1,1,1,1,0,0,0,0],
61 [1,1,1,1,0,0,0,0],
61 [1,1,1,1,0,0,0,0],
62 [1,1,1,1,0,0,0,0],
62 [1,1,1,1,0,0,0,0],
63 [1,1,1,1,0,0,0,0],
63 [1,1,1,1,0,0,0,0],
64 [0,0,0,0,1,1,1,1],
64 [0,0,0,0,1,1,1,1],
65 [0,0,0,0,1,1,1,1],
65 [0,0,0,0,1,1,1,1],
66 [0,0,0,0,1,1,1,1],
66 [0,0,0,0,1,1,1,1],
67 [0,0,0,0,1,1,1,1]],
67 [0,0,0,0,1,1,1,1]],
68
68
69 "down": [[1,1,1,1,0,0,0,0],
69 "down": [[1,1,1,1,0,0,0,0],
70 [1,1,1,1,0,0,0,0],
70 [1,1,1,1,0,0,0,0],
71 [1,1,1,1,0,0,0,0],
71 [1,1,1,1,0,0,0,0],
72 [1,1,1,1,0,0,0,0],
72 [1,1,1,1,0,0,0,0],
73 [0,0,0,0,1,1,1,1],
73 [0,0,0,0,1,1,1,1],
74 [0,0,0,0,1,1,1,1],
74 [0,0,0,0,1,1,1,1],
75 [0,0,0,0,1,1,1,1],
75 [0,0,0,0,1,1,1,1],
76 [0,0,0,0,1,1,1,1]],
76 [0,0,0,0,1,1,1,1]],
77 })
77 })
78
78
79 conf_default = {}
79 conf_default = {}
80 status_default = {}
80 status_default = {}
81 default_messages = {}
81 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,
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,
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,
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,
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,
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,
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
88 "61": 0, "62": 0, "63": 0, "64": 0} # 0 : Socket // 1: API Rest
89
89
90 for i in range(1,65):
90 for i in range(1,65):
91 conf_default[str(i)] = ""
91 conf_default[str(i)] = ""
92 status_default[str(i)] = 0
92 status_default[str(i)] = 0
93 default_messages[str(i)] = "Module "+str(i)
93 default_messages[str(i)] = "Module "+str(i)
94
94
95
95
96 ues_default = json.dumps({
96 ues_default = json.dumps({
97 "up": [0.533333,0.00000,1.06667,0.00000],
97 "up": [0.533333,0.00000,1.06667,0.00000],
98 "down": [0.533333,0.00000,1.06667,0.00000]
98 "down": [0.533333,0.00000,1.06667,0.00000]
99 })
99 })
100
100
101 onlyrx_default = json.dumps({
101 onlyrx_default = json.dumps({
102 "up": False,
102 "up": False,
103 "down": False
103 "down": False
104 })
104 })
105
105
106 def up_convertion(cadena):
106 def up_convertion(cadena):
107 valores = []
107 valores = []
108 for c in cadena:
108 for c in cadena:
109 if c == 1.0: valores=valores+['000']
109 if c == 1.0: valores=valores+['000']
110 if c == 2.0: valores=valores+['001']
110 if c == 2.0: valores=valores+['001']
111 if c == 3.0: valores=valores+['010']
111 if c == 3.0: valores=valores+['010']
112 if c == 0.0: valores=valores+['011']
112 if c == 0.0: valores=valores+['011']
113 if c == 0.5: valores=valores+['100']
113 if c == 0.5: valores=valores+['100']
114 if c == 1.5: valores=valores+['101']
114 if c == 1.5: valores=valores+['101']
115 if c == 2.5: valores=valores+['110']
115 if c == 2.5: valores=valores+['110']
116 if c == 3.5: valores=valores+['111']
116 if c == 3.5: valores=valores+['111']
117
117
118 return valores
118 return valores
119
119
120 def up_conv_bits(value):
120 def up_conv_bits(value):
121
121
122 if value == 1.0: bits="000"
122 if value == 1.0: bits="000"
123 if value == 2.0: bits="001"
123 if value == 2.0: bits="001"
124 if value == 3.0: bits="010"
124 if value == 3.0: bits="010"
125 if value == 0.0: bits="011"
125 if value == 0.0: bits="011"
126 if value == 0.5: bits="100"
126 if value == 0.5: bits="100"
127 if value == 1.5: bits="101"
127 if value == 1.5: bits="101"
128 if value == 2.5: bits="110"
128 if value == 2.5: bits="110"
129 if value == 3.5: bits="111"
129 if value == 3.5: bits="111"
130
130
131 return bits
131 return bits
132
132
133 def down_convertion(cadena):
133 def down_convertion(cadena):
134 valores = []
134 valores = []
135 for c in cadena:
135 for c in cadena:
136 if c == 1.0: valores=valores+['000']
136 if c == 1.0: valores=valores+['000']
137 if c == 2.0: valores=valores+['001']
137 if c == 2.0: valores=valores+['001']
138 if c == 3.0: valores=valores+['010']
138 if c == 3.0: valores=valores+['010']
139 if c == 0.0: valores=valores+['011']
139 if c == 0.0: valores=valores+['011']
140 if c == 0.5: valores=valores+['100']
140 if c == 0.5: valores=valores+['100']
141 if c == 1.5: valores=valores+['101']
141 if c == 1.5: valores=valores+['101']
142 if c == 2.5: valores=valores+['110']
142 if c == 2.5: valores=valores+['110']
143 if c == 3.5: valores=valores+['111']
143 if c == 3.5: valores=valores+['111']
144
144
145 return valores
145 return valores
146
146
147 def down_conv_bits(value):
147 def down_conv_bits(value):
148
148
149 if value == 1.0: bits="000"
149 if value == 1.0: bits="000"
150 if value == 2.0: bits="001"
150 if value == 2.0: bits="001"
151 if value == 3.0: bits="010"
151 if value == 3.0: bits="010"
152 if value == 0.0: bits="011"
152 if value == 0.0: bits="011"
153 if value == 0.5: bits="100"
153 if value == 0.5: bits="100"
154 if value == 1.5: bits="101"
154 if value == 1.5: bits="101"
155 if value == 2.5: bits="110"
155 if value == 2.5: bits="110"
156 if value == 3.5: bits="111"
156 if value == 3.5: bits="111"
157
157
158 return bits
158 return bits
159
159
160 def up_conv_value(bits):
160 def up_conv_value(bits):
161
161
162 if bits == "000": value=1.0
162 if bits == "000": value=1.0
163 if bits == "001": value=2.0
163 if bits == "001": value=2.0
164 if bits == "010": value=3.0
164 if bits == "010": value=3.0
165 if bits == "011": value=0.0
165 if bits == "011": value=0.0
166 if bits == "100": value=0.5
166 if bits == "100": value=0.5
167 if bits == "101": value=1.5
167 if bits == "101": value=1.5
168 if bits == "110": value=2.5
168 if bits == "110": value=2.5
169 if bits == "111": value=3.5
169 if bits == "111": value=3.5
170
170
171 return value
171 return value
172
172
173 def down_conv_value(bits):
173 def down_conv_value(bits):
174
174
175 if bits == "000": value=1.0
175 if bits == "000": value=1.0
176 if bits == "001": value=2.0
176 if bits == "001": value=2.0
177 if bits == "010": value=3.0
177 if bits == "010": value=3.0
178 if bits == "011": value=0.0
178 if bits == "011": value=0.0
179 if bits == "100": value=0.5
179 if bits == "100": value=0.5
180 if bits == "101": value=1.5
180 if bits == "101": value=1.5
181 if bits == "110": value=2.5
181 if bits == "110": value=2.5
182 if bits == "111": value=3.5
182 if bits == "111": value=3.5
183
183
184 return value
184 return value
185
185
186 def ip2position(module_number):
186 def ip2position(module_number):
187 j=0
187 j=0
188 i=0
188 i=0
189 for x in range(0,module_number-1):
189 for x in range(0,module_number-1):
190 j=j+1
190 j=j+1
191 if j==8:
191 if j==8:
192 i=i+1
192 i=i+1
193 j=0
193 j=0
194
194
195 pos = [i,j]
195 pos = [i,j]
196 return pos
196 return pos
197
197
198
198
199 def fromBinary2Char(binary_string):
199 def fromBinary2Char(binary_string):
200 number = int(binary_string, 2)
200 number = int(binary_string, 2)
201 #Plus 33 to avoid more than 1 characters values such as: '\x01'-'\x1f'
201 #Plus 33 to avoid more than 1 characters values such as: '\x01'-'\x1f'
202 number = number + 33
202 number = number + 33
203 char = chr(number)
203 char = chr(number)
204 return char
204 return char
205
205
206 def fromChar2Binary(char):
206 def fromChar2Binary(char):
207 number = ord(char) - 33
207 number = ord(char) - 33
208 #Minus 33 to get the real value
208 #Minus 33 to get the real value
209 bits = bin(number)[2:]
209 bits = bin(number)[2:]
210 #To ensure we have a string with 6bits
210 #To ensure we have a string with 6bits
211 if len(bits) < 6:
211 if len(bits) < 6:
212 bits = bits.zfill(6)
212 bits = bits.zfill(6)
213 return bits
213 return bits
214
214
215 OPERATION_MODES = (
215 OPERATION_MODES = (
216 (0, 'Manual'),
216 (0, 'Manual'),
217 (1, 'Automatic'),
217 (1, 'Automatic'),
218 )
218 )
219
219
220
220
221 class ABSConfiguration(Configuration):
221 class ABSConfiguration(Configuration):
222 active_beam = models.CharField(verbose_name='Active Beam', max_length=20000, default="{}")
222 active_beam = models.CharField(verbose_name='Active Beam', max_length=20000, default="{}")
223 module_status = models.CharField(verbose_name='Module Status', max_length=10000, default=json.dumps(status_default))
223 module_status = models.CharField(verbose_name='Module Status', max_length=10000, default=json.dumps(status_default))
224 operation_mode = models.PositiveSmallIntegerField(verbose_name='Operation Mode', choices=OPERATION_MODES, default = 0)
224 operation_mode = models.PositiveSmallIntegerField(verbose_name='Operation Mode', choices=OPERATION_MODES, default = 0)
225 operation_value = models.FloatField(verbose_name='Periodic (seconds)', default="10", null=True, blank=True)
225 operation_value = models.FloatField(verbose_name='Periodic (seconds)', default="10", null=True, blank=True)
226 module_messages = models.CharField(verbose_name='Modules Messages', max_length=10000, default=json.dumps(default_messages))
226 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))
227 module_mode = models.CharField(verbose_name='Modules Mode', max_length=10000, default=json.dumps(default_modulemode))
228
228
229 class Meta:
229 class Meta:
230 db_table = 'abs_configurations'
230 db_table = 'abs_configurations'
231
231
232 def get_absolute_url_plot(self):
232 def get_absolute_url_plot(self):
233 return reverse('url_plot_abs_patterns', args=[str(self.id)])
233 return reverse('url_plot_abs_patterns', args=[str(self.id)])
234
234
235
235
236 def parms_to_dict(self):
236 def parms_to_dict(self):
237
237
238 parameters = {}
238 parameters = {}
239
239
240 parameters['device_id'] = self.device.id
240 parameters['device_id'] = self.device.id
241 parameters['name'] = self.name
241 parameters['name'] = self.name
242 parameters['device_type'] = self.device.device_type.name
242 parameters['device_type'] = self.device.device_type.name
243 parameters['beams'] = {}
243 parameters['beams'] = {}
244
244
245 beams = ABSBeam.objects.filter(abs_conf=self)
245 beams = ABSBeam.objects.filter(abs_conf=self)
246 b=1
246 b=1
247 for beam in beams:
247 for beam in beams:
248 #absbeam = ABSBeam.objects.get(pk=beams[beam])
248 #absbeam = ABSBeam.objects.get(pk=beams[beam])
249 parameters['beams']['beam'+str(b)] = beam.parms_to_dict()#absbeam.parms_to_dict()
249 parameters['beams']['beam'+str(b)] = beam.parms_to_dict()#absbeam.parms_to_dict()
250 b+=1
250 b+=1
251
251
252 return parameters
252 return parameters
253
253
254
254 def dict_to_parms(self, parameters):
255 def dict_to_parms(self, parameters):
255
256
256 self.name = parameters['name']
257 self.name = parameters['name']
257
258
258 absbeams = ABSBeam.objects.filter(abs_conf=self)
259 absbeams = ABSBeam.objects.filter(abs_conf=self)
259 beams = parameters['beams']
260 beams = parameters['beams']
260
261
261 if absbeams:
262 if absbeams:
262 beams_number = len(beams)
263 beams_number = len(beams)
263 absbeams_number = len(absbeams)
264 absbeams_number = len(absbeams)
264 if beams_number==absbeams_number:
265 if beams_number==absbeams_number:
265 i = 1
266 i = 1
266 for absbeam in absbeams:
267 for absbeam in absbeams:
267 absbeam.dict_to_parms(beams['beam'+str(i)])
268 absbeam.dict_to_parms(beams['beam'+str(i)])
268 i = i+1
269 i = i+1
269 elif beams_number > absbeams_number:
270 elif beams_number > absbeams_number:
270 i = 1
271 i = 1
271 for absbeam in absbeams:
272 for absbeam in absbeams:
272 absbeam.dict_to_parms(beams['beam'+str(i)])
273 absbeam.dict_to_parms(beams['beam'+str(i)])
273 i=i+1
274 i=i+1
274 for x in range(i,beams_number+1):
275 for x in range(i,beams_number+1):
275 new_beam = ABSBeam(
276 new_beam = ABSBeam(
276 name =beams['beam'+str(i)]['name'],
277 name =beams['beam'+str(i)]['name'],
277 antenna =json.dumps(beams['beam'+str(i)]['antenna']),
278 antenna =json.dumps(beams['beam'+str(i)]['antenna']),
278 abs_conf = self,
279 abs_conf = self,
279 tx =json.dumps(beams['beam'+str(i)]['tx']),
280 tx =json.dumps(beams['beam'+str(i)]['tx']),
280 rx =json.dumps(beams['beam'+str(i)]['rx']),
281 rx =json.dumps(beams['beam'+str(i)]['rx']),
281 ues =json.dumps(beams['beam'+str(i)]['ues']),
282 ues =json.dumps(beams['beam'+str(i)]['ues']),
282 only_rx =json.dumps(beams['beam'+str(i)]['only_rx'])
283 only_rx =json.dumps(beams['beam'+str(i)]['only_rx'])
283 )
284 )
284 new_beam.save()
285 new_beam.save()
285 i=i+1
286 i=i+1
286 else: #beams_number < absbeams_number:
287 else: #beams_number < absbeams_number:
287 i = 1
288 i = 1
288 for absbeam in absbeams:
289 for absbeam in absbeams:
289 if i <= beams_number:
290 if i <= beams_number:
290 absbeam.dict_to_parms(beams['beam'+str(i)])
291 absbeam.dict_to_parms(beams['beam'+str(i)])
291 i=i+1
292 i=i+1
292 else:
293 else:
293 absbeam.delete()
294 absbeam.delete()
294 else:
295 else:
295 for beam in beams:
296 for beam in beams:
296 new_beam = ABSBeam(
297 new_beam = ABSBeam(
297 name =beams[beam]['name'],
298 name =beams[beam]['name'],
298 antenna =json.dumps(beams[beam]['antenna']),
299 antenna =json.dumps(beams[beam]['antenna']),
299 abs_conf = self,
300 abs_conf = self,
300 tx =json.dumps(beams[beam]['tx']),
301 tx =json.dumps(beams[beam]['tx']),
301 rx =json.dumps(beams[beam]['rx']),
302 rx =json.dumps(beams[beam]['rx']),
302 ues =json.dumps(beams[beam]['ues']),
303 ues =json.dumps(beams[beam]['ues']),
303 only_rx =json.dumps(beams[beam]['only_rx'])
304 only_rx =json.dumps(beams[beam]['only_rx'])
304 )
305 )
305 new_beam.save()
306 new_beam.save()
306
307
307
308
308
309
309 def update_from_file(self, parameters):
310 def update_from_file(self, parameters):
310
311
311 self.dict_to_parms(parameters)
312 self.dict_to_parms(parameters)
312 self.save()
313 self.save()
313
314
314
315
315 def get_beams(self, **kwargs):
316 def get_beams(self, **kwargs):
316 '''
317 '''
317 This function returns ABS Configuration beams
318 This function returns ABS Configuration beams
318 '''
319 '''
319 return ABSBeam.objects.filter(abs_conf=self.pk, **kwargs)
320 return ABSBeam.objects.filter(abs_conf=self.pk, **kwargs)
320
321
321 def clone(self, **kwargs):
322 def clone(self, **kwargs):
322
323
323 beams = self.get_beams()
324 beams = self.get_beams()
324 self.pk = None
325 self.pk = None
325 self.id = None
326 self.id = None
326 for attr, value in kwargs.items():
327 for attr, value in kwargs.items():
327 setattr(self, attr, value)
328 setattr(self, attr, value)
328 self.save()
329 self.save()
329
330
330 for beam in beams:
331 for beam in beams:
331 beam.clone(abs_conf=self)
332 beam.clone(abs_conf=self)
332
333
333 #-----For Active Beam-----
334 #-----For Active Beam-----
334 active_beam = json.loads(self.active_beam)
335 active_beam = json.loads(self.active_beam)
335 new_beams = ABSBeam.objects.filter(abs_conf=self)
336 new_beams = ABSBeam.objects.filter(abs_conf=self)
336 active_beam['active_beam'] = new_beams[0].id
337 active_beam['active_beam'] = new_beams[0].id
337
338
338 self.active_beam = json.dumps(active_beam)
339 self.active_beam = json.dumps(active_beam)
339 self.save()
340 self.save()
340 #-----For Active Beam-----
341 #-----For Active Beam-----
341 #-----For Device Status---
342 #-----For Device Status---
342 self.device.status = 3
343 self.device.status = 3
343 self.device.save()
344 self.device.save()
344 #-----For Device Status---
345 #-----For Device Status---
345
346
346 return self
347 return self
347
348
348
349
349 def start_device(self):
350 def start_device(self):
350
351
351 if self.device.status == 3:
352 if self.device.status == 3:
352
353
353 try:
354 try:
354 #self.write_device()
355 #self.write_device()
355 send_task('task_change_beam', [self.id],)
356 send_task('task_change_beam', [self.id],)
356 self.message = 'ABS running'
357 self.message = 'ABS running'
357
358
358 except Exception as e:
359 except Exception as e:
359 self.message = str(e)
360 self.message = str(e)
360 return False
361 return False
361
362
362 return True
363 return True
363
364
364 else:
365 else:
365 self.message = 'Please, select Write ABS Device first.'
366 self.message = 'Please, select Write ABS Device first.'
366 return False
367 return False
367
368
368
369
369 def stop_device(self):
370 def stop_device(self):
370
371
371 self.device.status = 2
372 self.device.status = 2
372 self.device.save()
373 self.device.save()
373 self.message = 'ABS has been stopped.'
374 self.message = 'ABS has been stopped.'
374 self.save()
375 self.save()
375
376
376 return True
377 return True
377
378
378 def monitoring_device(self):
379 def monitoring_device(self):
379
380
380 monitoreo_tx = 'JROABSClnt_01CeCnMod000000MNTR10'
381 monitoreo_tx = 'JROABSClnt_01CeCnMod000000MNTR10'
381 beam_tx = 'JROABSCeCnModCnMod01000001CHGB10'
382 beam_tx = 'JROABSCeCnModCnMod01000001CHGB10'
382
383
383 beam_pos = 1
384 beam_pos = 1
384 module_address = ('192.168.1.63', 5500)
385 module_address = ('192.168.1.63', 5500)
385
386
386 message_tx = monitoreo_tx
387 message_tx = monitoreo_tx
387 # Create the datagram socket
388 # Create the datagram socket
388 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
389 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
389 sock.connect(module_address)
390 sock.connect(module_address)
390
391
391 sock.send(message_tx)
392 sock.send(message_tx)
392 t = sock.recv(1024)
393 t = sock.recv(1024)
393 print 'Respuesta: \n',t
394 print 'Respuesta: \n',t
394 sock.close()
395 sock.close()
395 sock = None
396 sock = None
396
397
397 return True
398 return True
398
399
399
400
400 def module_conf(self, module_num, beams):
401 def module_conf(self, module_num, beams):
401 """
402 """
402 This function creates beam configurations for one abs module.
403 This function creates beam configurations for one abs module.
403 """
404 """
404 ip_address = self.device.ip_address
405 ip_address = self.device.ip_address
405 ip_address = ip_address.split('.')
406 ip_address = ip_address.split('.')
406 module_seq = (ip_address[0],ip_address[1],ip_address[2])
407 module_seq = (ip_address[0],ip_address[1],ip_address[2])
407 dot = '.'
408 dot = '.'
408 module_ip = dot.join(module_seq)+'.'+str(module_num)
409 module_ip = dot.join(module_seq)+'.'+str(module_num)
409 module_port = self.device.port_address
410 module_port = self.device.port_address
410 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
411 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
411
412
412 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
413 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
413 #module = 'ABS_'+str(module_num)
414 #module = 'ABS_'+str(module_num)
414 bs = '' #{}
415 bs = '' #{}
415 i=1
416 i=1
416
417
417 for beam in beams:
418 for beam in beams:
418 #bs[i] = fromBinary2Char(beam.module_6bits(module_num))
419 #bs[i] = fromBinary2Char(beam.module_6bits(module_num))
419 bs = bs + fromBinary2Char(beam.module_6bits(module_num))
420 bs = bs + fromBinary2Char(beam.module_6bits(module_num))
420 i=i+1
421 i=i+1
421
422
422 beams = bs
423 beams = bs
423
424
424 parameters = {}
425 parameters = {}
425 parameters['beams'] = beams #json.dumps(beams)
426 parameters['beams'] = beams #json.dumps(beams)
426 print parameters
427 print parameters
427 answer = ''
428 answer = ''
428
429
429 try:
430 try:
430 #r_write = requests.post(write_route, parameters, timeout=0.5)
431 #r_write = requests.post(write_route, parameters, timeout=0.5)
431 r_write = requests.post(write_route, json = parameters, timeout=0.5)
432 r_write = requests.post(write_route, json = parameters, timeout=0.5)
432 answer = r_write.json()
433 answer = r_write.json()
433 #self.message = answer['message']
434 #self.message = answer['message']
434 except:
435 except:
435 #self.message = "Could not write ABS parameters"
436 #self.message = "Could not write ABS parameters"
436 return False
437 return False
437
438
438 return answer
439 return answer
439
440
440
441
441
442
442 def write_device(self):
443 def write_device(self):
443
444
444 """
445 """
445 This function sends the beams list to every abs module.
446 This function sends the beams list to every abs module.
446 It needs 'module_conf' function
447 It needs 'module_conf' function
447 """
448 """
448
449
449 beams = ABSBeam.objects.filter(abs_conf=self)
450 beams = ABSBeam.objects.filter(abs_conf=self)
450 connected_modules = ast.literal_eval(self.module_status)
451 connected_modules = ast.literal_eval(self.module_status)
451 suma_connected_modules = 0
452 suma_connected_modules = 0
452
453
453 for c in connected_modules:
454 for c in connected_modules:
454 suma_connected_modules = suma_connected_modules+connected_modules[c]
455 suma_connected_modules = suma_connected_modules+connected_modules[c]
455 if not suma_connected_modules > 0 :
456 if not suma_connected_modules > 0 :
456 self.message = "No ABS Module detected."
457 self.message = "No ABS Module detected."
457 return False
458 return False
458
459
459 #-------------Write each abs module-----------
460 #-------------Write each abs module-----------
460 if beams:
461 if beams:
461 beams_status = ast.literal_eval(self.module_status)
462 beams_status = ast.literal_eval(self.module_status)
462 disconnected_modules = 0
463 disconnected_modules = 0
463 for i in range(1,65): #(62,65)
464 for i in range(1,65): #(62,65)
464 #--------------JUEVES-------------
465 #--------------JUEVES-------------
465 if beams_status[str(i)] != 0:
466 if beams_status[str(i)] != 0:
466 try:
467 try:
467 answer = self.module_conf(i,beams)
468 answer = self.module_conf(i,beams)
468 if answer:
469 if answer:
469 if answer['status']:
470 if answer['status']:
470 beams_status[str(i)] = 3
471 beams_status[str(i)] = 3
471 print snswer
472 print snswer
472
473
473 except:
474 except:
474 beams_status[str(i)] = 1
475 beams_status[str(i)] = 1
475
476
476 pass
477 pass
477 else:
478 else:
478 disconnected_modules += 1
479 disconnected_modules += 1
479
480
480 else:
481 else:
481 self.message = "ABS Configuration does not have beams"
482 self.message = "ABS Configuration does not have beams"
482 return False
483 return False
483
484
484 #self.device.status = 1
485 #self.device.status = 1
485 ##
486 ##
486 #-------------Jueves-------------
487 #-------------Jueves-------------
487 if disconnected_modules == 64:
488 if disconnected_modules == 64:
488 self.message = "Could not write ABS Modules"
489 self.message = "Could not write ABS Modules"
489 self.device.status = 0
490 self.device.status = 0
490 return False
491 return False
491 else:
492 else:
492 self.message = "ABS Beams List have been sent to ABS Modules"
493 self.message = "ABS Beams List have been sent to ABS Modules"
493 beams[0].set_as_activebeam()
494 beams[0].set_as_activebeam()
494
495
495 self.device.status = 3
496 self.device.status = 3
496 self.module_status = json.dumps(beams_status)
497 self.module_status = json.dumps(beams_status)
497
498
498
499
499
500
500 self.save()
501 self.save()
501 return True
502 return True
502
503
503
504
504
505
505
506
506 def read_module(self, module):
507 def read_module(self, module):
507
508
508 """
509 """
509 Read out-bits (up-down) of 1 abs module NOT for Configuration
510 Read out-bits (up-down) of 1 abs module NOT for Configuration
510 """
511 """
511
512
512 ip_address = self.device.ip_address
513 ip_address = self.device.ip_address
513 ip_address = ip_address.split('.')
514 ip_address = ip_address.split('.')
514 module_seq = (ip_address[0],ip_address[1],ip_address[2])
515 module_seq = (ip_address[0],ip_address[1],ip_address[2])
515 dot = '.'
516 dot = '.'
516 module_ip = dot.join(module_seq)+'.'+str(module)
517 module_ip = dot.join(module_seq)+'.'+str(module)
517 module_port = self.device.port_address
518 module_port = self.device.port_address
518 read_route = 'http://'+module_ip+':'+str(module_port)+'/read'
519 read_route = 'http://'+module_ip+':'+str(module_port)+'/read'
519
520
520 module_status = json.loads(self.module_status)
521 module_status = json.loads(self.module_status)
521 print(read_route)
522 print(read_route)
522
523
523 module_bits = ''
524 module_bits = ''
524
525
525 try:
526 try:
526 r_read = requests.get(read_route, timeout=0.5)
527 r_read = requests.get(read_route, timeout=0.5)
527 answer = r_read.json()
528 answer = r_read.json()
528 module_bits = answer['allbits']
529 module_bits = answer['allbits']
529 except:
530 except:
530 return {}
531 return {}
531
532
532 return module_bits
533 return module_bits
533
534
534 def read_device(self):
535 def read_device(self):
535
536
536 parms = {}
537 parms = {}
537 # Reads active modules.
538 # Reads active modules.
538 module_status = json.loads(self.module_status)
539 module_status = json.loads(self.module_status)
539 total = 0
540 total = 0
540 for status in module_status:
541 for status in module_status:
541 if module_status[status] != 0:
542 if module_status[status] != 0:
542 module_bits = self.read_module(int(status))
543 module_bits = self.read_module(int(status))
543 bits={}
544 bits={}
544 if module_bits:
545 if module_bits:
545 bits = (str(module_bits['um2']) + str(module_bits['um1']) + str(module_bits['um0']) +
546 bits = (str(module_bits['um2']) + str(module_bits['um1']) + str(module_bits['um0']) +
546 str(module_bits['dm2']) + str(module_bits['dm1']) + str(module_bits['dm0']) )
547 str(module_bits['dm2']) + str(module_bits['dm1']) + str(module_bits['dm0']) )
547 parms[str(status)] = bits
548 parms[str(status)] = bits
548
549
549 total +=1
550 total +=1
550
551
551 if total==0:
552 if total==0:
552 self.message = "No ABS Module detected. Please select 'Status'."
553 self.message = "No ABS Module detected. Please select 'Status'."
553 return False
554 return False
554
555
555
556
556
557
557 self.message = "ABS Modules have been read"
558 self.message = "ABS Modules have been read"
558 #monitoreo_tx = JROABSClnt_01CeCnMod000000MNTR10
559 #monitoreo_tx = JROABSClnt_01CeCnMod000000MNTR10
559 return parms
560 return parms
560
561
561
562
562 def absmodule_status(self):
563 def absmodule_status(self):
563 """
564 """
564 This function gets the status of each abs module. It sends GET method to Web Application
565 This function gets the status of each abs module. It sends GET method to Web Application
565 in Python Bottle.
566 in Python Bottle.
566 This function updates "module_status" field from ABSconfiguration.
567 This function updates "module_status" field from ABSconfiguration.
567 """
568 """
568 ip_address = self.device.ip_address
569 ip_address = self.device.ip_address
569 ip_address = ip_address.split('.')
570 ip_address = ip_address.split('.')
570 module_seq = (ip_address[0],ip_address[1],ip_address[2])
571 module_seq = (ip_address[0],ip_address[1],ip_address[2])
571 dot = '.'
572 dot = '.'
572 module_port = self.device.port_address
573 module_port = self.device.port_address
573
574
574 modules_status = json.loads(self.module_status)
575 modules_status = json.loads(self.module_status)
575 module_messages = json.loads(self.module_messages)
576 module_messages = json.loads(self.module_messages)
576
577
577 for i in range(1,65):
578 for i in range(1,65):
578 module_ip = dot.join(module_seq)+'.'+str(i)
579 module_ip = dot.join(module_seq)+'.'+str(i)
579 print module_ip
580 print module_ip
580
581
581 route = 'http://'+module_ip+':'+str(module_port)+'/status'
582 route = 'http://'+module_ip+':'+str(module_port)+'/status'
582
583
583 try:
584 try:
584 r = requests.get(route, timeout=0.8)#, timeout=0.7)
585 r = requests.get(route, timeout=0.8)#, timeout=0.7)
585 answer = r.json()
586 answer = r.json()
586 modules_status[str(i)] = answer['status']
587 modules_status[str(i)] = answer['status']
587 module_messages[str(i)] = answer['message']
588 module_messages[str(i)] = answer['message']
588 except:
589 except:
589 modules_status[str(i)] = 0
590 modules_status[str(i)] = 0
590 pass
591 pass
591
592
592
593
593 self.module_status = json.dumps(modules_status)
594 self.module_status = json.dumps(modules_status)
594 self.module_messages = json.dumps(module_messages)
595 self.module_messages = json.dumps(module_messages)
595 self.save()
596 self.save()
596
597
598 print 'Termino (='
599
597 return
600 return
598
601
599
602
600 def connected_modules(self):
603 def connected_modules(self):
601 """
604 """
602 This function returns the number of connected abs-modules without updating.
605 This function returns the number of connected abs-modules without updating.
603 """
606 """
604 modules_status = json.loads(self.module_status)
607 modules_status = json.loads(self.module_status)
605 num = 0
608 num = 0
606 for status in modules_status:
609 for status in modules_status:
607 if modules_status[status] != 0:
610 if modules_status[status] != 0:
608 num += 1
611 num += 1
609
612
610 return num
613 return num
611
614
612
615
613 def status_device(self):
616 def status_device(self):
614 """
617 """
615 This function returns the status of all abs-modules as one.
618 This function returns the status of all abs-modules as one.
616 If at least one module is connected, its answer is "1"
619 If at least one module is connected, its answer is "1"
617 """
620 """
618 self.absmodule_status()
621 #self.absmodule_status()
622 send_task('status_absdevice', [self.id],)
619 connected_modules = self.connected_modules()
623 connected_modules = self.connected_modules()
620 if connected_modules>0:
624 if connected_modules>0:
621 self.message = 'ABS modules Status have been updated.'
625 self.message = 'ABS modules Status have been updated.'
622 return 1
626 return 1
627 else:
628 self.device.status=0
629
623 self.message = 'No ABS module is connected.'
630 self.message = 'No ABS module is connected.'
631 self.save()
624 return 0
632 return 0
625
633
626
634
627
635
628 def write_module(self, module):
636 def write_module(self, module):
629
637
630 """
638 """
631 Send configuration to one abs module
639 Send configuration to one abs module
632 """
640 """
633
641
634 parameters = {}
642 parameters = {}
635 ip_address = self.device.ip_address
643 ip_address = self.device.ip_address
636 ip_address = ip_address.split('.')
644 ip_address = ip_address.split('.')
637 module_seq = (ip_address[0],ip_address[1],ip_address[2])
645 module_seq = (ip_address[0],ip_address[1],ip_address[2])
638 dot = '.'
646 dot = '.'
639 module_ip = dot.join(module_seq)+'.'+str(module)
647 module_ip = dot.join(module_seq)+'.'+str(module)
640 module_port = self.device.port_address
648 module_port = self.device.port_address
641 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
649 write_route = 'http://'+module_ip+':'+str(module_port)+'/write'
642
650
643 #print write_route
651 #print write_route
644
652
645 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
653 #header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
646 #module = 'ABS_'+str(module)
654 #module = 'ABS_'+str(module)
647 beams = '!`*3<ENW'#{1: '001000', 2: '010001', 3: '010010', 4: '000011', 5: '101100', 6: '101101',
655 beams = '!`*3<ENW'#{1: '001000', 2: '010001', 3: '010010', 4: '000011', 5: '101100', 6: '101101',
648 # 7: '110110', 8: '111111', 9: '000000', 10: '001001', 11: '010010', 12: '011011'}
656 # 7: '110110', 8: '111111', 9: '000000', 10: '001001', 11: '010010', 12: '011011'}
649
657
650 #parameters['header'] = header
658 #parameters['header'] = header
651 parameters['module'] = module
659 parameters['module'] = module
652 parameters['beams'] = json.dumps(beams)
660 parameters['beams'] = json.dumps(beams)
653
661
654 answer = ''
662 answer = ''
655
663
656 try:
664 try:
657 r_write = requests.post(write_route, parameters, timeout=0.5)
665 r_write = requests.post(write_route, parameters, timeout=0.5)
658 answer = r_write.json()
666 answer = r_write.json()
659 self.message = answer['message']
667 self.message = answer['message']
660 except:
668 except:
661 self.message = "Could not write ABS parameters"
669 self.message = "Could not write ABS parameters"
662 return 0
670 return 0
663
671
664
672
665 #self.device.status = int(answer['status'])
673 #self.device.status = int(answer['status'])
666
674
667 return 1
675 return 1
668
676
669
677
670 def write_module_socket(self, module):
678 def write_module_socket(self, module):
671 """
679 """
672 This function sends beams list to one abs-module to TCP_Control_Module using sockets
680 This function sends beams list to one abs-module to TCP_Control_Module using sockets
673 """
681 """
674
682
675 ip_address = self.device.ip_address
683 ip_address = self.device.ip_address
676 ip_address = ip_address.split('.')
684 ip_address = ip_address.split('.')
677 module_seq = (ip_address[0],ip_address[1],ip_address[2])
685 module_seq = (ip_address[0],ip_address[1],ip_address[2])
678 dot = '.'
686 dot = '.'
679 module_ip = dot.join(module_seq)+'.'+str(module)
687 module_ip = dot.join(module_seq)+'.'+str(module)
680 module_port = self.device.port_address
688 module_port = self.device.port_address
681
689
682 header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
690 header = 'JROABSCeCnModCnMod01000108SNDFexperimento1.ab1'
683 abs_module = 'ABS_'+str(module)
691 abs_module = 'ABS_'+str(module)
684
692
685 beams = self.get_beams()
693 beams = self.get_beams()
686 beams_text = ''
694 beams_text = ''
687 for beam in beams:
695 for beam in beams:
688 modules_conf=json.loads(beam.modules_conf)
696 modules_conf=json.loads(beam.modules_conf)
689 beams_text = beams_text + modules_conf[str(module)] + '\n'
697 beams_text = beams_text + modules_conf[str(module)] + '\n'
690
698
691 message_tx = header + '\n' + abs_module + '\n' + beams_text + '0'
699 message_tx = header + '\n' + abs_module + '\n' + beams_text + '0'
692 print "Send: ", message_tx
700 print "Send: ", message_tx
693
701
694 # Create the datagram socket
702 # Create the datagram socket
695 module_address = (module_ip, 5500)
703 module_address = (module_ip, 5500)
696 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
704 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
697 try:
705 try:
698 sock.connect(module_address)
706 sock.connect(module_address)
699 sock.send(message_tx)
707 sock.send(message_tx)
700 t = sock.recv(1024)
708 t = sock.recv(1024)
701 print 'Respuesta: \n',t
709 print 'Respuesta: \n',t
702
710
703 except Exception as e:
711 except Exception as e:
704 print str(e)
712 print str(e)
705 sock.close()
713 sock.close()
706 sock = None
714 sock = None
707 return False
715 return False
708
716
709 sock.close()
717 sock.close()
710 sock = None
718 sock = None
711
719
712 return True
720 return True
713
721
714 def write_device_socket(self):
722 def write_device_socket(self):
715 """
723 """
716 This function sends beams list to every connected abs-module to TCP_Control_Module using sockets
724 This function sends beams list to every connected abs-module to TCP_Control_Module using sockets
717 """
725 """
718 module_mode = json.loads(self.module_mode)
726 module_mode = json.loads(self.module_mode)
719 module_status = json.loads(self.module_status)
727 module_status = json.loads(self.module_status)
720
728
721 for i in range(1,65):
729 for i in range(1,65):
722 if module_mode[str(i)] == 0 and module_status[str(i)] == 1: # 0: Sockets + Cserver & 1: Connected
730 if module_mode[str(i)] == 0 and module_status[str(i)] == 1: # 0: Sockets + Cserver & 1: Connected
723 try:
731 try:
724 self.write_module_socket(i)
732 self.write_module_socket(i)
725 except Exception as e:
733 except Exception as e:
726 print 'Error ABS '+str(i)+': '+str(e)
734 print 'Error ABS '+str(i)+': '+str(e)
727
735
728 return True
736 return True
729
737
730
738
731 def beam_selector(self, module, beam_pos):
739 def beam_selector(self, module, beam_pos):
732 """
740 """
733 This function selects the beam number for one absmodule.
741 This function selects the beam number for one absmodule.
734 """
742 """
735
743
736 if beam_pos > 0:
744 if beam_pos > 0:
737 beam_pos = beam_pos - 1
745 beam_pos = beam_pos - 1
738 else:
746 else:
739 beam_pos = 0
747 beam_pos = 0
740
748
741 #El indice del apunte debe ser menor que el numero total de apuntes
749 #El indice del apunte debe ser menor que el numero total de apuntes
742 #El servidor tcp en el embebido comienza a contar desde 0
750 #El servidor tcp en el embebido comienza a contar desde 0
743 beams_list = ABSBeam.objects.filter(abs_conf=self)
751 beams_list = ABSBeam.objects.filter(abs_conf=self)
744 if len(beams_list) < beam_pos:
752 if len(beams_list) < beam_pos:
745 return 0
753 return 0
746
754
747 flag = 1
755 flag = 1
748 if beam_pos>9:
756 if beam_pos>9:
749 flag = 2
757 flag = 2
750
758
751 module_address = ('192.168.1.'+str(module), 5500)
759 module_address = ('192.168.1.'+str(module), 5500)
752 header = 'JROABSCeCnModCnMod0100000'
760 header = 'JROABSCeCnModCnMod0100000'
753 numbers = len(str(beam_pos))
761 numbers = len(str(beam_pos))
754 function = 'CHGB'
762 function = 'CHGB'
755
763
756 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
764 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
757
765
758 # Create the datagram socket
766 # Create the datagram socket
759 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
767 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
760 #sock.connect(module_address)
768 #sock.connect(module_address)
761 try:
769 try:
762 sock.connect(module_address)
770 sock.connect(module_address)
763 sock.send(message_tx)
771 sock.send(message_tx)
764 sock.close()
772 sock.close()
765 print("Writing abs module:"+module_address[0]+"...")
773 print("Writing abs module:"+module_address[0]+"...")
766 except:
774 except:
767 sock = None
775 sock = None
768 print("Problem writing abs module:"+module_address[0])
776 print("Problem writing abs module:"+module_address[0])
769 return 0
777 return 0
770
778
771 return 1
779 return 1
772
780
773
781
774 def change_beam(self, beam_pos):
782 def change_beam(self, beam_pos):
775 """
783 """
776 This function selects the beam number for all absmodules.
784 This function selects the beam number for all absmodules.
777 """
785 """
778 for i in range(1,65):
786 for i in range(1,65):
779 try:
787 try:
780 self.beam_selector(i,beam_pos)
788 self.beam_selector(i,beam_pos)
781 except:
789 except:
782 print("Problem with module: 192.168.1."+str(i))
790 print("Problem with module: 192.168.1."+str(i))
783 self.message = "Problem with module: 192.168.1."+str(i)
791 self.message = "Problem with module: 192.168.1."+str(i)
784 #return 0
792 #return 0
785 return 1
793 return 1
786
794
787
795
788 def send_beam_num(self, beam_pos):
796 def send_beam_num(self, beam_pos):
789 """
797 """
790 This function connects to a multicast group and sends the beam number
798 This function connects to a multicast group and sends the beam number
791 to all abs modules.
799 to all abs modules.
792 """
800 """
793
801
794 # Se manda a cero RC para poder realizar cambio de beam
802 # Se manda a cero RC para poder realizar cambio de beam
795 confs = Configuration.objects.filter(experiment = self.experiment)
803 confs = Configuration.objects.filter(experiment = self.experiment)
796 confdds = ''
804 confdds = ''
797 confjars = ''
805 confjars = ''
798 confrc = ''
806 confrc = ''
799
807
800 #TO STOP DEVICES: DDS-JARS-RC
808 #TO STOP DEVICES: DDS-JARS-RC
801 for i in range(0,len(confs)):
809 for i in range(0,len(confs)):
802 if i==0:
810 if i==0:
803 for conf in confs:
811 for conf in confs:
804 if conf.device.device_type.name == 'dds':
812 if conf.device.device_type.name == 'dds':
805 confdds = conf
813 confdds = conf
806 confdds.stop_device()
814 confdds.stop_device()
807 break
815 break
808 if i==1:
816 if i==1:
809 for conf in confs:
817 for conf in confs:
810 if conf.device.device_type.name == 'jars':
818 if conf.device.device_type.name == 'jars':
811 confjars = conf
819 confjars = conf
812 confjars.stop_device()
820 confjars.stop_device()
813 break
821 break
814 if i==2:
822 if i==2:
815 for conf in confs:
823 for conf in confs:
816 if conf.device.device_type.name == 'rc':
824 if conf.device.device_type.name == 'rc':
817 confrc = conf
825 confrc = conf
818 confrc.stop_device()
826 confrc.stop_device()
819 break
827 break
820
828
821 if beam_pos > 0:
829 if beam_pos > 0:
822 beam_pos = beam_pos - 1
830 beam_pos = beam_pos - 1
823 else:
831 else:
824 beam_pos = 0
832 beam_pos = 0
825
833
826 #El indice del apunte debe ser menor que el numero total de apuntes
834 #El indice del apunte debe ser menor que el numero total de apuntes
827 #El servidor tcp en el embebido comienza a contar desde 0
835 #El servidor tcp en el embebido comienza a contar desde 0
828 beams_list = ABSBeam.objects.filter(abs_conf=self)
836 beams_list = ABSBeam.objects.filter(abs_conf=self)
829 if len(beams_list) < beam_pos:
837 if len(beams_list) < beam_pos:
830 return 0
838 return 0
831
839
832 flag = 1
840 flag = 1
833 if beam_pos>9:
841 if beam_pos>9:
834 flag = 2
842 flag = 2
835
843
836 header = 'JROABSCeCnModCnMod0100000'
844 header = 'JROABSCeCnModCnMod0100000'
837 flag = str(flag)
845 flag = str(flag)
838 function = 'CHGB'
846 function = 'CHGB'
839 message_tx = header+flag+function+str(beam_pos)+'0'
847 message_tx = header+flag+function+str(beam_pos)+'0'
840
848
841 multicast_group = '224.3.29.71'
849 multicast_group = '224.3.29.71'
842 server_address = ('',10000)
850 server_address = ('',10000)
843
851
844 # Create the socket
852 # Create the socket
845 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
853 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
846 # Bind to the server address
854 # Bind to the server address
847 sock.bind(server_address)
855 sock.bind(server_address)
848 # Telling the OS add the socket to the multicast on all interfaces
856 # Telling the OS add the socket to the multicast on all interfaces
849 group = socket.inet_aton(multicast_group)
857 group = socket.inet_aton(multicast_group)
850 mreq = struct.pack('4sL', group, socket.INADDR_ANY)
858 mreq = struct.pack('4sL', group, socket.INADDR_ANY)
851
859
852 try:
860 try:
853 sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
861 sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
854 except Exception as e:
862 except Exception as e:
855 self.message = str(e)
863 self.message = str(e)
856 print str(e)
864 print str(e)
857 sock.close()
865 sock.close()
858 sock = None
866 sock = None
859 return False
867 return False
860
868
861 #print 'sending acknowledgement to all: \n' + message_tx
869 #print 'sending acknowledgement to all: \n' + message_tx
862 try:
870 try:
863 sock.sendto(message_tx, (multicast_group, 10000))
871 sock.sendto(message_tx, (multicast_group, 10000))
864 except Exception as e:
872 except Exception as e:
865 self.message = str(e)
873 self.message = str(e)
866 print str(e)
874 print str(e)
867 sock.close()
875 sock.close()
868 sock = None
876 sock = None
869 return False
877 return False
870 sock.close()
878 sock.close()
871 sock = None
879 sock = None
872
880
873 #Start DDS-RC-JARS
881 #Start DDS-RC-JARS
874 if confdds:
882 if confdds:
875 confdds.start_device()
883 confdds.start_device()
876 if confrc:
884 if confrc:
877 #print confrc
885 #print confrc
878 confrc.start_device()
886 confrc.start_device()
879 if confjars:
887 if confjars:
880 confjars.start_device()
888 confjars.start_device()
881
889
882 self.message = "ABS Beam has been changed"
890 self.message = "ABS Beam has been changed"
883
891
884 return True
892 return True
885
893
886 def test1(self):
894 def test1(self):
887 t1 = time.time()
895 t1 = time.time()
888 t2 = 0
896 t2 = 0
889 while (t2-t1)<100:#300
897 while (t2-t1)<100:#300
890 t2 = time.time()
898 t2 = time.time()
891 self.send_beam_num(2)
899 self.send_beam_num(2)
892 time.sleep(0.04)
900 time.sleep(0.04)
893 self.send_beam_num(1)
901 self.send_beam_num(1)
894 time.sleep(0.04)
902 time.sleep(0.04)
895 return
903 return
896
904
897 def change_procs_test1(self, module):
905 def change_procs_test1(self, module):
898
906
899 for i in range (1,300):#300
907 for i in range (1,300):#300
900 beam_pos = 1
908 beam_pos = 1
901 module_address = ('192.168.1.'+str(module), 5500)
909 module_address = ('192.168.1.'+str(module), 5500)
902 header = 'JROABSCeCnModCnMod0100000'
910 header = 'JROABSCeCnModCnMod0100000'
903 numbers = len(str(beam_pos))
911 numbers = len(str(beam_pos))
904 function = 'CHGB'
912 function = 'CHGB'
905
913
906 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
914 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
907
915
908 # Create the datagram socket
916 # Create the datagram socket
909 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
917 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
910 sock.connect(module_address)
918 sock.connect(module_address)
911
919
912 sock.send(message_tx)
920 sock.send(message_tx)
913 #t = sock.recv(1024)
921 #t = sock.recv(1024)
914 sock.close()
922 sock.close()
915 sock = None
923 sock = None
916
924
917
925
918 time.sleep(0.04)
926 time.sleep(0.04)
919
927
920
928
921 beam_pos = 0
929 beam_pos = 0
922 numbers = len(str(beam_pos))
930 numbers = len(str(beam_pos))
923
931
924 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
932 message_tx = header+str(numbers)+function+str(beam_pos)+'0'
925
933
926 # Create the datagram socket
934 # Create the datagram socket
927 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
935 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
928 sock.connect(module_address)
936 sock.connect(module_address)
929 sock.send(message_tx)
937 sock.send(message_tx)
930 sock.close()
938 sock.close()
931 sock = None
939 sock = None
932
940
933 time.sleep(0.04)
941 time.sleep(0.04)
934
942
935
943
936 def multi_procs_test1(self):
944 def multi_procs_test1(self):
937
945
938 """
946 """
939 This function sends the beam number to all abs modules using multiprocessing.
947 This function sends the beam number to all abs modules using multiprocessing.
940 """
948 """
941
949
942 #if __name__ == "__main__":
950 #if __name__ == "__main__":
943 size = 10000000 # Number of random numbers to add
951 size = 10000000 # Number of random numbers to add
944 procs = 65 # (Number-1) of processes to create (absmodule)
952 procs = 65 # (Number-1) of processes to create (absmodule)
945
953
946 # Create a list of jobs and then iterate through
954 # Create a list of jobs and then iterate through
947 # the number of processes appending each process to
955 # the number of processes appending each process to
948 # the job list
956 # the job list
949 jobs = []
957 jobs = []
950 for i in range(1, procs):
958 for i in range(1, procs):
951
959
952 process = multiprocessing.Process(target=self.change_procs_test1,args=(i,))
960 process = multiprocessing.Process(target=self.change_procs_test1,args=(i,))
953 jobs.append(process)
961 jobs.append(process)
954 #print jobs
962 #print jobs
955
963
956 # Start the processes (i.e. calculate the random number lists)
964 # Start the processes (i.e. calculate the random number lists)
957 for j in jobs:
965 for j in jobs:
958 #time.sleep(0.4)
966 #time.sleep(0.4)
959 #print j
967 #print j
960 j.start()
968 j.start()
961
969
962 # Ensure all of the processes have finished
970 # Ensure all of the processes have finished
963 for j in jobs:
971 for j in jobs:
964 j.join()
972 j.join()
965
973
966 print("List processing complete.")
974 print("List processing complete.")
967 return 1
975 return 1
968
976
969
977
970
978
971 def multi_procs_test2(self):
979 def multi_procs_test2(self):
972 """
980 """
973 This function use multiprocessing python library. Importing Pool we can select
981 This function use multiprocessing python library. Importing Pool we can select
974 the number of cores we want to use
982 the number of cores we want to use
975 After 'nproc' linux command, we know how many cores computer has.
983 After 'nproc' linux command, we know how many cores computer has.
976 NOT WORKING
984 NOT WORKING
977 """
985 """
978 import multiprocessing
986 import multiprocessing
979 pool = multiprocessing.Pool(3) # cores
987 pool = multiprocessing.Pool(3) # cores
980
988
981 tasks = []
989 tasks = []
982 procs = 65
990 procs = 65
983 for i in range(62, procs):
991 for i in range(62, procs):
984 tasks.append( (i,))
992 tasks.append( (i,))
985 #print tasks
993 #print tasks
986 #pool.apply_async(self.change_procs_test1, 62)
994 #pool.apply_async(self.change_procs_test1, 62)
987 results = [pool.apply( self.change_procs_test1, t ) for t in tasks]
995 results = [pool.apply( self.change_procs_test1, t ) for t in tasks]
988 #for result in results:
996 #for result in results:
989 #result.get()
997 #result.get()
990 #(plotNum, plotFilename) = result.get()
998 #(plotNum, plotFilename) = result.get()
991 #print("Result: plot %d written to %s" % (plotNum, plotFilename) )
999 #print("Result: plot %d written to %s" % (plotNum, plotFilename) )
992
1000
993 return 1
1001 return 1
994
1002
995
1003
996 def multi_procs_test3(self):
1004 def multi_procs_test3(self):
997 """
1005 """
998 This function use multiprocessing python library. Importing Pool we can select
1006 This function use multiprocessing python library. Importing Pool we can select
999 the number of cores we want to use
1007 the number of cores we want to use
1000 After 'nproc' linux command, we know how many cores computer has.
1008 After 'nproc' linux command, we know how many cores computer has.
1001 """
1009 """
1002 from multiprocessing import Pool
1010 from multiprocessing import Pool
1003 import time
1011 import time
1004
1012
1005 def f(x):
1013 def f(x):
1006 return x*x
1014 return x*x
1007
1015
1008 tasks = []
1016 tasks = []
1009 procs = 65
1017 procs = 65
1010 pool = Pool(processes=4)
1018 pool = Pool(processes=4)
1011
1019
1012 #for i in range(62, procs):
1020 #for i in range(62, procs):
1013 #result = pool.map(f, range(62,65))
1021 #result = pool.map(f, range(62,65))
1014 it = pool.imap(self.change_procs_test1, range(62,65))
1022 it = pool.imap(self.change_procs_test1, range(62,65))
1015 #result.get(timeout=5)
1023 #result.get(timeout=5)
1016
1024
1017 return 1
1025 return 1
1018
1026
1019
1027
1020 def multi_procs_test4(self):
1028 def multi_procs_test4(self):
1021 import multiprocessing as mp
1029 import multiprocessing as mp
1022
1030
1023
1031
1024 num_workers = mp.cpu_count()
1032 num_workers = mp.cpu_count()
1025
1033
1026 pool = mp.Pool(num_workers)
1034 pool = mp.Pool(num_workers)
1027 procs = 65
1035 procs = 65
1028 for i in range(62, procs):
1036 for i in range(62, procs):
1029 #for task in tasks:
1037 #for task in tasks:
1030 pool.apply_async(self.f, args = (i,))
1038 pool.apply_async(self.f, args = (i,))
1031
1039
1032 pool.close()
1040 pool.close()
1033 pool.join()
1041 pool.join()
1034
1042
1035 return 1
1043 return 1
1036
1044
1037
1045
1038 def get_absolute_url_import(self):
1046 def get_absolute_url_import(self):
1039 return reverse('url_import_abs_conf', args=[str(self.id)])
1047 return reverse('url_import_abs_conf', args=[str(self.id)])
1040
1048
1041
1049
1050 def get_absolute_url_status(self):
1051 return reverse('url_status_abs_conf', args=[str(self.id)])
1052
1042
1053
1043
1054
1044 class ABSBeam(models.Model):
1055 class ABSBeam(models.Model):
1045
1056
1046 name = models.CharField(max_length=60, default='Beam')
1057 name = models.CharField(max_length=60, default='Beam')
1047 antenna = models.CharField(verbose_name='Antenna', max_length=1000, default=antenna_default)
1058 antenna = models.CharField(verbose_name='Antenna', max_length=1000, default=antenna_default)
1048 abs_conf = models.ForeignKey(ABSConfiguration, null=True, verbose_name='ABS Configuration')
1059 abs_conf = models.ForeignKey(ABSConfiguration, null=True, verbose_name='ABS Configuration')
1049 tx = models.CharField(verbose_name='Tx', max_length=1000, default=tx_default)
1060 tx = models.CharField(verbose_name='Tx', max_length=1000, default=tx_default)
1050 rx = models.CharField(verbose_name='Rx', max_length=1000, default=rx_default)
1061 rx = models.CharField(verbose_name='Rx', max_length=1000, default=rx_default)
1051 s_time = models.TimeField(verbose_name='Star Time', default='00:00:00')
1062 s_time = models.TimeField(verbose_name='Star Time', default='00:00:00')
1052 e_time = models.TimeField(verbose_name='End Time', default='23:59:59')
1063 e_time = models.TimeField(verbose_name='End Time', default='23:59:59')
1053 modules_conf = models.CharField(verbose_name='Modules', max_length=2000, default=json.dumps(conf_default))
1064 modules_conf = models.CharField(verbose_name='Modules', max_length=2000, default=json.dumps(conf_default))
1054 ues = models.CharField(verbose_name='Ues', max_length=100, default=ues_default)
1065 ues = models.CharField(verbose_name='Ues', max_length=100, default=ues_default)
1055 only_rx = models.CharField(verbose_name='Only RX', max_length=40, default=onlyrx_default)
1066 only_rx = models.CharField(verbose_name='Only RX', max_length=40, default=onlyrx_default)
1056
1067
1057 class Meta:
1068 class Meta:
1058 db_table = 'abs_beams'
1069 db_table = 'abs_beams'
1059
1070
1060 def __unicode__(self):
1071 def __unicode__(self):
1061 return u'%s' % (self.name)
1072 return u'%s' % (self.name)
1062
1073
1063 def parms_to_dict(self):
1074 def parms_to_dict(self):
1064
1075
1065 #Update data
1076 #Update data
1066 self.modules_6bits()
1077 self.modules_6bits()
1067
1078
1068 parameters = {}
1079 parameters = {}
1069
1080
1070 parameters['name'] = self.name
1081 parameters['name'] = self.name
1071 parameters['antenna'] = ast.literal_eval(self.antenna)
1082 parameters['antenna'] = ast.literal_eval(self.antenna)
1072 parameters['abs_conf'] = self.abs_conf.name
1083 parameters['abs_conf'] = self.abs_conf.name
1073 parameters['tx'] = ast.literal_eval(self.tx)
1084 parameters['tx'] = ast.literal_eval(self.tx)
1074 parameters['rx'] = ast.literal_eval(self.rx)
1085 parameters['rx'] = ast.literal_eval(self.rx)
1075 parameters['s_time'] = self.s_time.strftime("%H:%M:%S")
1086 parameters['s_time'] = self.s_time.strftime("%H:%M:%S")
1076 parameters['e_time'] = self.e_time.strftime("%H:%M:%S")
1087 parameters['e_time'] = self.e_time.strftime("%H:%M:%S")
1077 parameters['configuration'] = ast.literal_eval(self.modules_conf)
1088 parameters['configuration'] = ast.literal_eval(self.modules_conf)
1078 parameters['ues'] = ast.literal_eval(self.ues)
1089 parameters['ues'] = ast.literal_eval(self.ues)
1079 parameters['only_rx'] = json.loads(self.only_rx)
1090 parameters['only_rx'] = json.loads(self.only_rx)
1080
1091
1081 return parameters
1092 return parameters
1082
1093
1083 def dict_to_parms(self, parameters):
1094 def dict_to_parms(self, parameters):
1084
1095
1085 self.name = parameters['name']
1096 self.name = parameters['name']
1086 self.antenna = json.dumps(parameters['antenna'])
1097 self.antenna = json.dumps(parameters['antenna'])
1087 #self.abs_conf = parameters['abs_conf']
1098 #self.abs_conf = parameters['abs_conf']
1088 self.tx = json.dumps(parameters['tx'])
1099 self.tx = json.dumps(parameters['tx'])
1089 self.rx = json.dumps(parameters['rx'])
1100 self.rx = json.dumps(parameters['rx'])
1090 #self.s_time = parameters['s_time']
1101 #self.s_time = parameters['s_time']
1091 #self.e_time = parameters['e_time']
1102 #self.e_time = parameters['e_time']
1092 self.ues = json.dumps(parameters['ues'])
1103 self.ues = json.dumps(parameters['ues'])
1093 self.only_rx = json.dumps(parameters['only_rx'])
1104 self.only_rx = json.dumps(parameters['only_rx'])
1094
1105
1095 self.modules_6bits()
1106 self.modules_6bits()
1096 self.save()
1107 self.save()
1097
1108
1098
1109
1099 def clone(self, **kwargs):
1110 def clone(self, **kwargs):
1100
1111
1101 self.pk = None
1112 self.pk = None
1102 self.id = None
1113 self.id = None
1103 for attr, value in kwargs.items():
1114 for attr, value in kwargs.items():
1104 setattr(self, attr, value)
1115 setattr(self, attr, value)
1105
1116
1106 self.save()
1117 self.save()
1107
1118
1108 return self
1119 return self
1109
1120
1110
1121
1111
1122
1112 def module_6bits(self, module):
1123 def module_6bits(self, module):
1113 """
1124 """
1114 This function reads antenna pattern and choose 6bits (upbits-downbits) for one abs module
1125 This function reads antenna pattern and choose 6bits (upbits-downbits) for one abs module
1115 """
1126 """
1116 if module > 64:
1127 if module > 64:
1117 beam_bits = ""
1128 beam_bits = ""
1118 return beam_bits
1129 return beam_bits
1119
1130
1120 data = ast.literal_eval(self.antenna)
1131 data = ast.literal_eval(self.antenna)
1121 up_data = data['antenna_up']
1132 up_data = data['antenna_up']
1122 down_data = data['antenna_down']
1133 down_data = data['antenna_down']
1123
1134
1124 pos = ip2position(module)
1135 pos = ip2position(module)
1125 up_value = up_data[pos[0]][pos[1]]
1136 up_value = up_data[pos[0]][pos[1]]
1126 down_value = down_data[pos[0]][pos[1]]
1137 down_value = down_data[pos[0]][pos[1]]
1127
1138
1128 up_bits = up_conv_bits(up_value)
1139 up_bits = up_conv_bits(up_value)
1129 down_bits = down_conv_bits(down_value)
1140 down_bits = down_conv_bits(down_value)
1130 beam_bits = up_bits+down_bits
1141 beam_bits = up_bits+down_bits
1131
1142
1132 return beam_bits
1143 return beam_bits
1133
1144
1134 def modules_6bits(self):
1145 def modules_6bits(self):
1135 """
1146 """
1136 This function returns 6bits from every abs module (1-64) in a dict
1147 This function returns 6bits from every abs module (1-64) in a dict
1137 """
1148 """
1138 modules_configuration = ast.literal_eval(self.modules_conf)
1149 modules_configuration = ast.literal_eval(self.modules_conf)
1139
1150
1140 for i in range(1,65):
1151 for i in range(1,65):
1141 modules_configuration[str(i)] = self.module_6bits(i)
1152 modules_configuration[str(i)] = self.module_6bits(i)
1142
1153
1143 self.modules_conf = json.dumps(modules_configuration)
1154 self.modules_conf = json.dumps(modules_configuration)
1144 self.save()
1155 self.save()
1145
1156
1146 return self.modules_conf
1157 return self.modules_conf
1147
1158
1148
1159
1149 def set_as_activebeam(self):
1160 def set_as_activebeam(self):
1150 """
1161 """
1151 This function set this beam as the active beam of its ABS Configuration.
1162 This function set this beam as the active beam of its ABS Configuration.
1152 """
1163 """
1153 self.abs_conf.active_beam = json.dumps({'active_beam': self.id})
1164 self.abs_conf.active_beam = json.dumps({'active_beam': self.id})
1154 self.abs_conf.save()
1165 self.abs_conf.save()
1155
1166
1156 return
1167 return
1157
1168
1158
1169
1159 @property
1170 @property
1160 def get_upvalues(self):
1171 def get_upvalues(self):
1161 """
1172 """
1162 This function reads antenna pattern and show the up-value of one abs module
1173 This function reads antenna pattern and show the up-value of one abs module
1163 """
1174 """
1164
1175
1165 data = ast.literal_eval(self.antenna)
1176 data = ast.literal_eval(self.antenna)
1166 up_data = data['antenna_up']
1177 up_data = data['antenna_up']
1167
1178
1168 up_values = []
1179 up_values = []
1169 for data in up_data:
1180 for data in up_data:
1170 for i in range(0,8):
1181 for i in range(0,8):
1171 up_values.append(data[i])
1182 up_values.append(data[i])
1172
1183
1173 return up_values
1184 return up_values
1174
1185
1175 @property
1186 @property
1176 def antenna_upvalues(self):
1187 def antenna_upvalues(self):
1177 """
1188 """
1178 This function reads antenna pattern and show the up - values of one abs beam
1189 This function reads antenna pattern and show the up - values of one abs beam
1179 in a particular order
1190 in a particular order
1180 """
1191 """
1181 data = ast.literal_eval(self.antenna)
1192 data = ast.literal_eval(self.antenna)
1182 up_data = data['antenna_up']
1193 up_data = data['antenna_up']
1183
1194
1184 return up_data
1195 return up_data
1185
1196
1186 @property
1197 @property
1187 def antenna_downvalues(self):
1198 def antenna_downvalues(self):
1188 """
1199 """
1189 This function reads antenna pattern and show the down - values of one abs beam
1200 This function reads antenna pattern and show the down - values of one abs beam
1190 in a particular order
1201 in a particular order
1191 """
1202 """
1192 data = ast.literal_eval(self.antenna)
1203 data = ast.literal_eval(self.antenna)
1193 down_data = data['antenna_down']
1204 down_data = data['antenna_down']
1194
1205
1195 return down_data
1206 return down_data
1196
1207
1197 @property
1208 @property
1198 def get_downvalues(self):
1209 def get_downvalues(self):
1199 """
1210 """
1200 This function reads antenna pattern and show the down-value of one abs module
1211 This function reads antenna pattern and show the down-value of one abs module
1201 """
1212 """
1202
1213
1203 data = ast.literal_eval(self.antenna)
1214 data = ast.literal_eval(self.antenna)
1204 down_data = data['antenna_down']
1215 down_data = data['antenna_down']
1205
1216
1206 down_values = []
1217 down_values = []
1207 for data in down_data:
1218 for data in down_data:
1208 for i in range(0,8):
1219 for i in range(0,8):
1209 down_values.append(data[i])
1220 down_values.append(data[i])
1210
1221
1211 return down_values
1222 return down_values
1212
1223
1213 @property
1224 @property
1214 def get_up_ues(self):
1225 def get_up_ues(self):
1215 """
1226 """
1216 This function shows the up-ues-value of one beam
1227 This function shows the up-ues-value of one beam
1217 """
1228 """
1218 data = ast.literal_eval(self.ues)
1229 data = ast.literal_eval(self.ues)
1219 up_ues = data['up']
1230 up_ues = data['up']
1220
1231
1221 return up_ues
1232 return up_ues
1222
1233
1223 @property
1234 @property
1224 def get_down_ues(self):
1235 def get_down_ues(self):
1225 """
1236 """
1226 This function shows the down-ues-value of one beam
1237 This function shows the down-ues-value of one beam
1227 """
1238 """
1228 data = ast.literal_eval(self.ues)
1239 data = ast.literal_eval(self.ues)
1229 down_ues = data['down']
1240 down_ues = data['down']
1230
1241
1231 return down_ues
1242 return down_ues
1232
1243
1233 @property
1244 @property
1234 def get_up_onlyrx(self):
1245 def get_up_onlyrx(self):
1235 """
1246 """
1236 This function shows the up-onlyrx-value of one beam
1247 This function shows the up-onlyrx-value of one beam
1237 """
1248 """
1238 data = json.loads(self.only_rx)
1249 data = json.loads(self.only_rx)
1239 up_onlyrx = data['up']
1250 up_onlyrx = data['up']
1240
1251
1241 return up_onlyrx
1252 return up_onlyrx
1242
1253
1243 @property
1254 @property
1244 def get_down_onlyrx(self):
1255 def get_down_onlyrx(self):
1245 """
1256 """
1246 This function shows the down-onlyrx-value of one beam
1257 This function shows the down-onlyrx-value of one beam
1247 """
1258 """
1248 data = json.loads(self.only_rx)
1259 data = json.loads(self.only_rx)
1249 down_onlyrx = data['down']
1260 down_onlyrx = data['down']
1250
1261
1251 return down_onlyrx
1262 return down_onlyrx
1252
1263
1253 @property
1264 @property
1254 def get_tx(self):
1265 def get_tx(self):
1255 """
1266 """
1256 This function shows the tx-values of one beam
1267 This function shows the tx-values of one beam
1257 """
1268 """
1258 data = json.loads(self.tx)
1269 data = json.loads(self.tx)
1259
1270
1260 return data
1271 return data
1261
1272
1262 @property
1273 @property
1263 def get_uptx(self):
1274 def get_uptx(self):
1264 """
1275 """
1265 This function shows the up-tx-values of one beam
1276 This function shows the up-tx-values of one beam
1266 """
1277 """
1267 data = json.loads(self.tx)
1278 data = json.loads(self.tx)
1268 up_data = data['up']
1279 up_data = data['up']
1269
1280
1270 up_values = []
1281 up_values = []
1271 for data in up_data:
1282 for data in up_data:
1272 for i in range(0,8):
1283 for i in range(0,8):
1273 up_values.append(data[i])
1284 up_values.append(data[i])
1274
1285
1275 return up_values
1286 return up_values
1276
1287
1277 @property
1288 @property
1278 def get_downtx(self):
1289 def get_downtx(self):
1279 """
1290 """
1280 This function shows the down-tx-values of one beam
1291 This function shows the down-tx-values of one beam
1281 """
1292 """
1282 data = json.loads(self.tx)
1293 data = json.loads(self.tx)
1283 down_data = data['down']
1294 down_data = data['down']
1284
1295
1285 down_values = []
1296 down_values = []
1286 for data in down_data:
1297 for data in down_data:
1287 for i in range(0,8):
1298 for i in range(0,8):
1288 down_values.append(data[i])
1299 down_values.append(data[i])
1289
1300
1290 return down_values
1301 return down_values
1291
1302
1292
1303
1293
1304
1294 @property
1305 @property
1295 def get_rx(self):
1306 def get_rx(self):
1296 """
1307 """
1297 This function shows the rx-values of one beam
1308 This function shows the rx-values of one beam
1298 """
1309 """
1299 data = json.loads(self.rx)
1310 data = json.loads(self.rx)
1300
1311
1301 return data
1312 return data
1302
1313
1303 @property
1314 @property
1304 def get_uprx(self):
1315 def get_uprx(self):
1305 """
1316 """
1306 This function shows the up-rx-values of one beam
1317 This function shows the up-rx-values of one beam
1307 """
1318 """
1308 data = json.loads(self.rx)
1319 data = json.loads(self.rx)
1309 up_data = data['up']
1320 up_data = data['up']
1310
1321
1311 up_values = []
1322 up_values = []
1312 for data in up_data:
1323 for data in up_data:
1313 for i in range(0,8):
1324 for i in range(0,8):
1314 up_values.append(data[i])
1325 up_values.append(data[i])
1315
1326
1316 return up_values
1327 return up_values
1317
1328
1318 @property
1329 @property
1319 def get_downrx(self):
1330 def get_downrx(self):
1320 """
1331 """
1321 This function shows the down-rx-values of one beam
1332 This function shows the down-rx-values of one beam
1322 """
1333 """
1323 data = json.loads(self.rx)
1334 data = json.loads(self.rx)
1324 down_data = data['down']
1335 down_data = data['down']
1325
1336
1326 down_values = []
1337 down_values = []
1327 for data in down_data:
1338 for data in down_data:
1328 for i in range(0,8):
1339 for i in range(0,8):
1329 down_values.append(data[i])
1340 down_values.append(data[i])
1330
1341
1331 return down_values
1342 return down_values
@@ -1,54 +1,63
1 from __future__ import absolute_import
1 from __future__ import absolute_import
2
2
3 from apps.main.models import Configuration
3 from apps.main.models import Configuration
4 from .models import ABSBeam
4 from .models import ABSBeam
5 import json
5 import json
6 from datetime import timedelta, datetime
6 from datetime import timedelta, datetime
7 from celery.task import task
7 from celery.task import task
8
8
9 @task(name='task_change_beam')
9 @task(name='task_change_beam')
10 def task_change_beam(id_conf):
10 def task_change_beam(id_conf):
11
11
12 abs_conf = Configuration.objects.get(pk=id_conf)
12 abs_conf = Configuration.objects.get(pk=id_conf)
13 beams_list = ABSBeam.objects.filter(abs_conf=abs_conf)
13 beams_list = ABSBeam.objects.filter(abs_conf=abs_conf)
14 active_beam = json.loads(abs_conf.active_beam)
14 active_beam = json.loads(abs_conf.active_beam)
15
15
16 run_every = timedelta(seconds=abs_conf.operation_value)
16 run_every = timedelta(seconds=abs_conf.operation_value)
17 now = datetime.utcnow()
17 now = datetime.utcnow()
18 date = now + run_every
18 date = now + run_every
19
19
20 if abs_conf.device.status != 3:
20 if abs_conf.device.status != 3:
21 return abs_conf.device.status
21 return abs_conf.device.status
22
22
23 if abs_conf.operation_mode == 0: #Manual Mode
23 if abs_conf.operation_mode == 0: #Manual Mode
24 return 1
24 return 1
25
25
26 if active_beam:
26 if active_beam:
27 current_beam = ABSBeam.objects.get(pk=active_beam['active_beam'])
27 current_beam = ABSBeam.objects.get(pk=active_beam['active_beam'])
28 i=0
28 i=0
29 for beam in beams_list:
29 for beam in beams_list:
30 if beam == current_beam:
30 if beam == current_beam:
31 i+=1
31 i+=1
32 break
32 break
33 i+=1
33 i+=1
34
34
35 if i < len(beams_list):
35 if i < len(beams_list):
36 next_beam = beams_list[i]
36 next_beam = beams_list[i]
37 abs_conf.send_beam_num(i+1)
37 abs_conf.send_beam_num(i+1)
38 next_beam.set_as_activebeam()
38 next_beam.set_as_activebeam()
39 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
39 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
40 print next_beam
40 print next_beam
41 else:
41 else:
42 abs_conf.send_beam_num(1)
42 abs_conf.send_beam_num(1)
43 beams_list[0].set_as_activebeam()
43 beams_list[0].set_as_activebeam()
44 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
44 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
45 print beams_list[0]
45 print beams_list[0]
46 i=0
46 i=0
47
47
48 else:
48 else:
49 abs_conf.send_beam_num(1)
49 abs_conf.send_beam_num(1)
50 beams_list[0].set_as_activebeam()
50 beams_list[0].set_as_activebeam()
51 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
51 task = task_change_beam.apply_async((abs_conf.pk,), eta=date)
52
52
53
53
54 return 2
54 return 2
55
56
57 @task(name='status_absdevice')
58 def status_absdevice(id_conf):
59
60 abs_conf = Configuration.objects.get(pk=id_conf)
61 abs_conf.absmodule_status()
62
63 return
@@ -1,542 +1,550
1 {% extends "dev_conf.html" %}
1 {% extends "dev_conf.html" %}
2
2
3 {% load static %}
3 {% load static %}
4 {% load bootstrap3 %}
4 {% load bootstrap3 %}
5 {% load main_tags %}
5 {% load main_tags %}
6
6
7 {% block extra-menu-actions %}
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>
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 %}
9 {% endblock %}
10
10
11 {% block extra-content %}
11 {% block extra-content %}
12 <style>
12 <style>
13
13
14 .abs {
14 .abs {
15 border: 2px solid #00334d;
15 border: 2px solid #00334d;
16 vertical-align: center;
16 vertical-align: center;
17 display: inline-block;
17 display: inline-block;
18 }
18 }
19 .abs tr:nth-child(1){
19 .abs tr:nth-child(1){
20 border-bottom: 1px dashed #00334d;
20 border-bottom: 1px dashed #00334d;
21 }
21 }
22 .abs tr{
22 .abs tr{
23 border-bottom: 0px solid #00334d;
23 border-bottom: 0px solid #00334d;
24 }
24 }
25 .abs td {
25 .abs td {
26 border-right: 1px dashed #00334d;
26 border-right: 1px dashed #00334d;
27 text-align: center;
27 text-align: center;
28 padding: 5px;
28 padding: 5px;
29 }
29 }
30
30
31
31
32 .legend {
32 .legend {
33 margin-left: 15px;
33 margin-left: 15px;
34 display: inline-block;
34 display: inline-block;
35 border: 2px solid #00334d;
35 border: 2px solid #00334d;
36 vertical-align: top;
36 vertical-align: top;
37 }
37 }
38 .legend th{
38 .legend th{
39 border-bottom: 1px dashed #00334d;
39 border-bottom: 1px dashed #00334d;
40 font-weight: bold;
40 font-weight: bold;
41 vertical-align: center;
41 vertical-align: center;
42 text-align: center;
42 text-align: center;
43 }
43 }
44 .legend td {
44 .legend td {
45 padding: 2px;
45 padding: 2px;
46 text-align: center;
46 text-align: center;
47 }
47 }
48
48
49
49
50 .north {
50 .north {
51 border: 2px solid #00334d;
51 border: 2px solid #00334d;
52 vertical-align: center;
52 vertical-align: center;
53 font-weight: bold;
53 font-weight: bold;
54 }
54 }
55 .north tr{
55 .north tr{
56 border: 1px solid #ffffff;
56 border: 1px solid #ffffff;
57
57
58 }
58 }
59 .north td{
59 .north td{
60 border: 2px solid #e2e2e7;
60 border: 2px solid #e2e2e7;
61 text-align: center;
61 text-align: center;
62 padding: 1px 15px 1px 15px;
62 padding: 1px 15px 1px 15px;
63 }
63 }
64 .north tr:nth-child(even) td:nth-child(n){
64 .north tr:nth-child(even) td:nth-child(n){
65 border-bottom: 12px solid #e2e2e7;
65 border-bottom: 12px solid #e2e2e7;
66 }
66 }
67 .north td:nth-child(n) {
67 .north td:nth-child(n) {
68 border-right: 12px solid #e2e2e7;
68 border-right: 12px solid #e2e2e7;
69 }
69 }
70 .north td:nth-last-child(4n+1) {
70 .north td:nth-last-child(4n+1) {
71 border-right: 2px solid #e2e2e7;
71 border-right: 2px solid #e2e2e7;
72 }
72 }
73 .north tr:nth-last-child(1) td:nth-child(n){
73 .north tr:nth-last-child(1) td:nth-child(n){
74 border-bottom: 3px solid #e2e2e7;
74 border-bottom: 3px solid #e2e2e7;
75 }
75 }
76
76
77
77
78
78
79 .east {
79 .east {
80 border: 2px solid #00334d;
80 border: 2px solid #00334d;
81 vertical-align: center;
81 vertical-align: center;
82 font-weight: bold;
82 font-weight: bold;
83 }
83 }
84 .east tr{
84 .east tr{
85 border: 1px solid #ffffff;
85 border: 1px solid #ffffff;
86 }
86 }
87 .east td{
87 .east td{
88 border: 2px solid #e2e2e7;
88 border: 2px solid #e2e2e7;
89 text-align: center;
89 text-align: center;
90 padding: 1px 15px 1px 15px;
90 padding: 1px 15px 1px 15px;
91 }
91 }
92 .east tr:nth-child(even) td:nth-child(n){
92 .east tr:nth-child(even) td:nth-child(n){
93 border-bottom: 12px solid #e2e2e7;
93 border-bottom: 12px solid #e2e2e7;
94 }
94 }
95 .east td:nth-child(n) {
95 .east td:nth-child(n) {
96 border-right: 12px solid #e2e2e7;
96 border-right: 12px solid #e2e2e7;
97 }
97 }
98 .east td:nth-last-child(4n+1) {
98 .east td:nth-last-child(4n+1) {
99 border-right: 2px solid #e2e2e7;
99 border-right: 2px solid #e2e2e7;
100 }
100 }
101 .east tr:nth-last-child(1) td:nth-child(n){
101 .east tr:nth-last-child(1) td:nth-child(n){
102 border-bottom: 3px solid #e2e2e7;
102 border-bottom: 3px solid #e2e2e7;
103 }
103 }
104
104
105
105
106
106
107
107
108 .west {
108 .west {
109 border: 2px solid #00334d;
109 border: 2px solid #00334d;
110 vertical-align: center;
110 vertical-align: center;
111 font-weight: bold;
111 font-weight: bold;
112 }
112 }
113 .west tr{
113 .west tr{
114 border: 1px solid #ffffff;
114 border: 1px solid #ffffff;
115 }
115 }
116 .west td{
116 .west td{
117 border: 2px solid #e2e2e7;
117 border: 2px solid #e2e2e7;
118 text-align: center;
118 text-align: center;
119 padding: 1px 15px 1px 15px;
119 padding: 1px 15px 1px 15px;
120 }
120 }
121 .west tr:nth-child(even) td:nth-child(n){
121 .west tr:nth-child(even) td:nth-child(n){
122 border-bottom: 12px solid #e2e2e7;
122 border-bottom: 12px solid #e2e2e7;
123 }
123 }
124 .west td:nth-child(n) {
124 .west td:nth-child(n) {
125 border-right: 12px solid #e2e2e7;
125 border-right: 12px solid #e2e2e7;
126 }
126 }
127 .west td:nth-last-child(4n+1) {
127 .west td:nth-last-child(4n+1) {
128 border-right: 2px solid #e2e2e7;
128 border-right: 2px solid #e2e2e7;
129 }
129 }
130 .west tr:nth-last-child(1) td:nth-child(n){
130 .west tr:nth-last-child(1) td:nth-child(n){
131 border-bottom: 3px solid #e2e2e7;
131 border-bottom: 3px solid #e2e2e7;
132 }
132 }
133
133
134
134
135
135
136
136
137 .south {
137 .south {
138 border: 2px solid #00334d;
138 border: 2px solid #00334d;
139 vertical-align: center;
139 vertical-align: center;
140 font-weight: bold;
140 font-weight: bold;
141 }
141 }
142 .south tr{
142 .south tr{
143 border: 1px solid #ffffff;
143 border: 1px solid #ffffff;
144 }
144 }
145 .south td{
145 .south td{
146 border: 2px solid #e2e2e7;
146 border: 2px solid #e2e2e7;
147 text-align: center;
147 text-align: center;
148 padding: 1px 15px 1px 15px;
148 padding: 1px 15px 1px 15px;
149 }
149 }
150 .south tr:nth-child(even) td:nth-child(n){
150 .south tr:nth-child(even) td:nth-child(n){
151 border-bottom: 12px solid #e2e2e7;
151 border-bottom: 12px solid #e2e2e7;
152 }
152 }
153 .south td:nth-child(n) {
153 .south td:nth-child(n) {
154 border-right: 12px solid #e2e2e7;
154 border-right: 12px solid #e2e2e7;
155 }
155 }
156 .south td:nth-last-child(4n+1) {
156 .south td:nth-last-child(4n+1) {
157 border-right: 2px solid #e2e2e7;
157 border-right: 2px solid #e2e2e7;
158 }
158 }
159 .south tr:nth-last-child(1) td:nth-child(n){
159 .south tr:nth-last-child(1) td:nth-child(n){
160 border-bottom: 3px solid #e2e2e7;
160 border-bottom: 3px solid #e2e2e7;
161 }
161 }
162
162
163
163
164
164
165
165
166 </style>
166 </style>
167
167
168 {% if status_request %}
169 <img id="loading" src="{% static 'images/loader.gif' %}">
170 {% endif %}
171
168
172
169 {% if beams %}
173 {% if beams %}
170
174
171
175
172
176
173 <h4>Beams:</h4>
177 <h4>Beams:</h4>
174 <div class="container">
178 <div class="container">
175 <ul class="nav nav-pills">
179 <ul class="nav nav-pills">
176 {% for beam in beams %}
180 {% for beam in beams %}
177 <li {% if active_beam.id == beam.id %} class="active" {% endif %} >
181 <li {% if active_beam.id == beam.id %} class="active" {% endif %} >
178 <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a>
182 <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a>
179 </li>
183 </li>
180 {% endfor %}
184 {% endfor %}
181 </ul>
185 </ul>
182
186
183
187
184 <div class="tab-content">
188 <div class="tab-content">
185 <div id="home" class="tab-pane fade in active">
189 <div id="home" class="tab-pane fade in active">
186 <!---->
190 <!---->
187 {% if active_beam %}
191 {% if active_beam %}
188 <h3>Active Beam: {{active_beam.name}}</h3>
192 <h3>Active Beam: {{active_beam.name}}</h3>
189
193
190 <table id="abs_pattern" class="abs">
194 <table id="abs_pattern" class="abs">
191 <tr>
195 <tr>
192 <td> <b>North Quarter</b>
196 <td> <b>North Quarter</b>
193 <table class="north ">
197 <table class="north ">
194 <tr>
198 <tr>
195 <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>
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>
196 </tr>
200 </tr>
197 <tr>
201 <tr>
198 <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>
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>
199 </tr>
203 </tr>
200 <tr>
204 <tr>
201 <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>
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>
202 </tr>
206 </tr>
203 <tr>
207 <tr>
204 <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>
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>
205 </tr>
209 </tr>
206 <tr>
210 <tr>
207 <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>
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>
208 </tr>
212 </tr>
209 <tr>
213 <tr>
210 <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>
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>
211 </tr>
215 </tr>
212 <tr>
216 <tr>
213 <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>
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>
214 </tr>
218 </tr>
215 <tr>
219 <tr>
216 <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>
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>
217 </tr>
221 </tr>
218 </table>
222 </table>
219 </td>
223 </td>
220 <td> <b>East Quarter</b>
224 <td> <b>East Quarter</b>
221 <table class="east ">
225 <table class="east ">
222 <tr>
226 <tr>
223 <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>
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>
224 </tr>
228 </tr>
225 <tr>
229 <tr>
226 <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>
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>
227 </tr>
231 </tr>
228 <tr>
232 <tr>
229 <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>
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>
230 </tr>
234 </tr>
231 <tr>
235 <tr>
232 <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>
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>
233 </tr>
237 </tr>
234 <tr>
238 <tr>
235 <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>
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>
236 </tr>
240 </tr>
237 <tr>
241 <tr>
238 <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>
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>
239 </tr>
243 </tr>
240 <tr>
244 <tr>
241 <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>
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>
242 </tr>
246 </tr>
243 <tr>
247 <tr>
244 <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>
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>
245 </tr>
249 </tr>
246 </table>
250 </table>
247 </td>
251 </td>
248 </tr>
252 </tr>
249 <tr>
253 <tr>
250 <td> <b>West Quarter</b>
254 <td> <b>West Quarter</b>
251 <table class="west ">
255 <table class="west ">
252 <tr>
256 <tr>
253 <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>
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>
254 </tr>
258 </tr>
255 <tr>
259 <tr>
256 <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>
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>
257 </tr>
261 </tr>
258 <tr>
262 <tr>
259 <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>
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>
260 </tr>
264 </tr>
261 <tr>
265 <tr>
262 <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>
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>
263 </tr>
267 </tr>
264 <tr>
268 <tr>
265 <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>
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>
266 </tr>
270 </tr>
267 <tr>
271 <tr>
268 <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>
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>
269 </tr>
273 </tr>
270 <tr>
274 <tr>
271 <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>
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>
272 </tr>
276 </tr>
273 <tr>
277 <tr>
274 <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>
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>
275 </tr>
279 </tr>
276 </table>
280 </table>
277 </td>
281 </td>
278 <td> <b>South Quarter</b>
282 <td> <b>South Quarter</b>
279 <table class="south ">
283 <table class="south ">
280 <tr>
284 <tr>
281 <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>
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>
282 </tr>
286 </tr>
283 <tr>
287 <tr>
284 <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>
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>
285 </tr>
289 </tr>
286 <tr>
290 <tr>
287 <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>
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>
288 </tr>
292 </tr>
289 <tr>
293 <tr>
290 <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>
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>
291 </tr>
295 </tr>
292 <tr>
296 <tr>
293 <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>
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>
294 </tr>
298 </tr>
295 <tr>
299 <tr>
296 <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>
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>
297 </tr>
301 </tr>
298 <tr>
302 <tr>
299 <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>
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>
300 </tr>
304 </tr>
301 <tr>
305 <tr>
302 <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>
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>
303 </tr>
307 </tr>
304 </table>
308 </table>
305 </td>
309 </td>
306 </tr>
310 </tr>
307 </table>
311 </table>
308
312
309
313
310
314
311 <table class="legend">
315 <table class="legend">
312 <tr>
316 <tr>
313 <th colspan="2">Legend</th>
317 <th colspan="2">Legend</th>
314 </tr>
318 </tr>
315 <tr>
319 <tr>
316 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
320 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
317 </tr>
321 </tr>
318 <tr>
322 <tr>
319 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
323 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
320 </tr>
324 </tr>
321 <tr>
325 <tr>
322 <td class="text-success"><i>GREEN</i></td><td>Running </td>
326 <td class="text-success"><i>GREEN</i></td><td>Running </td>
323 </tr>
327 </tr>
324 <!--
328 <!--
325 <tr>
329 <tr>
326 <td colspan="2">
330 <td colspan="2">
327 <button style="margin: 10px;" id="sendbeam" type="button" class="btn btn-default">
331 <button style="margin: 10px;" id="sendbeam" type="button" class="btn btn-default">
328 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
332 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
329 Change Beam</button>
333 Change Beam</button>
330 </td>
334 </td>
331 </tr>
335 </tr>
332 -->
336 -->
333 </table>
337 </table>
334
338
335
339
336
340
337
341
338 {% else %}
342 {% else %}
339 <p><i>This ABS Configuration does not have a current active ABS Beam...<br>
343 <p><i>This ABS Configuration does not have a current active ABS Beam...<br>
340 Please send Beam List to ABS modules. </i></p>
344 Please send Beam List to ABS modules. </i></p>
341
345
342 {% endif %}
346 {% endif %}
343
347
344
348
345 </div>
349 </div>
346
350
347
351
348
352
349 {% for beam in beams %}
353 {% for beam in beams %}
350 <div id="menu{{forloop.counter}}" class="tab-pane fade">
354 <div id="menu{{forloop.counter}}" class="tab-pane fade">
351 <h3>{%if active_beam.id == beam.id%}Active Beam: {%endif%}{{beam.name}}</h3>
355 <h3>{%if active_beam.id == beam.id%}Active Beam: {%endif%}{{beam.name}}</h3>
352 <!--<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>-->
356 <!--<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>-->
353 <table id="abs_pattern{{forloop.counter}}" class="abs">
357 <table id="abs_pattern{{forloop.counter}}" class="abs">
354 <tr>
358 <tr>
355 <td> <b>North Quarter</b>
359 <td> <b>North Quarter</b>
356 <table class="north ">
360 <table class="north ">
357 <tr>
361 <tr>
358 <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>
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>
359 </tr>
363 </tr>
360 <tr>
364 <tr>
361 <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>
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>
362 </tr>
366 </tr>
363 <tr>
367 <tr>
364 <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>
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>
365 </tr>
369 </tr>
366 <tr>
370 <tr>
367 <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>
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>
368 </tr>
372 </tr>
369 <tr>
373 <tr>
370 <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>
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>
371 </tr>
375 </tr>
372 <tr>
376 <tr>
373 <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>
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>
374 </tr>
378 </tr>
375 <tr>
379 <tr>
376 <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>
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>
377 </tr>
381 </tr>
378 <tr>
382 <tr>
379 <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>
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>
380 </tr>
384 </tr>
381 </table>
385 </table>
382 </td>
386 </td>
383 <td> <b>East Quarter</b>
387 <td> <b>East Quarter</b>
384 <table class="east ">
388 <table class="east ">
385 <tr>
389 <tr>
386 <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>
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>
387 </tr>
391 </tr>
388 <tr>
392 <tr>
389 <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>
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>
390 </tr>
394 </tr>
391 <tr>
395 <tr>
392 <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>
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>
393 </tr>
397 </tr>
394 <tr>
398 <tr>
395 <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>
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>
396 </tr>
400 </tr>
397 <tr>
401 <tr>
398 <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>
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>
399 </tr>
403 </tr>
400 <tr>
404 <tr>
401 <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>
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>
402 </tr>
406 </tr>
403 <tr>
407 <tr>
404 <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>
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>
405 </tr>
409 </tr>
406 <tr>
410 <tr>
407 <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>
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>
408 </tr>
412 </tr>
409 </table>
413 </table>
410 </td>
414 </td>
411 </tr>
415 </tr>
412 <tr>
416 <tr>
413 <td> <b>West Quarter</b>
417 <td> <b>West Quarter</b>
414 <table class="west ">
418 <table class="west ">
415 <tr>
419 <tr>
416 <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>
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>
417 </tr>
421 </tr>
418 <tr>
422 <tr>
419 <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>
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>
420 </tr>
424 </tr>
421 <tr>
425 <tr>
422 <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>
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>
423 </tr>
427 </tr>
424 <tr>
428 <tr>
425 <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>
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>
426 </tr>
430 </tr>
427 <tr>
431 <tr>
428 <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>
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>
429 </tr>
433 </tr>
430 <tr>
434 <tr>
431 <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>
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>
432 </tr>
436 </tr>
433 <tr>
437 <tr>
434 <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>
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>
435 </tr>
439 </tr>
436 <tr>
440 <tr>
437 <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>
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>
438 </tr>
442 </tr>
439 </table>
443 </table>
440 </td>
444 </td>
441 <td> <b>South Quarter</b>
445 <td> <b>South Quarter</b>
442 <table class="south ">
446 <table class="south ">
443 <tr>
447 <tr>
444 <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>
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>
445 </tr>
449 </tr>
446 <tr>
450 <tr>
447 <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>
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>
448 </tr>
452 </tr>
449 <tr>
453 <tr>
450 <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>
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>
451 </tr>
455 </tr>
452 <tr>
456 <tr>
453 <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>
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>
454 </tr>
458 </tr>
455 <tr>
459 <tr>
456 <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>
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>
457 </tr>
461 </tr>
458 <tr>
462 <tr>
459 <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>
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>
460 </tr>
464 </tr>
461 <tr>
465 <tr>
462 <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>
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>
463 </tr>
467 </tr>
464 <tr>
468 <tr>
465 <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>
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>
466 </tr>
470 </tr>
467 </table>
471 </table>
468 </td>
472 </td>
469 </tr>
473 </tr>
470 </table>
474 </table>
471
475
472 {% if active_beam.id != beam.id %}
476 {% if active_beam.id != beam.id %}
473 <div style="vertical-align: top; display:inline-block;">
477 <div style="vertical-align: top; display:inline-block;">
474 <button style="" id="send_beam{{forloop.counter}}" type="button" class="btn btn-default">
478 <button style="" id="send_beam{{forloop.counter}}" type="button" class="btn btn-default">
475 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
479 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
476 Change Beam</button>
480 Change Beam</button>
477 </div>
481 </div>
478 {% endif %}
482 {% endif %}
479
483
480
484
481
485
482
486
483 {% if active_beam %}
487 {% if active_beam %}
484 {% if active_beam.id == beam.id %}
488 {% if active_beam.id == beam.id %}
485 <table class="legend">
489 <table class="legend">
486 <tr>
490 <tr>
487 <th colspan="2">Legend</th>
491 <th colspan="2">Legend</th>
488 </tr>
492 </tr>
489 <tr>
493 <tr>
490 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
494 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
491 </tr>
495 </tr>
492 <tr>
496 <tr>
493 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
497 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
494 </tr>
498 </tr>
495 <tr>
499 <tr>
496 <td class="text-success"><i>GREEN</i></td><td>Running
500 <td class="text-success"><i>GREEN</i></td><td>Running
497 </td>
501 </td>
498 </tr>
502 </tr>
499 </table>
503 </table>
500
504
501 {% endif %}
505 {% endif %}
502 {% endif %}
506 {% endif %}
503
507
504
508
505 </div>
509 </div>
506
510
507
511
508 {% endfor %}
512 {% endfor %}
509
513
510
514
511
515
512 </div>
516 </div>
513 </div>
517 </div>
514
518
515
519
516 {% else %}
520 {% else %}
517 <p style="color:#b4bcc2; margin-left: 5%;"><i>No Beams...</i></p>
521 <p style="color:#b4bcc2; margin-left: 5%;"><i>No Beams...</i></p>
518 {% endif %}
522 {% endif %}
519
523
520 {% endblock extra-content %}
524 {% endblock extra-content %}
521
525
522
526
523
527
524 {% block extra-js%}
528 {% block extra-js%}
525 <script>
529 <script>
526 $(document).ready(function() {
530 $(document).ready(function() {
527
531
528 {% for beam in beams %}
532 {% for beam in beams %}
529
533
530 {% if dev_conf.operation_mode == 1 %}
534 {% if dev_conf.operation_mode == 1 %}
531 $("#send_beam{{forloop.counter}}").prop('disabled', true)
535 $("#send_beam{{forloop.counter}}").prop('disabled', true)
532 {% else %}
536 {% else %}
533 $("#send_beam{{forloop.counter}}").click(function() {
537 $("#send_beam{{forloop.counter}}").click(function() {
534 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
538 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
535 });
539 });
536 {% endif %}
540 {% endif %}
537
541
538 {% endfor %}
542 {% endfor %}
539
543
544 {% if status_request %}
545 setTimeout("location.href = '{% url 'url_abs_conf' dev_conf.id %}'",53000);
546 {% endif %}
547
540 });
548 });
541 </script>
549 </script>
542 {% endblock %}
550 {% endblock %}
@@ -1,16 +1,17
1 from django.conf.urls import url
1 from django.conf.urls import url
2
2
3 from apps.abs import views
3 from apps.abs import views
4
4
5 urlpatterns = (
5 urlpatterns = (
6 url(r'^(?P<id_conf>-?\d+)/$', views.abs_conf, name='url_abs_conf'),
6 url(r'^(?P<id_conf>-?\d+)/$', views.abs_conf, name='url_abs_conf'),
7 url(r'^(?P<id_conf>-?\d+)/edit/$', views.abs_conf_edit, name='url_edit_abs_conf'),
7 url(r'^(?P<id_conf>-?\d+)/edit/$', views.abs_conf_edit, name='url_edit_abs_conf'),
8 url(r'^(?P<id_conf>-?\d+)/import/$', views.import_file, name='url_import_abs_conf'),
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+)/change_beam/(?P<id_beam>-?\d+)/$', views.send_beam, name='url_send_beam'),
10 url(r'^(?P<id_conf>-?\d+)/change_beam/(?P<id_beam>-?\d+)/$', views.send_beam, name='url_send_beam'),
10 url(r'^(?P<id_conf>-?\d+)/plot/$', views.plot_patterns, name='url_plot_abs_patterns'),
11 url(r'^(?P<id_conf>-?\d+)/plot/$', views.plot_patterns, name='url_plot_abs_patterns'),
11 url(r'^(?P<id_conf>-?\d+)/plot/(?P<id_beam>-?\d+)/$', views.plot_patterns, name='url_plot_abs_patterns'),
12 url(r'^(?P<id_conf>-?\d+)/plot/(?P<id_beam>-?\d+)/$', views.plot_patterns, name='url_plot_abs_patterns'),
12 url(r'^(?P<id_conf>-?\d+)/plot/(?P<id_beam>-?\d+)/(?P<antenna>[\w\-]+)/pattern.png$', views.plot_pattern, name='url_plot_beam'),
13 url(r'^(?P<id_conf>-?\d+)/plot/(?P<id_beam>-?\d+)/(?P<antenna>[\w\-]+)/pattern.png$', views.plot_pattern, name='url_plot_beam'),
13 url(r'^(?P<id_conf>-?\d+)/add_beam/$', views.add_beam, name='url_add_abs_beam'),
14 url(r'^(?P<id_conf>-?\d+)/add_beam/$', views.add_beam, name='url_add_abs_beam'),
14 url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', views.remove_beam, name='url_remove_abs_beam'),
15 url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/delete/$', views.remove_beam, name='url_remove_abs_beam'),
15 url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', views.edit_beam, name='url_edit_abs_beam'),
16 url(r'^(?P<id_conf>-?\d+)/beam/(?P<id_beam>-?\d+)/edit/$', views.edit_beam, name='url_edit_abs_beam'),
16 )
17 )
@@ -1,430 +1,440
1 from django.shortcuts import render_to_response
1 from django.shortcuts import render_to_response
2 from django.template import RequestContext
2 from django.template import RequestContext
3 from django.shortcuts import redirect, render, get_object_or_404
3 from django.shortcuts import redirect, render, get_object_or_404
4 from django.contrib import messages
4 from django.contrib import messages
5 from django.conf import settings
5 from django.conf import settings
6 from django.http import HttpResponse
6 from django.http import HttpResponse
7 from django.core.urlresolvers import reverse
7 from django.core.urlresolvers import reverse
8
8
9 from datetime import datetime
9 from datetime import datetime
10 from time import sleep
10 from time import sleep
11 import os
11 import os
12
12
13 from apps.main.models import Device, Configuration, Experiment
13 from apps.main.models import Device, Configuration, Experiment
14 from apps.main.views import sidebar
14 from apps.main.views import sidebar
15
15
16 from .models import ABSConfiguration, ABSBeam
16 from .models import ABSConfiguration, ABSBeam
17 from .forms import ABSConfigurationForm, ABSBeamEditForm, ABSBeamAddForm, ABSImportForm
17 from .forms import ABSConfigurationForm, ABSBeamEditForm, ABSBeamAddForm, ABSImportForm
18
18
19 from .utils.overJroShow import overJroShow
19 from .utils.overJroShow import overJroShow
20 from .utils.OverJRO import OverJRO
20 from .utils.OverJRO import OverJRO
21 # Create your views here.
21 # Create your views here.
22 import json, ast
22 import json, ast
23
23
24
24
25 def get_values_from_form(form_data):
25 def get_values_from_form(form_data):
26
26
27 sublistup = []
27 sublistup = []
28 sublistdown = []
28 sublistdown = []
29 subtxlistup = []
29 subtxlistup = []
30 subtxlistdown = []
30 subtxlistdown = []
31 subrxlistup = []
31 subrxlistup = []
32 subrxlistdown = []
32 subrxlistdown = []
33
33
34 up_values_list = []
34 up_values_list = []
35 down_values_list = []
35 down_values_list = []
36 up_txvalues_list = []
36 up_txvalues_list = []
37 down_txvalues_list = []
37 down_txvalues_list = []
38 up_rxvalues_list = []
38 up_rxvalues_list = []
39 down_rxvalues_list = []
39 down_rxvalues_list = []
40
40
41 values_list = {}
41 values_list = {}
42 cont = 1
42 cont = 1
43
43
44 for i in range(1,65):
44 for i in range(1,65):
45 x = float(form_data['abs_up'+str(i)])
45 x = float(form_data['abs_up'+str(i)])
46 y = float(form_data['abs_down'+str(i)])
46 y = float(form_data['abs_down'+str(i)])
47 sublistup.append(x)
47 sublistup.append(x)
48 sublistdown.append(y)
48 sublistdown.append(y)
49
49
50 if str(i) in form_data.getlist('uptx_checks'):
50 if str(i) in form_data.getlist('uptx_checks'):
51 subtxlistup.append(1)
51 subtxlistup.append(1)
52 else:
52 else:
53 subtxlistup.append(0)
53 subtxlistup.append(0)
54 if str(i) in form_data.getlist('downtx_checks'):
54 if str(i) in form_data.getlist('downtx_checks'):
55 subtxlistdown.append(1)
55 subtxlistdown.append(1)
56 else:
56 else:
57 subtxlistdown.append(0)
57 subtxlistdown.append(0)
58
58
59 if str(i) in form_data.getlist('uprx_checks'):
59 if str(i) in form_data.getlist('uprx_checks'):
60 subrxlistup.append(1)
60 subrxlistup.append(1)
61 else:
61 else:
62 subrxlistup.append(0)
62 subrxlistup.append(0)
63 if str(i) in form_data.getlist('downrx_checks'):
63 if str(i) in form_data.getlist('downrx_checks'):
64 subrxlistdown.append(1)
64 subrxlistdown.append(1)
65 else:
65 else:
66 subrxlistdown.append(0)
66 subrxlistdown.append(0)
67
67
68 cont = cont+1
68 cont = cont+1
69
69
70 if cont == 9:
70 if cont == 9:
71 up_values_list.append(sublistup)
71 up_values_list.append(sublistup)
72 down_values_list.append(sublistdown)
72 down_values_list.append(sublistdown)
73 sublistup = []
73 sublistup = []
74 sublistdown = []
74 sublistdown = []
75
75
76 up_txvalues_list.append(subtxlistup)
76 up_txvalues_list.append(subtxlistup)
77 down_txvalues_list.append(subtxlistdown)
77 down_txvalues_list.append(subtxlistdown)
78 subtxlistup = []
78 subtxlistup = []
79 subtxlistdown = []
79 subtxlistdown = []
80 up_rxvalues_list.append(subrxlistup)
80 up_rxvalues_list.append(subrxlistup)
81 down_rxvalues_list.append(subrxlistdown)
81 down_rxvalues_list.append(subrxlistdown)
82 subrxlistup = []
82 subrxlistup = []
83 subrxlistdown = []
83 subrxlistdown = []
84 cont = 1
84 cont = 1
85
85
86
86
87 list_uesup = []
87 list_uesup = []
88 list_uesdown = []
88 list_uesdown = []
89 for i in range(1,5):
89 for i in range(1,5):
90 if form_data['ues_up'+str(i)] == '':
90 if form_data['ues_up'+str(i)] == '':
91 list_uesup.append(0.0)
91 list_uesup.append(0.0)
92 else:
92 else:
93 list_uesup.append(float(form_data['ues_up'+str(i)]))
93 list_uesup.append(float(form_data['ues_up'+str(i)]))
94
94
95 if form_data['ues_down'+str(i)] == '':
95 if form_data['ues_down'+str(i)] == '':
96 list_uesdown.append(0.0)
96 list_uesdown.append(0.0)
97 else:
97 else:
98 list_uesdown.append(float(form_data['ues_down'+str(i)]))
98 list_uesdown.append(float(form_data['ues_down'+str(i)]))
99
99
100 onlyrx_list = form_data.getlist('onlyrx')
100 onlyrx_list = form_data.getlist('onlyrx')
101 only_rx = {}
101 only_rx = {}
102 if '1' in onlyrx_list:
102 if '1' in onlyrx_list:
103 only_rx['up'] = True
103 only_rx['up'] = True
104 else:
104 else:
105 only_rx['up'] = False
105 only_rx['up'] = False
106 if '2' in onlyrx_list:
106 if '2' in onlyrx_list:
107 only_rx['down'] = True
107 only_rx['down'] = True
108 else:
108 else:
109 only_rx['down'] = False
109 only_rx['down'] = False
110
110
111 antenna = {'antenna_up': up_values_list, 'antenna_down': down_values_list}
111 antenna = {'antenna_up': up_values_list, 'antenna_down': down_values_list}
112 tx = {'up': up_txvalues_list, 'down': down_txvalues_list}
112 tx = {'up': up_txvalues_list, 'down': down_txvalues_list}
113 rx = {'up': up_rxvalues_list, 'down': down_rxvalues_list}
113 rx = {'up': up_rxvalues_list, 'down': down_rxvalues_list}
114 ues = {'up': list_uesup, 'down': list_uesdown}
114 ues = {'up': list_uesup, 'down': list_uesdown}
115 name = str(form_data['beam_name'])
115 name = str(form_data['beam_name'])
116
116
117 beam_data = {'name': name, 'antenna': antenna, 'tx': tx, 'rx': rx, 'ues': ues, 'only_rx': only_rx}
117 beam_data = {'name': name, 'antenna': antenna, 'tx': tx, 'rx': rx, 'ues': ues, 'only_rx': only_rx}
118
118
119 return beam_data
119 return beam_data
120
120
121
121
122
122
123 def abs_conf(request, id_conf):
123 def abs_conf(request, id_conf, status_request=None):
124
124
125 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
125 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
126 beams = ABSBeam.objects.filter(abs_conf=conf)
126 beams = ABSBeam.objects.filter(abs_conf=conf)
127 active_beam_id = json.loads(conf.active_beam)
127 active_beam_id = json.loads(conf.active_beam)
128
128
129 #------------Colors for Active Beam:-------------
129 #------------Colors for Active Beam:-------------
130 modules_status = json.loads(conf.module_status)
130 modules_status = json.loads(conf.module_status)
131 module_messages = json.loads(conf.module_messages)
131 module_messages = json.loads(conf.module_messages)
132
132
133 color_status = {}
133 color_status = {}
134 for status in modules_status:
134 for status in modules_status:
135 if modules_status[status] == 3: #Running background-color: #00cc00;
135 if modules_status[status] == 3: #Running background-color: #00cc00;
136 color_status[status] = 'class=text-success'#'bgcolor=#00cc00'
136 color_status[status] = 'class=text-success'#'bgcolor=#00cc00'
137 elif modules_status[status] == 1: #Connected background-color: #ee902c;
137 elif modules_status[status] == 1: #Connected background-color: #ee902c;
138 color_status[status] = 'class=text-warning'#'bgcolor=#ee902c'
138 color_status[status] = 'class=text-warning'#'bgcolor=#ee902c'
139 else: #Disconnected background-color: #ff0000;
139 else: #Disconnected background-color: #ff0000;
140 color_status[status] = 'class=text-danger'#'bgcolor=#FF0000'
140 color_status[status] = 'class=text-danger'#'bgcolor=#FF0000'
141 #------------------------------------------------
141 #------------------------------------------------
142
142
143 kwargs = {}
143 kwargs = {}
144 #kwargs['status'] = conf.device.get_status_display()
144 #kwargs['status'] = conf.device.get_status_display()
145 kwargs['connected_modules'] = str(conf.connected_modules())+'/64'
145 kwargs['connected_modules'] = str(conf.connected_modules())+'/64'
146
146
147 kwargs['dev_conf'] = conf
147 kwargs['dev_conf'] = conf
148 if conf.operation_mode == 0:
148 if conf.operation_mode == 0:
149 kwargs['dev_conf_keys'] = ['name', 'operation_mode']
149 kwargs['dev_conf_keys'] = ['name', 'operation_mode']
150 else:
150 else:
151 kwargs['dev_conf_keys'] = ['name', 'operation_mode', 'operation_value']
151 kwargs['dev_conf_keys'] = ['name', 'operation_mode', 'operation_value']
152
152
153 kwargs['title'] = 'ABS Configuration'
153 kwargs['title'] = 'ABS Configuration'
154 kwargs['suptitle'] = 'Details'
154 kwargs['suptitle'] = 'Details'
155 #kwargs['no_play'] = True
155 #kwargs['no_play'] = True
156
156
157 kwargs['button'] = 'Edit Configuration'
157 kwargs['button'] = 'Edit Configuration'
158 #------------------Active Beam-----------------------
158 #------------------Active Beam-----------------------
159 try:
159 try:
160 active_beam_id = active_beam_id['active_beam']
160 active_beam_id = active_beam_id['active_beam']
161 active_beam = ABSBeam.objects.get(pk=active_beam_id)
161 active_beam = ABSBeam.objects.get(pk=active_beam_id)
162 kwargs['active_beam'] = active_beam
162 kwargs['active_beam'] = active_beam
163 for beam in beams:
163 for beam in beams:
164 if beam.id == active_beam.id:
164 if beam.id == active_beam.id:
165 beam.color_status = color_status
165 beam.color_status = color_status
166 beam.module_messages = module_messages
166 beam.module_messages = module_messages
167 except:
167 except:
168 active_beam = ''
168 active_beam = ''
169 #----------------------------------------------------
169 #----------------------------------------------------
170 kwargs['beams'] = beams
170 kwargs['beams'] = beams
171 kwargs['modules_status'] = modules_status
171 kwargs['modules_status'] = modules_status
172 kwargs['color_status'] = color_status
172 kwargs['color_status'] = color_status
173 kwargs['module_messages'] = module_messages
173 kwargs['module_messages'] = module_messages
174
174
175 #kwargs['only_stop'] = True
175 #if conf.device.status in [0,1]:
176 if conf.connected_modules() == 0:
177 messages.error(request, 'No ABS module is connected.')#conf.message)
178 else:
179 messages.success(request, 'ABS modules are connected.')#conf.message)
176
180
177 ###### SIDEBAR ######
181 ###### SIDEBAR ######
178 kwargs.update(sidebar(conf=conf))
182 kwargs.update(sidebar(conf=conf))
179
183
184 if status_request:
185 conf.status_device()
186 kwargs['status_request'] = True
187 return render(request, 'abs_conf.html', kwargs)
188
180 return render(request, 'abs_conf.html', kwargs)
189 return render(request, 'abs_conf.html', kwargs)
181
190
191
182 def abs_conf_edit(request, id_conf):
192 def abs_conf_edit(request, id_conf):
183
193
184 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
194 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
185
195
186 beams = ABSBeam.objects.filter(abs_conf=conf)
196 beams = ABSBeam.objects.filter(abs_conf=conf)
187 print beams
197 print beams
188
198
189 if request.method=='GET':
199 if request.method=='GET':
190 form = ABSConfigurationForm(instance=conf)
200 form = ABSConfigurationForm(instance=conf)
191
201
192 if request.method=='POST':
202 if request.method=='POST':
193 form = ABSConfigurationForm(request.POST, instance=conf)
203 form = ABSConfigurationForm(request.POST, instance=conf)
194
204
195 if form.is_valid():
205 if form.is_valid():
196 conf = form.save(commit=False)
206 conf = form.save(commit=False)
197 conf.save()
207 conf.save()
198 return redirect('url_abs_conf', id_conf=conf.id)
208 return redirect('url_abs_conf', id_conf=conf.id)
199
209
200 ###### SIDEBAR ######
210 ###### SIDEBAR ######
201 kwargs = {}
211 kwargs = {}
202
212
203 kwargs['dev_conf'] = conf
213 kwargs['dev_conf'] = conf
204 #kwargs['id_dev'] = conf.id
214 #kwargs['id_dev'] = conf.id
205 kwargs['id_conf'] = conf.id
215 kwargs['id_conf'] = conf.id
206 kwargs['form'] = form
216 kwargs['form'] = form
207 kwargs['abs_beams'] = beams
217 kwargs['abs_beams'] = beams
208 kwargs['title'] = 'Device Configuration'
218 kwargs['title'] = 'Device Configuration'
209 kwargs['suptitle'] = 'Edit'
219 kwargs['suptitle'] = 'Edit'
210 kwargs['button'] = 'Save'
220 kwargs['button'] = 'Save'
211
221
212 kwargs['edit'] = True
222 kwargs['edit'] = True
213
223
214 return render(request, 'abs_conf_edit.html', kwargs)
224 return render(request, 'abs_conf_edit.html', kwargs)
215
225
216
226
217 def import_file(request, id_conf):
227 def import_file(request, id_conf):
218
228
219 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
229 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
220 if request.method=='POST':
230 if request.method=='POST':
221 form = ABSImportForm(request.POST, request.FILES)
231 form = ABSImportForm(request.POST, request.FILES)
222 if form.is_valid():
232 if form.is_valid():
223 try:
233 try:
224 parms = conf.import_from_file(request.FILES['file_name'])
234 parms = conf.import_from_file(request.FILES['file_name'])
225
235
226 if parms:
236 if parms:
227 conf.update_from_file(parms)
237 conf.update_from_file(parms)
228 messages.success(request, 'Configuration "%s" loaded succesfully' % request.FILES['file_name'])
238 messages.success(request, 'Configuration "%s" loaded succesfully' % request.FILES['file_name'])
229 return redirect(conf.get_absolute_url_edit())
239 return redirect(conf.get_absolute_url_edit())
230
240
231 except Exception as e:
241 except Exception as e:
232 messages.error(request, 'Error parsing file: "%s" - %s' % (request.FILES['file_name'], e))
242 messages.error(request, 'Error parsing file: "%s" - %s' % (request.FILES['file_name'], e))
233
243
234 else:
244 else:
235 messages.warning(request, 'Your current configuration will be replaced')
245 messages.warning(request, 'Your current configuration will be replaced')
236 form = ABSImportForm()
246 form = ABSImportForm()
237
247
238 kwargs = {}
248 kwargs = {}
239 kwargs['form'] = form
249 kwargs['form'] = form
240 kwargs['title'] = 'ABS Configuration'
250 kwargs['title'] = 'ABS Configuration'
241 kwargs['suptitle'] = 'Import file'
251 kwargs['suptitle'] = 'Import file'
242 kwargs['button'] = 'Upload'
252 kwargs['button'] = 'Upload'
243 kwargs['previous'] = conf.get_absolute_url()
253 kwargs['previous'] = conf.get_absolute_url()
244
254
245 return render(request, 'abs_import.html', kwargs)
255 return render(request, 'abs_import.html', kwargs)
246
256
247
257
248 def send_beam(request, id_conf, id_beam):
258 def send_beam(request, id_conf, id_beam):
249
259
250 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
260 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
251 beam = get_object_or_404(ABSBeam, pk=id_beam)
261 beam = get_object_or_404(ABSBeam, pk=id_beam)
252 beams_list = ABSBeam.objects.filter(abs_conf=conf)
262 beams_list = ABSBeam.objects.filter(abs_conf=conf)
253 #To set this beam as an Active Beam
263 #To set this beam as an Active Beam
254 beam.set_as_activebeam()
264 beam.set_as_activebeam()
255 #To send beam position to abs-modules
265 #To send beam position to abs-modules
256 i = 0
266 i = 0
257 for b in beams_list:
267 for b in beams_list:
258 if b.id == int(id_beam):
268 if b.id == int(id_beam):
259 break
269 break
260 else:
270 else:
261 i += 1
271 i += 1
262 beam_pos = i + 1 #Estandarizar
272 beam_pos = i + 1 #Estandarizar
263 print 'Position: ',beam_pos
273 print 'Position: ',beam_pos
264 conf.send_beam_num(beam_pos)
274 conf.send_beam_num(beam_pos)
265
275
266 return redirect('url_abs_conf', conf.id)
276 return redirect('url_abs_conf', conf.id)
267
277
268
278
269 def add_beam(request, id_conf):
279 def add_beam(request, id_conf):
270
280
271 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
281 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
272 confs = Configuration.objects.all()
282 confs = Configuration.objects.all()
273
283
274 if request.method=='GET':
284 if request.method=='GET':
275 #form = ABSBeamEditForm()
285 #form = ABSBeamEditForm()
276 form = ABSBeamAddForm()
286 form = ABSBeamAddForm()
277
287
278 if request.method=='POST':
288 if request.method=='POST':
279 form = ABSBeamAddForm(request.POST)
289 form = ABSBeamAddForm(request.POST)
280
290
281 beam_data = get_values_from_form(request.POST)
291 beam_data = get_values_from_form(request.POST)
282
292
283 new_beam = ABSBeam(
293 new_beam = ABSBeam(
284 name =beam_data['name'],
294 name =beam_data['name'],
285 antenna =json.dumps(beam_data['antenna']),
295 antenna =json.dumps(beam_data['antenna']),
286 abs_conf=conf,
296 abs_conf=conf,
287 tx =json.dumps(beam_data['tx']),
297 tx =json.dumps(beam_data['tx']),
288 rx =json.dumps(beam_data['rx']),
298 rx =json.dumps(beam_data['rx']),
289 ues =json.dumps(beam_data['ues']),
299 ues =json.dumps(beam_data['ues']),
290 only_rx =json.dumps(beam_data['only_rx'])
300 only_rx =json.dumps(beam_data['only_rx'])
291 )
301 )
292 new_beam.save()
302 new_beam.save()
293 #---Update 6bits configuration and add beam to abs configuration beams list.
303 #---Update 6bits configuration and add beam to abs configuration beams list.
294 new_beam.modules_6bits()
304 new_beam.modules_6bits()
295 #new_beam.add_beam2list()
305 #new_beam.add_beam2list()
296 messages.success(request, 'Beam: "%s" has been added.' % new_beam.name)
306 messages.success(request, 'Beam: "%s" has been added.' % new_beam.name)
297
307
298 return redirect('url_edit_abs_conf', conf.id)
308 return redirect('url_edit_abs_conf', conf.id)
299
309
300 ###### SIDEBAR ######
310 ###### SIDEBAR ######
301 kwargs = {}
311 kwargs = {}
302
312
303 #kwargs['dev_conf'] = conf.device
313 #kwargs['dev_conf'] = conf.device
304 #kwargs['id_dev'] = conf.device
314 #kwargs['id_dev'] = conf.device
305 kwargs['id_conf'] = conf.id
315 kwargs['id_conf'] = conf.id
306 kwargs['form'] = form
316 kwargs['form'] = form
307 kwargs['title'] = 'ABS Beams'
317 kwargs['title'] = 'ABS Beams'
308 kwargs['suptitle'] = 'Add Beam'
318 kwargs['suptitle'] = 'Add Beam'
309 kwargs['button'] = 'Add'
319 kwargs['button'] = 'Add'
310 kwargs['no_sidebar'] = True
320 kwargs['no_sidebar'] = True
311
321
312 #kwargs['previous'] = conf.get_absolute_url_edit()
322 #kwargs['previous'] = conf.get_absolute_url_edit()
313 kwargs['edit'] = True
323 kwargs['edit'] = True
314
324
315 return render(request, 'abs_add_beam.html', kwargs)
325 return render(request, 'abs_add_beam.html', kwargs)
316
326
317
327
318 def edit_beam(request, id_conf, id_beam):
328 def edit_beam(request, id_conf, id_beam):
319
329
320 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
330 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
321 beam = get_object_or_404(ABSBeam, pk=id_beam)
331 beam = get_object_or_404(ABSBeam, pk=id_beam)
322
332
323 if request.method=='GET':
333 if request.method=='GET':
324 form = ABSBeamEditForm(initial={'beam': beam})
334 form = ABSBeamEditForm(initial={'beam': beam})
325
335
326 if request.method=='POST':
336 if request.method=='POST':
327 form = ABSBeamEditForm(request.POST)
337 form = ABSBeamEditForm(request.POST)
328
338
329 beam_data = get_values_from_form(request.POST)
339 beam_data = get_values_from_form(request.POST)
330
340
331 beam.dict_to_parms(beam_data)
341 beam.dict_to_parms(beam_data)
332 beam.save()
342 beam.save()
333
343
334 messages.success(request, 'Beam: "%s" has been updated.' % beam.name)
344 messages.success(request, 'Beam: "%s" has been updated.' % beam.name)
335
345
336 return redirect('url_edit_abs_conf', conf.id)
346 return redirect('url_edit_abs_conf', conf.id)
337
347
338 ###### SIDEBAR ######
348 ###### SIDEBAR ######
339 kwargs = {}
349 kwargs = {}
340
350
341 kwargs['id_conf'] = conf.id
351 kwargs['id_conf'] = conf.id
342 kwargs['form'] = form
352 kwargs['form'] = form
343 kwargs['title'] = 'ABS Beams'
353 kwargs['title'] = 'ABS Beams'
344 kwargs['suptitle'] = 'Edit Beam'
354 kwargs['suptitle'] = 'Edit Beam'
345 kwargs['button'] = 'Save'
355 kwargs['button'] = 'Save'
346 kwargs['no_sidebar'] = True
356 kwargs['no_sidebar'] = True
347
357
348 #kwargs['previous'] = conf.get_absolute_url_edit()
358 #kwargs['previous'] = conf.get_absolute_url_edit()
349 kwargs['edit'] = True
359 kwargs['edit'] = True
350
360
351 return render(request, 'abs_edit_beam.html', kwargs)
361 return render(request, 'abs_edit_beam.html', kwargs)
352
362
353
363
354
364
355 def remove_beam(request, id_conf, id_beam):
365 def remove_beam(request, id_conf, id_beam):
356
366
357 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
367 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
358 beam = get_object_or_404(ABSBeam, pk=id_beam)
368 beam = get_object_or_404(ABSBeam, pk=id_beam)
359
369
360 if request.method=='POST':
370 if request.method=='POST':
361 if beam:
371 if beam:
362 try:
372 try:
363 beam.remove_beamfromlist()
373 beam.remove_beamfromlist()
364 beam.delete()
374 beam.delete()
365 messages.success(request, 'Beam: "%s" has been deleted.' % beam)
375 messages.success(request, 'Beam: "%s" has been deleted.' % beam)
366 except:
376 except:
367 messages.error(request, 'Unable to delete beam: "%s".' % beam)
377 messages.error(request, 'Unable to delete beam: "%s".' % beam)
368
378
369 return redirect('url_edit_abs_conf', conf.id)
379 return redirect('url_edit_abs_conf', conf.id)
370
380
371 ###### SIDEBAR ######
381 ###### SIDEBAR ######
372 kwargs = {}
382 kwargs = {}
373
383
374 kwargs['object'] = beam
384 kwargs['object'] = beam
375 kwargs['delete'] = True
385 kwargs['delete'] = True
376 kwargs['title'] = 'Delete'
386 kwargs['title'] = 'Delete'
377 kwargs['suptitle'] = 'Beam'
387 kwargs['suptitle'] = 'Beam'
378 kwargs['previous'] = conf.get_absolute_url_edit()
388 kwargs['previous'] = conf.get_absolute_url_edit()
379 return render(request, 'confirm.html', kwargs)
389 return render(request, 'confirm.html', kwargs)
380
390
381
391
382
392
383 def plot_patterns(request, id_conf, id_beam=None):
393 def plot_patterns(request, id_conf, id_beam=None):
384
394
385 kwargs = {}
395 kwargs = {}
386 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
396 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
387 beams = ABSBeam.objects.filter(abs_conf=conf)
397 beams = ABSBeam.objects.filter(abs_conf=conf)
388
398
389 if id_beam:
399 if id_beam:
390 beam = get_object_or_404(ABSBeam, pk=id_beam)
400 beam = get_object_or_404(ABSBeam, pk=id_beam)
391 kwargs['beam'] = beam
401 kwargs['beam'] = beam
392
402
393
403
394 ###### SIDEBAR ######
404 ###### SIDEBAR ######
395
405
396 kwargs['dev_conf'] = conf.device
406 kwargs['dev_conf'] = conf.device
397 kwargs['id_dev'] = conf.device
407 kwargs['id_dev'] = conf.device
398 kwargs['id_conf'] = conf.id
408 kwargs['id_conf'] = conf.id
399 kwargs['abs_beams'] = beams
409 kwargs['abs_beams'] = beams
400 kwargs['title'] = 'ABS Patterns'
410 kwargs['title'] = 'ABS Patterns'
401 kwargs['suptitle'] = conf.name
411 kwargs['suptitle'] = conf.name
402 kwargs['no_sidebar'] = True
412 kwargs['no_sidebar'] = True
403
413
404 return render(request, 'abs_patterns.html', kwargs)
414 return render(request, 'abs_patterns.html', kwargs)
405
415
406
416
407 def plot_pattern(request, id_conf, id_beam, antenna):
417 def plot_pattern(request, id_conf, id_beam, antenna):
408
418
409 if antenna=='down':
419 if antenna=='down':
410 sleep(3)
420 sleep(3)
411
421
412 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
422 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
413 beam = get_object_or_404(ABSBeam, pk=id_beam)
423 beam = get_object_or_404(ABSBeam, pk=id_beam)
414
424
415 name = conf.experiment.name
425 name = conf.experiment.name
416
426
417 just_rx = 1 if json.loads(beam.only_rx)[antenna] else 0
427 just_rx = 1 if json.loads(beam.only_rx)[antenna] else 0
418 phases = json.loads(beam.antenna)['antenna_{}'.format(antenna)]
428 phases = json.loads(beam.antenna)['antenna_{}'.format(antenna)]
419 gain_tx = json.loads(beam.tx)[antenna]
429 gain_tx = json.loads(beam.tx)[antenna]
420 gain_rx = json.loads(beam.rx)[antenna]
430 gain_rx = json.loads(beam.rx)[antenna]
421 ues = json.loads(beam.ues)[antenna]
431 ues = json.loads(beam.ues)[antenna]
422
432
423 newOverJro = overJroShow(name)
433 newOverJro = overJroShow(name)
424 fig = newOverJro.plotPattern2(datetime.today(), phases, gain_tx, gain_rx, ues, just_rx)
434 fig = newOverJro.plotPattern2(datetime.today(), phases, gain_tx, gain_rx, ues, just_rx)
425
435
426 response=HttpResponse(content_type='image/png')
436 response=HttpResponse(content_type='image/png')
427
437
428 fig.canvas.print_png(response)
438 fig.canvas.print_png(response)
429
439
430 return response
440 return response
General Comments 0
You need to be logged in to leave comments. Login now