SIL error (Unable to find function)

3 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 DSP Algorithm Acceleration 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by