As SOA software architecture gradually enters the field of automotive software development, the Adaptive Autosar platform is used more frequently in application software development. Today, let’s talk about how to import the AP description document and develop application layer software in Simulink.
Step 1: Import the arxml file
Use the importer command to import the arxml file. The syntax format is as follows:
ar = arxml.importer(filename)
ar = arxml.importer({filename1,filename2,...,filenameN})
Step 2: Create autosar model components
Use the createComponentAsModel command to create a component. The syntax format is as follows:
createComponentAsModel(ar,ComponentName)
[mdl, sts] = createComponentAsModel(ar,ComponentName,Name,Value)
Among them, ComponentName is the shortest path name of the atomic component defined in the arxml file.
ar is the file imported by arxml;
For the corresponding attributes of Name and Value in the second method, you can check the document: Name-Value Pair Arguments ;
After understanding the above instructions, we can connect all the steps in series and complete the above work in batches, as follows:
clear
clc
[fillName,pathName]=uigetfile('*.*','Please seltect a file');
ar=arxml.importer(fillName);
names=getComponentNames(ar);
createComponentAsModel(ar,names{1,1},'ModelPeriodicRunnablesAs','FunctionCallSubsystem');
clearvars ar names fillName pathName ans
After completing the above steps, we only need to run the script to easily convert the arxml file into a simulink model.