SPRACO3 October   2019 INA240 , LMG5200 , TMS320F280021 , TMS320F280021-Q1 , TMS320F280023 , TMS320F280023-Q1 , TMS320F280023C , TMS320F280025 , TMS320F280025-Q1 , TMS320F280025C , TMS320F280025C-Q1 , TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041-Q1 , TMS320F280041C , TMS320F280041C-Q1 , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049-Q1 , TMS320F280049C , TMS320F280049C-Q1 , TMS320F28374D , TMS320F28374S , TMS320F28375D , TMS320F28375S , TMS320F28375S-Q1 , TMS320F28376D , TMS320F28376S , TMS320F28377D , TMS320F28377D-EP , TMS320F28377D-Q1 , TMS320F28377S , TMS320F28377S-Q1 , TMS320F28378D , TMS320F28378S , TMS320F28379D , TMS320F28379D-Q1 , TMS320F28379S

 

  1.   Dual-Axis Motor Control Using FCL and SFRA On a Single C2000 MCU
    1.     Trademarks
    2. 1 Introduction
      1. 1.1 Acronyms and Descriptions
    3. 2 Benefits of the C2000 for High-Bandwidth Current Loop
    4. 3 Current Loops in Servo Drives
    5. 4 PWM Update Latency for Dual Motor
    6. 5 Outline of the Fast Current Loop Library
    7. 6 Evaluation Platform Setup
      1. 6.1 Hardware
        1. 6.1.1 LAUNCHXL-F28379D or LAUNCHXL-F280049C
          1. 6.1.1.1 DACs
          2. 6.1.1.2 QEPs
        2. 6.1.2 Inverter BoosterPack - GaN + INA240
        3. 6.1.3 Two Motor Dyno
        4. 6.1.4 System Hardware Connections
        5. 6.1.5 Powering Up the Setup
      2. 6.2 Software
        1. 6.2.1 Incremental Build
        2. 6.2.2 Software Setup for Dual-Axis Servo Drive Projects
    8. 7 System Software Integration and Testing
      1. 7.1 Incremental Build Level 1
        1. 7.1.1 SVGEN Test
        2. 7.1.2 Testing SVGEN With DACs
        3. 7.1.3 Inverter Functionality Verification
      2. 7.2 Incremental Build Level 2
        1. 7.2.1 Connecting motor to INVs
        2. 7.2.2 Testing the Motors and INVs
        3. 7.2.3 Setting Over-current Limit in the Software
        4. 7.2.4 Setting Current Regulator Limits
        5. 7.2.5 Position Encoder Feedback
      3. 7.3 Incremental Build Level 3
        1. 7.3.1 Observation One – Latency
      4. 7.4 Incremental Build Level 4
        1. 7.4.1 Observation
        2. 7.4.2 Dual Motor Run With Speed Loop
      5. 7.5 Incremental Build Level 5
        1. 7.5.1 Dual Motor Run with Position Loop
      6. 7.6 Incremental Build Level 6
        1. 7.6.1 Integrating SFRA Library
        2. 7.6.2 Initial Setup Before Starting SFRA
        3. 7.6.3 SFRA GUIs
        4. 7.6.4 Setting Up the GUIs to Connect to Target Platform
        5. 7.6.5 Running the SFRA GUIs
        6. 7.6.6 Influence of Current Feedback SNR
        7. 7.6.7 Inferences
        8. 7.6.8 Phase Margin vs Gain Crossover Frequency
    9. 8 Summary
    10. 9 References

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 loop bandwidth can be set in the debug window. The implementation block diagram is given in Figure 25. The two motors shafts must be kept disconnected for more clarity.

figure_25.gifFigure 25. Level 3 Block Diagram Showing Inner Control Loop - FCL

WARNING

In this build, control is done based on the actual rotor position and the motor can run at higher speeds if the commanded ‘IqRef’ is higher and if there is no load on the motor. Therefore, it is advised to either add some mechanical load on the motor before the test or to apply lower values of ‘IqRef’.

At start up, the motors are taken through QEP calibration phase where each motor takes turns to calibrate its QEP’s angular offset with respect to its stator angle zero. To start with, motor goes through an alignment and then spins slowly based on an enforced angle waiting on index pulse for calibration. After the index pulse is received, it goes to float mode.

After calibration is done, when any of the motor is commanded to run, it runs in full self-control mode based on its own angular position. This calibration step happens for this build level and beyond. Since the calibration routine calibrates both motors, connect both motors but the shafts need not be connected together necessarily yet. If the shafts are already coupled, only one motor can be tested at a given time, otherwise both motors can be tested simultaneously.

  1. Open "dual_axis_servo_drive_settings.h" and select level 3 incremental build option by setting the BUILDLEVEL to FCL_LEVEL3 (#define BUILDLEVEL FCL_LEVEL3). The current loop regulator can be selected to be the PI controller or the complex controller by setting FCL_CNTLR to PI_CNTLR or CMPLX_CNTLR. The current and position feedbacks can be sampled once or twice per PWM period depending on the sampling method. The sampling is synchronized to carrier max in single sampling method and to carrier max and carrier zero in double sampling method. This sample method selection is done in the example by selecting SAMPLING_METHOD to SINGLE_SAMPLING or SAMPLING_METHOD to DOUBLE_SAMPLING.
  2. NOTE

    The maximum modulation index changes from 0.98 in SINGLE_SAMPLING method to 0.96 in DOUBLE_SAMPLING method. If the PWM_FREQUENCY is changed from 10 KHz, the maximum modulation index also changes.

  3. Right-click on the project name, then click Rebuild Project.
  4. When the build is complete, click the Debug button, reset the CPU, restart, enable real-time mode, and run. In the software, within the 'motorVars[0]' structure, the key variables to add, adjust, or monitor are summarized as follows:
    1. motorVars[0].runMotor : flag to MOTOR_RUN or MOTOR_STOP the motor.
    2. motorVars[0].maxModIndex: maximum modulation index.
    3. motorVars[0].IdRef_run : changes the d-axis voltage in per-unit.
    4. motorVars[0].IqRef : changes the q-axis voltage in per-unit.
    5. motorVars[0].FCL_params.WccD : preferred bandwidth of d-axis current loop.
    6. motorVars[0].FCL_params.WccQ : preferred bandwidth of q-axis current loop.
    7. motorVars[0].fclLatencyInMicroSec: shows latency between ADC and QEP sampling, and PWM in µs.
    8. motorVars[0].fclClrCnt: flag to clear the variable motorVars[0].fclLatencyInMicroSec and let it refresh.
  5. Set 'enableFlag' to '1' in the expressions window. The variables named 'motorVars[0].isrTicker' and "'motorVars[1].isrTicker' are incrementally increased as shown in Expressions window to confirm the interrupts are working properly.
  6. Verify if the 'motorVars[0].maxModIndex' value is either 0.96 in double-sampling method or 0.98 in single-sampling method.
  7. Set 'motorVars[0].speedRef' to 0.3 pu (or another suitable value if the base speed is different), 'motorVars[0].IdRef_run' to zero, and 'motorVars[0].IqRef' to 0.05 pu (or another suitable value). 'motorVars[0].speedRef' helps only until the QEP index pulse is received. Thereafter, the motor is controlled based on its rotor position. The soft-switch variable (motorVars[0].ptrFCL->lsw) is auto promoted in a sequence inside the FCL. In the code, 'motorVars[0].ptrFCL->lsw' manages the loop setting as follows:
    1. lsw = ENC_ALIGNMENT --> lock the rotor of the motor
    2. lsw = ENC_WAIT_FOR_INDEX --> motor in running mode, waiting for first instance of QEP Index pulse
    3. lsw = ENC_CALIBRATION_DONE --> motor in running mode, first Index pulse of encoder occurred
  8. Gradually increase voltage at DC power supply to, for example, 20% of the rated voltage.
  9. Set 'motorVars[0].runMotor' flag to MOTOR_RUN to run the motor.
  10. Check 'motorVars[0].pi_id.fbk' in the watch windows with continuous refresh feature and see if it can track 'motorVars[0].IdRef'.
  11. Check 'motorVars[0].ptrFCL->pi_iq.fbk' in the watch windows with continuous refresh feature and see if it can track 'motorVars[0].IqRef'.
  12. To confirm these two current regulator modules, try different values of 'motorVars[0].pi_id.ref' and 'motorVars[0].ptrFCL->pi_iq.ref' by changing 'motorVars[0].IdRef_run' and 'motorVars[0].IqRef' respectively.
  13. Try different bandwidths for the current loop by tweaking the values of 'motorVars[0].FCL_params.wccD' and 'motorVars[0].FCL_params.wccQ'. The default setting for the bandwidth is 1/18 of the sampling frequency.
  14. If the motor shaft can be held tight, then the 'motorVars[0].IqRef' value can be changed back and forth from 0.5 to–0.5, to study the effect of loop bandwidth.
  15. Set ‘motorVars[0].runMotor’ to MOTOR_STOP to stop the motor.
  16. 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.
  17. The same set of tests can be done on motor 2 by working with structure variable 'motorVars[1]'.