Skip to Main Content Skip to Search
Product Documentation

Model Variants in the Generated Code

To open a model for generating preprocessor conditionals, enter rtwdemo_preprocessor.

After building the model, look at the variants in the generated code. rtwdemo_preprocessor_types.h includes the following:

Calls to the step and initialization functions are conditionally compiled as shown in a portion of the step function, rtwdemo_preprocessor_step, in ModRefVar.c:

#if LINEAR

/* ModelReference: '<Root>/Left Controller' */
rtwdemo_linl(&rtb_Add, &rtb_LeftController_merge_1,
                &(rtwdemo_preprocessor_DWork.LeftController_1_DWORK1.rtdw));

#elif NONLINEAR                                 
/* ModelReference: '<Root>/Left Controller' */

rtwdemo_nlinl(&rtb_Add, &rtb_LeftController_merge_1,
                 &(rtwdemo_preprocessor_DWork.LeftController_2_DWORK1.rtdw));

#endif                        /* LINEAR */         

and

#if LINEAR

/* ModelReference: '<Root>/Right Controller' */
rtwdemo_linr(&rtb_Add1, &rtb_RightController_merge_1,
                &(rtwdemo_preprocessor_DWork.RightController_1_DWORK1.rtdw));

#elif NONLINEAR                              

/* ModelReference: '<Root>/Right Controller' */
rtwdemo_nlinr(&rtb_Add1, &rtb_RightController_merge_1,
                 &(rtwdemo_preprocessor_DWork.RightController_2_DWORK1.rtdw));

#endif                                 /* LINEAR */
  


Related Products & Applications

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

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