Compute speed and estimate position of rotor by using Hall sensors
Motor Control Blockset / Sensor Decoders
The Hall Speed and Position block computes the mechanical speed of the rotor by tracking changes in the Hall state. The block also estimates the electric position of the rotor by using the direction, Hall state, and external counter value inputs.
The block executes periodically after a fixed time interval that the controller algorithm defines.
HallVal
— Current Hall sensor output stateThe Hall state at current time. For example, these are the possible valid Hall states (where the MSB represents the output of the first Hall sensor connected):
5 - (101)
4 - (100)
6 - (110)
2 - (010)
3 - (011)
1 - (001)
Data Types: single
| double
| fixed point
Cnt
— External counter valueThe external counter value that the block uses to determine the time elapsed between the Hall state change and block execution.
Data Types: single
| double
| fixed point
SpdCnt
— Count at Hall state changeThis value indicates the clock cycles (time) elapsed between two consecutive changes in the Hall state.
Data Types: single
| double
| fixed point
Dir
— Rotor spin direction during current Hall stateThe direction of the rotor spin (either +1 or –1 indicating positive or negative direction of rotation, respectively) during the current Hall state.
Data Types: single
| double
| fixed point
SpdVal
— Validity of current and previous Hall states and speed calculationThe port value indicates Hall state validity. The value zero indicates that the current or previous Hall state is invalid and that the block cannot calculate speed and position.
The value one indicates that both the current and previous Hall states are valid and that the block can calculate speed and position.
Data Types: single
| double
| fixed point
HallChng
— Value of Hall state change flagThe port value indicates Hall state change and block execution status. The value one indicates that the Hall state changed, but that the block execution is pending. The value zero indicates that the block has completed executing the last Hall state change.
Data Types: single
| double
| fixed point
θe
— Electrical position of rotorThe estimated electrical position of the rotor based on the Expected
hall sequence in positive direction parameter and the
Direction
, HallVal
, and
CounterValue
inputs.
To enable this port, set Block output to either
Position
or Speed and
position
.
Data Types: single
| double
| fixed point
⍵m
— Mechanical speed of rotorThe mechanical speed of the rotor in revolutions per minute. The block calculates this value by tracking the Hall state changes.
The port returns zero if the SpdVal
input is zero.
To enable this port, set Block output to either
Speed
or Speed and
position
.
Data Types: single
| double
| fixed point
HallChngRst
— Resets Hall state change flag to zeroThe port outputs a value of zero (sets the Hall state change flag to zero) indicating that the block has successfully executed speed and position computations for the last Hall state change.
Data Types: single
| double
| fixed point
Block output
— Select output portsSpeed and position
(default) | Speed
| Position
Select the available block output ports as one of the following values:
Speed and position
Speed
Position
Counter size
— Size of external counter register16 bits
(default) | 8 bits
| 32 bits
The register size of the external counter. The maximum counter value is , where = counter size.
Counter clock frequency (Hz)
— Clock frequency of external counter90e6
(default) | scalarThe clock frequency of the external counter.
Block sample time (S)
— Sample time after which block executes again50e-6
(default) | scalarThe time between two consecutive instances of block execution.
Number of pole pairs
— Number of pole pairs available in motor8
(default) | scalarNumber of pole pairs available in the motor.
Minimum detectable speed (RPM)
— Minimum speed that block can detect20
(default) | scalarThe block does not calculate position for speed below this value.
Speed measurement interval
— Interval over which block measures speedEvery 180 Degrees
(default) | Every 60 Degrees
Rotor angular displacement that represents the interval at which the
SpdCnt
port value was calculated.
Speed unit
— Unit of rotor angular speed outputRadians/sec
(default) | Degrees/sec
| RPM
| Per unit
Unit of the angular velocity or mechanical speed
(⍵m
) output.
To enable this parameter, set Block output to either
Speed
or Speed and
position
.
Speed datatype
— Data type of rotor angular speed outputsingle
(default) | double
| fixdt(1,16,0)
| fixdt(1,16,2^0,0)
| <data type expression>
Data type of the rotor angular speed output.
To enable this parameter, set Block output to either
Speed
or Speed and
position
.
Expected hall sequence in positive direction
— Sequence indicating positive directionABC
(default) | CBA
| Custom sequence
The Hall sensor sequence that represents the positive direction of rotor spin.
To enable this parameter, set Block output to either
Position
or Speed and
position
.
Sequence
— Custom sequence indicating positive direction[5,4,6,2,3,1]
(default) | scalarThe custom sequence that you can enter to represent rotor spin in the positive direction.
To enable this parameter:
Set Block output to either
Position
or Speed and
position
.
Set Expected hall sequence in positive direction to
Custom sequence
.
Order of extrapolation of position
— Indicates precision in position computation1st Order
(default) | 2nd Order
The 1st Order
option is less accurate in computing
position, but quick. The 2nd Order
option is more accurate,
but needs more computation time. These equations describe the options:
where:
= Position computed by using 1st order extrapolation.
= Position computed by using 2nd order extrapolation.
= Sector angle defined by the Hall sensor output.
= Angular velocity of the rotor.
= Angular acceleration of the rotor.
= Time spent in a sector.
To enable this parameter, set Block output to either
Position
or Speed and
position
.
Position unit
— Unit of angular speed outputRadians
(default) | Degrees
| Per unit
Unit of angular speed output.
To enable this parameter, set Block output to either
Position
or Speed and
position
.
Position datatype
— Data type of angular speed outputsingle
(default) | double
| fixdt(1,16,0)
| fixdt(1,16,2^0,0)
| <data type expression>
Data type of angular speed output.
To enable this parameter, set Block output to either
Position
or Speed and
position
.