Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

Signal Storage Concepts

This section discusses structures and concepts you must understand to choose the best signal storage options for your application:

The Global Block I/O Structure

By default, the Real-Time Workshop product attempts to optimize memory usage by sharing signal memory and using local variables.

However, there are a number of circumstances in which it is desirable or necessary to place signals in global memory. For example,

In such cases, it is possible to override the default behavior and store selected (or all) signals in a model-specific global block I/O data structure. The global block I/O structure is called model_B (in earlier versions this was called rtB).

The following code shows how model_B is defined and declared in code generated (with signal storage optimizations off) from the signal_examp model shown in the Signal_examp Model figure.

(in signal_examp.h)
/* Block signals (auto storage) */
extern BlockIO_signal_examp signal_examp_B;

(in signal_examp.c)
/* Block signals (auto storage) */
BlockIO_signal_examp signal_examp_B;

Field names for signals stored in model_B are generated according to the rules described in Symbolic Naming Conventions for Signals in Generated Code.

Signals Storage Classes

In the Real-Time Workshop product, the storage class property of a signal specifies how the product declares and stores the signal. In some cases this specification is qualified by more options.

In the context of the Real-Time Workshop product, the term "storage class" is not synonymous with the term storage class specifier, as used in the C language.

Default Storage Class

Auto is the default storage class. Auto is the appropriate storage class for signals that you do not need to interface to external code. Signals with Auto storage class can be stored in local and/or shared variables or in a global data structure. The form of storage depends on the Signal storage reuse, Reuse block outputs, Enable local block outputs, and Minimize data copies between local and global variables options, and on available stack space. See Signals with Auto Storage Class for a full description of code generation options for signals with Auto storage class.

Explicitly Assigned Storage Classes

Signals with storage classes other than Auto are stored either as members of model_B, or in unstructured global variables, independent of model_B. These storage classes are appropriate for signals that you want to monitor and/or interface to external code.

The Signal storage reuse, Enable local block outputs, Reuse block outputs, Eliminate superfluous local variables (Expression folding), and Minimize data copies between local and global variables optimizations do not apply to signals with storage classes other than Auto.

Use the Signal Properties dialog box to assign these storage classes to signals:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS