@@ -21,6 +21,7 PGDATA=/var/lib/postgresql/data | |||||
21 | #Volumes - path |
|
21 | #Volumes - path | |
22 | EXPOSE_SIRM=./volumes/sirm |
|
22 | EXPOSE_SIRM=./volumes/sirm | |
23 | EXPOSE_PROC=./volumes/proc |
|
23 | EXPOSE_PROC=./volumes/proc | |
|
24 | EXPOSE_CAM=/path/to/cam | |||
24 | EXPOSE_NAS=/path/to/nas_data |
|
25 | EXPOSE_NAS=/path/to/nas_data | |
25 | EXPOSE_PGDATA=/path/to/pg_data |
|
26 | EXPOSE_PGDATA=/path/to/pg_data | |
26 | EXPOSE_CERTS=/path/to/certs |
|
27 | EXPOSE_CERTS=/path/to/certs |
@@ -38,6 +38,7 Update enviroment vars (/path/to/radarsys_met/.env) | |||||
38 | DB_PASSWORD=**** |
|
38 | DB_PASSWORD=**** | |
39 |
|
39 | |||
40 | #Volumes - path |
|
40 | #Volumes - path | |
|
41 | EXPOSE_CAM=/path/to/cam | |||
41 | EXPOSE_NAS=/path/to/nas_data |
|
42 | EXPOSE_NAS=/path/to/nas_data | |
42 | EXPOSE_PGDATA=/path/to/pg_data |
|
43 | EXPOSE_PGDATA=/path/to/pg_data | |
43 | EXPOSE_CERTS=/path/to/certs |
|
44 | EXPOSE_CERTS=/path/to/certs |
@@ -44,6 +44,13 volumes: | |||||
44 | type: "none" |
|
44 | type: "none" | |
45 | o: "bind" |
|
45 | o: "bind" | |
46 | device: "${EXPOSE_NAS}" |
|
46 | device: "${EXPOSE_NAS}" | |
|
47 | sirm_cam: | |||
|
48 | name: sirm_cam | |||
|
49 | driver: local | |||
|
50 | driver_opts: | |||
|
51 | type: "none" | |||
|
52 | o: "bind" | |||
|
53 | device: "${EXPOSE_CAM}" | |||
47 |
|
54 | |||
48 | services: |
|
55 | services: | |
49 | sirm-nginx-proxy: |
|
56 | sirm-nginx-proxy: | |
@@ -144,8 +151,6 services: | |||||
144 | driver: "json-file" |
|
151 | driver: "json-file" | |
145 | options: |
|
152 | options: | |
146 | max-size: "12m" |
|
153 | max-size: "12m" | |
147 | # ports: |
|
|||
148 | # - 8086:5000 |
|
|||
149 |
|
154 | |||
150 | sirm-monitor: |
|
155 | sirm-monitor: | |
151 | container_name: 'sirm-monitor' |
|
156 | container_name: 'sirm-monitor' | |
@@ -174,6 +179,8 services: | |||||
174 | restart: always |
|
179 | restart: always | |
175 | environment: |
|
180 | environment: | |
176 | - VIRTUAL_HOST=${CAM_SITE} |
|
181 | - VIRTUAL_HOST=${CAM_SITE} | |
|
182 | volumes: | |||
|
183 | - 'sirm_cam:./.wine/drive_c/iVMS-4200' | |||
177 | networks: |
|
184 | networks: | |
178 | - frontend_sirm |
|
185 | - frontend_sirm | |
179 | logging: |
|
186 | logging: |
@@ -190,6 +190,8 class GeneratorConfiguration(Configuration): | |||||
190 |
|
190 | |||
191 | r = requests.get(complete_url_trmode) |
|
191 | r = requests.get(complete_url_trmode) | |
192 |
|
192 | |||
|
193 | self.clone(type=1, experiment = 'empty') | |||
|
194 | ||||
193 | if r: |
|
195 | if r: | |
194 | self.device.status = 3 |
|
196 | self.device.status = 3 | |
195 | self.device.save() |
|
197 | self.device.save() |
@@ -303,17 +303,14 class Experiment(PolymorphicModel): | |||||
303 | 'heading': self.heading |
|
303 | 'heading': self.heading | |
304 | } |
|
304 | } | |
305 |
|
305 | |||
306 | self.reception_rx.datadir = os.path.join(os.environ['EXPOSE_NAS'], data['name'], 'rawdata') |
|
|||
307 | self.reception_rx.save() |
|
|||
308 |
|
||||
309 | try: |
|
306 | try: | |
310 | data['pedestal'] = self.pedestal.start_device() |
|
307 | data['pedestal'] = self.pedestal.start_device(name_experiment=data['name']) | |
311 | time.sleep(1.0) |
|
308 | time.sleep(1.0) | |
312 | self.generator_start() |
|
309 | self.generator_start() | |
313 | time.sleep(1.0) |
|
310 | time.sleep(1.0) | |
314 | data['usrp_tx'] = self.transmission_tx.start_device() |
|
311 | data['usrp_tx'] = self.transmission_tx.start_device(name_experiment=data['name']) | |
315 | time.sleep(1.0) |
|
312 | time.sleep(1.0) | |
316 | data['usrp_rx'] = self.reception_rx.start_device() |
|
313 | data['usrp_rx'] = self.reception_rx.start_device(name_experiment=data['name']) | |
317 | time.sleep(0.1) |
|
314 | time.sleep(0.1) | |
318 | proc_url = 'http://'+os.environ['PROC_SITE']+'/start' |
|
315 | proc_url = 'http://'+os.environ['PROC_SITE']+'/start' | |
319 | requests.post(proc_url, json=data) |
|
316 | requests.post(proc_url, json=data) | |
@@ -444,7 +441,8 class Experiment(PolymorphicModel): | |||||
444 |
|
441 | |||
445 | class Configuration(PolymorphicModel): |
|
442 | class Configuration(PolymorphicModel): | |
446 |
|
443 | |||
447 | id = models.AutoField(primary_key=True) |
|
444 | id = models.AutoField(primary_key=True) | |
|
445 | experiment = models.CharField(default='empty', editable=False, max_length=64, null=True, blank=True) | |||
448 | device = models.ForeignKey('Device', verbose_name='Device', null=True, on_delete=models.CASCADE) |
|
446 | device = models.ForeignKey('Device', verbose_name='Device', null=True, on_delete=models.CASCADE) | |
449 | type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES) |
|
447 | type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES) | |
450 | created_date = models.DateTimeField(auto_now_add=True) |
|
448 | created_date = models.DateTimeField(auto_now_add=True) | |
@@ -452,7 +450,7 class Configuration(PolymorphicModel): | |||||
452 | parameters = models.TextField(default='{}') |
|
450 | parameters = models.TextField(default='{}') | |
453 | author = models.ForeignKey(User, null=True, blank=True,on_delete=models.CASCADE) |
|
451 | author = models.ForeignKey(User, null=True, blank=True,on_delete=models.CASCADE) | |
454 | hash = models.CharField(default='', max_length=64, null=True, blank=True) |
|
452 | hash = models.CharField(default='', max_length=64, null=True, blank=True) | |
455 | message = "" |
|
453 | message = "" | |
456 |
|
454 | |||
457 | class Meta: |
|
455 | class Meta: | |
458 | db_table = 'db_configurations' |
|
456 | db_table = 'db_configurations' | |
@@ -498,14 +496,15 class Configuration(PolymorphicModel): | |||||
498 | return data |
|
496 | return data | |
499 |
|
497 | |||
500 | def clone(self, **kwargs): |
|
498 | def clone(self, **kwargs): | |
|
499 | before_id = self.id | |||
501 |
|
500 | |||
502 | self.pk = None |
|
501 | self.pk = None | |
503 | self.id = None |
|
502 | self.id = None | |
504 | for attr, value in kwargs.items(): |
|
503 | for attr, value in kwargs.items(): | |
505 | setattr(self, attr, value) |
|
504 | setattr(self, attr, value) | |
506 |
|
||||
507 | self.save() |
|
505 | self.save() | |
508 |
|
506 | |||
|
507 | self.id = before_id | |||
509 | return self |
|
508 | return self | |
510 |
|
509 | |||
511 | def parms_to_dict(self): |
|
510 | def parms_to_dict(self): |
@@ -809,8 +809,11 def dev_confs(request): | |||||
809 | if request.user.is_authenticated: |
|
809 | if request.user.is_authenticated: | |
810 | fields.append('my configurations') |
|
810 | fields.append('my configurations') | |
811 | form = FilterForm(initial=request.GET, extra_fields=fields) |
|
811 | form = FilterForm(initial=request.GET, extra_fields=fields) | |
812 | kwargs['keys'] = ['name', 'device', |
|
812 | kwargs['keys'] = ['name', 'device', 'type', | |
813 |
|
|
813 | 'programmed_date', 'actions'] | |
|
814 | if request.GET.get('historical') == 'on': | |||
|
815 | kwargs['keys'].insert(3, 'experiment') | |||
|
816 | ||||
814 | kwargs['title'] = 'Configuration' |
|
817 | kwargs['title'] = 'Configuration' | |
815 | kwargs['suptitle'] = 'List' |
|
818 | kwargs['suptitle'] = 'List' | |
816 | kwargs['no_sidebar'] = True |
|
819 | kwargs['no_sidebar'] = True | |
@@ -873,7 +876,6 def dev_conf_new(request, id_exp=0, id_dev=0): | |||||
873 | if device.device_type.name == 'usrp_tx': |
|
876 | if device.device_type.name == 'usrp_tx': | |
874 | validation_usrp_tx_code(request, conf) |
|
877 | validation_usrp_tx_code(request, conf) | |
875 |
|
878 | |||
876 | conf.clone(type=1) |
|
|||
877 | conf.save() |
|
879 | conf.save() | |
878 | conf.author = request.user |
|
880 | conf.author = request.user | |
879 |
|
881 |
@@ -191,7 +191,7 class PedestalConfiguration(Configuration): | |||||
191 |
|
191 | |||
192 | return True |
|
192 | return True | |
193 |
|
193 | |||
194 | def start_device(self): |
|
194 | def start_device(self, name_experiment=False): | |
195 |
|
195 | |||
196 | if self.mode == 'table': |
|
196 | if self.mode == 'table': | |
197 | if len(self.angle.split(',')) > 1: |
|
197 | if len(self.angle.split(',')) > 1: | |
@@ -255,6 +255,12 class PedestalConfiguration(Configuration): | |||||
255 | if self.mode == 'table': |
|
255 | if self.mode == 'table': | |
256 | payload['table'] = list_of_floats |
|
256 | payload['table'] = list_of_floats | |
257 |
|
257 | |||
|
258 | if name_experiment: | |||
|
259 | name_experiment = name_experiment.split("@") | |||
|
260 | self.clone(experiment=name_experiment[0], programmed_date=name_experiment[1], type=1) | |||
|
261 | else: | |||
|
262 | self.clone(type=1, experiment = 'empty') | |||
|
263 | ||||
258 | if r: |
|
264 | if r: | |
259 | self.device.status = 3 |
|
265 | self.device.status = 3 | |
260 | self.device.save() |
|
266 | self.device.save() |
@@ -3,6 +3,8 import json | |||||
3 | import requests |
|
3 | import requests | |
4 | import base64 |
|
4 | import base64 | |
5 | from struct import pack |
|
5 | from struct import pack | |
|
6 | from datetime import datetime | |||
|
7 | import os | |||
6 |
|
8 | |||
7 | from django.db import models |
|
9 | from django.db import models | |
8 | from django.urls import reverse |
|
10 | from django.urls import reverse | |
@@ -73,10 +75,11 class USRPRXConfiguration(Configuration): | |||||
73 | datadir = models.CharField( |
|
75 | datadir = models.CharField( | |
74 | verbose_name="Data Directory", |
|
76 | verbose_name="Data Directory", | |
75 | max_length=100, |
|
77 | max_length=100, | |
76 | default='', |
|
78 | default='/to/path/NAME@YYYY-MM-DDTHH:MM:SS/rawdata', | |
77 | blank=False, |
|
79 | blank=False, | |
78 | null=False, |
|
80 | null=False, | |
79 | help_text='Fill with a directory. Example: /media/soporte/DATA' |
|
81 | help_text='Fill with a directory. Example: /media/soporte/DATA', | |
|
82 | editable=False | |||
80 | ) |
|
83 | ) | |
81 |
|
84 | |||
82 | clocksource = models.CharField( |
|
85 | clocksource = models.CharField( | |
@@ -186,7 +189,7 class USRPRXConfiguration(Configuration): | |||||
186 |
|
189 | |||
187 | return True |
|
190 | return True | |
188 |
|
191 | |||
189 | def start_device(self): |
|
192 | def start_device(self, name_experiment=False): | |
190 |
|
193 | |||
191 | try: |
|
194 | try: | |
192 | usrp = USRPRXConfiguration.objects.get(pk=self) |
|
195 | usrp = USRPRXConfiguration.objects.get(pk=self) | |
@@ -194,12 +197,25 class USRPRXConfiguration(Configuration): | |||||
194 | usrp_antenna_rx = usrp.get_antenna_rx_display() |
|
197 | usrp_antenna_rx = usrp.get_antenna_rx_display() | |
195 | usrp_clocksource = usrp.get_clocksource_display() |
|
198 | usrp_clocksource = usrp.get_clocksource_display() | |
196 | usrp_timesource = usrp.get_timesource_display() |
|
199 | usrp_timesource = usrp.get_timesource_display() | |
|
200 | ||||
|
201 | if name_experiment: | |||
|
202 | self.datadir = os.path.join(os.environ['EXPOSE_NAS'], name_experiment, 'rawdata') | |||
|
203 | self.save() | |||
|
204 | ||||
|
205 | name_experiment = name_experiment.split("@") | |||
|
206 | self.clone(experiment=name_experiment[0], programmed_date=name_experiment[1], type=1) | |||
|
207 | else: | |||
|
208 | data_name = 'empty@{}'.format(datetime.now().isoformat().split('.')[0]) | |||
|
209 | self.datadir = os.path.join(os.environ['EXPOSE_NAS'], data_name, 'rawdata') | |||
|
210 | self.save() | |||
|
211 | ||||
|
212 | self.clone(type=1, experiment = 'empty') | |||
197 |
|
213 | |||
198 | payload = {'ip_address': usrp.ip_address_rx, 'daughterboard': usrp_daughterboard_rx, 'antenna': usrp_antenna_rx, 'sample_rate': usrp.samplerate_rx, 'frequency': usrp.frequency_rx, |
|
214 | payload = {'ip_address': usrp.ip_address_rx, 'daughterboard': usrp_daughterboard_rx, 'antenna': usrp_antenna_rx, 'sample_rate': usrp.samplerate_rx, 'frequency': usrp.frequency_rx, | |
199 |
'datadir': |
|
215 | 'datadir': self.datadir, 'clock_source': usrp_clocksource, 'time_source': usrp_timesource, 'clock_rate':usrp.clockrate} | |
200 |
|
216 | |||
201 | r = requests.post(self.device.url("usrprx"), json=payload) |
|
217 | r = requests.post(self.device.url("usrprx"), json=payload) | |
202 |
|
218 | |||
203 | if r: |
|
219 | if r: | |
204 | self.device.status = 3 |
|
220 | self.device.status = 3 | |
205 | self.device.save() |
|
221 | self.device.save() |
@@ -245,7 +245,7 class USRPTXConfiguration(Configuration): | |||||
245 |
|
245 | |||
246 | return True |
|
246 | return True | |
247 |
|
247 | |||
248 | def start_device(self): |
|
248 | def start_device(self, name_experiment=False): | |
249 |
|
249 | |||
250 | try: |
|
250 | try: | |
251 | usrp = USRPTXConfiguration.objects.get(pk=self) |
|
251 | usrp = USRPTXConfiguration.objects.get(pk=self) | |
@@ -265,6 +265,12 class USRPTXConfiguration(Configuration): | |||||
265 | 'repetitions_1': usrp.repetitions_1, 'enable_2': usrp.enable_2} |
|
265 | 'repetitions_1': usrp.repetitions_1, 'enable_2': usrp.enable_2} | |
266 |
|
266 | |||
267 | r = requests.post(self.device.url("usrptx"), json=payload) |
|
267 | r = requests.post(self.device.url("usrptx"), json=payload) | |
|
268 | ||||
|
269 | if name_experiment: | |||
|
270 | name_experiment = name_experiment.split("@") | |||
|
271 | self.clone(experiment=name_experiment[0], programmed_date=name_experiment[1], type=1) | |||
|
272 | else: | |||
|
273 | self.clone(type=1, experiment = 'empty') | |||
268 |
|
274 | |||
269 | if r: |
|
275 | if r: | |
270 | self.device.status = 3 |
|
276 | self.device.status = 3 |
General Comments 0
You need to be logged in to leave comments.
Login now