simulink test issue with c++ class code packaing interface

7 次查看(过去 30 天)
Hi, I'm using Simulink test in order to create a back-to-back test scenario using simulink/statechart mode and C++ generated code (Embedded coder).
When I set target languge to C (for code generation), it works fine. But for C++ case, it has the error below
'C++ class cannot be generated for this subsystem because it cannot be converted to a model block: Simulation status of model 'stop_wait' is 'paused'. This indicates that the model is being run. Please stop the simulation, and rerun convertToModelReference. Simulation status of model 'stop_wait' is 'paused'. This indicates that the model is being run. Please stop the simulation, and rerun convertToModelReference.'
It is somehow strange, that prints a statement twice! also, there is not any running simulation that time.
I use:
Simulink Test -> Test Manager -> Create Test for Model Component -> Use component input from the top model as test input -> Perform back-to-back testing -> Done and this error raises as a window.
is there any limitation to use C++ as langauge (or target packaging interface) in Simulink Test?
thanks

回答(1 个)

Samay Sagar
Samay Sagar 2024-8-22
Hi Jafar,
I understand that you are encountering an error related to code generation for C++ in Simulink Test, where a subsystem cannot be converted to a model block due to an incorrect indication that the model is being simulated, despite no active simulations.
The issue you are facing relates to the conversion process when attempting to generate C++ code for a Simulink model. There are a few potential reasons and solutions to consider:
  1. Model Reference Conversion: The error message suggests an issue with converting a subsystem to a model reference. Ensure that your subsystem is properly configured to be converted into a model reference. Check any requirements or constraints in the documentation for model reference conversion, especially when targeting C++.
  2. Simulation Status: Although the error mentions the simulation is "paused," this could be a false indication. Try explicitly stopping any simulations and ensuring that no background processes are running. You can do this by using the “set_param” command. Check the Simulink Editor to ensure no simulations are active.
set_param('modelName', 'SimulationCommand', 'stop')
For more information about code generation limitations for a Simulink model and model references, refer the following documentation:

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by