ISOLAR与Simuink交互
8.1 AutoSar的几种开发流程
8.2 Simulink 到ISOLAR
Simulink生成SWC arxml
SWC arxml放到ISOLAR文件夹
F5即可显示
8.3 ISOLAR到Simulink
1、Matlab的几个命令
1)importer
Call the constructor arxml.importer to create an importer object that represents the software component information in the specified XML file or files. For example, the following call specifies a main software component file, mr_component.arxml, and related dependent files containing data type, implementation, and interface information that completes the software component description.
obj = arxml.importer({'mr_component.arxml','mr_datatype.arxml',...
'mr_implementation.arxml','mr_interface.arxml'})
If you enter the arxml.importer constructor call without a terminating semicolon (;), the importer lists the AUTOSAR content of the specified XML file or files. The information includes paths to software components in the AUTOSAR package structure, which you use in the next step. In this example, the path to software component ASWC is /pkg/swc/ASWC.
obj =
The file "H:\wrk\mr_component.arxml" contains:
1 Application-Software-Component-Type:
'/pkg/swc/ASWC'
0 Sensor-Actuator-Software-Component-Type.
0 CalPrm-Component-Type.
0 Client-Server-Interface.
>>
2)createComponentAsModel
If CreateInternalBehavior is set to true, the importer creates a function-call-based model. The importer adds function-call subsystem or function blocks and signal lines and maps them to corresponding runnables and IRVs imported from the AUTOSAR software component.
The following call directs the importer to import a multi-runnable AUTOSAR software component and map it into a new function-call-based model:
obj = arxml.importer('mySWC.arxml')
createComponentAsModel(obj,'/pkg/swc/ASWC','CreateInternalBehavior',true)
3)其它命令
createCalibrationComponentObjects | Create Simulink calibration objects from AUTOSAR calibration component |
createComponentAsModel | Create AUTOSAR atomic software component as Simulink model |
getApplicationComponentNames | Get list of application software component names |
getCalibrationComponentNames | Get calibration component names |
getClientServerInterfaceNames | Get list of client-server interfaces |
getComponentNames | Get application and sensor/actuator software component names |
getDependencies | Get list of XML dependency files |
getFile | Return software component XML file name |
getSensorActuatorComponentNames | Get list of sensor/actuator software component names |
setDependencies | Set XML file dependencies |
setFile | Set software component XML file name |
updateModel | Update AUTOSAR model with arxml changes |
updateReferences | Update model with arxml definitions of AUTOSAR reference elements |
2、ISOLAR 搭建DEMO
1)结构树
2)示意图
3)文件列表
4)AutoSar版本需保持一致
4)执行代码
第一步:obj = arxml.importer({'ApplicationSwComponentTypeTest.arxml','ISOLAR_PlatformTypes.arxml','InterfaceTest.arxml'})
第二部:createComponentAsModel(obj,'/ApplicationSwComponentTypeTest/ApplicationSwComponentTest','CreateInternalBehavior',true)
8.4 Simulink 配置生成AutoSar 代码
1、Configuration 相关配置
2、搭建Model
3、进行AUTOSAR配置(类似于ISOLAR-A操作)
4、AUTOSAR配置与SWC进行Mapping
5、Mapping之后的模型
6、生成代码和描述文件
7、注意事项
1)Simulink Function中的形参要与CS端口里面的配置同名
2)Simulink Function中的Function Name要与Runnable里面的symbol同名
3)通过对xml配置,可以生成独立的Arxml文件和独立的Arxml文件
4)在模型里面需要定义端口数据类型,否则默认全部为Double
8.5 Simulink 配置与ISOLAR对应关系
1)Interface
2)Port
3)Runnable
4)IRV