Why do I receive an error when protecting a model reference block that contains an Embedded MATLAB block in its design in Simulink 7.6 (R2010b)?

6 views (last 30 days)
I am trying to create a protected model reference block using the following steps:
Simulink.ModelReference.protect('model_name') %model_name is the name of the model
After this step, Real-Time Workshop build procedure for model is aborted due to a CGIR assertion. I receive the following error message:
CGIR assertion in b:\matlab\src\cg_ir\util_prim/Size64.hpp(93): 'fSize == (Uint64)i'
### Real-Time Workshop build procedure for model: 'PrimeMover4' aborted due to an error.
??? Error using ==> tlc_c at 160
Unexpected or internal error encountered in "in CGIR: b:\matlab\src\cg_ir\util_prim/Size64.hpp line 93:
fSize == (Uint64)i
". Please report this to The MathWorks if you can cause it to recur.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Nov 2012
The issue is due to a compiler limitation related to the maximum size of a persistent, input or output variable that can be declared in an Embedded MATLAB Function block or MATLAB code. In Simulink 7.5 (R2010b), the compilation process returns a CGIR error.
In the latest release of Simulink 7.7 (R2011a), the build process return the error from the compiler:
LINK : fatal error LNK1248: image size (8F11E000) exceeds maximum allowable size (80000000)
From the above error message it is inferred from the Microsoft Viual Studio documentation that it is not possible to have more than a total of 80MB of persistent variable assignment.
For example an assignment of type:
persistent p;
if(~isempty(p))
{
p = 0;
}
p = single(zeros(1,200000000));
The only way to work around this limitation is to restructure your application to use a smaller amount of persistant variable.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2011a

Community Treasure Hunt

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

Start Hunting!