main content

create and configure autosar adaptive software component -凯发k8网页登录

create an autosar adaptive software component model from an algorithm model.

autosar blockset software supports automotive open system architecture (autosar), an open and standardized automotive software architecture. automobile manufacturers, suppliers, and tool developers jointly develop autosar components. to develop autosar adaptive components in simulink, follow this general workflow:

  1. create a simulink representation of an autosar adaptive component.

  2. develop the component by refining the autosar configuration and creating algorithmic model content.

  3. generate arxml descriptions and algorithmic c code for testing in simulink or integration into an autosar run-time environment. (autosar code generation requires simulink coder and embedded coder.)

create autosar adaptive software component in simulink

to create an initial simulink representation of an autosar adaptive software component, you take one of these actions:

  • create an autosar adaptive software component using an existing simulink model.

  • import an autosar adaptive software component description from arxml files into a new simulink model. (see example .)

to create an autosar adaptive software component using an existing model, first open a simulink component model for which an autosar software component is not mapped. this example uses autosar example model laneguidance.

open_system('laneguidance'); 

in the model window, on the modeling tab, select model settings. in the configuration parameters dialog box, code generation pane, set the system target file to autosar_adaptive.tlc. click ok.

at the top level of the model, set up event-based communication. an autosar adaptive software component provides and consumes services. each component contains:

  • an algorithm that performs tasks in response to received events

  • required and provided ports, each associated with a service interface

  • service interfaces, with associated events and associated namespaces

autosar blockset provides and blocks to make the necessary event and signal connections.

  • after each root inport, add an event receive block, which converts an input event to a signal while preserving the signal values and data type.

  • before each root outport, add an event send block, which converts an input signal to an event while preserving the signal values and data type.

(to expedite the block insertion, you can copy the event blocks from autosar example model autosar_laneguidance.)

to configure the model as a mapped autosar adaptive software component, open the autosar component quick start. on the apps tab, click autosar component designer. the autosar component quick start opens.

to configure the model for autosar adaptive software component development, work through the quick-start procedure. this example accepts default settings for the options in the quick start set component pane.

in the finish pane, when you click finish, your model opens in the autosar code perspective.

configure autosar adaptive software component in simulink

the autosar code perspective displays your model, and directly below the model, the code mappings editor.

next you use the code mappings editor and the autosar dictionary to further develop the autosar adaptive component.

the code mappings editor displays model inports and outports. use the editor to map simulink inports and outports to autosar required ports and provided ports (defined in the autosar standard) from a simulink model perspective.

open each code mapping tab and examine the mapped model elements. to modify the autosar mapping for an element, select an element and modify its associated properties. when you select an element, it is highlighted in the model.

to configure the autosar properties of the mapped autosar adaptive software component, open the autosar dictionary. in the code mappings editor, click the autosar dictionary button, which is the leftmost icon. the autosar dictionary opens in the autosar view that corresponds to the simulink element that you last selected and mapped in the code mappings editor. if you selected and mapped a simulink inport, the dictionary opens in requiredports view and displays the autosar port to which you mapped the inport.

the autosar dictionary displays the mapped autosar adaptive component and its elements, communication interfaces, and xml options. use the dictionary to configure autosar elements and properties from an autosar component perspective.

open each node and examine its autosar elements. to modify an autosar element, select an element and modify its associated properties. autosar xml and autosar-compliant c code generated from the model reflect your modifications.

generate c code and arxml descriptions (embedded coder)

if you have simulink coder and embedded coder software, you can build the autosar adaptive model. building the autosar model generates autosar-compliant c code and exports autosar xml (arxml) descriptions. in the model window, press ctrl b or, on the autosar tab, click generate code.

when the build completes, a code generation report opens. examine the report. verify that your code mappings editor and autosar dictionary changes are reflected in the c code and arxml descriptions. for example, use the find field to search for the names of the simulink model elements and autosar component elements that you modified.

related links

网站地图