SIL error (Unable to find function)

3 ビュー (過去 30 日間)
Jung Sunghun
Jung Sunghun 2023 年 11 月 15 日
編集済み: Angelo Yeo 2023 年 11 月 15 日
Hello all,
I am currently having trouble when I try to run the SIL simulation. As shown in the following capture, I simply created the SIL block (UKF_EKF_1TC_SIL) which is identical to the original block (UKF_EKF_1TC).
When I try to run "Run Verification" by setting "SIL/PIL > System Under Test: Model blocks in SIL/PIL mode," the simulation fails due to the following error message.
It seems like both the "EKF" and "UKF" blocks located in the "UKF_EKF_1TC_SIL" which refer to "batteryStateFcn" and "batteryMeasurementFcn" cannot call it due to an unknown reason whereas "UKF_EKF_1TC" works great by calling up both the "batteryStateFcn" and "batteryMeasurementFcn".
I would appreciate it if anyone could guide me in the correct direction. Thank you very much in advance.

採用された回答

Angelo Yeo
Angelo Yeo 2023 年 11 月 15 日
編集済み: Angelo Yeo 2023 年 11 月 15 日
BLOT: You need to have Simulink functions inside the SIL model to build C/C++ code.
I was able to reproduce your issue with a shipped example below.
Below are my reproduction stpes.
  1. Open the example model and change the codegen target to "ert.tlc".
  2. Go to "Configuration > Code Generation > Verification > Advanced Options > Create Block" and set it as "SIL".
  3. Wrap a part of the model into a subsystem (as shown in the picture below) and try to build the subsystem into a C/C++ code. Then you will get a similar error to yours.
The solution here is to put the Simulink functions for calculating state transition and measurements into the subsystem.
Hence, in your case, put all the Simulink functions for calculating state transition and measurement into "UKF_EKF_1TC" subsystem and generate a SIL model block out of it. Do not forget to change the options described in the reproduction step 2 if you want to build a subsystem solely for SIL.

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by