About Modeling Patterns
Several standard methods are available for setting up a model
to generate specific C Constructs in your code. For preparing your
model for code generation, some of these methods include: configuring
signals and ports, initializing states, and setting up configuration
parameters for code generation. Depending on the components of your
model, some of these methods are optional. Methods for configuring
a model to generate specific C constructs are organized by category,
for example, the Control Flow category includes constructs if-else, switch, for,
and while. Refer to the name of a construct to
see how you should configure blocks and parameters in your model.
Different modeling methodologies are available, such as Simulink blocks, Stateflow® charts,
and Embedded MATLAB™ blocks, to implement a C construct.
Model examples have the following naming conventions:
| Model Components | Naming Convention |
| Inputs | u1, u2, u3,
and so on |
| Outputs | y1, y2, y3,
and so on |
| Parameters | p1, p2, p3,
and so on |
| States | x1, x2, x3,
and so on |
Input ports are named to reflect the signal names that they
propagate.
 | Developing Model Patterns that Generate Specific C Constructs | | Standard Methods to Prepare a Model for Code Generation |  |
Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
Get this Simulink Kit