Mapping software components onto two ECUs
- Debug component on ECU1:
- Send out Torque(sensor) data via CAN COM TX
- Receive
Wiper_2ms component on ECU2:
- Rx torque data via COM stack from CAN COM RX
- Convert it to current data and sent to Wiper_100us on the same ECU component to omponent higher frequence for sampling rate
1 Software Template 创建SWC这个工具箱,其中包括 data element 和 runnable 这两个最重要的概念
Interface + SWC + composition
1 Import example project + import files from other project into your own project
2 when new a project, it will automatically contain all "Can_EcucParamDef.arxml" files
3 import(copy) "01_TypesAndInterface.arxml" into new project reuse the arxml
- <SENDER-RECEIVER-INTERFACE> : <DATA-ELEMENTS> + <APPLICATION-PRIMITIVE-DATA-TYPE> interface: data element + data type 本质上就是c语言函数的参数 Func( uint8 A, uint16 B )
- <IMPLEMENTATION-DATA-TYPE> : AP 和 IP 怎么联系起来的?答:在Internal behavior的 data type mapping 里面
4 New a arxml file and new a package under the arxml, new a sensorActuator component under the package. create a SWC
5 adding port to SWC + adding interface under each port
- Provide/Required port: define the direction of the data flow
- S/R or C/S Interface: define the available data element and the data type under the interface
- S/R interface means sender provide data to receiver via interface 想象是C语言把变量a传递给了函数B作为输入 int a=10; func(a)
- C/S interface means client call an operation the server provided 想象是C语言 调用函数B / 获得返回值
Example: A client/server interface "TrsmRatGear1" is defined to return the gear ratio for a given gear. The client requests the operation 'GetTrsmRatGear' with input argument 'Gear'. The function call returns the output argument 'Rat'.
Adding internal behavior under the SWC SWC由静态的port 和 动态的 internal behavior 构成
- Runnable + data access point/server call point 函数名 + 函数内部收发 port下面的可用的data element/函数内部调用port下面的operation
- Timing event 该runnable/函数 的周期在此确定,OS task mapping后 RTE 会根据timing event的周期生成对应的c代码
- Data type mapping AP 和 IP 对应上
至此,SWC的 函数名,函数周期,函数内部的变量获取/函数调用 全部完成, 唯一剩下的就是 由哪个 OS task 去调用该函数(实际上并不影响执行)
注意: 以上只是创建了一个一个的SWC 个体,SWC 与 SWC 之间的互动将在composition里面实现(需要先新建SWC prototype,因为这里只是性质定义,所以需要在composition里面创建SWC实体) 上面这些所有的,都可以在migration的时候复用
6 New arxml and create composition under it + new SWC prototype under composition
不管是interface还是SWC都只是工具库,在composition下面new SWC prototype才算创建了SWC的实体 composition下面可包含SWC或其他composition
7 Assembly connector, connect port between each SWC
2 System description 创建communication matrix 这个工具箱,里面包含了signal的信息
8 import DBC and genrate communication matrix arxml file convert DBC to arxml file 没有任何信息量的增加,我们不需要关注这个arxml文件,因为它就是宁一个dbc而已,只是个库文件
Which will genrate "ECU, PDU, ISignal and SystemSignal" database inside the "DBC_SysDesc.arxml"
3 System Mapping 把上面两个工具箱的内容拿出来整合成可用的实体,最重要的就是 data element 跟 signal 连接上 + runnable 跟 OS task 连接上
9 New a arxml file, and save it as "System extract" property 这是System level 最重要的一个arxml文件,接下来所有的配置都将存储在这个armxl里面,所以它的属性是 "System extract"
10 New a systemMapping under the arxml file, map the SWCs under the composition to the desired ECU SWC to ECU mapping multi-core 什么时候配置?
11 Mapping system signal to data element, this information is also saved under the "System extract" arxml system signal mapping
12 right click on ECU "wiper control" to create EcuExtract, which will generate corresponding arxml file 因为一个project的目的是配置一个ECU,所以需要生成Ecu extract arxml, 不然怎么知道你想配置哪个ECU呢。 接下来的RTE editor操作所产生的OS.arxml 和 RTE.arxml 都link在这个ECU extract arxml 里面
13 right click on the ECU extract to open RTE editor, finish mapping runnables into OS task Runnable to OSTask mapping
至此,我们有了 函数原型体,函数所需的变量,以及函数的触发条件。 接下来只需要在 函数内部填充相应的功能代码即可
Example:
- 客户会给我们包含了 communication matrix 的 ECU extract arxml 文件,这样我们就知道了
- 我们在针对communication matrix下的哪个ECU进行配置
- 有哪些从外部总线而来的signal可用
- 如果我们想添加自己的SWC,只需要添加到客户已有的ECU下面 (SWC to ECU mapping),然后重新生成ECU Extract 即可。 接下来就可完成自己所需的 signal mapping 和 runnable mapping
- 直接在system extract 下面看SWC to ECU mapping的信息,即可知道当前ECU下面有哪些生效的SWC,只有生效的SWC的runnable才能在RTE 里面进行 OS task mapping
- 当我们想创建一个test component,里面有一个周期性运行的函数,我们的测试代码放在里面运行
- 考虑是否需要跟外部总线的signal 或者 其他SWC的 data element 互动
- 创建 interface + data element 定义
- 创建SWC,并将interface部署在SWC的port下面
- 定义SWC的runnable 的触发Event,以及data access point
- 考虑函数的被调用模式
- 创建composition 并添加该SWC
- 将该SWC mapping 到ECU下面
- 执行RTE OSTask mapping