Main Content

Configure Code Interfaces for Code Generation

In addition to representing code interfaces as elements in your model design, you must provide the code generator with mappings of those elements to code interfaces. The code generator uses the mappings to produce code that can interact with target environment services. You configure a model with a data or service interface, depending on your project requirements and deployment objective.

As the following figure shows, you must configure a model to use a data code interface for application deployment or if you are generating C++ code. Code generated for application deployment is optimized to a specific scheduler (single-tasking, rate-monotonic, or concurrent) based on your model configuration.

For component deployment, a service code interface offers benefits such as:

  • Customized interface code that includes built-in safeguards for maintaining data coherence for outside-execution and during-execution data communication

  • Customized code for data transfers between functions outside of (before and after) function execution

  • Support for accessing time values in aperiodic tasks

  • Flexible scheduling

  • Mapping of model elements to complete interface abstractions rather than to storage classes and specific property settings

Choose between a data or service interface based on your project requirements and deployment objective.

For more information, see: