Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

Tunable Parameter Storage Classes

The Real-Time Workshop product defines four storage classes for tunable parameters. You must declare a tunable parameter to have one of the following storage classes:

The generated code for model.h includes model_private.h to make the extern declarations available to subsystem files.

As an example of how the storage class declaration affects the code generated for a parameter, consider the next figure.

The workspace variable Kp sets the gain of the Gain1 block. Assume that the value of Kp is 3.14. The following table shows the variable declarations and the code generated for the gain block when Kp is declared as a tunable parameter. An example is shown for each storage class.

The symbolic name Kp is preserved in the variable and field names in the generated code.

Storage Class

Generated Variable Declaration and Code

SimulinkGlobal (Auto)

typedef struct _Parameters_tunable_sin 
Parameters_tunable_sin;

struct _Parameters_tunable_sin {
  real_T Kp;
};

Parameters_tunable_sin tunable_sin_P = {
  3.14
};
.
.
tunable_sin_Y.Out1 = rtb_u * 
tunable_sin_P.Kp;

ExportedGlobal

real_T Kp = 3.14; 
.
.
tunable_sin_Y.Out1 = rtb_u * Kp;

ImportedExtern

extern real_T Kp;
.
.
tunable_sin_Y.Out1 = rtb_u * Kp;

ImportedExtern Pointer

extern real_T *Kp; 
.
.
tunable_sin_Y.Out1 = rtb_u * (*Kp);

  


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