纲要:
SWC属于AUTOSAR的Component文件夹下,而Composition属于Composition文件夹下。
目录
1. Import "Data Type" and "Interface" information
2. Creat Software Component(SWC)
3. Create "Port" for this SWC
4. Add "Internal Behavior" for this SWC
1. Import "Data Type" and "Interface" information
Copy the "01_TypesAndInterface.arxml" file into the project, which contains
- Interface
- Data Element
- Application data type
- Implementation Data Type
which will be used in the "SWC creation". [0][0.1]
2. Creat Software Component(SWC)
Right click on the project, create "Component - Element/Sensor Actuator Sw Component Type". Then name the SWC, which will create "02_WiperControl_100us.arxml" file to save the SWC information.
3. Create "Port" for this SWC
Right click on the "02_WiperControl_100us.arxml" file and Open with “Component Editor", there will be option to create Pport/Rport. And also which Interface to be added under the port.[0.2](Interface is defined under 01_TypesAndInterface.arxml)
4. Add "Internal Behavior" for this SWC
- Runnable Entity(RE) [1]
- DataAccessPoint: DataReadAccess/DataWriteAccess [2]
- Timing Event[3]
- DataTypeMappingSet[4][5]
[0] 说明新建SWC port的前提是要提前定义好Interface库,port只能从现有的库里面去绑定Interface
注:
[0]: 每次在新建SWC之前,都应该去看看有哪些Interface可用,这是新建SWC的基础和前提条件。因为SWC的port只能与现有的Interface相连,而Interface下面的Data Element则代表着SWC可用的variable
[0.1]: Application data type 和 Implementation Data Type 存在“01_TypesAndInterface.arxml”文件,但AUTOSAR platform types存在"ISOLAR_PlatformTypes.arxml"文件里面
[0.2]: 用户去决定是Pport还是Rport,因为Interface是不分方向的
[1] 每个SWC下面可以有多个runnables
[2] 是Read还是Write基于之前给该SWC新建的Ports来确定,软件会自动识别这步分配的是Pport还是Rport,从而确定是Read还是Write AccessPoint
[3] 新建TimingEvent后软件会问和哪个runnable绑定
[4] DataTypeMappingSet is under "Internal Behavior', 所以说是基于SWC去绑定一个个相互独立的DataTypeMappingSet
[5] 之前在“01_TypesAndInterface.arxml” 文件里面只会去创建Application data type和Implementation data type(并声明IDT和哪种AUTOSAR base type相连),在这里(02_WiperControl_100us.arxml)才会将 Application data type和Implementation data type连接起来(可附加ComputeMethoud)
[6] 但在实际生成的代码中,SWC变量/DataElement 用的是Implementation data type