@@ -102,8 +102,6 class GeneratorConfiguration(Configuration): | |||||
102 | def status_device(self): |
|
102 | def status_device(self): | |
103 |
|
103 | |||
104 | try: |
|
104 | try: | |
105 | #self.device.status = 0 |
|
|||
106 | #payload = self.request('status') |
|
|||
107 | payload = requests.get(self.device.url()) |
|
105 | payload = requests.get(self.device.url()) | |
108 |
|
106 | |||
109 | if payload: |
|
107 | if payload: | |
@@ -146,9 +144,7 class GeneratorConfiguration(Configuration): | |||||
146 | def stop_device(self): |
|
144 | def stop_device(self): | |
147 |
|
145 | |||
148 | try: |
|
146 | try: | |
149 | self.selector = 0 |
|
147 | payload = {"enable": 0} | |
150 | self.save() |
|
|||
151 | payload = {"enable": self.selector} |
|
|||
152 |
|
148 | |||
153 | json_trmode_selector = json.dumps(payload) |
|
149 | json_trmode_selector = json.dumps(payload) | |
154 | base64_trmode_selector = base64.standard_b64encode(json_trmode_selector.encode('ascii')) |
|
150 | base64_trmode_selector = base64.standard_b64encode(json_trmode_selector.encode('ascii')) |
@@ -287,14 +287,11 class Experiment(PolymorphicModel): | |||||
287 |
|
287 | |||
288 | try: |
|
288 | try: | |
289 | proc_url = 'http://'+os.environ['PROC_SITE']+'/start' |
|
289 | proc_url = 'http://'+os.environ['PROC_SITE']+'/start' | |
290 |
data[' |
|
290 | data['usrp_rx'] = self.reception_rx.start_device() | |
291 |
data[' |
|
291 | data['pedestal'] = self.pedestal.start_device() | |
292 | data['usrp_tx'] = self.transmission_tx.jsonify() |
|
|||
293 | r = requests.post(proc_url, json=data) |
|
|||
294 | self.reception_rx.start_device() |
|
|||
295 | self.pedestal.start_device() |
|
|||
296 | self.generator_start() |
|
292 | self.generator_start() | |
297 | self.transmission_tx.start_device() |
|
293 | data['usrp_tx'] = self.transmission_tx.start_device() | |
|
294 | requests.post(proc_url, json=data) | |||
298 |
|
295 | |||
299 | except: |
|
296 | except: | |
300 | return 0 |
|
297 | return 0 | |
@@ -309,14 +306,14 class Experiment(PolymorphicModel): | |||||
309 |
|
306 | |||
310 | try: |
|
307 | try: | |
311 | proc_url = 'http://'+os.environ['PROC_SITE']+'/stop' |
|
308 | proc_url = 'http://'+os.environ['PROC_SITE']+'/stop' | |
312 |
|
|
309 | requests.get(proc_url) | |
313 | self.reception_rx.stop_device() |
|
310 | self.reception_rx.stop_device() | |
314 | self.pedestal.stop_device() |
|
311 | self.pedestal.stop_device() | |
315 | self.generator.stop_device() |
|
312 | self.generator.stop_device() | |
316 | self.transmission_tx.stop_device() |
|
313 | self.transmission_tx.stop_device() | |
317 | except: |
|
314 | except: | |
318 | return 0 |
|
315 | return 0 | |
319 |
return |
|
316 | return 2 | |
320 |
|
317 | |||
321 | def get_status(self): |
|
318 | def get_status(self): | |
322 |
|
319 |
@@ -167,6 +167,13 class PedestalConfiguration(Configuration): | |||||
167 | try: |
|
167 | try: | |
168 | command = self.device.url() + "stop" |
|
168 | command = self.device.url() + "stop" | |
169 | r = requests.get(command) |
|
169 | r = requests.get(command) | |
|
170 | ||||
|
171 | if self.mode == 'table': | |||
|
172 | AX = {'az':'azimuth', 'el':'elevation'} | |||
|
173 | axis = [AX[x.lower().strip()] for x in self.axis.split(',')] | |||
|
174 | list_of_floats = [float(x.strip()) for x in self.angle.split(",")] | |||
|
175 | self.reset_device(axis[0], list_of_floats[0]) | |||
|
176 | ||||
170 | if r: |
|
177 | if r: | |
171 | self.device.status = 4 |
|
178 | self.device.status = 4 | |
172 | self.device.save() |
|
179 | self.device.save() | |
@@ -223,8 +230,6 class PedestalConfiguration(Configuration): | |||||
223 | 'top': self.max_value, |
|
230 | 'top': self.max_value, | |
224 | 'table': coded_table_ascii |
|
231 | 'table': coded_table_ascii | |
225 | } |
|
232 | } | |
226 | self.reset_device(axis[0], list_of_floats[0]) |
|
|||
227 | time.sleep(15) |
|
|||
228 |
|
233 | |||
229 | json_data = json.dumps(payload) |
|
234 | json_data = json.dumps(payload) | |
230 | print(json_data) |
|
235 | print(json_data) | |
@@ -233,6 +238,9 class PedestalConfiguration(Configuration): | |||||
233 | print(url) |
|
238 | print(url) | |
234 | r = requests.get(url) |
|
239 | r = requests.get(url) | |
235 |
|
240 | |||
|
241 | if self.mode == 'table': | |||
|
242 | payload['table'] = list_of_floats | |||
|
243 | ||||
236 | if r: |
|
244 | if r: | |
237 | self.device.status = 3 |
|
245 | self.device.status = 3 | |
238 | self.device.save() |
|
246 | self.device.save() | |
@@ -249,7 +257,7 class PedestalConfiguration(Configuration): | |||||
249 | self.device.save() |
|
257 | self.device.save() | |
250 | return False |
|
258 | return False | |
251 |
|
259 | |||
252 |
return |
|
260 | return payload | |
253 |
|
261 | |||
254 | def get_absolute_url_import(self): |
|
262 | def get_absolute_url_import(self): | |
255 | return reverse('url_import_pedestal_conf', args=[str(self.id)]) |
|
263 | return reverse('url_import_pedestal_conf', args=[str(self.id)]) |
@@ -214,10 +214,7 class USRPRXConfiguration(Configuration): | |||||
214 | self.device.save() |
|
214 | self.device.save() | |
215 | return False |
|
215 | return False | |
216 |
|
216 | |||
217 |
return |
|
217 | return payload | |
218 |
|
218 | |||
219 | def get_absolute_url_import(self): |
|
219 | def get_absolute_url_import(self): | |
220 |
return reverse('url_import_usrp_rx_conf', args=[str(self.id)]) |
|
220 | return reverse('url_import_usrp_rx_conf', args=[str(self.id)]) | |
No newline at end of file |
|
||||
221 |
|
||||
222 |
|
||||
223 |
|
@@ -281,7 +281,7 class USRPTXConfiguration(Configuration): | |||||
281 | self.device.save() |
|
281 | self.device.save() | |
282 | return False |
|
282 | return False | |
283 |
|
283 | |||
284 |
return |
|
284 | return payload | |
285 |
|
285 | |||
286 | def get_absolute_url_import(self): |
|
286 | def get_absolute_url_import(self): | |
287 | return reverse('url_import_usrp_tx_conf', args=[str(self.id)]) No newline at end of file |
|
287 | return reverse('url_import_usrp_tx_conf', args=[str(self.id)]) |
General Comments 0
You need to be logged in to leave comments.
Login now