[USRP-users] Configuration Simulink

Mike McLernon Mike.McLernon at mathworks.com
Fri Nov 5 16:08:37 EDT 2010


Here is a list of performance improvements you can make in your Simulink models to approach, if not achieve, real-time:

1.       In the Configuration Parameters → Data Import/Export dialog, turn off all logging.

2.       Make sure that the model is single-rate.  If the model requires resampling, then choose rational coefficients that will keep the model single-rate.  For instance, the FM demos in the Communications Blockset use a native frame size of 358, with an initial sample rate of roughly 195 kHz.  The signal is eventually piped to an output audio device, which runs at 48 kHz.  The model then uses a resampling factor of 44/179 to get close to 48 kHz, and results in good quality audio.  (To get to those demos, type ‘demo toolbox commblks’ at the MATLAB command prompt, then navigate in the help browser to Simulink Demos -> SDR Hardware.)

3.       Do not add any Buffer blocks to the model.  Although it's tempting to create friendlier frame lengths than 358, doing so by using a Buffer will severely degrade performance.

4.       You should try to run with Rapid Accelerator instead of Normal mode.  Be aware that some scopes do not plot data when run in Rapid Accelerator mode, but scopes inevitably slow down a model in any case.  (See point 6.)

5.       Try to avoid feedback loops.  Typically, such loops imply scalar processing, which will slow down the model considerably.

6.       Perhaps the most obvious trick of all is not to use scopes unless absolutely necessary.  To visualize your data, send it to a workspace variable and post-process it.

7.       If you are using Accelerator or Rapid Accelerator, set the Configuration Parameters → Optimization → Compiler optimization level to 'Optimizations on (faster runs)'.

8.       If the model has lots of Constant blocks, it could help slightly if Configuration Parameters → Optimization (Signals and Parameters) → Inline parameters is checked on.  This will cause the sample time of those Constant blocks to truly become inf -- Simulink will get the values once and only once during a run.

9.       If the model generates code, the Solver setting should be Fixed-step/discrete.  The tasking mode should be SingleTasking.

Hope this is helpful,

From: usrp-users-bounces at lists.ettus.com [mailto:usrp-users-bounces at lists.ettus.com] On Behalf Of MOISES NAVARRO
Sent: Thursday, November 04, 2010 7:18 AM
To: usrp-users at lists.ettus.com
Subject: [USRP-users] Configuration Simulink

Dear All,

I'm working with simulink and usrp2.
I trying to synchronize with an OFDM signal.
I noticed a possible problem.

I set up the simulation for 10 seconds (stop time), but the simulation takes about 60 seconds. As I conclude that my processor can not generate the signal so fast, right?

So I decided to create the signal and store it in a variable. Subsequently generated a program that only reads the variable and transmitted through the USRP.

My surprise is that neither is able to run this program in real time (read and send a variable) it  takes around 15 seconds. I have configured the Decimation to 512 and SampleTime to 512/100e6.

It is normal for a corel 2 duo is not capable of running at that speed? If I monitor the processor is at 100 %.....

There any special settings for simulink work well? " Is there any way to configure simulink to work in real time with USRP2?
and if the processor inst fast enough that appears a warning or error?

Thank you very much
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20101105/64656511/attachment-0002.html>

More information about the USRP-users mailing list