Exemplo n.º 1
0
    def __init__(self, tx_id, rx_id, sample_rate, filename):
        """
        Parameters:

        sample_rate: int or float
            sample_rate of the flowgraph

        filename: string
            file containing the channel model

        Notes:
            The modelfile was created with the pickle module and contains a list
            of sum of cisoids, each sum of cisoids models the Doppler spectrum
            with a specific delay. If one list element is empty this means that
            there exist no scatterers with the specified delay. Each sum of
            cisoids, i.e. list element, contains again a list of amplitudes and
            frequencies.

        """

        gr.hier_block2.__init__(self, "Channel Sounder Measurement",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.sample_rate = sample_rate
        fp = open(filename, 'r')

        model = pickle.load(fp)

        self.taps_delays = []
        # check for non-empty list elements to find multipath components with a
        # certain delay
        for idx, mpc in enumerate(model):
            if mpc:
                self.taps_delays.append(idx)

        # print 'taps_delays', self.taps_delays
        # create a tapped delay line structure, since the amplitudes of the sum
        # of cisoids already contain all the information about the power of a
        # Doppler spectrum, the power delay profile is set to 1 for all delays.
        self.mpc_channel = mpc_channel_cc(self.taps_delays,
                                          [1] * len(self.taps_delays))

        # loop through all delays
        for idx, delay in enumerate(self.taps_delays):
            adder = gr.add_cc()
            # loop through all cisoids of a delay
            for iidx, (freq, ampl) in enumerate(model[delay]):
                src = gr.sig_source_c(sample_rate, gr.GR_COS_WAVE, freq, ampl)
                self.connect(src, (adder, iidx))
            # print iidx
            self.connect(adder, (self.mpc_channel, idx + 1))

        self.connect(self,       (self.mpc_channel, 0))
        self.connect(self.mpc_channel, self)
Exemplo n.º 2
0
    def __init__(self, tx_id, rx_id, sample_rate, fmax):
        gr.hier_block2.__init__(self, "COST207 Bad Urban 6 paths",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.sample_rate = sample_rate
        print sample_rate
        # Statistics of this channel, taken from
        # "Mobile Radio Channels", Paetzold, 2011, p 357
        # Delays of the multipath components in seconds
        delays = [0, 0.4e-6, 1.0e-6, 1.6e-6, 5.0e-6, 6.6e-6]
        print 'delays', delays
        # Delays expressed in samples
        self.taps_delays = [int(sample_rate * delay) for delay in delays]
        print 'delays in samples', self.taps_delays
        # power delay profile
        self.pdp = [0.5, 1, 0.5, 0.32, 0.63, 0.4]
        # channel options
        self.channel_opts = {'N': 2001,
                             'fmax': fmax}
        self.mpc_channel = mpc_channel_cc(self.taps_delays, self.pdp)
        # The different multipath components have to be uncorrelated. This is
        # the reason for choosing changing values for N
        self.mpc1 = gauss_rand_proc_c(sample_rate, "cost207:jakes", "mea",
                                      12, self.channel_opts)
        self.mpc2 = gauss_rand_proc_c(sample_rate, "cost207:jakes", "mea",
                                      14, self.channel_opts)
        self.mpc3 = gauss_rand_proc_c(sample_rate, "cost207:gauss1", "gmea",
                                      9, self.channel_opts)
        self.mpc4 = gauss_rand_proc_c(sample_rate, "cost207:gauss1", "gmea",
                                      10, self.channel_opts)
        self.mpc5 = gauss_rand_proc_c(sample_rate, "cost207:gauss2", "gmea",
                                      11, self.channel_opts)
        self.mpc6 = gauss_rand_proc_c(sample_rate, "cost207:gauss2", "gmea",
                                      8, self.channel_opts)

        self.connect(self,      (self.mpc_channel, 0))
        self.connect(self.mpc1, (self.mpc_channel, 1))
        self.connect(self.mpc2, (self.mpc_channel, 2))
        self.connect(self.mpc3, (self.mpc_channel, 3))
        self.connect(self.mpc4, (self.mpc_channel, 4))
        self.connect(self.mpc5, (self.mpc_channel, 5))
        self.connect(self.mpc6, (self.mpc_channel, 6))
        self.connect(self.mpc_channel, self)