Can I use protected models with Simulink Real-Time?

29 views (last 30 days)
I am receiving some components from a supplier who can only send me protected models, and I want to run these models using Simulink Real-Time. When I try to build the model and connect to the target, however, I see one of the following errors:
Target in protected model <model name> does not match target of model that references it 'speedgoat'.
Regenerate protected model with correct target to continue.
Target in protected model <model name> does not match target of model that references it 'slrealtime'.
Regenerate protected model with correct target to continue.
Target slrt unsupported for protected model <model name>
How can I fix this? Is there any way I can use protected models with Simulink Real-Time?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jan 2026 at 0:00
Edited: MathWorks Support Team on 29 Jan 2026 at 18:47
Protected models are fully supported with Simulink Real-Time.
Note that the following limitations apply:
  1. The receiving party cannot use protected models in External Mode in releases before R2023b. For more information, see the following MATLAB answer: Can I run a Simulink model that references a Protected Model in External Mode?
  2. There are several (mainly hardware-related) blocks in SLRT that are non-inlined S-functions. These blocks cannot be placed inside a protected model.
  3. The model creator needs a Simulink Real-Time license and installation to create a protected model that can be run with Simulink Real-Time. In R2024a and later, you also need to install "Speedgoat I/O Blockset" to access the required system target file.

Resolving target mismatch errors:

If you encounter the errors above, then the protected model is not set to the correct code generation target. To create a protected model that can be run with Simulink Real-Time, in the Configuration Parameters of the protected model under Code Generation > System target file, select one of the options below, depending on the MATLAB release. If it is set to something else, this could be the cause of the error.
  • speedgoat.tlc (R2024a or later)
  • slrealtime.tlc (R2020b through R2023b)
  • slrt.tlc (R2020a and earlier)
If the model has already been protected, then you can add another target with the 'Simulink.ProtectedModel.addTarget' function. An example of this can be found here: Create Protected Models with Multiple Targets.

Alternative Workflow: Export FMU with Simulink Compiler

If the model creator has no access to Simulink Real-Time but has access to Simulink Compiler, an alternative approach is to export the model as a standalone FMU (functional mockup unit). See: How can I run my Simulink model containing an FMU on Speedgoat hardware with Simulink Real-Time (SLRT)?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!