##// END OF EJS Templates
Experiment detail view update
amorales -
r365:24b24259841b
parent child
Show More
@@ -448,7 +448,7 class Experiment(PolymorphicModel):
448 def stop(self):
448 def stop(self):
449 '''
449 '''
450 Stop experiments's devices
450 Stop experiments's devices
451 PEDESTAL, PULSE GENERATOR & USRP's
451 PEDESTAL, GENERATOR & USRP's
452 '''
452 '''
453
453
454 #confs = Configuration.objects.filter(experiment=self, type = 0).order_by('device__device_type__sequence')
454 #confs = Configuration.objects.filter(experiment=self, type = 0).order_by('device__device_type__sequence')
@@ -28,52 +28,39
28 {% if key == 'freq' %}
28 {% if key == 'freq' %}
29 <tr><th>Operating Freq. (MHz)</th><td>{{experiment|attr:key}}</td></tr>
29 <tr><th>Operating Freq. (MHz)</th><td>{{experiment|attr:key}}</td></tr>
30 {% else %}
30 {% else %}
31 <tr><th>{{key|title}}</th><td>{{experiment|attr:key}}</td></tr>
31 <tr><th>{{key|title}}</th><td>{{experiment|attr:key}}</td></tr>
32 {% endif %}
32 {% endif %}
33 {% endfor %}
33 {% endfor %}
34 </table>
34 </table>
35 <br>
35 <br>
36
36
37 <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
37 <table class="table table-bordered">
38 <h1>Pedestal</h1>
39 <br>
40 {% for key in experiment_pedestal_keys %}
41 <tr><th>{{key|title}}</th><td>{{experiment_pedestal|attr:key}}</td></tr>
42 {% endfor %}
43 </table>
44 <br>
38
45
39 <div class="panel panel-default bootcards-summary">
46 <table class="table table-bordered">
40 <div class="panel-heading" role="tab">
47 <h1>RX</h1>
41 <h4 class="panel-title">
48 <br>
42 Devices
49 {% for key in experiment_rx_keys %}
43 </h4>
50 <tr><th>{{key|title}}</th><td>{{experiment_rx|attr:key}}</td></tr>
44 </div>
51 {% endfor %}
45 <div class="panel-body">
52 </table>
53 <br>
46
54
47 {% for item in configurations %}
55 <table class="table table-bordered">
48 <div class="col-xs-6 col-sm-4" style="padding-top:5px;padding-bottom:5px">
56 <h1>TX</h1>
49 <a class="bootcards-summary-item" href="{{item.get_absolute_url}}"><br>
57 <br>
50 {% if item.device.device_type.name == 'cgs' %}
58 {% for key in experiment_tx_keys %}
51 <i class="fa fa-2x fa-clock-o"></i>
59 <tr><th>{{key|title}}</th><td>{{experiment_tx|attr:key}}</td></tr>
52 {% elif item.device.device_type.name == 'rc' %}
60 {% endfor %}
53 <i class="fa fa-2x fa-microchip"></i>
61 </table>
54 {% elif item.device.device_type.name == 'abs' %}
62 <br>
55 <i class="fa fa-2x fa-podcast"></i>
56 {% elif item.device.device_type.name == 'jars' %}
57 <i class="fa fa-2x fa-desktop"></i>
58 {% elif item.device.device_type.name == 'dds' %}
59 <i class="fa fa-2x fa-bar-chart"></i>
60 {% else %}
61 <i class="fa fa-3x fa-puzzle-piece"></i>
62 {%endif%}
63 <h4>{{item}}<br><small>{{item.device.ip_address}}</small>
64 {%if item.pk != item.device.conf_active %}
65 <span class="label label-info">Configured</span>
66 {%else%}
67 <span class="label label-{{item.device.status_color}}">{{item.device.get_status_display}}</span>
68 {%endif%}
69 </h4>
70 </a>
71 </div>
72 {% endfor %}
73
63
74 </div>
75 </div>
76 </div>
77 {% endblock %}
64 {% endblock %}
78
65
79 {% block sidebar%}
66 {% block sidebar%}
@@ -598,17 +598,25 def experiment(request, id_exp):
598 id_p = experiment.pedestal_id
598 id_p = experiment.pedestal_id
599 id_rx = experiment.reception_rx_id
599 id_rx = experiment.reception_rx_id
600 id_tx = experiment.transmission_tx_id
600 id_tx = experiment.transmission_tx_id
601 id_list = [id_p, id_rx, id_tx]
601 #id_list = [id_p, id_rx, id_tx]
602 configurations = Configuration.objects.filter(id__in = id_list)
602 #configurations = Configuration.objects.filter(id__in = id_list)
603 conf_pedestal = PedestalConfiguration.objects.get(id = id_p)
604 conf_rx = USRPRXConfiguration.objects.get(id = id_rx)
605 conf_tx = USRPTXConfiguration.objects.get(id = id_tx)
603 #configurations = PedestalConfiguration.objects.all()
606 #configurations = PedestalConfiguration.objects.all()
604 print(type(configurations))
605 kwargs = {}
606
607
607 kwargs['experiment_keys'] = ['template', 'radar_system', 'name', 'pedestal', 'generator', 'reception_rx', 'transmission_tx']
608 kwargs = {}
609 kwargs['experiment_keys'] = ['name', 'location']
608 kwargs['experiment'] = experiment
610 kwargs['experiment'] = experiment
609 kwargs['configuration_keys'] = ['name', 'device__ip_address',
611 kwargs['experiment_pedestal_keys'] = ['mode', 'speed', 'table']
610 'device__port_address', 'device__status']
612 kwargs['experiment_pedestal'] = conf_pedestal
611 kwargs['configurations'] = configurations
613 kwargs['experiment_rx_keys'] = ['samplerate', 'frequency', 'datadir', 'clocksource', 'timesource', 'clockrate']
614 kwargs['experiment_rx'] = conf_rx
615 kwargs['experiment_tx_keys'] = ['frequency', 'samplerate', 'ipp', 'enable_1', 'pulse_1', 'delay_1', 'type_1', 'code_1', 'repetitions_1',
616 'enable_2', 'pulse_2', 'delay_2', 'type_2', 'code_2', 'repetitions_2']
617 kwargs['experiment_tx'] = conf_tx
618 #kwargs['configuration_keys'] = ['name', 'device__ip_address', 'device__port_address', 'device__status']
619 #kwargs['configurations'] = configurations
612 kwargs['title'] = 'Experiment'
620 kwargs['title'] = 'Experiment'
613 kwargs['suptitle'] = 'Details'
621 kwargs['suptitle'] = 'Details'
614 kwargs['button'] = 'Add Configuration'
622 kwargs['button'] = 'Add Configuration'
@@ -12,17 +12,17 from django.core.validators import MinValueValidator, MaxValueValidator
12
12
13 from apps.main.models import Configuration
13 from apps.main.models import Configuration
14
14
15 AXIS_VALUE = (
15 MODE_VALUE = (
16 ('azimuth', 'PPI'),
16 ('azimuth', 'PPI'),
17 ('elevation', 'RHI')
17 ('elevation', 'RHI')
18 )
18 )
19
19
20 class PedestalConfiguration(Configuration):
20 class PedestalConfiguration(Configuration):
21
21
22 axis = models.CharField(
22 mode = models.CharField(
23 verbose_name='Axis',
23 verbose_name='Mode',
24 max_length=10,
24 max_length=10,
25 choices=AXIS_VALUE,
25 choices=MODE_VALUE,
26 null=False,
26 null=False,
27 blank=False
27 blank=False
28 )
28 )
@@ -155,13 +155,13 class PedestalConfiguration(Configuration):
155 coded_table = base64.standard_b64encode(bytes(byte_table))
155 coded_table = base64.standard_b64encode(bytes(byte_table))
156 coded_table_ascii = coded_table.decode('ascii')
156 coded_table_ascii = coded_table.decode('ascii')
157 print(coded_table_ascii)
157 print(coded_table_ascii)
158 data = {'axis': pedestal.axis, 'speed': pedestal.speed, 'table': coded_table_ascii}
158 data = {'axis': pedestal.mode, 'speed': pedestal.speed, 'table': coded_table_ascii}
159 print(data)
159 print(data)
160 json_data = json.dumps(data)
160 json_data = json.dumps(data)
161 print(json_data)
161 print(json_data)
162 first_position = table[0]
162 first_position = table[0]
163
163
164 if pedestal.axis=='PPI':
164 if pedestal.mode=='PPI':
165 json_az = json.dumps({"axis": 'azimuth', "position": 0.0})
165 json_az = json.dumps({"axis": 'azimuth', "position": 0.0})
166 json_el = json.dumps({"axis": 'elevation', "position": first_position})
166 json_el = json.dumps({"axis": 'elevation', "position": first_position})
167 else:
167 else:
@@ -19,7 +19,7 def conf(request, conf_id):
19
19
20 kwargs = {}
20 kwargs = {}
21 kwargs['dev_conf'] = conf
21 kwargs['dev_conf'] = conf
22 kwargs['dev_conf_keys'] = ['axis', 'speed', 'table']
22 kwargs['dev_conf_keys'] = ['mode', 'speed', 'table']
23
23
24 kwargs['title'] = 'Configuration'
24 kwargs['title'] = 'Configuration'
25 kwargs['suptitle'] = 'Detail'
25 kwargs['suptitle'] = 'Detail'
General Comments 0
You need to be logged in to leave comments. Login now