double_pid_vco.py
27.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Double Pid Vco
# Generated: Fri Apr 21 14:54:08 2017
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from PyQt4 import Qt
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from gnuradio.qtgui import Range, RangeWidget
from optparse import OptionParser
import redpitaya_gnuradio
import sys
class double_pid_vco(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Double Pid Vco")
Qt.QWidget.__init__(self)
self.setWindowTitle("Double Pid Vco")
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "double_pid_vco")
self.restoreGeometry(self.settings.value("geometry").toByteArray())
##################################################
# Variables
##################################################
self.port = port = 1001
self.pid2_sign = pid2_sign = 0
self.pid2_setpoint = pid2_setpoint = 0
self.pid2_rst_int = pid2_rst_int = 0
self.pid2_kp = pid2_kp = 0
self.pid2_ki = pid2_ki = 0
self.pid2_kd = pid2_kd = 0
self.pid1_sign = pid1_sign = 0
self.pid1_setpoint = pid1_setpoint = 0
self.pid1_rst_int = pid1_rst_int = 0
self.pid1_kp = pid1_kp = 0
self.pid1_ki = pid1_ki = 0
self.pid1_kd = pid1_kd = 0
self.dds2_range = dds2_range = 0
self.dds2_poff_sw = dds2_poff_sw = 1
self.dds2_pinc_sw = dds2_pinc_sw = 1
self.dds2_offset = dds2_offset = 0
self.dds2_nco = dds2_nco = 40750000
self.dds2_f0 = dds2_f0 = 40750000
self.dds2_ampl = dds2_ampl = 0
self.dds1_range = dds1_range = 0
self.dds1_poff_sw = dds1_poff_sw = 1
self.dds1_pinc_sw = dds1_pinc_sw = 1
self.dds1_offset = dds1_offset = 0
self.dds1_nco = dds1_nco = 39500000
self.dds1_f0 = dds1_f0 = 39500000
self.dds1_ampl = dds1_ampl = 0
self.addr = addr = "192.168.0.203"
self.adc2_offset = adc2_offset = 0
self.adc1_offset = adc1_offset = 0
##################################################
# Blocks
##################################################
_pid2_sign_check_box = Qt.QCheckBox('pid2_sign')
self._pid2_sign_choices = {True: 1, False: 0}
self._pid2_sign_choices_inv = dict((v,k) for k,v in self._pid2_sign_choices.iteritems())
self._pid2_sign_callback = lambda i: Qt.QMetaObject.invokeMethod(_pid2_sign_check_box, "setChecked", Qt.Q_ARG("bool", self._pid2_sign_choices_inv[i]))
self._pid2_sign_callback(self.pid2_sign)
_pid2_sign_check_box.stateChanged.connect(lambda i: self.set_pid2_sign(self._pid2_sign_choices[bool(i)]))
self.top_grid_layout.addWidget(_pid2_sign_check_box, 10,1)
self._pid2_setpoint_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._pid2_setpoint_win = RangeWidget(self._pid2_setpoint_range, self.set_pid2_setpoint, 'pid2_setpoint', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid2_setpoint_win, 9,1)
_pid2_rst_int_push_button = Qt.QPushButton('pid2_rst_int')
self._pid2_rst_int_choices = {'Pressed': 1, 'Released': 0}
_pid2_rst_int_push_button.pressed.connect(lambda: self.set_pid2_rst_int(self._pid2_rst_int_choices['Pressed']))
_pid2_rst_int_push_button.released.connect(lambda: self.set_pid2_rst_int(self._pid2_rst_int_choices['Released']))
self.top_grid_layout.addWidget(_pid2_rst_int_push_button, 11,1)
self._pid2_kp_range = Range(0, 2**13-1, 1, 0, 200)
self._pid2_kp_win = RangeWidget(self._pid2_kp_range, self.set_pid2_kp, 'pid2_kp', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid2_kp_win, 6,1)
self._pid2_ki_range = Range(0, 2**13-1, 1, 0, 200)
self._pid2_ki_win = RangeWidget(self._pid2_ki_range, self.set_pid2_ki, 'pid2_ki', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid2_ki_win, 7,1)
self._pid2_kd_range = Range(0, 2**13-1, 1, 0, 200)
self._pid2_kd_win = RangeWidget(self._pid2_kd_range, self.set_pid2_kd, 'pid2_kd', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid2_kd_win, 8,1)
_pid1_sign_check_box = Qt.QCheckBox('pid1_sign')
self._pid1_sign_choices = {True: 1, False: 0}
self._pid1_sign_choices_inv = dict((v,k) for k,v in self._pid1_sign_choices.iteritems())
self._pid1_sign_callback = lambda i: Qt.QMetaObject.invokeMethod(_pid1_sign_check_box, "setChecked", Qt.Q_ARG("bool", self._pid1_sign_choices_inv[i]))
self._pid1_sign_callback(self.pid1_sign)
_pid1_sign_check_box.stateChanged.connect(lambda i: self.set_pid1_sign(self._pid1_sign_choices[bool(i)]))
self.top_grid_layout.addWidget(_pid1_sign_check_box, 10,0)
self._pid1_setpoint_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._pid1_setpoint_win = RangeWidget(self._pid1_setpoint_range, self.set_pid1_setpoint, 'pid1_setpoint', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid1_setpoint_win, 9,0)
_pid1_rst_int_push_button = Qt.QPushButton('pid1_rst_int')
self._pid1_rst_int_choices = {'Pressed': 1, 'Released': 0}
_pid1_rst_int_push_button.pressed.connect(lambda: self.set_pid1_rst_int(self._pid1_rst_int_choices['Pressed']))
_pid1_rst_int_push_button.released.connect(lambda: self.set_pid1_rst_int(self._pid1_rst_int_choices['Released']))
self.top_grid_layout.addWidget(_pid1_rst_int_push_button, 11,0)
self._pid1_kp_range = Range(0, 2**13-1, 1, 0, 200)
self._pid1_kp_win = RangeWidget(self._pid1_kp_range, self.set_pid1_kp, 'pid1_kp', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid1_kp_win, 6,0)
self._pid1_ki_range = Range(0, 2**13-1, 1, 0, 200)
self._pid1_ki_win = RangeWidget(self._pid1_ki_range, self.set_pid1_ki, 'pid1_ki', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid1_ki_win, 7,0)
self._pid1_kd_range = Range(0, 2**13-1, 1, 0, 200)
self._pid1_kd_win = RangeWidget(self._pid1_kd_range, self.set_pid1_kd, 'pid1_kd', "counter_slider", int)
self.top_grid_layout.addWidget(self._pid1_kd_win, 8,0)
self._dds2_range_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._dds2_range_win = RangeWidget(self._dds2_range_range, self.set_dds2_range, 'dds2_range', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds2_range_win, 13,1)
_dds2_poff_sw_check_box = Qt.QCheckBox('dds2_poff_sw')
self._dds2_poff_sw_choices = {True: 1, False: 0}
self._dds2_poff_sw_choices_inv = dict((v,k) for k,v in self._dds2_poff_sw_choices.iteritems())
self._dds2_poff_sw_callback = lambda i: Qt.QMetaObject.invokeMethod(_dds2_poff_sw_check_box, "setChecked", Qt.Q_ARG("bool", self._dds2_poff_sw_choices_inv[i]))
self._dds2_poff_sw_callback(self.dds2_poff_sw)
_dds2_poff_sw_check_box.stateChanged.connect(lambda i: self.set_dds2_poff_sw(self._dds2_poff_sw_choices[bool(i)]))
self.top_grid_layout.addWidget(_dds2_poff_sw_check_box, 2, 1)
_dds2_pinc_sw_check_box = Qt.QCheckBox('dds2_pinc_sw')
self._dds2_pinc_sw_choices = {True: 1, False: 0}
self._dds2_pinc_sw_choices_inv = dict((v,k) for k,v in self._dds2_pinc_sw_choices.iteritems())
self._dds2_pinc_sw_callback = lambda i: Qt.QMetaObject.invokeMethod(_dds2_pinc_sw_check_box, "setChecked", Qt.Q_ARG("bool", self._dds2_pinc_sw_choices_inv[i]))
self._dds2_pinc_sw_callback(self.dds2_pinc_sw)
_dds2_pinc_sw_check_box.stateChanged.connect(lambda i: self.set_dds2_pinc_sw(self._dds2_pinc_sw_choices[bool(i)]))
self.top_grid_layout.addWidget(_dds2_pinc_sw_check_box, 1,1)
self._dds2_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._dds2_offset_win = RangeWidget(self._dds2_offset_range, self.set_dds2_offset, 'dds2_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds2_offset_win, 4,1)
self._dds2_nco_range = Range(0, 60000000, 1, 40750000, 200)
self._dds2_nco_win = RangeWidget(self._dds2_nco_range, self.set_dds2_nco, 'dds2_nco', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds2_nco_win, 0,1)
self._dds2_f0_range = Range(0, 60000000, 1, 40750000, 200)
self._dds2_f0_win = RangeWidget(self._dds2_f0_range, self.set_dds2_f0, 'dds2_f0', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds2_f0_win, 12,1)
self._dds2_ampl_range = Range(0, 2**13-1, 1, 0, 200)
self._dds2_ampl_win = RangeWidget(self._dds2_ampl_range, self.set_dds2_ampl, 'dds2_ampl', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds2_ampl_win, 3,1)
self._dds1_range_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._dds1_range_win = RangeWidget(self._dds1_range_range, self.set_dds1_range, 'dds1_range', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds1_range_win, 13,0)
_dds1_poff_sw_check_box = Qt.QCheckBox('dds1_poff_sw')
self._dds1_poff_sw_choices = {True: 1, False: 0}
self._dds1_poff_sw_choices_inv = dict((v,k) for k,v in self._dds1_poff_sw_choices.iteritems())
self._dds1_poff_sw_callback = lambda i: Qt.QMetaObject.invokeMethod(_dds1_poff_sw_check_box, "setChecked", Qt.Q_ARG("bool", self._dds1_poff_sw_choices_inv[i]))
self._dds1_poff_sw_callback(self.dds1_poff_sw)
_dds1_poff_sw_check_box.stateChanged.connect(lambda i: self.set_dds1_poff_sw(self._dds1_poff_sw_choices[bool(i)]))
self.top_grid_layout.addWidget(_dds1_poff_sw_check_box, 2, 0)
_dds1_pinc_sw_check_box = Qt.QCheckBox('dds1_pinc_sw')
self._dds1_pinc_sw_choices = {True: 1, False: 0}
self._dds1_pinc_sw_choices_inv = dict((v,k) for k,v in self._dds1_pinc_sw_choices.iteritems())
self._dds1_pinc_sw_callback = lambda i: Qt.QMetaObject.invokeMethod(_dds1_pinc_sw_check_box, "setChecked", Qt.Q_ARG("bool", self._dds1_pinc_sw_choices_inv[i]))
self._dds1_pinc_sw_callback(self.dds1_pinc_sw)
_dds1_pinc_sw_check_box.stateChanged.connect(lambda i: self.set_dds1_pinc_sw(self._dds1_pinc_sw_choices[bool(i)]))
self.top_grid_layout.addWidget(_dds1_pinc_sw_check_box, 1,0)
self._dds1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._dds1_offset_win = RangeWidget(self._dds1_offset_range, self.set_dds1_offset, 'dds1_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds1_offset_win, 4,0)
self._dds1_nco_range = Range(0, 60000000, 1, 39500000, 200)
self._dds1_nco_win = RangeWidget(self._dds1_nco_range, self.set_dds1_nco, 'dds1_nco', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds1_nco_win, 0,0)
self._dds1_f0_range = Range(0, 60000000, 1, 39500000, 200)
self._dds1_f0_win = RangeWidget(self._dds1_f0_range, self.set_dds1_f0, 'dds1_f0', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds1_f0_win, 12,0)
self._dds1_ampl_range = Range(0, 2**13-1, 1, 0, 200)
self._dds1_ampl_win = RangeWidget(self._dds1_ampl_range, self.set_dds1_ampl, 'dds1_ampl', "counter_slider", int)
self.top_grid_layout.addWidget(self._dds1_ampl_win, 3,0)
self._adc2_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._adc2_offset_win = RangeWidget(self._adc2_offset_range, self.set_adc2_offset, 'adc2_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._adc2_offset_win, 5,1)
self._adc1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200)
self._adc1_offset_win = RangeWidget(self._adc1_offset_range, self.set_adc1_offset, 'adc1_offset', "counter_slider", int)
self.top_grid_layout.addWidget(self._adc1_offset_win, 5,0)
self.nco_counter_send_conf_0_0 = redpitaya_gnuradio.nco_counter_send_conf(
addr=addr,
port=port,
device='/dev/dds2_nco',
freq_ref=125000000,
freq_dds=dds2_nco,
acc_size=32,
offset=0,
pinc_sw=dds2_pinc_sw,
poff_sw=dds2_poff_sw,
)
self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf(
addr=addr,
port=port,
device='/dev/dds1_nco',
freq_ref=125000000,
freq_dds=dds1_nco,
acc_size=32,
offset=0,
pinc_sw=dds1_pinc_sw,
poff_sw=dds1_poff_sw,
)
self.add_const_set_offset_0_0_0_1_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_setpoint',
const=pid2_setpoint,
)
self.add_const_set_offset_0_0_0_1_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_kp',
const=pid2_kp,
)
self.add_const_set_offset_0_0_0_1_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_ki',
const=pid2_ki,
)
self.add_const_set_offset_0_0_0_1_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_kd',
const=pid2_kd,
)
self.add_const_set_offset_0_0_0_1_0_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_sign',
const=pid2_sign,
)
self.add_const_set_offset_0_0_0_1_0_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid2_rst_int',
const=pid2_rst_int,
)
self.add_const_set_offset_0_0_0_1_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_rst_int',
const=pid1_rst_int,
)
self.add_const_set_offset_0_0_0_1_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_sign',
const=pid1_sign,
)
self.add_const_set_offset_0_0_0_1_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_kd',
const=pid1_kd,
)
self.add_const_set_offset_0_0_0_1_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_ki',
const=pid1_ki,
)
self.add_const_set_offset_0_0_0_1_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_kp',
const=pid1_kp,
)
self.add_const_set_offset_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/pid1_setpoint',
const=pid1_setpoint,
)
self.add_const_set_offset_0_0_0_0_1_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds2_offset',
const=dds2_offset,
)
self.add_const_set_offset_0_0_0_0_1_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds2_f0',
const=int(dds2_f0/(125e6/2**32)),
)
self.add_const_set_offset_0_0_0_0_1_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds2_range',
const=dds2_range,
)
self.add_const_set_offset_0_0_0_0_1_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds1_range',
const=dds1_range,
)
self.add_const_set_offset_0_0_0_0_1_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds1_f0',
const=int(dds1_f0/(125e6/2**32)),
)
self.add_const_set_offset_0_0_0_0_1 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds1_offset',
const=dds1_offset,
)
self.add_const_set_offset_0_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds2_ampl',
const=dds2_ampl,
)
self.add_const_set_offset_0_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/dds1_ampl',
const=dds1_ampl,
)
self.add_const_set_offset_0_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/adc2_offset',
const=adc2_offset,
)
self.add_const_set_offset_0_0_0 = redpitaya_gnuradio.add_const_set_offset(
addr=addr,
port=port,
device='/dev/adc1_offset',
const=adc1_offset,
)
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "double_pid_vco")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
def get_port(self):
return self.port
def set_port(self, port):
self.port = port
def get_pid2_sign(self):
return self.pid2_sign
def set_pid2_sign(self, pid2_sign):
self.pid2_sign = pid2_sign
self._pid2_sign_callback(self.pid2_sign)
self.add_const_set_offset_0_0_0_1_0_0_0_0_1.set_const(device='/dev/pid2_sign', const=self.pid2_sign)
def get_pid2_setpoint(self):
return self.pid2_setpoint
def set_pid2_setpoint(self, pid2_setpoint):
self.pid2_setpoint = pid2_setpoint
self.add_const_set_offset_0_0_0_1_1.set_const(device='/dev/pid2_setpoint', const=self.pid2_setpoint)
def get_pid2_rst_int(self):
return self.pid2_rst_int
def set_pid2_rst_int(self, pid2_rst_int):
self.pid2_rst_int = pid2_rst_int
self.add_const_set_offset_0_0_0_1_0_0_0_0_0_0.set_const(device='/dev/pid2_rst_int', const=self.pid2_rst_int)
def get_pid2_kp(self):
return self.pid2_kp
def set_pid2_kp(self, pid2_kp):
self.pid2_kp = pid2_kp
self.add_const_set_offset_0_0_0_1_0_1.set_const(device='/dev/pid2_kp', const=self.pid2_kp)
def get_pid2_ki(self):
return self.pid2_ki
def set_pid2_ki(self, pid2_ki):
self.pid2_ki = pid2_ki
self.add_const_set_offset_0_0_0_1_0_0_1.set_const(device='/dev/pid2_ki', const=self.pid2_ki)
def get_pid2_kd(self):
return self.pid2_kd
def set_pid2_kd(self, pid2_kd):
self.pid2_kd = pid2_kd
self.add_const_set_offset_0_0_0_1_0_0_0_1.set_const(device='/dev/pid2_kd', const=self.pid2_kd)
def get_pid1_sign(self):
return self.pid1_sign
def set_pid1_sign(self, pid1_sign):
self.pid1_sign = pid1_sign
self._pid1_sign_callback(self.pid1_sign)
self.add_const_set_offset_0_0_0_1_0_0_0_0.set_const(device='/dev/pid1_sign', const=self.pid1_sign)
def get_pid1_setpoint(self):
return self.pid1_setpoint
def set_pid1_setpoint(self, pid1_setpoint):
self.pid1_setpoint = pid1_setpoint
self.add_const_set_offset_0_0_0_1.set_const(device='/dev/pid1_setpoint', const=self.pid1_setpoint)
def get_pid1_rst_int(self):
return self.pid1_rst_int
def set_pid1_rst_int(self, pid1_rst_int):
self.pid1_rst_int = pid1_rst_int
self.add_const_set_offset_0_0_0_1_0_0_0_0_0.set_const(device='/dev/pid1_rst_int', const=self.pid1_rst_int)
def get_pid1_kp(self):
return self.pid1_kp
def set_pid1_kp(self, pid1_kp):
self.pid1_kp = pid1_kp
self.add_const_set_offset_0_0_0_1_0.set_const(device='/dev/pid1_kp', const=self.pid1_kp)
def get_pid1_ki(self):
return self.pid1_ki
def set_pid1_ki(self, pid1_ki):
self.pid1_ki = pid1_ki
self.add_const_set_offset_0_0_0_1_0_0.set_const(device='/dev/pid1_ki', const=self.pid1_ki)
def get_pid1_kd(self):
return self.pid1_kd
def set_pid1_kd(self, pid1_kd):
self.pid1_kd = pid1_kd
self.add_const_set_offset_0_0_0_1_0_0_0.set_const(device='/dev/pid1_kd', const=self.pid1_kd)
def get_dds2_range(self):
return self.dds2_range
def set_dds2_range(self, dds2_range):
self.dds2_range = dds2_range
self.add_const_set_offset_0_0_0_0_1_0_0_0.set_const(device='/dev/dds2_range', const=self.dds2_range)
def get_dds2_poff_sw(self):
return self.dds2_poff_sw
def set_dds2_poff_sw(self, dds2_poff_sw):
self.dds2_poff_sw = dds2_poff_sw
self._dds2_poff_sw_callback(self.dds2_poff_sw)
self.nco_counter_send_conf_0_0.set_nco(device='/dev/dds2_nco', freq_ref=125000000, freq_dds=self.dds2_nco, acc_size=32, offset=0, pinc_sw=self.dds2_pinc_sw, poff_sw=self.dds2_poff_sw)
def get_dds2_pinc_sw(self):
return self.dds2_pinc_sw
def set_dds2_pinc_sw(self, dds2_pinc_sw):
self.dds2_pinc_sw = dds2_pinc_sw
self._dds2_pinc_sw_callback(self.dds2_pinc_sw)
self.nco_counter_send_conf_0_0.set_nco(device='/dev/dds2_nco', freq_ref=125000000, freq_dds=self.dds2_nco, acc_size=32, offset=0, pinc_sw=self.dds2_pinc_sw, poff_sw=self.dds2_poff_sw)
def get_dds2_offset(self):
return self.dds2_offset
def set_dds2_offset(self, dds2_offset):
self.dds2_offset = dds2_offset
self.add_const_set_offset_0_0_0_0_1_1.set_const(device='/dev/dds2_offset', const=self.dds2_offset)
def get_dds2_nco(self):
return self.dds2_nco
def set_dds2_nco(self, dds2_nco):
self.dds2_nco = dds2_nco
self.nco_counter_send_conf_0_0.set_nco(device='/dev/dds2_nco', freq_ref=125000000, freq_dds=self.dds2_nco, acc_size=32, offset=0, pinc_sw=self.dds2_pinc_sw, poff_sw=self.dds2_poff_sw)
def get_dds2_f0(self):
return self.dds2_f0
def set_dds2_f0(self, dds2_f0):
self.dds2_f0 = dds2_f0
self.add_const_set_offset_0_0_0_0_1_0_1.set_const(device='/dev/dds2_f0', const=int(self.dds2_f0/(125e6/2**32)))
def get_dds2_ampl(self):
return self.dds2_ampl
def set_dds2_ampl(self, dds2_ampl):
self.dds2_ampl = dds2_ampl
self.add_const_set_offset_0_0_0_0_0_0.set_const(device='/dev/dds2_ampl', const=self.dds2_ampl)
def get_dds1_range(self):
return self.dds1_range
def set_dds1_range(self, dds1_range):
self.dds1_range = dds1_range
self.add_const_set_offset_0_0_0_0_1_0_0.set_const(device='/dev/dds1_range', const=self.dds1_range)
def get_dds1_poff_sw(self):
return self.dds1_poff_sw
def set_dds1_poff_sw(self, dds1_poff_sw):
self.dds1_poff_sw = dds1_poff_sw
self._dds1_poff_sw_callback(self.dds1_poff_sw)
self.nco_counter_send_conf_0.set_nco(device='/dev/dds1_nco', freq_ref=125000000, freq_dds=self.dds1_nco, acc_size=32, offset=0, pinc_sw=self.dds1_pinc_sw, poff_sw=self.dds1_poff_sw)
def get_dds1_pinc_sw(self):
return self.dds1_pinc_sw
def set_dds1_pinc_sw(self, dds1_pinc_sw):
self.dds1_pinc_sw = dds1_pinc_sw
self._dds1_pinc_sw_callback(self.dds1_pinc_sw)
self.nco_counter_send_conf_0.set_nco(device='/dev/dds1_nco', freq_ref=125000000, freq_dds=self.dds1_nco, acc_size=32, offset=0, pinc_sw=self.dds1_pinc_sw, poff_sw=self.dds1_poff_sw)
def get_dds1_offset(self):
return self.dds1_offset
def set_dds1_offset(self, dds1_offset):
self.dds1_offset = dds1_offset
self.add_const_set_offset_0_0_0_0_1.set_const(device='/dev/dds1_offset', const=self.dds1_offset)
def get_dds1_nco(self):
return self.dds1_nco
def set_dds1_nco(self, dds1_nco):
self.dds1_nco = dds1_nco
self.nco_counter_send_conf_0.set_nco(device='/dev/dds1_nco', freq_ref=125000000, freq_dds=self.dds1_nco, acc_size=32, offset=0, pinc_sw=self.dds1_pinc_sw, poff_sw=self.dds1_poff_sw)
def get_dds1_f0(self):
return self.dds1_f0
def set_dds1_f0(self, dds1_f0):
self.dds1_f0 = dds1_f0
self.add_const_set_offset_0_0_0_0_1_0.set_const(device='/dev/dds1_f0', const=int(self.dds1_f0/(125e6/2**32)))
def get_dds1_ampl(self):
return self.dds1_ampl
def set_dds1_ampl(self, dds1_ampl):
self.dds1_ampl = dds1_ampl
self.add_const_set_offset_0_0_0_0_0.set_const(device='/dev/dds1_ampl', const=self.dds1_ampl)
def get_addr(self):
return self.addr
def set_addr(self, addr):
self.addr = addr
def get_adc2_offset(self):
return self.adc2_offset
def set_adc2_offset(self, adc2_offset):
self.adc2_offset = adc2_offset
self.add_const_set_offset_0_0_0_0.set_const(device='/dev/adc2_offset', const=self.adc2_offset)
def get_adc1_offset(self):
return self.adc1_offset
def set_adc1_offset(self, adc1_offset):
self.adc1_offset = adc1_offset
self.add_const_set_offset_0_0_0.set_const(device='/dev/adc1_offset', const=self.adc1_offset)
def main(top_block_cls=double_pid_vco, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
if __name__ == '__main__':
main()