Why do I get an "Incorrect data type" error or "Parameter precision loss" warning when tuning an integer or fixed-point type parameter with Simulink Real-Time & Speedgoat?
Show older comments
I am trying to change a Gain parameter during my Simulink Real-Time (SLRT) simulation, but I get an "Incorrect data type" error when I use the setparam target function as follows:
>> tg = slrealtime;
>> tg.setparam('MyModel/Gain','Gain',-2)
Unable to set 'Gain' parameter value on target computer 'TargetPC1': Incorrect data type.
When I try changing the parameter in the block dialog while using the external mode ("Run on Target"), I see warnings such as the following in the MATLAB prompt:
Warning: Parameter precision loss occurred for 'Gain' of 'MyModel/Gain'. The
original value of the parameter, 1, cannot be represented exactly using the run-time data type
sfix32_En31. The value is quantized to 0.9999999995343387. Quantization error occurred with an absolute
difference of 4.656612873077393e-10 and a relative difference of 4.65661287307739e-08%.
Suggested Actions:
• To disable this warning or error for all parameters in the model, set the 'Detect precision loss'
option to 'none'. - Apply
• Inspect details in the Parameter Quantization Advisor. - Open
• - Suppress
> In slrealtime/Instrument/dataAvailableFromObserverViaTarget (line 1413)
In slrealtime.Target/dataAvailableFromObserver (line 66)
In slrealtime.Instrument>@(varargin)tg.dataAvailableFromObserver(varargin{:}) (line 1332)
In slrealtime.internal.instrument.StreamingCallBack.NewData (line 25)
Accepted Answer
More Answers (0)
Categories
Find more on Fixed Point in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!