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