Main Content

setDeploymentType

Set deployment type of model

Since R2022a

Description

example

setDeploymentType(coderMapObj, depType) sets the deployment type of the model specified by code mappings object coderMapObj to the type specified by depType. The deployment type controls the code interfaces at different levels of a model hierarchy. The code generator uses the deployment type to:

  • Enforce peer and nesting rules in the model hierarchy.

  • Map model elements to code interface definitions.

  • Generate code that uses the appropriate interface to connect to other parts of the hierarchy.

Examples

collapse all

The deployment type of a model controls the code interfaces at different levels of a model hierarchy.

To access the deployment type of a model, use the getDeploymentType function.

openExample("CounterModel.slx");
cm = coder.mapping.utils.create("CounterModel");
depType = getDeploymentType(cm)
depType =

    'Automatic'

The default deployment type of a model is Automatic.

To specify the deployment type of a model, use the setDeploymentType function.

setDeploymentType(cm,"Subcomponent")

Input Arguments

collapse all

Code mapping object (model code mappings), returned by a call to function coder.mapping.api.get.

The deployment type of the model, specified as Automatic, Component, or Subcomponent.

Deployment TypeDescription
Automatic

Embedded Coder® determines the deployment type based on the model hierarchy context

Component

The top model that generates code. The model generates a standalone algorithm. The component code exposes its interface to other components in the system.

Component deployment type is only valid for models with a service interface code configuration.

Subcomponent

A model reference that a component model uses. The generated code entry points are symbolically scoped to the parent component.

Data Types: char

Version History

Introduced in R2022a