Measurement and calculation proccess for the motor control on RA MCUs. This module implements the Motor Inertia Estimate Interface.
Overview
The motor inertia estimation module is used to measure and calculate rotor inertia in an application. This module should be used with Renesas Motor Workbench (RMW) basically.
Features
The Motor Inertia Estimation Module has below features.
- Measurement process work automatically
- Calculate rotor inertia [kgm^2].
Configuration
Build Time Configurations for rm_motor_inertia_estimate
The following build time configurations are defined in fsp_cfg/rm_motor_inertia_estimate_cfg.h:
Configuration | Options | Default | Description |
Parameter Checking |
-
Default (BSP)
-
Enabled
-
Disabled
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configurations for Motor > Motor inertia estimation (rm_motor_inertia_estimate)
This module can be added to the Stacks tab via New Stack > Motor > Motor inertia estimation (rm_motor_inertia_estimate).
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_motor_inertia_estimate0 | Module name. |
Moved position distance to measure (degree) | Must be set -360 to -10 or 10 to 360. | 360 | Moved position distance to measure inertia (degree) |
Maximum speed (rpm) | Must be set over 60. | 500 | Maximum rotation speed (rpm) |
Acceleration time | Must be a valid non-negative value. | 0.3 | Acceleration time |
Motor inertia | Must be a valid non-negative value. | 0.0000041 | Motor inertia |
Low threshold to judge speed | Must be set 0.1 to 0.5. | 0.1 | Low threshold to judge speed reached |
High threshold to judge speed | Must be set 0.5 to 0.9, and greater than low threshold | 0.9 | High threshold to judge speed reached |
Time to wait moving stability (sec) | Must be a valid non-negative value. | 0.8 | Time to wait moving stability |
Cyclic period of current control (sec) | Must be a valid non-negative value. | 0.00005 | Cyclic period of current control (sec) |
Cyclic period of speed control (sec) | Must be a valid non-negative value. | 0.0005 | Cyclic period of speed control (sec) |
Motor pole pairs | Must be a valid non-negative value. | 4 | Motor pole pairs |
Motor magnet flux (Wb) | Must be a valid non-negative value. | 0.00623 | Motor magnet flux (Wb) |
Interval time | Must be a valid non-negative value. | 400.0 | Interval time. Please set same value as Position control |
Clock Configuration
This module doesn't depend on clock setting, because this module is a simple calculation process.
Pin Configuration
This module does not use I/O pins.
Usage Notes
Limitations
Examples
Basic Example
This is a basic example of minimal use of the Motor Inertia Estimation in an application.
void motor_inertia_estimate_basic_example (void)
{
assert(FSP_SUCCESS == err);
temp_set_data.f_iq = 1.0F;
temp_set_data.f_speed_radian_control = 1.04F;
temp_set_data.s2_position_degree = 180;
temp_set_data.u1_position_state = 0;
}
◆ motor_inertia_estimate_extended_cfg_t
struct motor_inertia_estimate_extended_cfg_t |
Extended configurations for motor inertia estimate
Data Fields |
int16_t |
s2_move_degree |
Moving position reference [degree]. |
uint16_t |
u2_J_max_speed_rpm |
Maximum Speed [rpm]. |
float |
f_accel_time |
Acceleration time. |
float |
f_rotor_inertia |
Initialized rotor inertia value. |
float |
f_judge_low_threshold |
Low threshold to judge speed. |
float |
f_judge_high_threshold |
High threshold to judge speed. |
float |
f_change_mode_time |
Timing value to change internal mode. |
float |
f_current_ctrl_period |
Period of current control [sec]. |
float |
f_speed_ctrl_period |
Period of speed control [sec]. |
uint8_t |
u1_motor_polepairs |
Motor pole pairs. |
float |
f_motor_m |
Motor magnet flux [Wb]. |
float |
f_position_interval |
Interval counts for reference position change. |
◆ motor_inertia_estimate_instance_ctrl_t
struct motor_inertia_estimate_instance_ctrl_t |
Inertia estimate instance control block
Data Fields |
uint32_t |
open |
Used to determine if the module is configured. |
motor_inertia_estimate_start_flag_t |
start_flag |
start/stop flag |
motor_inertia_estimate_mode_t |
mode |
Internal mode. |
uint8_t |
u1_mode_count |
Use to manage internal mode. |
motor_inertia_estimate_period_t |
speed_period |
Measure period. |
motor_inertia_estimate_period_t |
speed_period_buffer |
Buffer of measure period to be reffered by current cyclic. |
uint32_t |
u4_measure_count |
Counter for speed control cycle. |
uint32_t |
u4_wait_count |
Counter to wait change mode timing. |
uint8_t |
u1_position_move_mode |
Position move mode (TRIANGLE/TRAPEZOID) |
int16_t |
s2_initial_position_degree |
Initial position. |
float |
f_iq_ad |
q-axis current [A] |
float |
f_summary_iq_ad |
Summary of q-axis current. |
float |
f_position_mode_time |
Summary of speed control period to judge the timing. |
float |
f_position_dt_time_sec |
Differencial time of move. |
int16_t |
s2_position_reference_degree |
Position reference [degree]. |
float |
f_estimated_value |
Estimated inertia. |
float |
f_inertia_value1 |
Buffer to calculate inertia 1. |
float |
f_inertia_value2 |
Buffer to calculate inertia 2. |
float |
f_interval_time |
Interval time about position transition. |
float |
f_inertia_speed_ctrl1 |
|
float |
f_inertia_speed_ctrl2 |
|
float |
f_inertia_speed_ctrl3 |
|
float |
f_inertia_speed_ctrl4 |
|
float |
f_inertia_speed_ctrl5 |
|
float |
f_inertia_speed_ctrl6 |
|
float |
f_inertia_speed_ctrl7 |
|
float |
f_inertia_speed_ctrl8 |
|
float |
f_inertia_integ_iq1 |
|
float |
f_inertia_integ_iq2 |
|
float |
f_inertia_integ_iq3 |
|
float |
f_inertia_integ_iq4 |
|
float |
f_inertia_integ_time1 |
|
float |
f_inertia_integ_time2 |
|
float |
f_inertia_integ_time3 |
|
float |
f_inertia_integ_time4 |
|
float |
f_inverse_motor_polepairs |
Inverse motor pole pairs (for calculation) |
motor_inertia_estimate_set_data_t |
receive_data |
Received data set from speed(position) and current. |
motor_inertia_estimate_cfg_t
const * |
p_cfg |
Pointer of configuration structure. |
◆ RM_MOTOR_INERTIA_ESTIMATE_Open()
Opens and configures the motor inertia estimate module. Implements motor_inertia_estimate_api_t::open.
Example:
- Return values
-
FSP_SUCCESS | Motor inertia estimate module successfully configured. |
FSP_ERR_ASSERTION | Null pointer, or one or more configuration options is invalid. |
FSP_ERR_ALREADY_OPEN | Module is already open. This module can only be opened once. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |
◆ RM_MOTOR_INERTIA_ESTIMATE_Close()
Disables specified motor inertia estimate module. Implements motor_inertia_estimate_api_t::close.
Example:
- Return values
-
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_Start()
Start inertia estimation. Implements motor_inertia_estimate_api_t::start.
Example:
- Return values
-
FSP_SUCCESS | Successfully started. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_Stop()
Stop (Cancel) inertia estimation. Implements motor_inertia_estimate_api_t::stop.
Example:
- Return values
-
FSP_SUCCESS | Successfully stopped (canceled). |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_Reset()
Reset variables of inertia estimate module. Implements motor_inertia_estimate_api_t::reset.
- Return values
-
FSP_SUCCESS | Successfully reset. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_InfoGet()
Get information of inertia estimation. Implements motor_inertia_estimate_api_t::infoGet.
Example:
- Return values
-
FSP_SUCCESS | Successfully get data. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Argument pointer is invalid. |
◆ RM_MOTOR_INERTIA_ESTIMATE_DataSet()
Set necessary data to inertia estimation. Implements motor_inertia_estimate_api_t::dataSet.
Example:
- Return values
-
FSP_SUCCESS | Successfully set data. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |
◆ RM_MOTOR_INERTIA_ESTIMATE_SpeedCyclic()
Cyclic process of inertia estimation at speed control period. Implements motor_inertia_estimate_api_t::speedCyclic.
- Return values
-
FSP_SUCCESS | Successfully perform the process. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_CurrentCyclic()
Cyclic process of inertia estimation at current control period (called at A/D conversion finish interrupt). Implements motor_inertia_estimate_api_t::currentCyclic.
- Return values
-
FSP_SUCCESS | Successfully perform the process. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_INERTIA_ESTIMATE_ParameterUpdate()
Update the parameters of inertia estimate. Implements motor_inertia_estimate_api_t::parameterUpdate.
- Return values
-
FSP_SUCCESS | Successfully data was updated. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |