Model coverage with library blocks and model reference.

34 views (last 30 days)
Claudio Rosso
Claudio Rosso on 8 Nov 2024 at 12:48
Answered: Pramil on 21 Nov 2024 at 5:59
Good afternoon,
I'm trying to create a workflow for apllication development on simulink where one or more libraries and one or more projects can be referenced to access blocks and referenced models.
I've some trouble to understand how I can aggregate the coverage of my main blocks with the one obtained testing the library blocks and referenced models stand alone.
For example:
I have block Main that will instance library block LibA and LibB, In te same time it will refernced project X and use model C into the application.
I want at this point create test harnesses for the block Main without concerning directly in these harnesses of coverage of library blocks and referenced models. In this way, even if my harness won't cover 100% of LibA and LibB, this will be obtained by the harnesses dedicate to the library blocks. The same should work also for referenced models.
I'm not be able to reproduce this behaviour. Is there any guide or someone that can explain me how to approach to this problem?

Answers (1)

Pramil
Pramil on 21 Nov 2024 at 5:59
Hi Claudio,
For your usecase, you can use the Coverage Analyzer app, you can learn more about Simulink coverage here:
Here's how you can achieve your usecase:
  • Ensure that your main model (Main), library blocks (LibA, LibB), and referenced models (C) are well-organized in your project.
  • Develop test harnesses for each individual library block (LibA, LibB) and referenced model (C). These harnesses should focus on covering the functionality of the library blocks and referenced models independently.
  • In each test harness, enable coverage collection by navigating to Configuration Panel > Coverage > Enable coverage analysis. Ensure that you select the appropriate coverage metrics (e.g., decision, condition, MCDC).
  • Execute the test cases on each library block and referenced model to collect coverage data.
  • Create a separate test harness for the main block (Main). This harness will focus on the integration and interaction of all components. Execute the test cases for the same.
  • Now go to Apps > Coverage Analyzer and open Result Explorer. Import the saved coverage results from the individual library blocks, referenced models, and the main block.
  • Use the "Aggregate" section to combine these results into a comprehensive report.
You can refer the following documentation as well, to know more about managing coverage results:
If you have any doubts, feel free to drop them here.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!