Can I use protected models with Simulink Real-Time?

10 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 23 Oct 2025 at 0:00
Edited: MathWorks Support Team on 23 Oct 2025 at 22:04
You can use protected models with Simulink Real-Time, although there are some limitations:
  1. You cannot use protected models in External Mode in releases before R2023b. For more information, see: Can I run a Simulink model that references a Protected Model in External Mode?
  2. There are several (mainly hardware functionality-related blocks) in SLRT that are non-inlined S-functions, and these blocks cannot be inside a protected model.
  3. You need a Simulink Real-Time license to create a protected model that can be run with Simulink Real-Time.
One reason that could cause the error is if the protected model is not set to have 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, one of the options below should be selected, 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 for the same can be found here:  Create Protected Models with Multiple Targets
ALTERNATIVE WORKFLOW: If Simulink Real-Time is not available, but the model creator has access to Simulink Compiler, an alternative approach is to export the model as a standalone FMU. See: How can I run my Simulink model containing an FMU on Speedgoat hardware with Simulink Real-Time (SLRT)?

More Answers (0)

Categories

Find more on Multicore Processor Targets in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!