Cannot modify locked model because the test harness belonging to it is open.

20 views (last 30 days)
Hi,
I am creating some library blocks for a custom library (the library is called 'Controllers'). One of the blocks (in this case the ramp_limiter) is used inside the other one (asc).
I have created a test harness for the ramp limiter block and tested it succesfully without any problem. However, when I try to do the same with the asc block, I have the following error displayed when I update (Ctrl+D) the model:
If a disable the link between the instance of the ramp_limiter inside the asc block and the library, the model updates and "compiles" without any error:
So, the problem seems to be with this block. Diving a litle bit more, inside this block, there is a Matlab Function block where I perform some calculations (I am not using persistent vars and the implemented logic is stateless):
The thing is that if I restore the library link of the ramp limiter and I try to update the model, Simulink does not complain anymore, so, it seems that there is a problem when I try to use a linked subsystem with a matlab function block inside another linked subsystem. If I remove the Matlab Function block or I disable the library link, there is no error.
May be I need to configure something else or there is something wrong with my approach. Any ideas?
Thank you in advance.
Aitor.

Answers (2)

Piyush Dubey
Piyush Dubey on 27 Jul 2023
Hi Aitor,
There can be multiple reasons for such situation to arise. Following pointers can be rechecked to ensure that there are no issues:
Library Link Configuration:
  1. Ensure that the library link is properly configured for both the main model and the linked subsystems.
  2. Verify that the library link is set up correctly, including the necessary library paths and dependencies, to ensure that all required functions and blocks are accessible.
MATLAB Function Block Dependencies:
  1. Check if the MATLAB Function block inside the linked subsystem has any dependencies on functions or variables that are not available or accessible.
  2. Ensure that all required functions and variables are properly defined and accessible within the linked subsystem and its parent model.
  3. Pay attention to any dependencies on custom MATLAB functions or external files that may not be linked correctly or have conflicting versions.
Code Generation Settings:
  1. If you are generating code from the model, verify that the code generation settings for the linked subsystems and the MATLAB Function block are compatible.
  2. Make sure that the code generation settings, such as the language, optimization level, and target hardware, are consistent for all linked subsystems and the MATLAB Function block.
  3. In some cases, certain code generation settings may cause conflicts or compatibility issues, resulting in errors when using linked subsystems with MATLAB Function blocks.
Compatibility with Linked Subsystems:
  1. Confirm that the MATLAB Function block is compatible with the use of linked subsystems.
  2. Some blocks, including certain variants of the MATLAB Function block, may have limitations or restrictions when used within linked subsystems.
  3. Check the documentation or release notes for your specific version of Simulink to ensure that the MATLAB Function block is supported in the context of linked subsystems.
Hope this helps.

Aitor Juanicorena
Aitor Juanicorena on 1 Aug 2023
Hi Piyush,
First of all thanks for your support.
I have tried to open and work with the same library with a newer version of Simulink (R2023a) and this issue does not happen.
Currently we are using Simulink R2021a due to some project requirements. It seems a problem or a bug in this specific version that happens when you try to run a test harness of a library subsystem that contains another library subsystem that is saved in the same library file.
Regards,
Aitor.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!