This is because c is much faster for performing

Info icon This preview shows pages 18–20. Sign up to view the full content.

View Full Document Right Arrow Icon
Perform as much processing as possible using C++ blocks. This is because C++ is much faster for performing computationally expensive tasks than Python. For example, notice that we use the “Complex to Mag” block to obtain the magnitude from the FFT. Alternatively, we could have designed our custom block to accept a stream of complex samples directly from the FFT and we could have computed the magnitude in the Python code. This probably would have worked fine, since computing the magnitude only requires a few arithmetic operations, but we decided to use the C++ block instead. You should not be paranoid about processing data in Python; just be practical. If possible, try to minimize the rate of the frames entering your Python block. The “Keep 1 in N” block demonstrates how you might downsample a stream in order to reduce the frame rate. For example, there is no sense in checking the magnitude spectrum 100 times per second if your application only requires checking it twice per second. This principle applies not only for Python blocks, but for practical system design in general. Note that there is no “Throttle” block in this flow diagram, even though the entire system is a simulation. When you run Build Generate , GRC will give a warning indicating that there are no USRP2 or audio sources/sinks and that you should add a “Throttle” block to reduce CPU congestion. Ignore this warning; it will be fine to let this simulaion run as fast as possible. We have had some issues with the “Throttle” block; sometimes it seems to starve the flow graph, throttling down the rate of processing down to zero and preventing any data at all from flowing through the graph. 3.3.4 Exercises Now that you are familiar with how to use custom blocks, it is time to experiment with custom blocks in a real software-defined radio system. Create two new top-level flow graphs in GRC: one for the transmitter and one for the receiver. On the transmitter side, use the “Signal Source” and “Add” blocks to generate and combine several sinusoidal tones with different frequencies and amplitudes. Use a “USRP2 Sink” block to transmit the tones. On the receiver side, send the output of a “USRP2 Source” block through an FFT block, then through a “Complex to Mag” block and finally through the custom “Max Detect” block. Does your receiver properly detect the frequency of the transmitted tone with the largest am- plitude? Hints: 18
Image of page 18

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The audio FDM example from last week’s lab (Lab #4) might be useful; it demonstrates how to generate and transmit multiple FDM carrier tones. Try using a value of 400 for your USRP2 decimation and interpolation parameters. Recall that a “USRP2 Source” with decimation of 400 generates samples at 250 kHz. You might consider using a “Keep 1 in N” block to downsample the data before sending it through your FFT so that your computer does not have to process as much data.
Image of page 19
Image of page 20
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Sign up to access 24/7 study resources for your classes

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern