Clear Filters
Clear Filters

Issue with protected model and mask function

10 views (last 30 days)
Borja Heriz
Borja Heriz on 27 Jun 2022
Answered: Yash on 26 Oct 2023
Hi there,
I've a simulink model with a reference model (calling to a protected model) and a block linked to a library. The library block is simulating other block diagram within its mask. Well, something very strange is happening when updating the block diagram with this configuration
When the mask function is evaluated (calling the sim command) the **_msp.mexw64 file previously created for the protected model is automatically deleted. Therefore, the model update results in error with the following message
"Error in Model block 'call_lib_model/Model': The model reference simulation target for the referenced model 'ref_model' does not exist. One reason this can happen is that the top model has the 'Rebuild options' parameter set to 'Never' on the 'Model Referencing' pane of the Configuration Parameters dialog."
My guess is that when you simulate another block diagram while doing the update of another, the slprj folder contents corrupt somehow and, therefore, the process finds an error.
My objective is to tell Simulink to create and use another slprj folder for the second simulation. I've tried to do it using the Simulink.fileGenControl, but I've not managed to get this working.
I'm attaching a dummy folder with all files needed to reproduce the error.
Many thanks in advanced

Answers (1)

Yash
Yash on 26 Oct 2023
Hi Borja,
I understand that you are facing issues while referencing a protected model in Simulink. After conducting a simulation of the model using MATLAB R2017b, I was able to reproduce the error you mentioned. Despite following the provided instructions, I was unable to resolve the error.
However, I discovered that running the model in a more recent release (MATLAB R2023a) did not result in any errors. I recommend you to update MATLAB to the latest relase to resolve the issue.
Note that in order to achieve this, you need to export the "ref_model" to a protected model using the later release. Additionally, ensure that the necessary folders are added to the MATLAB path so that the model can locate the referenced model.
Hope this helps.

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!