Component Model Design for Deployment
A component model is a top-level model that represents an application algorithm. From a component model, the code generator produces code that has a programming interface for interacting with other platform environment software. Embedded Coder® software produces component model code that you can deploy to run on or integrate as part of an embedded system platform.
When deploying a component model to a function platform, you develop each component model in isolation. Then, you or someone else in your organization integrates the generated function code into a complete application program at the source code level.
The composition of a component model can include subcomponents and utilities. Depending on the platform that you configure for a component model, you might need to configure the deployment type of each model in the component model hierarchy. The deployment type determines how model constructs map to platform interfaces and the rules for peer interaction and scope for data and function accessibility for models in the hierarchy. For each model in the hierarchy, you select a deployment type based on the role of the model.
|Role of Model||Deployment Type|
|Publish execution, communication, and service code interfaces according to the specified platform definition so the component can interact with other components in the target platform environment.||Component|
|Referenced by and runs as part of the parent component model. Execution and communication interfaces are accessible within the context of the parent component model only. Generated code is not accessible to the target platform environment.||Subcomponent|
When designing a component model that communicates with the platform code, consider and account for the communication methods used by the platform software and Simulink® semantics. For more information, see Platform Service Data Communication Methods.
A subcomponent is part of an algorithm that is captured within a component model and runs as part of a component model. You model a subcomponent as a reference model, subsystem, or linked subsystem. The parent component gains access to subcomponent code by using subcomponent entry points. Code generated for subcomponents is not accessible to the target platform environment. The code generated for a subcomponent is dependent on code for the parent component model. If a subcomponent shares data with other subcomponents, the subcomponent code must use data transfer services prescribed by the target platform.
For guidance on choosing an approach for modeling subcomponents, see Component-Based Modeling.
A utility is a reusable function that a program can call from any location in the code without considering the target platform environment. You model a utility as a library subsystem that adheres to specific modeling constraints. The code generator uses the constraints to produce code that is free of platform context requirements.
Include utilities in model compositions when you want to:
Generate code that models can share.
Lock down the interface for a subsystem.
Make a model the owner of its generated code.
For more information, see Library-Based Code Generation for Reusable Library Subsystems.