RA Flexible Software Package Documentation  Release v5.2.0

 
Motor Inertia estimate (rm_motor_inertia_estimate)

Functions

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Open (motor_inertia_estimate_ctrl_t *const p_ctrl, motor_inertia_estimate_cfg_t const *const p_cfg)
 Opens and configures the motor inertia estimate module. Implements motor_inertia_estimate_api_t::open. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Close (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Disables specified motor inertia estimate module. Implements motor_inertia_estimate_api_t::close. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Start (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Start inertia estimation. Implements motor_inertia_estimate_api_t::start. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Stop (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Stop (Cancel) inertia estimation. Implements motor_inertia_estimate_api_t::stop. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Reset (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Reset variables of inertia estimate module. Implements motor_inertia_estimate_api_t::reset. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_InfoGet (motor_inertia_estimate_ctrl_t *const p_ctrl, motor_inertia_estimate_info_t *const p_info)
 Get information of inertia estimation. Implements motor_inertia_estimate_api_t::infoGet. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_DataSet (motor_inertia_estimate_ctrl_t *const p_ctrl, motor_inertia_estimate_set_data_t *const p_set_data)
 Set necessary data to inertia estimation. Implements motor_inertia_estimate_api_t::dataSet. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_SpeedCyclic (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Cyclic process of inertia estimation at speed control period. Implements motor_inertia_estimate_api_t::speedCyclic. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_CurrentCyclic (motor_inertia_estimate_ctrl_t *const p_ctrl)
 Cyclic process of inertia estimation at current control period (called at A/D conversion finish interrupt). Implements motor_inertia_estimate_api_t::currentCyclic. More...
 
fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_ParameterUpdate (motor_inertia_estimate_ctrl_t *const p_ctrl, motor_inertia_estimate_cfg_t const *const p_cfg)
 Update the parameters of inertia estimate. Implements motor_inertia_estimate_api_t::parameterUpdate. More...
 

Detailed Description

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.

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:

ConfigurationOptionsDefaultDescription
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).

ConfigurationOptionsDefaultDescription
General
NameName must be a valid C symbolg_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 timeMust be a valid non-negative value.0.3 Acceleration time
Motor inertiaManual Entry0.0000041 Motor inertia
Low threshold to judge speedMust be set 0.1 to 0.50.1 Low threshold to judge speed reached
High threshold to judge speedMust be set 0.5 to 0.9, and greater than low threshold0.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 pairsMust 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 timeMust 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)
{
fsp_err_t err = FSP_SUCCESS;
/* Initializes the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_Open(&g_mtr_inertia_estimate0_ctrl, &g_mtr_inertia_estimate0_cfg);
assert(FSP_SUCCESS == err);
/* Start process. */
err = RM_MOTOR_INERTIA_ESTIMATE_Start(&g_mtr_inertia_estimate0_ctrl);
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;
/* Set data to the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_DataSet(&g_mtr_inertia_estimate0_ctrl, &temp_set_data);
/* Get information from the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_InfoGet(&g_mtr_inertia_estimate0_ctrl, &temp_information);
/* Stop process. */
err = RM_MOTOR_INERTIA_ESTIMATE_Stop(&g_mtr_inertia_estimate0_ctrl);
/* Close the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_Close(&g_mtr_inertia_estimate0_ctrl);
}

Data Structures

struct  motor_inertia_estimate_extended_cfg_t
 
struct  motor_inertia_estimate_instance_ctrl_t
 

Data Structure Documentation

◆ 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.

Function Documentation

◆ RM_MOTOR_INERTIA_ESTIMATE_Open()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Open ( motor_inertia_estimate_ctrl_t *const  p_ctrl,
motor_inertia_estimate_cfg_t const *const  p_cfg 
)

Opens and configures the motor inertia estimate module. Implements motor_inertia_estimate_api_t::open.

Example:

/* Initializes the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_Open(&g_mtr_inertia_estimate0_ctrl, &g_mtr_inertia_estimate0_cfg);
Return values
FSP_SUCCESSMotor inertia estimate module successfully configured.
FSP_ERR_ASSERTIONNull pointer, or one or more configuration options is invalid.
FSP_ERR_ALREADY_OPENModule is already open. This module can only be opened once.
FSP_ERR_INVALID_ARGUMENTInput parameter error.

◆ RM_MOTOR_INERTIA_ESTIMATE_Close()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Close ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

Disables specified motor inertia estimate module. Implements motor_inertia_estimate_api_t::close.

Example:

/* Close the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_Close(&g_mtr_inertia_estimate0_ctrl);
Return values
FSP_SUCCESSSuccessfully closed.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_Start()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Start ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

Start inertia estimation. Implements motor_inertia_estimate_api_t::start.

Example:

/* Start process. */
err = RM_MOTOR_INERTIA_ESTIMATE_Start(&g_mtr_inertia_estimate0_ctrl);
Return values
FSP_SUCCESSSuccessfully started.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_Stop()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Stop ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

Stop (Cancel) inertia estimation. Implements motor_inertia_estimate_api_t::stop.

Example:

/* Stop process. */
err = RM_MOTOR_INERTIA_ESTIMATE_Stop(&g_mtr_inertia_estimate0_ctrl);
Return values
FSP_SUCCESSSuccessfully stopped (canceled).
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_Reset()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_Reset ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

Reset variables of inertia estimate module. Implements motor_inertia_estimate_api_t::reset.

Return values
FSP_SUCCESSSuccessfully reset.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_InfoGet()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_InfoGet ( motor_inertia_estimate_ctrl_t *const  p_ctrl,
motor_inertia_estimate_info_t *const  p_info 
)

Get information of inertia estimation. Implements motor_inertia_estimate_api_t::infoGet.

Example:

/* Get information from the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_InfoGet(&g_mtr_inertia_estimate0_ctrl, &temp_information);
Return values
FSP_SUCCESSSuccessfully get data.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.
FSP_ERR_INVALID_ARGUMENTArgument pointer is invalid.

◆ RM_MOTOR_INERTIA_ESTIMATE_DataSet()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_DataSet ( motor_inertia_estimate_ctrl_t *const  p_ctrl,
motor_inertia_estimate_set_data_t *const  p_set_data 
)

Set necessary data to inertia estimation. Implements motor_inertia_estimate_api_t::dataSet.

Example:

/* Set data to the module. */
err = RM_MOTOR_INERTIA_ESTIMATE_DataSet(&g_mtr_inertia_estimate0_ctrl, &temp_set_data);
Return values
FSP_SUCCESSSuccessfully set data.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.
FSP_ERR_INVALID_ARGUMENTInput parameter error.

◆ RM_MOTOR_INERTIA_ESTIMATE_SpeedCyclic()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_SpeedCyclic ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

Cyclic process of inertia estimation at speed control period. Implements motor_inertia_estimate_api_t::speedCyclic.

Return values
FSP_SUCCESSSuccessfully perform the process.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_CurrentCyclic()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_CurrentCyclic ( motor_inertia_estimate_ctrl_t *const  p_ctrl)

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_SUCCESSSuccessfully perform the process.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.

◆ RM_MOTOR_INERTIA_ESTIMATE_ParameterUpdate()

fsp_err_t RM_MOTOR_INERTIA_ESTIMATE_ParameterUpdate ( motor_inertia_estimate_ctrl_t *const  p_ctrl,
motor_inertia_estimate_cfg_t const *const  p_cfg 
)

Update the parameters of inertia estimate. Implements motor_inertia_estimate_api_t::parameterUpdate.

Return values
FSP_SUCCESSSuccessfully data was updated.
FSP_ERR_ASSERTIONNull pointer.
FSP_ERR_NOT_OPENModule is not open.
FSP_ERR_INVALID_ARGUMENTInput parameter error.