Schedule Component Initialization in Software Architectures - MATLAB & Simulink (original) (raw)

You use initialize functions in a software architecture model to schedule and customize component initialization of each reference component for simulation and code generation. An initialize function is a specialization of a function that executes during model initialization. When you simulate your software architecture, all components are initialized during the model initialization phase of simulation. By default, each reference component of your software architecture has an initialize function. You can visualize and schedule the order of component initialization, on theInitialize tab of the Functions Editor.

To implement behavior of the initialize function of a component, add an Initialize Function block to the referenced model. The code generated fromInitialize Function blocks is part of themodel_initialize function that is called once at the beginning of model execution. For more information on defining initialization routines, see Common Uses of the Initialize Function Block.

This topic describes how to:

For more information about authoring, adding properties using stereotypes, and importing and exporting functions, see Author and Extend Functions for Software Architectures.

Schedule Component Initialization Using Functions Editor

To open the Functions Editor, in the toolstrip on theModeling tab, click .

On the Initialize tab of the Functions Editor, you can view the initialize functions and schedule the order of initialization of each reference component.

Functions Editor with the Initialize tab open.

Visualize Initialize Functions Using Class Diagram Views

Class diagrams are graphical representations of software architecture model structures. Each architecture component is represented as a class box with methods and properties listed. The root architecture is also represented as a class box that lists all methods, stereotypes, and properties. For both the root architecture and each reference component, an initialize function listed in theMethods section of the corresponding class box.

To open the Architecture Views Gallery, navigate to Modeling > . To open the class diagram view, click Diagram > Class Diagram.

Class diagram view with initialize functions listed in class boxes of reference components.

For more information, see Class Diagram View of Software Architectures.

Generate Code for Initialize Functions

You can generate code from your software architecture for the initialize functions. To generate code, from the Apps tab, select . Then select .

Each component has an initialize function call in themodel_initialize function. The order of the function calls follows the order specified in the Functions Editor.

Model initialize function from the generated code of the throttle example.

Programmatically Configure Initialize Functions

To programmatically configure and customize initialize functions:

See Also

Tools

Objects

Functions

Topics