Main Content

Configure AUTOSAR Nonvolatile Data Communication

The AUTOSAR standard defines port-based nonvolatile (NV) data communication, in which an AUTOSAR software component reads and writes data to AUTOSAR nonvolatile components. To implement NV data communication, AUTOSAR software components define provide and require ports that send and receive NV data. For more information about modeling software component access to AUTOSAR nonvolatile memory, see Model AUTOSAR Nonvolatile Memory.

In Simulink®, you can create AUTOSAR NV interfaces and ports, and map Simulink inports and outports to AUTOSAR NV ports. You model AUTOSAR NV ports with Simulink inports and outports, in the same manner described in Sender-Receiver Interface.

To create an NV data interface and ports in Simulink:

  1. Add an AUTOSAR NV interface to the model. Open the AUTOSAR Dictionary and select NV Interfaces. Click the Add button . In the Add Interfaces dialog box, specify the interface name and the number of associated NV data elements.

  2. Select and expand the new NV interface. Select DataElements and modify the data element attributes.

  3. Add AUTOSAR NV ports to the model. Expand AtomicComponents and expand the component. Select and use the NvReceiverPorts, NvSenderPorts, and NvSenderReceiverPorts views to add the NV ports you require. For each NV port, select the NV interface you created.

  4. Map Simulink inports and outports to the AUTOSAR NV ports you created. Open the Code Mappings editor. Select and use the Inports and Outports tabs to map the ports. For each inport or outport, select an AUTOSAR port, data element, and data access mode.

To programmatically configure AUTOSAR NV data communication elements, use the AUTOSAR property and mapping functions. For example, the following MATLAB® code adds an AUTOSAR NV data interface and an NV receiver port to an open model. It then maps a Simulink inport to the AUTOSAR NV receiver port.

% Add AUTOSAR NV data interface myNvInterface with NV data element DE3
arProps = autosar.api.getAUTOSARProperties(hModel);
addPackageableElement(arProps,'NvDataInterface','/pkg/if','myNvInterface');
add(arProps,'myNvInterface','DataElements','DE3');

% Add AUTOSAR NV receiver port NvRPort, associated with myNvInterface
add(arProps,'ASWC','NvReceiverPorts','NvRPort','Interface','myNvInterface');

% Map Simulink inport NvRPort_DE3 to AUTOSAR port/element pair NvRPort and DE3
slMap = autosar.api.getSimulinkMapping(hModel);
mapInport(slMap,'NvRPort_DE3','NvRPort','DE3','ImplicitReceive');

Related Examples

More About