2

I've a basic question regarding autosar with multiple runnables that are basically the same except for different output/input names.

Currently the Simulink model is designed for one tank-module. This single module has inputs and outputs named *_Md0. E.g Filling_level_Md0, outflow/inflow_rate_Md0, valve_open_Md0 ... Though also some inputs/outputs/constants are not module-specific. E.g: tank-volume, real time clock, ...

The goal is to add an "arbitrary" number of tanks.

          -------                   -------               -------
Inputs ->|Module1|-> Outputs     ->|Module2|->   ...   ->|ModuleN|->
          -------                   -------               -------

Obviously it is very tedious to just multiply every tank-module and rename the inputs/outputs that are needed individually per module. Because it is necessary to copy every runnable, fix the libraryies and the arxml file, ...

So the question is if there is a better solution to have multiple runnables that are more or less the same? Is there some kind of for loop available in Simulink?

4

1 回答 1

1

你有两个选择。

  1. 一个单实例软件组件,其端口包含数组作为端口元素,然后是下面的相应数据。例如,罐的数量将是一个系统常数,用作所有阵列的长度。这样做的好处是您可能会获得更高效的代码,例如由于编译器中的向量化。还拥有阵列可能会使通信、诊断和测量接口更容易或更有效。
  2. 一个多实例软件组件,具有“普通”端口和您现在拥有的模型。正如您所写的,每个罐都有不同的参数,您将需要每个实例的校准参数。然后,您的软件组合将像您拥有坦克一样频繁地实例化多实例坦克组件。这样做的好处是更容易测试,并且您的实现完全独立于储罐的数量。此外,您可以更好地分配 CPU 负载以减少峰值 CPU 负载。
于 2021-11-17T13:07:29.037 回答