RTDB Blocks

Map and access RTDB variables from generated code

Library

RTDB Blocks Library: simwbSfunlib

Description

SimWB RTDB Blocks

The toRTDBm, toRTDBc, fromRTDBm, and fromRTDBc blocks allow you to generate SimWB-compliant code for your Simulink® model. Connect these blocks to signals of interest that you want to access in the RTDB.

When you use the MLToolkit GUI to generate SimWB-compliant code, the software automatically replaces the relevant native Simulink source and sink blocks in your model with one of these blocks. You must manually place these blocks in your Simulink model only if you want to generate code programmatically or further customize the generated code. For example, you can specify a custom variable name or sample time for a signal.

Note: Before generating code for these C MEX S-function blocks, you must execute the createMexfunction. This function generates the MEX files for both the C MEX S-function blocks.

Dialog Box

The following images show the block dialogs for the fromRTDBc and fromRTDBm blocks:

fromRTDBc Block Parameters fromRTDBm Block Parameters

Treat as String Block

Option to treat the block input/output as a String (char array). (Applies to the toRTDBc and fromRTDBc blocks only.) When you check this box, the block dialog changes.

Variable Name

Name of the generated RTDB variable.

Note: You can customize how the MLToolkit handles variable names. For more information, see RTDB Generation Preferences

Signal Dimension

Dimension of the RTDB variable.

Example: [1 1]

Data Type

Data type of the RTDB variable. Basic Simulink& data types are supported.

Example: double

Sample Time

Block sample time. Default is inherited sample time.

Example: [-1 0]

Buffer Size

Buffer length of the RTDB variable. The Maximum length is 1024. The second output of the toRTDBc and fromRTDBc blocks specifies the actual length of the string being transmitted. (Applies when the Treat as String Block option is checked.)

Example: 10

Bus Name

Enter the bus name of a Simulink bus available in the workspace. Refer to Bus Support in SimWB for additional details.

Example: Bus: mybusname

Default Value

Default value of the RTDB variable. If the Treat as String Block option is checked, then this option is called Default String.

Example: 0

Related Links

Examples