Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Data Store Memory - Define data store

Library

Signal Routing

Description

The Data Store Memory block defines and initializes a named shared data store, which is a memory region usable by Data Store Read and Data Store Write blocks that specify the same data store name.

The location of the Data Store Memory block that defines a data store determines which Data Store Read and Data Store Write blocks can access the data store:

A Data Store Memory block in a referenced model cannot be accessed by Data Store Read or Data Store Write blocks in either a superior model or a subordinate model.

You initialize the data store by specifying a scalar value or an array of values in the Initial value parameter. The dimensions of the array determine the dimensionality of the data store. Any data written to the data store must have the dimensions designated by the Initial value parameter. Otherwise, an error occurs.

Obtaining correct results from data stores requires ensuring that data store reads and writes occur in the expected order. See Ordering Data Store Access and Using Data Store Diagnostics for details.

You can use Simulink.Signal objects in addition to or instead of Data Store Memory blocks to define data stores. A data store defined in the base workspace using a signal object is accessible to every model, including all referenced models. See Working with Data Stores for more information.

Data Type Support

The Data Store Memory block stores real or complex signals of any data type supported by Simulink software, including fixed-point and enumerated data types.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink.

Parameters and Dialog Box

The Main pane of the Data Store Memory block dialog appears as follows:

Data store name

Specify a name for the data store you are defining with this block. Data Store Read and Data Store Write blocks with the same name will be able to read from and write to the data store initialized by this block.

Corresponding Data Store Read blocks

This parameter lists all the Data Store Read and Data Store Write blocks that have the same data store name as the current block, and that are in the current (sub)system or in any subsystem below it in the model hierarchy. Double-click any entry on this list to highlight the block and bring it to the foreground.

Initial value

Specify the initial value or values of the data store. The dimensions of this value determine the dimensions of data that may be written to the data store. The Minimum parameter specifies the minimum value for this parameter, the Maximum parameter specifies the maximum value.

Data store must resolve to Simulink signal object

Causes Simulink software, when compiling the model, to search the model and base workspace for a Simulink.Signal object having the same name, as described in Resolving Symbols. If such an object is not found, Simulink software halts the compilation and displays an error. Otherwise Simulink software compares the attributes of the signal object with the corresponding attributes of the data store memory block. If the block and the object attributes are inconsistent, Simulink software halts model compilation and displays an error.

These following parameters pertain to code generation and have no effect during simulation:

See Block State Storage and Interfacing Considerations in the Real-Time Workshop documentation for more information.

Interpret vector parameters as 1-D

If selected and the Initial value parameter is specified as a column or row matrix, the data store is initialized to a 1-D array whose elements are equal to the elements of the row or column vector. See Determining the Output Dimensions of Source Blocks.

The Signal Attributes pane of the Data Store Memory block dialog appears as follows:

Minimum

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Maximum

Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Data type

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: auto

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Data type parameter.

See Specifying Block Output Data Types for more information.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.

Signal type

Specify the numeric type, real or complex, of the values stored in the data store.

The Diagnostics pane of the Data Store Memory block dialog appears as follows:

Detect read before write

Select the diagnostic action to take if the model attempts to read data from a data store to which it has not written data in this time step. See also Detect read before write in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Detect write after read

Select the diagnostic action to take if the model attempts to write data to the data store after previously reading data from it in the current time step. See also Detect write after read in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Detect write after write

Select the diagnostic action to take if the model attempts to write data to the data store twice in succession in the current time step. See also Detect write after write in the Data Store Memory Block section of the Configuration Parameters > Diagnostics > Data Validity pane.

Default: warning

none

Simulink software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Characteristics

Sample Time

N/A

Dimensionalized

Yes

Multidimensionalized

Yes

See Also

  


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