Status
@@ -82,14 +82,14 @@
@@ -98,7 +98,20 @@
Power Alerts
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempora quisquam cupiditate sunt eaque distinctio explicabo aliquam blanditiis illo eligendi eveniet culpa, vel laboriosam! Facilis dolores assumenda autem. Maiores, quibusdam eum.
+
+
+
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+
+
+
diff --git a/apps/atrad/templates/atrad_tx.html b/apps/atrad/templates/atrad_tx.html
index 4b6fa99..d303cd8 100644
--- a/apps/atrad/templates/atrad_tx.html
+++ b/apps/atrad/templates/atrad_tx.html
@@ -69,21 +69,21 @@
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function(data) {
console.log('Connecting... OK');
- var data = '{{data|safe}}'.split(',')
- console.log(data);
- makePlot("plot-temp-0",4,["PC1","PC2","PC3","PC4"],[0,40]);
- makePlot("plot-temp-1",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[0,40])
- makePlot("plot-temp-2",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[0,40])
- makePlot("plot-temp-3",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[0,40])
- makePlot("plot-temp-4",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[0,40])
- })
+ var basedata = JSON.parse('{{data|safe}}')
+ console.log(basedata);
+ makePlot("plot-temp-0",4,["PC1","PC2","PC3","PC4"],[10,40]);
+ makePlot2("plot-temp-1",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[10,40],basedata)
+ makePlot2("plot-temp-2",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[10,40],basedata)
+ makePlot2("plot-temp-3",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[10,40],basedata)
+ makePlot2("plot-temp-4",6,["PA1","PA2","PA3","PA4","PA5","PA6"],[10,40],basedata)
+ })
socket.on("temptx"+"{{id_tx}}", function(data) {
var controllers = [data.temp[0][1],data.temp[1][1],data.temp[2][1],data.temp[3][1]]
streamPlot2("plot-temp-0",data.time,controllers,4);
- streamPlot2("plot-temp-1",data.time,data.temp[0].slice(1,7),6);
- streamPlot2("plot-temp-2",data.time,data.temp[1].slice(1,7),6);
- streamPlot2("plot-temp-3",data.time,data.temp[2].slice(1,7),6);
- streamPlot2("plot-temp-4",data.time,data.temp[3].slice(1,7),6);
+ streamPlot2("plot-temp-1",data.time,data.temp[0].slice(2,8),6);
+ streamPlot2("plot-temp-2",data.time,data.temp[1].slice(2,8),6);
+ streamPlot2("plot-temp-3",data.time,data.temp[2].slice(2,8),6);
+ streamPlot2("plot-temp-4",data.time,data.temp[3].slice(2,8),6);
})
});
@@ -97,6 +97,38 @@
var yrange = ranges;
var layout = {
width: 505,
+ height: 300,
+ font: {size: 12},
+ margin: { t: 10, b:50, r:15 ,l:15},
+ xaxis: {
+ type: 'date'
+ },
+ yaxis: {
+ range: yrange,
+ },
+ legend: {"orientation": "h"},
+ };
+ var config = {responsive: true}
+ Plotly.newPlot(plotDiv, traces, layout,config);
+ };
+
+ function makePlot2(div, n=1, names=["", ""],ranges,data){
+ var plotDiv = document.getElementById(div);
+ var traces = [];
+ var keys = ['temp1','temp2','temp3','temp4','temp5','temp6']
+
+ for (let i = 0; i < n; i++) {
+ var x = [];
+ var y = [];
+ for(let j = 0;j < data.length; j++){
+ x[j] = data[j].datetime;
+ y[j] = data[j][keys[i]+'_'+div.charAt(10)];
+ }
+ traces.push({x:x, y:y,mode: 'lines', name: names[i]});
+ }
+ var yrange = ranges;
+ var layout = {
+ width: 505,
height: 400,
font: {size: 12},
margin: { t: 10, b:50, r:15 ,l:15},
diff --git a/apps/atrad/views.py b/apps/atrad/views.py
index a65da20..6d8d238 100644
--- a/apps/atrad/views.py
+++ b/apps/atrad/views.py
@@ -47,12 +47,14 @@ def atrad_conf(request, id_conf):
def atrad_tx(request, id_conf, id_tx):
kwargs = {}
kwargs['id_tx'] = id_tx[-1]
- kwargs['keys'] = ['id','temp1','temp2','temp3','temp4','temp5','temp6']
kwargs['title'] = 'Temperature Details'
kwargs['button'] = 'Edit Configuration'
time = ATRADData.objects.last().datetime
- mydata = ATRADData.objects.filter(datetime__gte = (time-timedelta(minutes=20)),nstx=1).values_list('datetime','temp1','temp2','temp3','temp4','temp5','temp6')
- kwargs['data'] = QuerytoStr(mydata)
+ id_stx = (int(id_tx[-1])-1)*4+1
+ mydata = ATRADData.objects.filter(datetime__gte = (time-timedelta(hours=1)),nstx = id_stx).values('datetime','temp1_1','temp2_1','temp3_1','temp4_1','temp5_1','temp6_1',
+ 'temp1_2','temp2_2','temp3_2','temp4_2','temp5_2','temp6_2','temp1_3','temp2_3','temp3_3','temp4_3','temp5_3','temp6_3',
+ 'temp1_4','temp2_4','temp3_4','temp4_4','temp5_4','temp6_4')
+ kwargs['data'] = json.dumps(list(mydata),default=str)
return render(request, 'atrad_tx.html', kwargs)
def QuerytoStr(data):
@@ -99,7 +101,9 @@ def monitor(request):
def atrad_prueba(request):
keys = ['id','temp1','temp2','temp3','temp4','temp5','temp6']
time = ATRADData.objects.last().datetime
- mydata = ATRADData.objects.filter(datetime__gte = (time-timedelta(hours=1))).values('id','temp1','temp2','temp3','temp4','temp5','temp6')
+ mydata = ATRADData.objects.filter(datetime__gte = (time-timedelta(hours=1))).values('id','temp1_1','temp2_1','temp3_1','temp4_1','temp5_1','temp6_1',
+ 'temp1_2','temp2_2','temp3_2','temp4_2','temp5_2','temp6_2','temp1_3','temp2_3','temp3_3','temp4_3','temp5_3','temp6_3',
+ 'temp1_4','temp2_4','temp3_4','temp4_4','temp5_4','temp6_4')
template = get_template('prueba.html')
context = {
'last' : time,
@@ -118,4 +122,4 @@ def atrad_disconnect(sid):
@sio.event
def atrad_control_event(sid,message):
- mqtt_client.publish('test/data2', json.dumps(message))
+ mqtt_client.publish('test/data2', json.dumps(message))
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index d27c93e..e6e64b6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -45,7 +45,7 @@ services:
restart: always
build: ./nginx/
ports:
- - '0.0.0.0:80:80'
+ - '0.0.0.0:8086:80'
volumes_from:
- radarsys
links:
diff --git a/radarsys/static/js/atrad-conf.js b/radarsys/static/js/atrad-conf.js
index 9547168..7a99c73 100644
--- a/radarsys/static/js/atrad-conf.js
+++ b/radarsys/static/js/atrad-conf.js
@@ -34,12 +34,12 @@ function UpdateData(id,data){
streamPlot("plot-temp",data.time,data.tmax[0],id,40);
streamPlot2("plot-pot-t"+(id+1),data.time,data.pow);
ligthStatus(id,data.status);
- PotenciaAmplificador(id,data.pow,total);
+ PotenciaAmplificador(id,data.pow,total,data.time);
$('#temp'+(id+1)).text(data.tmax[0]);
if(eval(data.tmax[0])>20){
- $('#alert-time'+(id+1)).text(data.time.slice(-8,));
- $('#alert-temp'+(id+1)).text(data.tmax[0]);
- $('#alert-loc'+(id+1)).text('Tx'+(id+1)+' '+data.tmax[1]);
+ $('#alerttemp-time'+(id+1)).text(data.time.slice(-8,));
+ $('#alerttemp-'+(id+1)).text(data.tmax[0]);
+ $('#alerttemp-loc'+(id+1)).text('Tx'+(id+1)+' '+data.tmax[1]);
}
}
@@ -115,13 +115,20 @@ function ligthStatus(id,status){
}
};
-function PotenciaAmplificador(id,data1,data2){
- let div = '#pot'+(id+1);
+function PotenciaAmplificador(id,data1,data2,time){
+ id_tx = (id+1)
+ let div = '#pot'+id_tx;
for(let i=1; i<5; i++){
- $(div+'-'+i).text(data1[i-1]/1000.0);
- }
- $(div).text(data2);
+ var pot = (data1[i-1]/1000.0).toFixed(1)
+ $(div+'-'+i).text(pot);
+ if (data1[i-1]<23000){
+ $("#alertpot-time"+id_tx).text(time.slice(-8,));
+ $("#alertpot-"+id_tx).text(pot);
+ $("#alertpot-loc"+id_tx).text('Tx'+ id_tx+ ' Amp '+i);
+ }
}
- $(".clickable-row").click(function() {
+ $(div).text(data2.toFixed(1));
+}
+$(".clickable-row").click(function() {
window.open($(this).data("href"),);
});
\ No newline at end of file