|
fsp_err_t | RM_MOTOR_POSITION_Open (motor_position_ctrl_t *const p_ctrl, motor_position_cfg_t const *const p_cfg) |
| Opens and configures the Motor Position Module. Implements motor_position_api_t::open. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_Close (motor_position_ctrl_t *const p_ctrl) |
| Disables specified Motor Position Module. Implements motor_position_api_t::close. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_Reset (motor_position_ctrl_t *const p_ctrl) |
| Reset the variables of Motor Position Module. Implements motor_position_api_t::reset. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_PositionGet (motor_position_ctrl_t *const p_ctrl, int16_t *const p_position) |
| Get Rotor Position Data [degree]. Implements motor_position_api_t::positionGet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_PositionSet (motor_position_ctrl_t *const p_ctrl, float const position_rad) |
| Set Position Data from Encoder [radian]. Implements motor_position_api_t::positionSet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_PositionReferenceSet (motor_position_ctrl_t *const p_ctrl, int16_t const position_reference_deg) |
| Set Position Reference Data [degree]. Implements motor_position_api_t::positionReferenceSet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_ControlModeSet (motor_position_ctrl_t *const p_ctrl, motor_position_ctrl_mode_t const mode) |
| Set Position Control Mode. Implements motor_position_api_t::controlModeSet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_PositionControl (motor_position_ctrl_t *const p_ctrl) |
| Calculates internal position reference.(Main process of Position Control) Implements motor_position_api_t::positionControl. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_IpdSpeedPControl (motor_position_ctrl_t *const p_ctrl, float const ref_speed_rad, float const speed_rad, float *const p_iq_ref) |
| Calculates the q-axis current reference by P control. Implements motor_position_api_t::ipdSpeedPControl. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_SpeedReferencePControlGet (motor_position_ctrl_t *const p_ctrl, float *const p_speed_ref) |
| Get Speed Reference by P Control. Implements motor_position_api_t::speedReferencePControlGet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_SpeedReferenceIpdControlGet (motor_position_ctrl_t *const p_ctrl, float const max_speed_rad, float *const p_speed_ref) |
| Get Speed Reference by IPD Control. Implements motor_position_api_t::speedReferenceIpdControlGet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_SpeedReferenceFeedforwardGet (motor_position_ctrl_t *const p_ctrl, float *const p_speed_ref) |
| Get Speed Reference by Feedforward. Implements motor_position_api_t::speedReferenceFeedforwardGet. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_InfoGet (motor_position_ctrl_t *const p_ctrl, motor_position_info_t *const p_info) |
| Get position information. More...
|
|
fsp_err_t | RM_MOTOR_POSITION_ParameterUpdate (motor_position_ctrl_t *const p_ctrl, motor_position_cfg_t const *const p_cfg) |
| Update the parameters of Position Control Calculation. Implements motor_position_api_t::parameterUpdate. More...
|
|
Calculation process for the motor control on RA MCUs. This module implements the Motor position Interface.
Overview
The motor position is used to control the position of motor rotor in an appication. This module should be called cyclically in an application (e.g. in cyclic timer interrupt). This module calculates speed reference with inputted position reference and current rotational speed.
Features
The Motor Position Module has below features.
- Calculate speed reference.
Configuration
Build Time Configurations for rm_motor_position
The following build time configurations are defined in fsp_cfg/rm_motor_position_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 Position Controller (rm_motor_position)
This module can be added to the Stacks tab via New Stack > Motor > Motor Position Controller (rm_motor_position).
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_motor_position0 | Module name. |
Position dead band | Manual Entry | 1U | Ignored area of position control. |
Position band limit | Manual Entry | 3U | Ignored area of position control. |
Speed feedforward ratio | Must be a valid value | 0.8F | Speed feedforward ratio. |
Encoder counts per one rotation | Must be a valid value | 1200.0F | Encoder counts per one rotation. |
Position omega | Must be a valid value | 10.0F | Position control omega. |
Period of speed control (sec) | Must be a valid value | 0.0005F | Period of speed control. |
IPD |
IPD LPF |
| Disable | IPD LPF process enable or disable |
Position Kp ratio | Must be a valid value | 0.3F | Position Kp ratio. |
Position feedforward ratio | Must be a valid value | 0.0F | Position feedforward ratio. |
Speed K ratio | Must be a valid value | 2.0F | Speed K ratio |
Error Limit #1 | Must be a valid value | 10.0F | Error limitation #1 |
Error limit #2 | Must be a valid value | 0.2F | Error limitation #2 |
LPF omega | Must be a valid value | 500.0F | LPF omega. |
LPF zeta | Must be a valid value | 1.0F | LPF zeta. |
Position Profiling |
Interval time | Manual Entry | 400U | Interval time. |
Accel time | Must be a valid value | 0.3F | Accel time. |
Maximum accel time (sec) | Must be a valid value | 8117.96F | Maximum accelaration time (sec) |
Accelaration maximum speed | Must be a valid value | 2000.0F | Accelaration maximum speed. |
Update step of timer | Must be a valid value | 0.0005F | Update step of timer. |
Motor Parameter |
Pole pair | Manual Entry | 7 | Pole pair |
Resistance (ohm) | Must be a valid value | 0.453F | Resistance |
Inductance of d-axis (H) | Must be a valid value | 0.0009447F | Inductance of d-axis |
Inductance of q-axis (H) | Must be a valid value | 0.0009447F | Inductance of q-axis |
Permanent magnetic flux (Wb) | Must be a valid value | 0.006198F | Permanent magnetic flux |
Motor Parameter > Motor inertia (kgm^2) | Must be a valid value | 0.00000962F | Motor inertia |
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
- Set the period of speed control with non-negative value.
- Set the limit of speed change step with non-negative value.
- Set the maximum speed with non-negative value.
Examples
Basic Example
This is a basic example of using the Motor Position module in an application.
void motor_position_basic_example (void)
{
handle_error(err);
RM_MOTOR_POSITION_ModeSet(g_motor_position0.p_ctrl, MOTOR_POSITION_CTRL_MODE_STEP);
{
}
}
◆ motor_position_ipd_lpf_t
Enumerator |
---|
MOTOR_POSITION_IPD_LPF_DISABLE | ipd control is disabled
|
MOTOR_POSITION_IPD_LPF_ENABLE | ipd control is enabled
|
◆ RM_MOTOR_POSITION_Open()
Opens and configures the Motor Position Module. Implements motor_position_api_t::open.
- Return values
-
FSP_SUCCESS | Motor Position 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 | Set parameter is invalid. |
◆ RM_MOTOR_POSITION_Close()
Disables specified Motor Position Module. Implements motor_position_api_t::close.
- Return values
-
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_Reset()
Reset the variables of Motor Position Module. Implements motor_position_api_t::reset.
- Return values
-
FSP_SUCCESS | Successfully reset. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_PositionGet()
Get Rotor Position Data [degree]. Implements motor_position_api_t::positionGet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_PositionSet()
Set Position Data from Encoder [radian]. Implements motor_position_api_t::positionSet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_PositionReferenceSet()
Set Position Reference Data [degree]. Implements motor_position_api_t::positionReferenceSet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_ControlModeSet()
Set Position Control Mode. Implements motor_position_api_t::controlModeSet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_PositionControl()
Calculates internal position reference.(Main process of Position Control) Implements motor_position_api_t::positionControl.
- Return values
-
FSP_SUCCESS | Successful data calculation. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_POSITION_IpdSpeedPControl()
fsp_err_t RM_MOTOR_POSITION_IpdSpeedPControl |
( |
motor_position_ctrl_t *const |
p_ctrl, |
|
|
float const |
ref_speed_rad, |
|
|
float const |
speed_rad, |
|
|
float *const |
p_iq_ref |
|
) |
| |
Calculates the q-axis current reference by P control. Implements motor_position_api_t::ipdSpeedPControl.
- Return values
-
FSP_SUCCESS | Successful data calculation. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_SpeedReferencePControlGet()
Get Speed Reference by P Control. Implements motor_position_api_t::speedReferencePControlGet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_SpeedReferenceIpdControlGet()
Get Speed Reference by IPD Control. Implements motor_position_api_t::speedReferenceIpdControlGet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_SpeedReferenceFeedforwardGet()
Get Speed Reference by Feedforward. Implements motor_position_api_t::speedReferenceFeedforwardGet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_InfoGet()
Get position information.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Output pointer is NULL. |
◆ RM_MOTOR_POSITION_ParameterUpdate()
Update the parameters of Position Control Calculation. Implements motor_position_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 | Configuration parameter error. |