Main Content

Code Generation of Constant Parameters

The code generator attempts to generate constant parameters to the shared utilities folder first. If constant parameters are not generated to the shared utilities folder, they are defined in the top model in a global constant parameter structure. The declaration of the structure, ConstParam_model, is in model.h:

/* Constant parameters (auto storage) */
typedef struct {
   /* Expression: [1 2 3 4 5 6 7]
    * Referenced by: '<Root>/Constant'
    */
   real_T Constant_Value[7];
   
   /* Expression: [7 6 5 4 3 2 1]
    * Referenced by: '<Root>/Gain'
    */
   real_T Gain_Gain[7];
 } ConstParam_model;
The definition of the constant parameters, model_constP, is in:
/* Constant parameters (auto storage) */
const ConstParam_model model_ConstP = {
   /* Expression: [1 2 3 4 5 6 7]
    * Referenced by: '<Root>/Constant'
    */
   { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 },

   /* Expression: [7 6 5 4 3 2 1]
    * Referenced by: '<Root>/Gain'
    */
   { 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 }
};
The model_constP is passed as an argument to referenced models.

Related Topics