|
fsp_err_t | RM_MOTOR_CURRENT_Open (motor_current_ctrl_t *const p_ctrl, motor_current_cfg_t const *const p_cfg) |
| Opens and configures the Motor Current Module. Implements motor_current_api_t::open. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_Close (motor_current_ctrl_t *const p_ctrl) |
| Disables specified Motor Current Module. Implements motor_current_api_t::close. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_Reset (motor_current_ctrl_t *const p_ctrl) |
| Reset variables of Motor Current Module. Implements motor_current_api_t::reset. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_Run (motor_current_ctrl_t *const p_ctrl) |
| Run(Start) the Current Control. Implements motor_current_api_t::run. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_ParameterSet (motor_current_ctrl_t *const p_ctrl, motor_current_input_t const *const p_st_input) |
| Set (Input) Parameter Data. Implements motor_current_api_t::parameterSet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_CurrentReferenceSet (motor_current_ctrl_t *const p_ctrl, float const id_reference, float const iq_reference) |
| Set Current Reference Data. Implements motor_current_api_t::currentReferenceSet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_SpeedPhaseSet (motor_current_ctrl_t *const p_ctrl, float const speed, float const phase) |
| Set Current Speed & rotor phase Data. Implements motor_current_api_t::speedPhaseSet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_CurrentSet (motor_current_ctrl_t *const p_ctrl, motor_current_input_current_t const *const p_st_current, motor_current_input_voltage_t const *const p_st_voltage) |
| Set d/q-axis Current & Voltage Data. Implements motor_current_api_t::currentSet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_ParameterGet (motor_current_ctrl_t *const p_ctrl, motor_current_output_t *const p_st_output) |
| Get Output Parameters. Implements motor_current_api_t::parameterGet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_CurrentGet (motor_current_ctrl_t *const p_ctrl, float *const p_id, float *const p_iq) |
| Get d/q-axis Current. Implements motor_current_api_t::currentGet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_PhaseVoltageGet (motor_current_ctrl_t *const p_ctrl, motor_current_get_voltage_t *const p_voltage) |
| Gets the set phase voltage. Implements motor_current_api_t::phaseVoltageGet. More...
|
|
fsp_err_t | RM_MOTOR_CURRENT_ParameterUpdate (motor_current_ctrl_t *const p_ctrl, motor_current_cfg_t const *const p_cfg) |
| Update the parameters of Current Control. Implements motor_current_api_t::parameterUpdate. More...
|
|
void | rm_motor_current_encoder_cyclic (motor_current_instance_t const *p_ctrl) |
|
Calculation process for the motor control on RA MCUs. This module implements the Motor current Interface.
Overview
The motor current is used to control the electric current of motor rotation in an appication. This module should be called cyclically after the A/D conversion of electric current of each phase in an application. This module calculates each phase voltage with input current reference, electric current and rotor angle.
Features
The Motor Current Module has below features.
- Calculate each phase(U/V/W) voltage.
- Decoupling Control.
- Voltage Error Compensation.
Configuration
Build Time Configurations for rm_motor_current
The following build time configurations are defined in fsp_cfg/rm_motor_current_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 Current Controller (rm_motor_current)
This module can be added to the Stacks tab via New Stack > Motor > Motor Current Controller (rm_motor_current).
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_motor_current0 | Module name. |
Sensor type |
-
Sensorless
-
Encoder
-
Induction
-
Hall
| Sensorless | Select sensor type |
Shunt type |
| 2 shunt | Select shunt type |
Current control decimation | Must be a valid non-negative value. | 0 | Decimation of current control. |
PWM carrier frequency (kHz) | Must be a valid value | 20.0F | PWM carrier frequency. |
Input voltage (V) | Must be a valid value | 24.0F | Input voltage for limitation of current PI control. |
Sample delay compensation |
| Enable | Select enable/disable sample delay compensation. |
Period magnification value | Must be a valid value | 1.5 | Period magnification value for sampling delay compensation. |
Voltage error compensation |
| Enable | Select enable/disable voltage error compensation. |
Voltage error compensation table of voltage 1 | Must be a valid value | 0.672F | Voltage error compensation table of voltage. |
Voltage error compensation table of voltage 2 | Must be a valid value | 0.945F | Voltage error compensation table of voltage. |
Voltage error compensation table of voltage 3 | Must be a valid value | 1.054F | Voltage error compensation table of voltage. |
Voltage error compensation table of voltage 4 | Must be a valid value | 1.109F | Voltage error compensation table of voltage. |
Voltage error compensation table of voltage 5 | Must be a valid value | 1.192F | Voltage error compensation table of voltage. |
Voltage error compensation table of current 1 | Must be a valid value | 0.013F | Voltage error compensation table of current. |
Voltage error compensation table of current 2 | Must be a valid value | 0.049F | Voltage error compensation table of current. |
Voltage error compensation table of current 3 | Must be a valid value | 0.080F | Voltage error compensation table of current. |
Voltage error compensation table of current 4 | Must be a valid value | 0.184F | Voltage error compensation table of current. |
Voltage error compensation table of current 5 | Must be a valid value | 0.751F | Voltage error compensation table of current. |
Interrupts |
Callback | Name must be a valid C symbol | NULL | A user callback function. If this callback function is provided, it is called at A/D conversion finish interrupt. |
Design Parameter |
Current PI loop omega (Hz) | Must be a valid value | 300.0F | Current PI loop omega |
Current PI loop zeta | Must be a valid value | 1.0F | Current PI loop zeta |
Motor Parameter |
Pole pairs | Must be a valid non-negative value. | 2 | Pole pairs |
Resistance (ohm) | Must be a valid value | 8.5F | Resistance |
Inductance of d-axis (H) | Must be a valid value | 0.0045F | Inductance of d-axis |
Inductance of q-axis (H) | Must be a valid value | 0.0045F | Inductance of q-axis |
Permanent magnetic flux (Wb) | Must be a valid value | 0.02159F | Permanent magnetic flux |
Motor Parameter > Rotor inertia (kgm^2) | Must be a valid value | 0.0000028F | Rotor 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 Current Control with none-negative value.
- Set the Reference Voltage with none-negative value.
Examples
Basic Example
This is a basic example of minimal use of the Motor Current in an application.
void motor_current_basic_example (void)
{
assert(FSP_SUCCESS == err);
{
temp_input_current.
iu = 1.0F;
temp_input_current.
iv = 1.0F;
temp_input_current.
iw = 1.0F;
temp_input_voltage.
vdc = 24.0F;
temp_input_voltage.
va_max = 24.0F;
(void) RM_MOTOR_CURRENT_PhaseVolageGet(g_test_motor_current.p_ctrl, &temp_get_voltage);
}
}
◆ motor_current_shunt_type_t
Selection of shunt type
Enumerator |
---|
MOTOR_CURRENT_SHUNT_TYPE_1_SHUNT | Only use U phase current.
|
MOTOR_CURRENT_SHUNT_TYPE_2_SHUNT | Use U and W phase current.
|
MOTOR_CURRENT_SHUNT_TYPE_3_SHUNT | Use all phase current.
|
◆ RM_MOTOR_CURRENT_Open()
Opens and configures the Motor Current Module. Implements motor_current_api_t::open.
- Return values
-
FSP_SUCCESS | Motor Current 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 | Configuration parameter error. |
◆ RM_MOTOR_CURRENT_Close()
Disables specified Motor Current Module. Implements motor_current_api_t::close.
- Return values
-
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_CURRENT_Reset()
Reset variables of Motor Current Module. Implements motor_current_api_t::reset.
- Return values
-
FSP_SUCCESS | Successfully reset. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_CURRENT_Run()
Run(Start) the Current Control. Implements motor_current_api_t::run.
- Return values
-
FSP_SUCCESS | Successfully run. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_CURRENT_ParameterSet()
Set (Input) Parameter Data. Implements motor_current_api_t::parameterSet.
- 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 | Input argument error. |
◆ RM_MOTOR_CURRENT_CurrentReferenceSet()
◆ RM_MOTOR_CURRENT_SpeedPhaseSet()
Set Current Speed & rotor phase Data. Implements motor_current_api_t::speedPhaseSet.
- Return values
-
FSP_SUCCESS | Successfully data is set. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ RM_MOTOR_CURRENT_CurrentSet()
Set d/q-axis Current & Voltage Data. Implements motor_current_api_t::currentSet.
- 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 | Input parameter error. |
◆ RM_MOTOR_CURRENT_ParameterGet()
Get Output Parameters. Implements motor_current_api_t::parameterGet.
- Return values
-
FSP_SUCCESS | Successful data get. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |
◆ RM_MOTOR_CURRENT_CurrentGet()
Get d/q-axis Current. Implements motor_current_api_t::currentGet.
- Return values
-
FSP_SUCCESS | Successful data get. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |
◆ RM_MOTOR_CURRENT_PhaseVoltageGet()
Gets the set phase voltage. Implements motor_current_api_t::phaseVoltageGet.
- Return values
-
FSP_SUCCESS | Successful data calculation. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input parameter error. |
◆ RM_MOTOR_CURRENT_ParameterUpdate()
Update the parameters of Current Control. Implements motor_current_api_t::parameterUpdate.
- Return values
-
FSP_SUCCESS | Successfully data was updated. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
◆ rm_motor_current_encoder_cyclic()
(end addtogroup MOTOR_CURRENT)