[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] working (in theory) phasing SSB modulator
From: |
cswiger |
Subject: |
[Discuss-gnuradio] working (in theory) phasing SSB modulator |
Date: |
Fri, 18 Feb 2005 14:47:14 -0500 (EST) |
Gang - Ok, here's a phasing SSB modulator that produces
the right output to gnuplot, that is, with an IF of 30Khz,
in upper-sideband, 300hz audio produces 30300hz and 3000hz
audio produces 33000hz, while in lower-sideband 300hz
audio produces 29700hz and 3000hz audio produces 27000hz.
You change sideband by reversing either the audio or rf_LO
phases (changing from complex SIN to COS in the LO won't work)
Here there are two blocks (split1 and combine1) that allow you to
connect 'em one way or the other.
This hasn't been tried on real hardware output and no optimizations
or simplifications are obvious to me at the moment - don't know
how much it's going to cost but looks more intensive than the
weaver method for now. Ultimately we'll have to write a dedicated
SSB mod/demod block using either phasing or weaver anyway ;)
--------------------- hilbert_ssb.py
#!/usr/bin/env python
"""
af = 32000 sps (float)
rf = 2000000 sps +---\ /----+
(float) (complex) | \ / | (complex)
[src]-->[bandfilter]-->[hilbert]-->[split1] X [combine1]---->
(af) (af) | / \ | (af)
+---/ \----+
[rf_LO] (af) Cross for LSB
(complex) | Straight for USB
>----[interp_filter]--------(X)------>
62 (rf)
(float)
+-----+
(complex) | v (float) (complex)
>-------->[split2] (+)--->[scale]---->[hilbert_2]--->[sink]
(rf) | ^ (rf) (rf)
+_____+
(rf)
"""
from gnuradio import gr
from gnuradio import audio_oss as audio
from gnuradio.wxgui import stdgui, scopesink, fftsink
import wx
#from gnuradio import usrp
class phase_shifter (stdgui.gui_flow_graph):
def __init__(self, frame, panel, vbox, argv):
self.fs=32000 # AF sampling rate
self.fsrf=2000000 # RF sampling rate
fir_interp = self.fsrf / self.fs
print "fir_interp: ", fir_interp
usrp_interp = 64
usrp_duc = 3900e3
sink = gr.file_sink (gr.sizeof_gr_complex, "hilbert")
#sink = gr.null_sink (gr.sizeof_gr_complex)
#sink = usrp.sink_c (0, usrp_interp)
#print "requesting: ", usrp_duc, "hz"
#sink.set_tx_freq(0, usrp_duc)
#actual_freq = sink.tx_freq(0)
#print "got ", actual_freq, "hz"
#df = sink.dac_freq()
#print "DAC Freq: ", df
#sink.set_nchannels(1)
#sink.set_mux(0x98)
rf_LO = 30e3 # target freq: 3930e3
stdgui.gui_flow_graph.__init__(self,frame,panel,vbox,argv)
#src = audio.source(self.fs)
#src = gr.noise_source_f(gr.GR_UNIFORM,1)
src = gr.sig_source_f(self.fs,gr.GR_SIN_WAVE,300,1)
bandfilter_coeffs = filter_coeffs =
gr.firdes.band_pass(1,self.fs, 300,3800, 300,gr.firdes.WIN_HAMMING)
bandfilter = gr.fir_filter_fff(1,bandfilter_coeffs)
interp_filter_coeffs =
gr.firdes.low_pass(1,self.fsrf,10e3,8e3,gr.firdes.WIN_HAMMING)
interp_filter =
gr.interp_fir_filter_ccf(fir_interp,interp_filter_coeffs)
hilbert = gr.hilbert_fc(201)
split1 = gr.complex_to_float()
combine1 = gr.float_to_complex()
rf_LO = gr.sig_source_c(self.fsrf,gr.GR_SIN_WAVE,rf_LO,1,0)
rf_mix = gr.multiply_cc()
split2 = gr.complex_to_float()
sum = gr.add_ff()
scale = gr.multiply_const_ff(24e3)
hilbert_2 = gr.hilbert_fc(121)
#scope, win = scopesink.make_scope_sink_f(self,panel,"Hilbert
Transformator",self.fs)
#fft, winfft = fftsink.make_fft_sink_c(self,panel,"Hilbert
Transformator",2048,self.fsrf)
#vbox.Add(win,1,wx.EXPAND)
#vbox.Add(winfft,1,wx.EXPAND)
#self.connect(hilbert_2,fft)
self.connect(src,bandfilter)
self.connect(bandfilter,hilbert)
self.connect(hilbert,split1)
# in the next two connections, connect port 0 to 0 for USB
# and port 0 to 1 for LSB
self.connect((split1,0),(combine1,1)) # this is LSB, 0->1
self.connect((split1,1),(combine1,0))
self.connect(combine1,interp_filter)
self.connect(interp_filter,(rf_mix,0))
self.connect(rf_LO,(rf_mix,1))
self.connect(rf_mix,split2)
self.connect((split2,0),(sum,0))
self.connect((split2,1),(sum,1))
self.connect(sum,scale)
self.connect(scale,hilbert_2)
self.connect(hilbert_2,sink)
def main():
app = stdgui.stdapp(phase_shifter,"SSB Modulator")
app.MainLoop()
if __name__=='__main__':
main()
- [Discuss-gnuradio] working (in theory) phasing SSB modulator,
cswiger <=