Speed Measurement
Compute speed from rotor angular position
 Library:
Motor Control Blockset / Sensor Decoders
Description
The Speed Measurement block calculates the angular speed from the angular position of the rotor by calculating the change in the angular position with respect to time.
Ports
Input
θ
— Angular position of rotor
scalar
Angular position of the rotor specified in either radians, degrees, or perunit.
Data Types: single
 double
 fixed point
Output
⍵
— Angular speed of rotor
scalar
Angular speed that the block computes based on the angular position input.
Data Types: single
 double
 fixed point
Parameters
Position unit
— Unit of angular position
Radians
(default)  Degrees
 Per unit
The unit of the angular position θ
.
Position scaling datatype
— Data type of angular position input
uint32
(default)  uint16
 uint64
The data type of the angular position input θ
.
Speed calculation criteria
— Method of speed calculation
Maximum application speed
(default)  Speed resolution
 Time interval for speed calculation
The speed calculation method used in the block. The selected method determines the range of the rotor speed that the block can measure.
These parameters change values according to the Speed calculation criteria parameter:
Parameter name  Maximum application speed  Speed Resolution  Time interval for speed calculation 

Delays for speed calculation (number of samples) 
 28  28 
Maximum measurable speed (RPM) 
 10344.8276  10713.2857 
Measurable speed resolution (RPM) 
 4.9892e06  4.9892e06 
Discrete step size (s)
— Sample time after which block executes again
100e6
(default)  scalar
The fixed time interval (in seconds) between every two consecutive instances of block execution.
These parameters change values according to the Discrete step size (s) parameter value:
Delays for speed calculation (number of samples)
Maximum measurable speed (RPM)
Measurable speed resolution (RPM)
Maximum application speed (RPM)
— Maximum measurable rotor speed
1000
(default)  scalar
The maximum rotor speed (in rotations per minute) that the block can measure.
These parameters change values according to the Maximum application speed (RPM) parameter value:
Delays for speed calculation (number of samples)
Maximum measurable speed (RPM)
Measurable speed resolution (RPM)
Dependencies
To enable this parameter, set Speed calculation criteria to
Maximum application speed
.
Speed Resolution (RPM)
— Minimum detectable speed
5e6
(default)  scalar
The minimum value of change in the θ
input per unit time that the
block can detect.
These parameters change values according to the Speed Resolution (RPM) parameter value:
Delays for speed calculation (number of samples)
Maximum measurable speed (RPM)
Measurable speed resolution (RPM)
Dependencies
To enable this parameter, set Speed calculation criteria to
Speed resolution
.
Delays for speed calculation (number of samples)
— Number of angular position samples measured
299
or 28
(default)  scalar
The number of samples of the angular position input that the block measures to compute the average position value.
These parameters change values according to the Delays for speed calculation (number of samples) parameter value:
Maximum measurable speed (RPM)
Measurable speed resolution (RPM)
Dependencies
To enable this parameter, set Speed calculation criteria to
Time interval for speed calculation
.
Maximum measurable speed (RPM)
— Maximum measurable speed
1000
or 10344.8276
or
10713.2857
(default)  scalar
The absolute maximum speed that the block can measure.
This parameter is not configurable and uses a value that is internally computed using other parameters.
Measurable speed resolution (RPM)
— Minimum speed resolution used for speed computation
4.6566e07
or
4.9892e06
(default)  scalar
The minimum speed resolution that the block uses for speed computation. It is always less than or equal to Speed Resolution (RPM).
This parameter is not configurable and uses a value that is internally computed using other parameters.
Speed unit
— Unit of angular speed output
RPM
(default)  Degrees/Sec
 Radians/Sec
 Per unit based on maximum measurable speed
 Per unit based on dialog
Unit of the angular speed output.
Per unit speed (RPM)
— Speed (in RPM) for perunit calculation
1000
(default)
Specify the speed in RPM for perunit calculation.
Dependencies
This parameter appears only if Per unit based on dialog
is selected for Speed unit.
Speed data type
— Data type of angular speed output
single
(default)  double
 fixed point
The data type of the angular speed output ⍵
.
Note
The Speed Measurement block may occasionally display the warning message
'Wrap on overflow detected
.'
Model Examples
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
HDL Code Generation
Generate Verilog and VHDL code for FPGA and ASIC designs using HDL Coder™.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
For HDL code generation with the Speed Measurement block, the input
data type must be fixed point
.
This block has one default HDL architecture.
ConstrainedOutputPipeline  Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is

InputPipeline  Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is

OutputPipeline  Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is

FixedPoint Conversion
Design and simulate fixedpoint systems using FixedPoint Designer™.
Version History
Introduced in R2020a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)