|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_Open (motor_angle_ctrl_t *const p_ctrl, motor_angle_cfg_t const *const p_cfg) |
| Opens and configures the Angle Encoder module. Implements motor_angle_api_t::open. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_Close (motor_angle_ctrl_t *const p_ctrl) |
| Disables specified Angle Encoder module. Implements motor_angle_api_t::close. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_Reset (motor_angle_ctrl_t *const p_ctrl) |
| Reset variables of Angle Encoder module. Implements motor_angle_api_t::reset. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_InternalCalculate (motor_angle_ctrl_t *const p_ctrl) |
| Calculate internal parameters. Implements motor_angle_api_t::internalCalculate. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_AngleSpeedGet (motor_angle_ctrl_t *const p_ctrl, float *const p_angle, float *const p_speed, float *const p_phase_err) |
| Gets the current rotor's angle and rotation speed. Implements motor_angle_api_t::angleSpeedGet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_AngleAdjust (motor_angle_ctrl_t *const p_ctrl) |
| Angle Adjustment Process. Implements motor_angle_api_t::angleAdjust. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_EncoderCyclic (motor_angle_ctrl_t *const p_ctrl) |
| Encoder Cyclic Process (Call in cyclic timer). Implements motor_angle_api_t::encoderCyclic. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_CyclicProcess (motor_angle_ctrl_t *const p_ctrl) |
| Perform cyclic process. Implements motor_angle_api_t::cyclicProcess. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_InfoGet (motor_angle_ctrl_t *const p_ctrl, motor_angle_encoder_info_t *const p_info) |
| Gets information of Encoder Angle Module. Implements motor_angle_api_t::infoGet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_ParameterUpdate (motor_angle_ctrl_t *const p_ctrl, motor_angle_cfg_t const *const p_cfg) |
| Update the parameters of Angle&Speed calculation with an encoder. Implements motor_angle_api_t::parameterUpdate. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_CurrentSet (motor_angle_ctrl_t *const p_ctrl, motor_angle_current_t *const p_st_current, motor_angle_voltage_reference_t *const p_st_voltage) |
| Set d/q-axis Current Data & Voltage Reference. Implements motor_angle_api_t::currentSet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_SpeedSet (motor_angle_ctrl_t *const p_ctrl, float const speed_ctrl, float const damp_speed) |
| Set Speed Information. Implements motor_angle_api_t::speedSet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_FlagPiCtrlSet (motor_angle_ctrl_t *const p_ctrl, uint32_t const flag_pi) |
| Set the flag of PI Control runs. Implements motor_angle_api_t::flagPiCtrlSet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_EstimatedComponentGet (motor_angle_ctrl_t *const p_ctrl, float *const p_ed, float *const p_eq) |
| Gets estimated d/q-axis component. Implements motor_angle_api_t::estimatedComponentGet. More...
|
|
fsp_err_t | RM_MOTOR_SENSE_ENCODER_SensorDataSet (motor_angle_ctrl_t *const p_ctrl, motor_angle_ad_data_t *const p_ad_data) |
| Set sensor data. Implements motor_angle_api_t::sensorDataSet. More...
|
|
Calculation process for the motor control on RA MCUs. This module implements the Motor angle Interface.
The motor angle and speed calculation with an encoder module is used to calculate rotor angle and rotational speed in an application. This module is designed to be used with the motor current module (rm_motor_current).
The motor angle and speed calculation with an encoder module has the features listed below.
The following build time configurations are defined in fsp_cfg/rm_motor_sense_encoder_cfg.h:
This module can be added to the Stacks tab via New Stack > Motor > Motor Angle and Speed Calculation with encoder (rm_motor_sense_encoder).
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_motor_sense_encoder0 | Module name. |
Motor Parameter |
Pole pairs | Must be a valid positive integer. | 7 | Pole pairs |
Resistance (ohm) | Must be a valid non-negative value | 0.453F | Resistance |
Inductance of d-axis (H) | Must be a valid non-negative value | 0.0009447F | Inductance of d-axis |
Inductance of q-axis (H) | Must be a valid non-negative value | 0.0009447F | Inductance of q-axis |
Permanent magnetic flux (Wb) | Must be a valid non-negative value | 0.006198F | Permanent magnetic flux |
Motor Parameter > Rotor inertia (kgm^2) | Must be a valid non-negative value | 0.00000962F | Rotor inertia |
Control Type |
| Position | Select control Type |
Period of Current control (kHz) | Must be a valid non-negative value | 20.0F | Period of Current control |
Period of Speed control (sec) | Must be a valid non-negative value | 0.0005F | Period of Speed control |
PWM Carrier Frequency (kHz) | Must be a valid non-negative value | 20.0F | PWM Carrier Frequency |
Decimation of Interrupt | Must be a valid positive integer. | 0U | Decimation of Interrupt |
Counts per Rotation | Must be a valid positive integer. | 1200U | Encoder Counts per One Rotation |
Counts for Angle Adjust | Must be a valid positive integer. | 512U | Counts for Angle Adjust (as working time) |
Zero speed counts | Must be a valid positive integer. | 20000000U | Threshold counts to judge zero speed |
Occupancy Time | Must be a valid non-negative value | 0.30F | Occupancy time of carrier interrup |
Carrier Time | Must be a valid non-negative value | 0.000013F | Processing time of carrier interrupt |
Process Time | Must be a valid non-negative value | 0.000001F | Processing time of encoder interrupt |
Highspeed Change Margin (rpm) | Must be a valid positive integer. | 150U | Margin of toggle speed for high speed mode |
LPF parameter for Highspeed Filter | Must be a valid non-negative value | 0.1F | Highspeed mode speed LPF parameter |
Counts to change speed | Must be a valid positive integer. | 8U | Counts for mode change of position speed calculation |
Developers should be aware of the following limitations when using the motor angle and speed calculation with an encoder: all configurations should be set as positive values.
This is a basic example of minimal use of the motor angle and speed calculation with an encoder in an application.