SPRACM9B June   2019  – November 2020 F29H850TU , F29H859TU-Q1 , TMS320F28384D , TMS320F28384S , TMS320F28386D , TMS320F28386S , TMS320F28388D , TMS320F28388S , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1

 

  1.   Trademarks
  2. Introduction
    1. 1.1 Acronyms Used in This Document
  3. Benefits of the TMS320F2838x MCU for High-Bandwidth Current Loop
  4. Current Loops in Servo Drives
  5. Outline of the Fast Current Loop Library
  6. Fast Current Loop Evaluation
    1. 5.1 Evaluation Setup
      1. 5.1.1 Hardware
      2. 5.1.2 Software
      3. 5.1.3 FCL With T-Format Type Position Encoder
        1. 5.1.3.1 Connecting T-Format Encoder to IDDK
        2. 5.1.3.2 T-Format Interface Software
        3. 5.1.3.3 T-Format Encoder Latency Considerations
      4. 5.1.4 SDFM
      5. 5.1.5 Incremental System Build
  7. Incremental Build Level 1
    1. 6.1 SVGEN Test
    2. 6.2 Testing SVGEN With DACs
    3. 6.3 Inverter Functionality Verification
  8. Incremental Build Level 2
    1. 7.1 Setting the Overcurrent Limit in the Software
    2. 7.2 Current Sense Method
    3. 7.3 Voltage Sense Method
    4. 7.4 Setting Current Regulator Limits
    5. 7.5 Verification of Current Sense
    6. 7.6 Position Encoder Feedback
      1. 7.6.1 Speed Observer and Position Estimator
      2. 7.6.2 Verification of Position Encoder Orientation
  9. Incremental Build Level 3
    1. 8.1 Observation One – PWM Update Latency
      1. 8.1.1 From the Expressions Window
      2. 8.1.2 From the Scope Plot
  10. Incremental Build Level 4
    1. 9.1 Observation
  11. 10Incremental Build Level 5
  12. 11Incremental Build Level 6
    1. 11.1 Integrating SFRA Library
    2. 11.2 Initial Setup Before Starting SFRA
    3. 11.3 SFRA GUIs
    4. 11.4 Setting Up the GUIs to Connect to Target Platform
    5. 11.5 Running the SFRA GUIs
    6. 11.6 Influence of Current Feedback SNR
    7. 11.7 Inferences
      1. 11.7.1 Bandwidth Determination From Closed Loop Plot
      2. 11.7.2 Phase Margin Determination From Open Loop Plot
      3. 11.7.3 Maximum Modulation Index Determination From PWM Update Time
      4. 11.7.4 Voltage Decoupling in Current Loop
    8. 11.8 Phase Margin vs Gain Crossover Frequency
  13. 12Incremental Build Level 7
    1. 12.1 Run the Code on CPU1 to Allocate ECAT to CM
    2. 12.2 Run the Code on CM to Setup ECAT
    3. 12.3 Setup TwinCAT
    4. 12.4 Scanning for EtherCAT Devices via TwinCAT
    5. 12.5 Program ControlCard EEPROM for ESC
    6. 12.6 Running the Application
  14. 13Incremental Build Level 8
    1. 13.1 Run the Code on CPU1 to Allocate ECAT to CM
    2. 13.2 Run the Code on CM to Setup ECAT
    3. 13.3 Running the Application
  15. 14References
  16. 15Revision History

Incremental Build Level 3

Assuming the previous section is completed successfully, this section verifies the dq-axis current regulation performed by the FCL. One of the two current controllers can be chosen: PI or complex. The bandwidth of the controllers can be set in the debug window.

Note:

In this build, control is done based on the actual rotor position; therefore, the motor can run at higher speeds if the commanded IqRef is higher and there is no load on the motor. TI advises to either add some mechanical load on the motor before the test or apply lower values of IqRef. When the motor is commanded to run, it is subjected to an initial alignment stage where the electrical angle and the encoder angle count are set to zero.

If the encoder is a QEP, then the QEP count is set to zero. The motor is then forced to run based on an enforced angle until the QEP index pulse is received. Then the motor can run in full self-control mode based on its own angular position.

If the encoder is an absolute type, then the angle at the end of alignment is captured as an initial angle (initTheta) that is used as a reference for position determination from then on. The motor can run in full self-control mode based on its own angular position right after the alignment.

The following initial steps can help with evaluating this build level;

  1. Open fcl_f2838x_tmdxiddk_settings_cpu1.h and select the level 3 incremental build option by setting BUILDLEVEL to FCL_LEVEL3 (#define BUILDLEVEL FCL_LEVEL3).
  2. The current loop regulator can be selected to be PI controller or complex controller by setting FCL_CNTLR to PI_CNTLR or CMPLX_CNTLR.
  3. Select CURRENT_SENSE to LEM_CURRENT_SENSE
  4. Select POSITION_ENCODER to QEP_POS_ENCODER or T_FORMAT_ENCODER depending on the encoder coupled to motor.
  5. The current and position feedbacks can be sampled once or twice per PWM period, depending on the sampling method. The sampling is synchronized to the carrier maximum in single sampling method, and to carrier maximum and carrier zero in double sampling method. This sample method selection is done in the example by selecting SAMPLING_METHOD to SINGLE_SAMPLING or DOUBLE_SAMPLING. The maximum modulation index changes from 0.98 in the SINGLE_SAMPLING method to 0.96 in the DOUBLE_SAMPLING method. If the PWM_FREQUENCY is changed from 10 kHz, the maximum modulation index also changes. If a T-format encoder is used, select SINGLE_SAMPLING and no more than 10KHz PWM frequency. For more information, see Section 5.1.3.3.
  6. Right-click on the project name, and then click Rebuild Project. When the build is complete, click the Debug button, reset the CPU, restart, enable real-time mode, and run.

In the software, the key variables to add, adjust, or monitor are summarized as follows:

  • maxModIndex : maximum modulation index
  • IdRef : changes the d-axis voltage in per-unit
  • IqRef : changes the q-axis voltage in per-unit
  • FCL_params.WccD : preferred bandwidth of d-axis current loop
  • FCL_params.WccQ : preferred bandwidth of q-axis current loop
  • fclLatencyInMicroSec : shows latency between ADC sampling and PWM update in µs
  • fclClrCntr : flag to clear the variable fclLatencyInMicroSec and let it refresh
  • runMotor : flag to RUN or STOP the motor

Figure 8-1 shows the level 3 block diagram.

GUID-52F9C0CA-AB9D-41A4-A744-50846422A343-low.gifFigure 8-1 Level 3 Block Diagram Showing Inner Most Loop - FCL

The key steps are explained as follows:

  1. Set enableFlag to 1 in the watch window. The isrTicker variable is incrementally increased, as seen in watch windows to confirm the interrupt is working properly.
  2. Verify if the maxModIndex value is either 0.96 in double-sampling method or 0.98 in single-sampling method.
  3. Set speedRef to 0.3 pu (or another suitable value if the base speed is different), IdRef to zero, and IqRef to 0.03 pu (or another suitable value). With a QEP encoder, speedRef helps to run the motor in forced mode only until the QEP index pulse is received. Thereafter, the motor is controlled based on its rotor position. Whereas, with an absolute encoder, there is no such forced mode and the motor runs based on rotor position right after alignment.
  4. Gradually increase voltage at variac / DC power supply to, for example, 20% of the rated voltage.
  5. lsw is a state machine variable representing the functional state of interacting with quadrature encoder. Its various states are as follows:
    1. lsw = ENC_ALIGNMENT --> lock the rotor of motor into alignment with stator phase A
    2. lsw = ENC_WAIT_FOR_INDEX --> motor in run mode and waiting for the first instance of QEP index pulse (applicable with QEP encoder only)
    3. lsw = ENC_CALIBRATION_DONE --> motor in run mode - (signifies occurence of QEP index pulse and completion of calibration when QEP is used, or, completion of calibration when other encoders are used)
  6. Set runMotor flag to MOTOR_RUN to run the motor.
  7. Notice that lsw state is autopromoted in a sequence (code is inside the FCL library)
  8. Check pi_id.fbk in the watch windows with the continuous refresh feature and see if it can track IdRef.
  9. Check pi_iq.fbk in the watch windows with the continuous refresh feature and see if it can track IqRef.
  10. To confirm these two current regulator modules, try different values of pi_id.ref and pi_iq.ref, by changing the values of IdRef and IqRef, respectively.
  11. Try different bandwidths for the current loop by tweaking the values of FCL_params.wccD and FCL_params.wccQ. The default setting for the bandwidth is 1/18 of the sampling frequency.
  12. If the motor shaft can be held tight, then the IqRef value can be changed back and forth from 0.5 to –0.5, to study the effect of loop bandwidth.
  13. Bring the system to a safe stop by reducing the bus voltage, taking the controller out of real-time mode, and resetting. Now the motor stops.