aboutsummaryrefslogtreecommitdiffstats
path: root/amplitude_ramp.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-08-07 12:58:25 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-08-07 12:58:25 +0200
commit89481b6ba5c1d3ac00e151f2e117b38c1710416e (patch)
tree98aca48b930210f3b00def116e5b63c74c31628f /amplitude_ramp.py
parent50295706666b574400945506b6e19f44f7e9d4b9 (diff)
downloadODR-StaticPrecorrection-89481b6ba5c1d3ac00e151f2e117b38c1710416e.tar.gz
ODR-StaticPrecorrection-89481b6ba5c1d3ac00e151f2e117b38c1710416e.tar.bz2
ODR-StaticPrecorrection-89481b6ba5c1d3ac00e151f2e117b38c1710416e.zip
Replace phase measurement by complex multiply
Diffstat (limited to 'amplitude_ramp.py')
-rwxr-xr-xamplitude_ramp.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/amplitude_ramp.py b/amplitude_ramp.py
index a80dbf7..334bb86 100755
--- a/amplitude_ramp.py
+++ b/amplitude_ramp.py
@@ -64,7 +64,7 @@ class amplitude_ramp(gr.top_block):
self.samp_rate, analog.GR_COS_WAVE, 2000, self.source_ampl, 0)
self.blocks_add_xx_0 = blocks.add_vcc(1)
- # Connects to both USRP output and mag/phase converter
+ # Connects to both USRP output, mag and phase converter
self.uhd_usrp_sink_0 = uhd.usrp_sink(
"",
@@ -77,14 +77,16 @@ class amplitude_ramp(gr.top_block):
self.uhd_usrp_sink_0.set_center_freq(self.freq, 0)
self.uhd_usrp_sink_0.set_gain(self.txgain, 0)
- self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1)
+ self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
+ self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
+ self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
- # mag goes to TCP interleaved, phase goes to subtractor. There is
- # no substraction block, so it is done with multiply by -1 and add
+ # mag goes to TCP interleaver, phase goes to complex multiplier
+ # and complex-to-arg
# Feedback from the USRP, goes to the subtractor after mag/phase
- self.blocks_complex_to_magphase_1 = blocks.complex_to_magphase(1)
+ self.blocks_complex_to_mag_squared_1 = blocks.complex_to_mag_squared(1)
self.uhd_usrp_source_0 = uhd.usrp_source(
"",
uhd.stream_args(
@@ -96,9 +98,6 @@ class amplitude_ramp(gr.top_block):
self.uhd_usrp_source_0.set_center_freq(self.freq, 0)
self.uhd_usrp_source_0.set_gain(self.rxgain, 0)
- self.blocks_invert_signal = blocks.multiply_const_vff((-1, ))
- self.blocks_phase_adder = blocks.add_vff(1)
-
# The interleaved takes gen mag, phase diff and feedback mag
# signals and puts them together. We need to decimate before we interleave
self.blocks_moving_average_gen = blocks.moving_average_ff(self.decim, 1, 4000)
@@ -125,27 +124,31 @@ class amplitude_ramp(gr.top_block):
# Connect outgoing
self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 1))
self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0))
- self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_magphase_0, 0))
+ self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
self.connect((self.blocks_add_xx_0, 0), (self.uhd_usrp_sink_0, 0))
+ self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
- self.connect((self.blocks_complex_to_magphase_0, 0),
+ self.connect((self.blocks_complex_to_mag_squared_0, 0),
(self.blocks_moving_average_gen, 0))
self.connect((self.blocks_moving_average_gen, 0),
(self.fir_filter_gen, 0))
self.connect((self.fir_filter_gen, 0), (self.blocks_interleave, 0))
- self.connect((self.blocks_complex_to_magphase_0, 1),
- (self.blocks_invert_signal, 0))
- self.connect((self.blocks_invert_signal, 0), (self.blocks_phase_adder, 1))
-
# Connect feedback
- self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_magphase_1, 0))
- self.connect((self.blocks_complex_to_magphase_1, 1), (self.blocks_phase_adder, 0))
- self.connect((self.blocks_phase_adder, 0), (self.blocks_moving_average_phase, 0))
+ self.connect((self.uhd_usrp_source_0, 0),
+ (self.blocks_complex_to_mag_squared_1, 0))
+ self.connect((self.uhd_usrp_source_0, 0),
+ (self.blocks_multiply_conjugate_cc_0, 1))
+
+ # Connect phase comparator
+ self.connect((self.blocks_multiply_conjugate_cc_0, 0),
+ (self.blocks_complex_to_arg_0, 0))
+ self.connect((self.blocks_complex_to_arg_0, 0),
+ (self.blocks_moving_average_phase, 0))
self.connect((self.blocks_moving_average_phase, 0), (self.fir_filter_phase, 0))
self.connect((self.fir_filter_phase, 0), (self.blocks_interleave, 1))
- self.connect((self.blocks_complex_to_magphase_1, 0),
+ self.connect((self.blocks_complex_to_mag_squared_1, 0),
(self.blocks_moving_average_feedback, 0))
self.connect((self.blocks_moving_average_feedback, 0),
(self.fir_filter_feedback, 0))