Main Content

cgsl_0405: Data receive for component deployment

ID: Titlecgsl_0405: Data receive for component deployment
DescriptionATo model a call to the target platform receiver service, use an In Bus Element or Inport block.
B

To safeguard data for concurrent access, map the component inports to a service interface that is configured to use the During Execution or Outside Execution communication method.

  • During Execution — The generated callable function that implements the algorithm safeguards data access for concurrency.

  • Outside Execution —The target platform service safeguards data access for concurrency.

C

When concurrent access to data is not a concern, map component inports to a service interface that is configured to use the Direct Access communication method. In this case, no safeguard for data access is provided.

Rationale

The generated code aligns with the data communication method that is required by the target platform environment.

Model Advisor CheckA Model Advisor check is not necessary for this guideline because a service interface for a receiver service must be configured to use one of the three data communication methods.
Example

Specifying the Data Communication Method for Calling the Target Platform Data Receiver Service

Embedded Coder dictionary interface for selecting the data communication method

In this example, the data communication method is set to Outside Execution.

void CD_integrator(void)
{
  .
  .
  .
  for (i = 0; i < 10; i++) { 
    .
    .
    .
    rtDWork.DiscreteTimeIntegrator_PREV_U[i] = (get_CD_integrator_input())[i];
  }
  .
  .
  .
}

In this example, the data communication method is set to During Execution.

void CD_integrator(void)
{
  .
  .
  .
real_T tmp[10];
  .
  .
  .
  get_CD_integrator_input(&tmp[0]);
  .
  .
  .
  for (i = 0; i < 10; i++) {
    .
    .
    .
    rtDWork.DiscreteTimeIntegrator_PREV_U[i] = tmp[i] 
  }
  .
  .
  .
}

In this example, the data communication method is set to Direct Access.

void CD_integrator(void)
{
  .
  .
  .
  for (i = 0; i < 10; i++) {
    .
    .
    .
    ... = CD_sig.In[i];
  }
  .
  .
  .
}

Version History

expand all

Introduced in R2022b