@@ -283,6 +283,7 class ReceiverData(ProcessingUnit, Process): | |||||
283 | self.data['throttle'] = self.throttle_value |
|
283 | self.data['throttle'] = self.throttle_value | |
284 | self.data['ENDED'] = False |
|
284 | self.data['ENDED'] = False | |
285 | self.isConfig = True |
|
285 | self.isConfig = True | |
|
286 | self.data_web = {} | |||
286 |
|
287 | |||
287 | def event_monitor(self, monitor): |
|
288 | def event_monitor(self, monitor): | |
288 |
|
289 | |||
@@ -327,7 +328,6 class ReceiverData(ProcessingUnit, Process): | |||||
327 | self.data['times'].append(t) |
|
328 | self.data['times'].append(t) | |
328 | self.data['dataOut'] = self.dataOut |
|
329 | self.data['dataOut'] = self.dataOut | |
329 | for plottype in self.plottypes: |
|
330 | for plottype in self.plottypes: | |
330 |
|
||||
331 | if plottype == 'spc': |
|
331 | if plottype == 'spc': | |
332 | z = self.dataOut.data_spc/self.dataOut.normFactor |
|
332 | z = self.dataOut.data_spc/self.dataOut.normFactor | |
333 | self.data[plottype] = 10*numpy.log10(z) |
|
333 | self.data[plottype] = 10*numpy.log10(z) | |
@@ -342,7 +342,9 class ReceiverData(ProcessingUnit, Process): | |||||
342 | self.data[plottype][t] = self.dataOut.getCoherence() |
|
342 | self.data[plottype][t] = self.dataOut.getCoherence() | |
343 | if plottype == 'phase': |
|
343 | if plottype == 'phase': | |
344 | self.data[plottype][t] = self.dataOut.getCoherence(phase=True) |
|
344 | self.data[plottype][t] = self.dataOut.getCoherence(phase=True) | |
345 |
|
345 | if self.realtime: | ||
|
346 | self.data_web[plottype] = self.data[plottype][t] | |||
|
347 | self.data_web['time'] = t | |||
346 | def run(self): |
|
348 | def run(self): | |
347 |
|
349 | |||
348 | print '[Starting] {} from {}'.format(self.name, self.address) |
|
350 | print '[Starting] {} from {}'.format(self.name, self.address) | |
@@ -352,10 +354,12 class ReceiverData(ProcessingUnit, Process): | |||||
352 | self.receiver.bind(self.address) |
|
354 | self.receiver.bind(self.address) | |
353 | monitor = self.receiver.get_monitor_socket() |
|
355 | monitor = self.receiver.get_monitor_socket() | |
354 | self.sender = self.context.socket(zmq.PUB) |
|
356 | self.sender = self.context.socket(zmq.PUB) | |
355 |
|
357 | if self.realtime: | ||
|
358 | self.sender_web = self.context.socket(zmq.PUB) | |||
|
359 | self.sender.bind("ipc:///tmp/zmq.web") | |||
356 | self.sender.bind("ipc:///tmp/zmq.plots") |
|
360 | self.sender.bind("ipc:///tmp/zmq.plots") | |
357 |
|
361 | |||
358 |
t = Thread(target=self.event_monitor |
|
362 | t = Thread(target=self.event_monitor) | |
359 | t.start() |
|
363 | t.start() | |
360 |
|
364 | |||
361 | while True: |
|
365 | while True: | |
@@ -376,6 +380,7 class ReceiverData(ProcessingUnit, Process): | |||||
376 | else: |
|
380 | else: | |
377 | if self.realtime: |
|
381 | if self.realtime: | |
378 | self.send(self.data) |
|
382 | self.send(self.data) | |
|
383 | self.sender_web.send_json(json.dumps(self.data_web)) | |||
379 | else: |
|
384 | else: | |
380 | self.sendData(self.send, self.data) |
|
385 | self.sendData(self.send, self.data) | |
381 | self.started = True |
|
386 | self.started = True |
@@ -15,21 +15,23 if __name__ == '__main__': | |||||
15 | controllerObj.setup(id='191', name='test01', description=desc) |
|
15 | controllerObj.setup(id='191', name='test01', description=desc) | |
16 |
|
16 | |||
17 | proc1 = controllerObj.addProcUnit(name='ReceiverData') |
|
17 | proc1 = controllerObj.addProcUnit(name='ReceiverData') | |
18 |
proc1.addParameter(name='realtime', value=' |
|
18 | proc1.addParameter(name='realtime', value='1', format='bool') | |
19 | proc1.addParameter(name='plottypes', value='rti,coh,phase', format='str') |
|
|||
20 | proc1.addParameter(name='throttle', value='10', format='int') |
|
|||
21 |
|
19 | |||
22 | op1 = proc1.addOperation(name='PlotRTIData', optype='other') |
|
20 | proc1.addParameter(name='plottypes', value='rti', format='str') | |
23 |
|
|
21 | proc1.addParameter(name='throttle', value='10', format='int') | |
24 | op1.addParameter(name='save', value='/home/nanosat/Pictures', format='str') |
|
22 | ## TODO Agregar direccion de server de publicacion a graficos como variable | |
25 |
|
23 | |||
26 |
|
|
24 | # op1 = proc1.addOperation(name='PlotRTIData', optype='other') | |
27 |
|
|
25 | # op1.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
28 |
|
|
26 | # op1.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
29 | # |
|
27 | # | |
30 |
|
|
28 | # op2 = proc1.addOperation(name='PlotCOHData', optype='other') | |
31 |
|
|
29 | # op2.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
32 |
|
|
30 | # op2.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
|
31 | # # | |||
|
32 | # op6 = proc1.addOperation(name='PlotPHASEData', optype='other') | |||
|
33 | # op6.addParameter(name='wintitle', value='Julia 150Km', format='str') | |||
|
34 | # op6.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |||
33 | # |
|
35 | # | |
34 | # proc2 = controllerObj.addProcUnit(name='ReceiverData') |
|
36 | # proc2 = controllerObj.addProcUnit(name='ReceiverData') | |
35 | # proc2.addParameter(name='server', value='juanca', format='str') |
|
37 | # proc2.addParameter(name='server', value='juanca', format='str') |
General Comments 0
You need to be logged in to leave comments.
Login now