One change recommended by the assistant is to add latency. Latency is typically added to a model when Dataflow identifies an opportunity for parallelism to increase throughput. The delays added along the signal lines are indicated with a z-n label.
We accept the changes and save the model with Dataflow enabled as mono_radiomodel_dataflow.
We then measure the execution time of the new subsystem using the same tic-toc commands that we used before.
modelname = 'mono_radiomodel_dataflow';
tic;
simData2 = sim(modelname);
t_Dataflow = toc
The execution time with Dataflow enabled is 2.5 seconds, which is 1.7 times faster than normal, single-thread execution. The speedup is due to the compiler optimizations, model settings changes, and latency added by Dataflow.
However, the model was executed on just one thread, and the speedup is not significant. This is because most of the computational load is concentrated in the up- and down-converter blocks. Dataflow works best when the computational load is spread across the model, providing more opportunities to create parallel threads. In the next section, we extend our model and show how implementing Dataflow further improves simulation performance.
Working with Larger Models
We increase the computational complexity of the model by introducing a multichannel audio input signal. This doubles the amount of data that needs to be processed and gives Dataflow more avenues to optimize simulation performance. Figure 6 shows the model modified with a stereo audio, which takes 18.6 seconds to run. By enabling the signal dimensions information overlay, we see that the signal input does indeed have two audio channels.