How can I desactivate Data Type Override option for a Simulink model ?
11 次查看(过去 30 天)
显示 更早的评论
After executing a Simulink model I had the error message in the image bellow, I click on fix button so matlab enabled the Data Type Override option automatically and now I want to desactivate it because it caused me problems with other variables types .How can I do to desactivate this option from the hole model ?
0 个评论
回答(2 个)
Fangjun Jiang
2024-6-1
set_param('MyModel','DataTypeOverride','Off')
2 个评论
Fangjun Jiang
2024-6-3
This is the correct answer to your titled question. It might not have solved your original problem. But you need to provide more info beyond "it didn't work".
The auto fix sometimes resolves a superficial error message but may not be the right fix for the underlining problem. You need to understand your orignal problem and take the right action, not just follow the "auto fix" without fully understand it.
Best way is for you to provide an example model of your original problem. Or contact the Mathworks' tech support.
Andy Bartlett
2024-6-3
编辑:Andy Bartlett
2024-6-3
The root problem is the model is configured to use fixed-point data types, but you are using it in a MATLAB session that does not have a Fixed-Point Designer license available.
Data Type Override provides a quick way to ignore (most) fixed-point type specifications in a Simulink model and instead use a base Simulink type. The base type can be set to either double precision floating-point or single precision floating-point. If everything connected with that data type specification is happy with the base type used, then model activities like simulation can proceed. But, keep in mind the simulaiton will not give the true specified fixed-point behavior, and will instead give an idealized "luxury math" behavior. The idealized behavior can be fine for checking high level behavior or making a change to the high level design of the algorithm.
Data types can come from many places. From sources outside the model like base workspace or Data Dictionariers. For any of the models in a model reference heirarchy. For MATLAB code using fi objects inside MATLAB Function Block, MATLAB System Block, etc.
To override fi objects, you should run this MATLAB code
fp = fipref
fp.DataTypeOverride = 'TrueDoubles'
before running code that creates fi objects, including code that defines data objects for a Simulink model. If the data using fixed-point fi objects was defined previously and saved in a MAT file, then loading the MAT file will still have fixed-point objects independent of data type override.
To override data types specified on blocks in a Simulink model, you should run
set_param(mdlName, 'DataTypeOverride','Double')
for all the models in a model reference heirarchy that are using fixed-point types.
Hopefully, these steps will cover all the fixed-point data types in a model and all the consumers of those data types will accept the base data type specified as the override type. When it works, it's easy to get to the idealized simulation. But there are definitely cases where all the data types cannot be overriden or some of the consumers of the data type refuse to accept the base type. In the latter case, the simplest solution is likely to use a MATLAB session that has the Fixed-Point Designer license available and work with the model's true specified behavior.
To remove the override, first run,
fp = fipref
fp.DataTypeOverride='ForceOff'
Second, on all the model's in the model reference heirarchy do
set_param(mdlName,'DataTypeOverride','Off')
as Fangjun suggested.
Third, rerun all the MATLAB scripts etc. that are defining data used by the models.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fixed Point 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!