Is it only possible to generate task execution time information for a subsystem with SIL while using a test harnish?

5 views (last 30 days)
Hello everyone,
I'm trying to generate task execution time for a subsystem trough a SIL (SIL/PIL manager). I'm using the 'Embedded Coder' toolbox. Unfortunatly I can't perform a SIL only for one subsystem.
If I click the 'Run SIL/PIL' button, with 'SIL/PIL only' settings chosen, it still only runs a normal simulation of the model (you can see the settings in SIL/PIL manager and the subsystem in the picture below).
While reading through several pages in the documentation I came to the conclusion, that I can only create a SIL over a single subsystem, when this subsystem is in 'SIL mode'. Also, the only way I found for setting a subsystem to 'SIL mode' is through creating a test harnish for it. For creating a test harnish for a subsystem you need the 'Simulink Test'-toolbox, which I don't have.
Is there any other way to create a SIL over a single subsystem (or another way to create a test harnish for a subsystem or measuaring the execution time with 'Embedded Coder')?
I'm using Matlab R2021b.
Thanks in advance!

Answers (1)

Altaïr
Altaïr on 24 Apr 2025
There are two main methods available for setting up SIL (Software-in-the-Loop) or PIL (Processor-in-the-Loop) simulations on subsystems:
  1. Using a Simulink Test harness with the SIL/PIL Manager: For models that include subsystems, Simulink Test together with the SIL/PIL Manager can be used to perform unit testing on the code generated from those subsystems. This approach allows the generated subsystem code to be tested as part of the overall code from the parent model.
  2. Creating a SIL or PIL block: Another method involves generating a SIL or PIL block directly from the subsystem. This block can then be placed into a separate environment or test harness model, where it receives test vectors or stimulus inputs. This workflow generates standalone code from the subsystem and tests it independently.
The following command provides more details on these workflows:
web(fullfile(docroot, 'ecoder/ug/configuring-a-sil-or-pil-simulation.html?s_tid=doc_srchtitle#bsf5v22_sep_brr9t4r-3'))
For PIL simulations, the compilation and execution of code in the target environment are managed through connectivity settings.
To generate a SIL or PIL block from a subsystem and use it for code testing, the following steps can be followed:
  • In the Configuration Parameters, navigate to Code Generation > Verification > Advanced Parameters, and choose either SIL or PIL from the Create block drop-down menu.
  • If needed, configure code execution profiling.
  • Click OK to confirm the settings.
  • In the model window, right-click the desired subsystem.
  • Select C/C++ Code > Build This Subsystem.
  • Click Build to begin the process, which will create a SIL or PIL block for the subsystem.
  • Add the generated block to an environment or test harness model that provides test vectors or stimulus input.
  • Run simulations using this setup.
An example illustrating this process can be found with the following command:
web(fullfile(docroot, 'ecoder/ug/software-and-processor-in-the-loop-sil-and-pil-simulation.html#d123e226050'))

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!