Real-Time Workshop    

Accumulators

Simulink recognizes the block diagram shown in Figure 9-13 as an accumulator. An accumulator construct -- comprising a Constant block, a Sum block, and feedback through a Unit Delay block -- is recognized anywhere across a block diagram, or within subsystems at lower levels.

Figure 9-13: An Accumulator Algorithm

By using the Block reduction option, you can significantly optimize code generated from an accumulator. Turn this option on in the Advanced page of the Simulink Simulation parameters dialog, as shown in Figure 9-14.

Figure 9-14: Block Reduction Option

With the Block reduction option on, Simulink creates a synthesized block, Sum_synth_accum. This synthesized block replaces the block diagram of Figure 9-13, resulting in a simple increment calculation.

With Block reduction turned off, the generated code reflects the block diagram more literally, but less efficiently.


  Look-Up Tables and Polynomials Use of Data Types