This demonstration shows you how to configure and generate AUTOSAR-compliant code and export AUTOSAR software component description XML files for a Simulink® model with multiple runnable entities.
You can use the rtwdemo_autosar_multirunnables model to see how to construct a Simulink model to designate multiple runnable entities.
You can execute the following commands to open the rtwdemo_autosar_multirunnables model.
% Model defines modelName = 'rtwdemo_autosar_multirunnables'; % open the model open_system( modelName );
Next, let us examine the ASWC subsystem by executing the commands below. You can see the multiple runnable entities that compose the atomic software component. Each function-call subsystem defines a runnable entity. This model contains three function-call subsystems: Runnable1, Runnable2, Runnable3. An additional runnable entity aggregating the initialization functions for each of the function-call subsystems is also created at code generation.
% open the ASWC subsystem open_system( [modelName, '/ASWC'] );
Inter-runnable variables ensure data consistency between runnable entities. You define these variables through the signals that connect the entities. The signals are labeled with their inter-runnable variable name. This model has four inter-runnable variables: irv1, irv2, irv3, irv4.
For an overview of the AUTOSAR Interface dialog, please see the AUTOSAR Model Interface Dialog Box section of the Real-Time Workshop Embedded Coder documentation (login required).
To change the AUTOSAR port settings, you can:
To generate AUTOSAR-compliant code from the model, you can:
An alternative method to generate AUTOSAR-compliant code from the model is to execute the following commands, which also displays the status of the code generation process:
rtwbuild( [modelName, '/ASWC'], 'Mode', 'ExportFunctionCalls');
### Starting Real-Time Workshop build procedure for model: ASWC ### Generating XML files description for model: ASWC ### Successful completion of Real-Time Workshop build procedure for model: ASWC
This demonstration makes use of BasicSoftwarePorts . If you intend to import the generated XML files into an AUTOSAR authoring tool, you should include the server interface referenced by BasicSoftwarePorts found in the NvMInterface.arxml file.
For more information on the AUTOSAR Target, please see the Generating Code That Complies with AUTOSAR Standards section of the Real-Time Workshop Embedded Coder documentation (login required).