Error: Error occurred when checking data object usage for model

7 views (last 30 days)
Error: Error occurred when checking data object usage for model 'VCU_App': The specified owner models for the following internal signals/states used by model 'VCU_App' must have access to the data: Signal 'Ctrl_VCU_SF1' is set to an invalid owner 'Ctrl_VCU_SF'
Hello,
I have a structure where I have a Top Model called VCU_App, and inside it I have referenced models for various functionalities that I want to code in separate source files
For this purpose I use in Embedded Coder the class ExportToFile for the Inports, Outports for each referenced model so that they are declared, defined in the respective model source files.
I already did this for some models, and I used as Owner in the Code Mappings the name of that model.
But now I made a new model Ctrl_VCU_SF, and I am receiving the error above when trying to generate code.
The only difference that I see is that this model has its inputs connected to ground blocks, and its output is connected to a terminator
Any idea what this means and how to fix it?
I tried to remove the Owner from the Code Mappings, and the code is generated, but I noticed that new .c, .h files are generated now just with the declaration and the definition of that variable, but they are located in the folder where the code for the Top App is.
Further more, this is crashing my compilation as I have the same files twice, and it also doesn't make sense to me.

Answers (1)

Mark McBroom
Mark McBroom on 2 May 2022
Since the top model VCU_App needs to interact with the child models using the same exported signals, you'll need to set owner of the data objects for the child model to also be VCU_App. Alternately, you could remove the storage classes for the child model inports and outports since presumbly you likely only care about the storage for the top level model root level ports and interfaces.
  1 Comment
Bogdan Bodnarescu
Bogdan Bodnarescu on 2 May 2022
Edited: Bogdan Bodnarescu on 2 May 2022
From the first part of your answer I understand that I can set for my Outport as Owner both VCU_App but also the model that produces it?
Just from my observation, if I have a signal that goes just from a child model to a child model, then if I set the Owner to to child model that produces that signal then the code generation works.
But if the signal goes from the child model to a terminator inside the top model, and I set the owner, then I get the error above.
If I don't set any owner, then the code generation is ok, but a .c and .h file will be defined in the same folder where the Top Model .c file is generated.
I don't understand the second part of your answer about removing the storage classes for the child model inports and outports?
I want that all the variables are declared in the files corresponding to the child models, the only way I could make this work was to use ExportToFile for the Inports and Outports of the child models, in this way the Top Model doesn't have any variables declared inside and the software is modular.
Is there a better way to do this?

Sign in to comment.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!