The values of desired_speed and desired_trq are 1 & 99, the typedef is PERCENTAGE which of integer type,but while simulating it is showing fraction values, Is this something to do with the "PERCENTAGE " typedef ?

datatype.PNG
data.PNG
typdef definition of PERCENTAGE in .m :
PERCENTAGE.WordType = 'uint16';
PERCENTAGE.DataTypeMode = 'Fixed-point: slope and bias scaling';
PERCENTAGE.Signed = 0;
PERCENTAGE.WordLength = 16;
PERCENTAGE.ScalingMethod = 'gain/offset';
PERCENTAGE.Gain = 2^15/100;
PERCENTAGE.DisplayMin = 0;
PERCENTAGE.DisplayMax = 199.9;
PERCENTAGE.DisplayPrecision = 8;
PERCENTAGE.Description = 'This is the percentage datatype';
PERCENTAGE.DisplayUnits = 'percent';

 Risposta accettata

You have specified PERCENTABE to used fixed point data type. Simulink is showing you the floating point equivalent of the integer value after applying the specified slope and bias scaling.

4 Commenti

Thank you for the response.
Can you please specify how to overcome this without altering the datatype mode?
Also, is it something to do with the scaling method?
Not sure what you are trying to overcome. If you want to retain the specified fixed point settings, the Simulink will always show you the physical signal value. Are you trying to see what the integer equivalent is to the fixed point number? If so, you could connect the signal to a display block and then set the "Format" for the display block to "decimal (Stored Integer)"
I am expecting integer 1 as 1.00000000 in fraction not as 1.0009765625 with the same 'DataTypeMode = Fixed-point: slope and bias scaling' is that possible?
With the gain you have selected, it is not possible to represent 1.000000
The LSB of the integer representation is bit = (1/2^15) * 100
327* bit = .9979
328*bit = 1.0010
You will need to select a different scale factor if you need to represent exactly 1.0000000

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by