Calculation process for the motor control on RA MCUs. This module implements the Motor speed Interface.
The motor speed is used to control the speed of motor rotation in an appication. This module should be called cyclically in an application (e.g. in cyclic timer interrupt). This module caliculates d/q-axis current reference with input speed reference, current rotational speed, and d/q-axis current.
The motor speed module has below features.
The following build time configurations are defined in fsp_cfg/rm_motor_speed_cfg.h:
This module can be added to the Stacks tab via New Stack > Motor > Motor Speed Controller (rm_motor_speed).
Configuration | Options | Default | Description |
General |
Name | Name must be a valid C symbol | g_motor_speed0 | Module name. |
Speed control period (sec) | Must be a valid non-negative value | 0.0005F | Period of speed control function. |
Step of speed climbing (rpm) | Must be a valid non-negative value | 0.5F | Step of speed change at start of open-loop. |
Maximum rotational speed (rpm) | Must be a valid non-negative value. | 2650.0F | Maximum rotational speed (Limit speed). |
Speed LPF omega | Must be a valid non-negative value | 10.0F | Design parameter for speed LPF. |
Limit of q-axis current (A) | Must be a valid non-negative value | 0.42F | Limit of q-axis current. |
Step of speed feedback at open-loop | Must be a valid non-negative value | 0.20F | Step of speed feedback at open-loop. |
Natural frequency | Must be a valid non-negative value. | 100.0F | Natural frequency for disturbance speed observer. |
Open-loop damping |
| Enable | Select enable/disable Open-loop damping control. |
Flux weakening |
| Disable | Select enable/disable flux weakening control. |
Torque compensation for sensorless transition |
| Enable | Select enable/disable torque compensation for sensorless transition. |
Speed observer |
| Enable | Select enable/disable Speed observer process. |
Selection of speed observer |
| Normal | Select speed observer type. |
Control method |
| PID | Select the control method [PID or IPD]. |
Control type |
-
Sensoreless
-
Encoder
-
Induction
-
Hall
| Sensoreless | |
Open-Loop |
Step of d-axis current climbing | Must be a valid non-negative value | 0.3F | Step of d-axis current climbing |
Step of d-axis current descending | Must be a valid non-negative value | 0.3F | Step of d-axis current descending |
Step of q-axis current descending ratio | Must be a valid non-negative value | 1.0F | Step of q-axis current descending ratio |
Reference of d-axis current | Must be a valid non-negative value | 0.3F | Reference of d-axis current |
Threshold of speed control descending | Must be a valid value | 600.0F | When rotational speed reaches this speed, d-axis current is controlled descending. |
Threshold of speed control climbing | Must be a valid value | 500.0F | Until rotational speed reaches this speed, d-axis current is controlled climbing. |
Period between open-loop to BEMF (sec) | Must be a valid non-negative value | 0.025F | Margin time between open-loop control changes to BEMF PI control. |
Phase error(degree) to decide sensor-less switch timing | Must be a valid value | 10.0F | Phase error(degree) to decide sensor-less switch timing. |
Design parameter |
Speed PI loop omega | Must be a valid non-negative value | 5.0F | Speed PI loop omega |
Speed PI loop zeta | Must be a valid non-negative value | 1.0F | Speed PI loop zeta |
Estimated d-axis HPF omega | Must be a valid non-negative value | 2.5F | HPF cutoff frequency for ed (Hz) |
Open-loop damping zeta | Must be a valid non-negative value | 1.0F | Damping ratio of open-loop damping control |
Cutoff frequency of phase error LPF | Must be a valid non-negative value | 10.0F | Cutoff frequency of phase error LPF |
Speed observer omega | Must be a valid non-negative value | 200.0F | Speed observer loop omega |
Speed observer zeta | Must be a valid non-negative value | 1.0F | Speed observer loop zeta |
Motor Parameter |
Pole pairs | Must be a valid non-negative value. | 2 | Pole pairs |
Resistance (ohm) | Must be a valid non-negative value | 8.5F | Resistance |
Inductance of d-axis (H) | Must be a valid non-negative value | 0.0045F | Inductance of d-axis |
Inductance of q-axis (H) | Must be a valid non-negative value | 0.0045F | Inductance of q-axis |
Permanent magnetic flux (Wb) | Must be a valid non-negative value | 0.02159F | Permanent magnetic flux |
Motor Parameter > Rotor inertia (kgm^2) | Must be a valid non-negative value | 0.0000028F | Rotor inertia |
Interrupts |
Callback | Name must be a valid C symbol | NULL | A user callback function. If this callback function is provided, it is called at timer interrupt. |
Input data | Name must be a valid C symbol | NULL | Structure for Speed control Input. If you set this content, Speed Control function read these data automatically. (No need to use Set API.) |
Output data | Name must be a valid C symbol | NULL | Structure for Speed control Output. If you set this content, Speed Control function write need data automatically. (No need to use Get API.) |
This module doesn't depend on clock setting, because this module is a simple calculation process.
This module does not use I/O pins.
This is a basic example of minimal use of the motor speed in an application.