Main Content

model_reset

Generated C/C++ entry-point function that contains reset code for a Simulink model

Description

example

void model_reset(void) is a generated C or C++ entry-point function that executes reset code for a Simulink® model. If a model includes a Reset Function block, reset code is generated. To reset conditions or state, call the function from the application code.

The generated calling interface of the reset entry-point function for a model differs depending on the Language and Code interface packaging parameters. For more information, see Code interface packaging.

To preview and customize the name of the generated reset entry-point function an Embedded Coder® license is required. To preview the reset entry-point function, open the Code Mappings editor and click the Functions tab. To customize the function name, in the Function Name column click and edit the spreadsheet directly. To customize the function name and arguments, in the Function Preview column click the function hyperlink and configure the reset function from the opened dialogue box. To customize a function using a template, in the Function Customization Template column select a template to apply to the function. For more information, see Configure Name and Arguments for Individual Step Functions, Customize Generated C++ Class Interfaces, and Configure Default Code Generation for Functions.

To view the generated reset entry-point function, open the Code view or Code Generation Report and view the source code for your model. For more information see, Analyze the Generated Code Interface.

Examples

collapse all

This example shows the basic workflow for how to configure, customize, generate, and examine a reset entry-point function. This specific example generates a nonreusable C reset function for the model rtwdemo_irt_base.

  1. Open a model. For this example, use rtwdemo_irt_base.

  2. Select a coder. In the Apps gallery, click Simulink Coder or Embedded Coder.

  3. Configure the parameters. In the Configuration Parameters dialog box, set the Language, and Code interface packaging parameters. In this example, the parameters are set for you.

  4. (Embedded Coder only) Customize the function. Using Embedded Coder, you can customize the name of the reset entry-point function.

    • Open the Code Mappings editor.

    • Click the Functions tab.

    • Edit the spreadsheet directly. In the Function Name column, enter a name for the function.

  5. Generate code.

  6. Examine the generated code. In the Code view, verify that the generated reset function appears with the expected name and parameters.

Input Arguments

collapse all

The reset entry-point C or C++ function provides an interface to the model reset code. By default, the generated function provides a void-void interface that does not have arguments.

Output Arguments

collapse all

The reset entry-point C or C++ function provides an interface to model reset code. By default, the generated function provides a void-void interface that does not have a return value.

Introduced before R2006a