Simulink Set Data Visibility mapping to private

3 vues (au cours des 30 derniers jours)
ntimmers
ntimmers le 19 Jan 2024
Commenté : ntimmers le 1 Fév 2024
Hi,
I have a Simulink model 'HighLevel' in which I use a referenced model 'LowLevel'. I have added some arguments for the referenced model 'LowLevel', such as Var1. This variable exists in the Model Workspace of 'LowLevel'. When I execute code generation (Simulink Coder) I get the following error:
  • Parameter 'Var1' on Model block 'HighLevel/LowLevel is configured as an argument, but this requires that the default mapping for model parameter arguments in model 'LowLevel' specifies that Data Visibility is 'None', and the parameter needs to be defined as a data object in that model. If the parameter is defined as a MATLAB variable, convert it to a data object. Then ensure that the Data Visibility of the default mapping is set to 'private'. If it is not possible to satisfy both of these conditions, clear the 'Argument' check box in Model block 'HighLevel/LowLevel'. Clearing the 'Argument' check box will discard values for this parameter that have been specified higher in the model reference hierarchy, which may change the behavior of the model.
I need to be able to have arguments, so clearing the arguments is not an option. However, I have no idea where to change the Data Visibility to none, or to set the default mapping to private. How can I do this?
Thanks in advance.

Réponses (1)

Jaynik
Jaynik le 29 Jan 2024
Hi,
The error suggests to ensure that the "Data Visibility" is set to "private". To configure the data visibility, you can take the following steps:
  1. Open Embedded Coder from APPS > Embedded Coder.
  2. Select the coder type from OUTPUT > Embedded Code - C++. (Assuming C++ since you need access specifiers).
  3. To check visibility, PREPARE > Code interaface drop-down > Code Mappings.
You can use "Model Explorer" to convert a variable to parameter object:
  1. Open Model Explorer.
  2. Select the variable Var1 in your case.
  3. Right-click on the value of variable > Convert to Parameter object.
You can also use the "assignin" function to assign s value to variable in the specified workspace.
Check these documentations to read more about solving the error:
Hope this helps!
  1 commentaire
ntimmers
ntimmers le 1 Fév 2024
Thanks for the tips. I will try them out and come back to you when I have the outcome

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by