- Set the AC source output to 0 V
at 50/60Hz, turn on the AC power supply, slowly increase the input voltage from
0-V to 220-V AC.
- The required motor parameters
must be defined in the user_mtr1.h header file as shown in the following
example code. If the motor parameters are not well know by the user, the motor
identification can be used to achieve the motor parameters if the FAST estimator
is implemented in the example
lab.
#define USER_MOTOR1_TYPE MOTOR_TYPE_PM
#define USER_MOTOR1_NUM_POLE_PAIRS (4)
#define USER_MOTOR1_Rr_Ohm (NULL)
#define USER_MOTOR1_Rs_Ohm (0.38157931f)
#define USER_MOTOR1_Ls_d_H (0.000188295482f)
#define USER_MOTOR1_Ls_q_H (0.000188295482f)
#define USER_MOTOR1_RATED_FLUX_VpHz (0.0396642499f)
- Changes the
userParams.flag_bypassMotorId value to "false"in the
sys_main.c file to enable the motor identification as the following
example
code.
// false->enable identification, true->disable identification
userParams_M1.flag_bypassMotorId = false;
- Set the right identification
variables value in the user_mtr1.h file according to the motor
specification.
#define USER_MOTOR1_RES_EST_CURRENT_A (1.5f) // A - 10~30% of rated current of the motor
#define USER_MOTOR1_IND_EST_CURRENT_A (-1.0f) // A - 10~30% of rated current of the motor, just enough to enable rotation
#define USER_MOTOR1_MAX_CURRENT_A (4.5f) // A - 30~150% of rated current of the motor
#define USER_MOTOR1_FLUX_EXC_FREQ_Hz (40.0f) // Hz - 10~30% of rated frequency of the motor
- Rebuild the project and load the
code into the controller, run the project by clicking on button ,
or click Run → Resume in the Debug tab. The
systemVars.flagEnableSystem should be set to 1 after a fixed
time, that means the offsets calibration have been done and the power relay for
inrush is turned on. The fault flags motorVars_M1.faultMtrUse.all should
be equal to '0' , if not, the user should check the current and voltage
sensing circuit as described in Section 3.5.1.
- Set the variable
motorVars_M1.flagEnableRunAndIdentify to' 1 in the Expressions
window as shown in Figure 3-46, the motor identification will be executed, the whole process will take about
150s. Once motorVars_M1.flagEnableRunAndIdentify is equal to 0 and
the motor is stopping, the motor parameters have been identified. Copy the
variables value in the watch window to replace the defined motor parameters in
the user_mtr1.h file as follows:
- USER_MOTOR1_Rs_Ohm =
motorSetVars_M1.Rs_Ohm’s value
- USER_MOTOR1_Ls_d_H =
motorSetVars_M1.Ls_d_H’s value
- USER_MOTOR1_Ls_q_H =
motorSetVars_M1.Ls_q_H’s value
- USER_MOTOR1_RATED_FLUX_VpHz = motorSetVars_M1.flux_VpHz’s value
- Set
userParams_M1.flag_bypassMotorId value to 'true' to disable
identification after successfully identify the motors parameters, rebuild the
project and load the code into the controller.
- The
example can support online identify the motor without reloading the code as the
following steps.
- Set the
motorVars_M1.flagEnableRunAndIdentify to' 0' to stop
run the motor.
- Set the
motorVars_M1.flagEnableMotorIdentify to '1' to enable
identification.
- Set the
motorVars_M1.flagEnableRunAndIdentify to' 1' to start
identify motor parameters. The
motorVars_M1.flagEnableMotorIdentify will be set to '0'
automatically that means the identification is in processing.
- As described in the step 6 above, the new motor parameters will
be identified.
- Once complete motor parameters
identification or set the correct the motor parameters in the user_mtr1.h
file. To start run the motor as the following steps.
- Set the variables
motorVars_M1.flagEnableRunAndIdentify equal to 1 again
to start run the motor.
- Set the target speed
value to the variable motorVars_M1.speedRef_Hz and watch how the
motor shaft speed will follow the setting speed.
- To change the
acceleration, enter a different acceleration value for the variable
motorVars_M1.accelerationMax_Hzps.
- Use PWMDAC or DAC128S
module to display the monitoring variables as described in Section 3.4.2 or Section 3.4.3. The motor angle and current waveforms are shown in Figure 3-47.
- The default proportional gain
(Kp) and integral gain (Ki) for the current controllers of the FOC system are
calculated in the function setupControllers(). After
setupControllers() is called, the global variables
motorSetVars_M1.Kp_Id, motorSetVars_M1.Ki_Id, motorSetVars_M1.Kp_Iq, and
motorSetVars_M1.Ki_Iq are initialized with the newly calculated Kp and Ki gains.
Tune the Kp and Ki value of these four variables in Expressions Watch Window as
shown in Figure 3-46 for the current controllers to achieve the expected current control bandwidth
and response. The Kp gain creates a zero that cancels the pole of the motor’s
stator and can easily be calculated. The Ki gain adjusts the bandwidth of the
current controller-motor system. When a speed controlled system is needed for a
certain damping, the Kp gain of the current controller will relate to the time
constant of the speed controlled system.
- The default proportional gain
(Kp) and integral gain (Ki) for the speed controllers of the FOC system are also
calculated in the function setupControllers(). After
setupControllers() is called, the global variables
motorSetVars_M1.Kp_spd and motorSetVars_M1.Ki_spd are initialized with the newly
calculated Kp and Ki gains. Tune the Kp and Ki value of these two variables in
Expressions Watch Window as shown in Figure 3-46 for the speed controllers to achieve the expected current control bandwidth
and response. Tuning the speed controller has more unknowns than when tuning a
current controller, the default calculated Kp and Ki is just a reference value
as a starting point.
- Set the variables
motorVars_M1.flagEnableRunAndIdentify to '0' to stop run the
motor.
- Once complete, the controller can
now be halted and the debug connection terminated. Fully halting the controller
by first clicking the Halt button on
the toolbar or by clicking Target → Halt. Finally, reset the
controller by clicking on or
clicking Run → Reset.
- Close CCS debug session by
clicking on Terminate Debug Session or
clicking Run → Terminate.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST estimator, feedback speed of the motor, and a phase current of the
motor as shown in Figure 3-47 when the motor
is running at forward rotation by setting motorVars_M1.speedRef_Hz to a
positive reference value.
As illustrated in Section 3.3.2, multiple FOC
algorithms can be supported in the example lab. The user can use one or two
algorithm for motor control in the lab project as shown in Table 3-7.
The user can implement FAST and eSMO
estimators in the project simultaneously by adding the pre-define name
'MOTOR1_FAST' and 'MOTOR1_ESMO' in project properties as described
in Section 3.3.1. Rebuild, load
and run the project as the operation steps above. The settings will be as shown in
Figure 3-46.
- The systemVars.estType value
equals to EST_TYPE_FAST_ESMO that means FAST and eSMO estimators are enabled in
this project.
- The motorVars_M1.estimatorMode
equals to ESTIMATOR_MODE_FAST that means the FAST estimator is using for
sensorless-FOC, equals to ESTIMATOR_MODE_ESMO that means the eSMO estimator is
using for sensorless-FOC.
- The estimated rotor angles from
FAST and eSMO are shown in Figure 3-48. The motor
is running with FAST at forward rotation by setting
motorVars_M1.speedRef_Hz to a positive value.
- The estimated rotor angles from
FAST and eSMO are shown in Figure 3-52. The motor
is running with FAST at reversal rotation by setting
motorVars_M1.speedRef_Hz to a negative value.
- The user can change the value to
ESTIMATOR_MODE_ESMO to select the eSMO estimator for sensorless-FOC. And also
the user can change the value to switch the using estimator on the fly.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST and eSMO estimator, and a phase current of the motor as shown in Figure 3-48 when the motor
is running at forward rotation by setting motorVars_M1.speedRef_Hz to a
positive reference value.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST and eSMO estimator, and a phase current of the motor as shown in Figure 3-49 when the motor
is running at reversal rotation by setting motorVars_M1.speedRef_Hz to a
negative reference value.
The user can
implement FAST and Encoder estimators in the project simultaneously by adding the
pre-define name 'MOTOR1_FAST' and 'MOTOR1_ENC' in project properties
as described in Section 3.3.1. Rebuild, load
and run the project as the operation steps above.
- The systemVars.estType value
equals to EST_TYPE_FAST_ENC that means FAST and Encoder estimators are enabled
in this project.
- The motorVars_M1.estimatorMode
equals to ESTIMATOR_MODE_FAST that means the FAST estimator is using for
sensorless-FOC, equals to ESTIMATOR_MODE_ENC that means the encoder estimator is
using for sensored-FOC.
- The estimated rotor angles from
FAST and Encoder are shown in Figure 3-50. The motor
is running with FAST at forward rotation by setting motorVars_M1.speedRef_Hz to
a positive value.
- The user can change the value to
ESTIMATOR_MODE_ENC to select the Encoder estimator for sensored-FOC. And also
the user can change the value to switch the using estimator on the fly.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST estimator and encoder, and a phase current of the motor as shown in
Figure 3-50 when the motor
is running at forward rotation by setting motorVars_M1.speedRef_Hz to a
positive reference value.
The user can implement FAST and Hall
sensor estimators in the project simultaneously by adding the pre-define name
'MOTOR1_FAST' and 'MOTOR1_HALL' in project properties as described
in Section 3.3.1. Rebuild, load
and run the project as the operation steps above.
- The systemVars.estType value
equals to EST_TYPE_FAST_HALL that means FAST and Hall sensor estimators are
enabled in this project.
- The motorVars_M1.estimatorMode
equals to ESTIMATOR_MODE_FAST that means the FAST estimator is using for
sensorless-FOC, equals to ESTIMATOR_MODE_HALL that means the Hall sensor
estimator is using for sensored-FOC.
- The estimated rotor angles from
FAST and Hall sensor are shown in Figure 3-51. The motor
is running with FAST at forward rotation by setting motorVars_M1.speedRef_Hz to
a positive value.
- The estimated rotor angles from
FAST and Hall sensor are shown in Figure 3-51. The motor
is running with Hall sensor at reversal rotation by setting
motorVars_M1.speedRef_Hz to a negative value.
- The user can change the value to
ESTIMATOR_MODE_HALL to select the Hall sensor estimator for sensored-FOC. And
also the user can change the value to switch the using estimator on the
fly.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST estimator and Hall sensor, and a phase current of the motor as shown
in Figure 3-51 when the motor
is running at forward rotation by setting motorVars_M1.speedRef_Hz to a
positive reference value.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the FAST estimator and Hall sensor, and a phase current of the motor as shown
in Figure 3-52 when the motor
is running at reversal rotation by setting motorVars_M1.speedRef_Hz to a
negative reference value.
The user can
implement eSMO and Encoder estimators in the project simultaneously by adding the
pre-define name 'MOTOR1_ESMO' and 'MOTOR1_ENC' in project properties
as described in Section 3.3.1. Rebuild, load
and run the project as the operation steps above.
- The systemVars.estType value
equals to EST_TYPE_ESMO_ENC that means eSMO and Encoder estimators are enabled
in this project.
- The motorVars_M1.estimatorMode
equals to ESTIMATOR_MODE_ESMO that means the eSMO estimator is using for
sensorless-FOC, equals to ESTIMATOR_MODE_ENC that means the encoder estimator is
using for sensored-FOC.
- The estimated rotor angles from
eSMO and Encoder are shown in Figure 3-53. The motor
is running with eSMO at forward rotation by setting motorVars_M1.speedRef_Hz to
a positive value.
- The user can change the value to
ESTIMATOR_MODE_ENC to select the Encoder estimator for sensored-FOC. And also
the user can change the value to switch the using estimator on the fly.
Use DAC128S085EVM with an oscilloscope to monitor rotor angle of the motor
from the eSMO estimator and encoder, and a phase current of the motor as shown in
Figure 3-53 when the motor
is running at forward rotation by setting motorVars_M1.speedRef_Hz to a
positive reference value.