TIDUF60 December   2023

 

  1.   1
  2.   Description
  3.   Resources
  4.   Features
  5.   Applications
  6.   6
  7. 1System Description
    1. 1.1 Terminology
    2. 1.2 Key System Specifications
  8. 2System Overview
    1. 2.1 Block Diagram
    2. 2.2 Design Considerations
    3. 2.3 Highlighted Products
      1. 2.3.1 TMS320F2800137
      2. 2.3.2 MSPM0G1507
      3. 2.3.3 TMP6131
      4. 2.3.4 UCC28881
      5. 2.3.5 TPS54202
      6. 2.3.6 TLV9062
      7. 2.3.7 TLV74033
    4. 2.4 System Design Theory
      1. 2.4.1 Hardware Design
        1. 2.4.1.1 Modular Design
        2. 2.4.1.2 High-Voltage Buck Auxiliary Power Supply
        3. 2.4.1.3 DC Link Voltage Sensing
        4. 2.4.1.4 Motor Phase Voltage Sensing
        5. 2.4.1.5 Motor Phase Current Sensing
        6. 2.4.1.6 External Overcurrent Protection
        7. 2.4.1.7 Internal Overcurrent Protection for TMS320F2800F137
      2. 2.4.2 Three-Phase PMSM Drive
        1. 2.4.2.1 Field-Oriented Control of PM Synchronous Motor
          1. 2.4.2.1.1 Space Vector Definition and Projection
            1. 2.4.2.1.1.1 ( a ,   b ) ⇒ ( α , β ) Clarke Transformation
            2. 2.4.2.1.1.2 α , β ⇒ ( d ,   q ) Park Transformation
          2. 2.4.2.1.2 Basic Scheme of FOC for AC Motor
          3. 2.4.2.1.3 Rotor Flux Position
        2. 2.4.2.2 Sensorless Control of PM Synchronous Motor
          1. 2.4.2.2.1 Enhanced Sliding Mode Observer With Phase-Locked Loop
            1. 2.4.2.2.1.1 Mathematical Model and FOC Structure of an IPMSM
            2. 2.4.2.2.1.2 Design of ESMO for the IPMSM
            3. 2.4.2.2.1.3 Rotor Position and Speed Estimation With PLL
        3. 2.4.2.3 Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control
        4. 2.4.2.4 Hardware Prerequisites for Motor Drive
          1. 2.4.2.4.1 Motor Current Feedback
            1. 2.4.2.4.1.1 Three-Shunt Current Sensing
            2. 2.4.2.4.1.2 Single-Shunt Current Sensing
          2. 2.4.2.4.2 Motor Voltage Feedback
  9. 3Hardware, Software, Testing Requirements, and Test Results
    1. 3.1 Getting Started Hardware
      1. 3.1.1 Hardware Board Overview
      2. 3.1.2 Test Conditions
      3. 3.1.3 Test Equipment Required for Board Validation
    2. 3.2 Getting Started GUI
      1. 3.2.1 Test Setup
      2. 3.2.2 Overview of GUI Software
      3. 3.2.3 Setup Serial Port
      4. 3.2.4 Motor Identification
      5. 3.2.5 Spin Motor
      6. 3.2.6 Motor Fault Status
      7. 3.2.7 Tune Control Parameters
      8. 3.2.8 Virtual Oscilloscope
    3. 3.3 Getting Started C2000 Firmware
      1. 3.3.1 Download and Install Software Required for Board Test
      2. 3.3.2 Opening Project Inside CCS
      3. 3.3.3 Project Structure
      4. 3.3.4 Test Procedure
        1. 3.3.4.1 Build Level 1: CPU and Board Setup
          1. 3.3.4.1.1 Start CCS and Open Project
          2. 3.3.4.1.2 Build and Load Project
          3. 3.3.4.1.3 Setup Debug Environment Windows
          4. 3.3.4.1.4 Run the Code
        2. 3.3.4.2 Build Level 2: Open-Loop Check With ADC Feedback
          1. 3.3.4.2.1 Start CCS and Open Project
          2. 3.3.4.2.2 Build and Load Project
          3. 3.3.4.2.3 Setup Debug Environment Windows
          4. 3.3.4.2.4 Run the Code
        3. 3.3.4.3 Build Level 3: Closed Current Loop Check
          1. 3.3.4.3.1 Start CCS and Open Project
          2. 3.3.4.3.2 Build and Load Project
          3. 3.3.4.3.3 Setup Debug Environment Windows
          4. 3.3.4.3.4 Run the Code
        4. 3.3.4.4 Build Level 4: Full Motor Drive Control
          1. 3.3.4.4.1 Start CCS and Open Project
          2. 3.3.4.4.2 Build and Load Project
          3. 3.3.4.4.3 Setup Debug Environment Windows
          4. 3.3.4.4.4 Run the Code
          5. 3.3.4.4.5 Tuning Motor Drive FOC Parameters
          6. 3.3.4.4.6 Tuning Field Weakening and MTPA Control Parameters
          7. 3.3.4.4.7 Tuning Current Sensing Parameters
    4. 3.4 Test Results
      1. 3.4.1 Load and Thermal Test
      2. 3.4.2 Overcurrent Protection by External Comparator
      3. 3.4.3 Overcurrent Protection by Internal CMPSS
    5. 3.5 Migrate Firmware to a New Hardware Board
      1. 3.5.1 Configure the PWM, CMPSS, and ADC Modules
      2. 3.5.2 Setup Hardware Board Parameters
      3. 3.5.3 Configure Faults Protection Parameters
      4. 3.5.4 Setup Motor Electrical Parameters
    6. 3.6 Getting Started MSPM0 Firmware
  10. 4Design and Documentation Support
    1. 4.1 Design Files
      1. 4.1.1 Schematics
      2. 4.1.2 Bill of Materials
      3. 4.1.3 PCB Layout Recommendations
      4. 4.1.4 Altium Project
      5. 4.1.5 Gerber Files
    2. 4.2 Software Files
    3. 4.3 Documentation Support
    4. 4.4 Support Resources
    5. 4.5 Trademarks
  11. 5About the Author

Motor Phase Current Sensing

The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. Top map 750-W Motor Inverter With C2000™ and MSPM0Reference Design 750-W Motor Inverter With C2000™ and MSPM0Reference Design Description Description Resources Resources Features Features Applications Applications System Description System Description Terminology Terminology Key System Specifications Key System Specifications System Overview System Overview Block Diagram Block Diagram Design Considerations Design Considerations Highlighted Products Highlighted Products TMS320F2800137 TMS320F2800137 MSPM0G1507 MSPM0G1507 TMP6131 TMP6131 UCC28881 UCC28881 TPS54202 TPS54202 TLV9062 TLV9062 TLV74033 TLV74033 System Design Theory System Design Theory Hardware Design Hardware Design Modular Design Modular Design High-Voltage Buck Auxiliary Power Supply High-Voltage Buck Auxiliary Power Supply DC Link Voltage Sensing DC Link Voltage Sensing Motor Phase Voltage Sensing Motor Phase Voltage Sensing Motor Phase Current Sensing Motor Phase Current Sensing External Overcurrent Protection External Overcurrent Protection Internal Overcurrent Protection for TMS320F2800F137 Internal Overcurrent Protection for TMS320F2800F137 Three-Phase PMSM Drive Three-Phase PMSM Drive Field-Oriented Control of PM Synchronous Motor Field-Oriented Control of PM Synchronous Motor Space Vector Definition and Projection Space Vector Definition and Projection ( a ,   b ) ⇒ ( α , β ) Clarke Transformation Clarke Transformation α , β ⇒ ( d ,   q ) Park Transformation Park Transformation Basic Scheme of FOC for AC Motor Basic Scheme of FOC for AC Motor Rotor Flux Position Rotor Flux Position Sensorless Control of PM Synchronous Motor Sensorless Control of PM Synchronous Motor Enhanced Sliding Mode Observer With Phase-Locked Loop Enhanced Sliding Mode Observer With Phase-Locked Loop Mathematical Model and FOC Structure of an IPMSM Mathematical Model and FOC Structure of an IPMSM Design of ESMO for the IPMSM Design of ESMO for the IPMSM Rotor Position and Speed Estimation With PLL Rotor Position and Speed Estimation With PLL Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Hardware Prerequisites for Motor Drive Hardware Prerequisites for Motor Drive Motor Current Feedback Motor Current Feedback Three-Shunt Current Sensing Three-Shunt Current Sensing Single-Shunt Current Sensing Single-Shunt Current Sensing Motor Voltage Feedback Motor Voltage Feedback Hardware, Software, Testing Requirements, and Test Results Hardware, Software, Testing Requirements, and Test Results Getting Started Hardware Getting Started Hardware Hardware Board Overview Hardware Board Overview Test Conditions Test Conditions Test Equipment Required for Board Validation Test Equipment Required for Board Validation Getting Started GUI Getting Started GUI Test Setup Test Setup Overview of GUI Software Overview of GUI Software Setup Serial Port Setup Serial Port Motor Identification Motor Identification Spin Motor Spin Motor Motor Fault Status Motor Fault Status Tune Control Parameters Tune Control Parameters Virtual Oscilloscope Virtual Oscilloscope Getting Started C2000 Firmware Getting Started C2000 Firmware Download and Install Software Required for Board Test Download and Install Software Required for Board Test Opening Project Inside CCS Opening Project Inside CCS Project Structure Project Structure Test Procedure Test Procedure Build Level 1: CPU and Board Setup Build Level 1: CPU and Board Setup Start CCS and Open Project Start CCS and Open Project Build and Load Project Build and Load Project Setup Debug Environment Windows Setup Debug Environment Windows Run the Code Run the Code Build Level 2: Open-Loop Check With ADC Feedback Build Level 2: Open-Loop Check With ADC Feedback Start CCS and Open Project Start CCS and Open Project Build and Load Project Build and Load Project Setup Debug Environment Windows Setup Debug Environment Windows Run the Code Run the Code Build Level 3: Closed Current Loop Check Build Level 3: Closed Current Loop Check Start CCS and Open Project Start CCS and Open Project Build and Load Project Build and Load Project Setup Debug Environment Windows Setup Debug Environment Windows Run the Code Run the Code Build Level 4: Full Motor Drive Control Build Level 4: Full Motor Drive Control Start CCS and Open Project Start CCS and Open Project Build and Load Project Build and Load Project Setup Debug Environment Windows Setup Debug Environment Windows Run the Code Run the Code Tuning Motor Drive FOC Parameters Tuning Motor Drive FOC Parameters Tuning Field Weakening and MTPA Control Parameters Tuning Field Weakening and MTPA Control Parameters Tuning Current Sensing Parameters Tuning Current Sensing Parameters Test Results Test Results Load and Thermal Test Load and Thermal Test Overcurrent Protection by External Comparator Overcurrent Protection by External Comparator Overcurrent Protection by Internal CMPSS Overcurrent Protection by Internal CMPSS Migrate Firmware to a New Hardware Board Migrate Firmware to a New Hardware Board Configure the PWM, CMPSS, and ADC Modules Configure the PWM, CMPSS, and ADC Modules Setup Hardware Board Parameters Setup Hardware Board Parameters Configure Faults Protection Parameters Configure Faults Protection Parameters Setup Motor Electrical Parameters Setup Motor Electrical Parameters Getting Started MSPM0 Firmware Getting Started MSPM0 Firmware Design and Documentation Support Design and Documentation Support Design Files Design Files Schematics Schematics Bill of Materials Bill of Materials PCB Layout Recommendations PCB Layout Recommendations Altium Project Altium Project Gerber Files Gerber Files Software Files Software Files Documentation Support Documentation Support Support Resources Support Resources Trademarks Trademarks About the Author About the Author IMPORTANT NOTICE AND DISCLAIMER IMPORTANT NOTICE AND DISCLAIMER 750-W Motor Inverter With C2000 and MSPM0
Reference Design 750-W Motor Inverter With C2000 and MSPM0
Reference Design™ Description This reference design is a 750-W motor drive for a washing machine or similar application, which illustrates a method to implement sensorless FOC control for a 3-phase PMSM with a FAST software encoder or eSMO. With a modular design, this reference design supports both the C2000 MCU and MSPM0 series microcontroller daughter-board on the same motherboard. The hardware and software available with this reference design are tested and ready-to-use to help accelerate development time to market. The hardware design details and test results are found in this design guide. Description This reference design is a 750-W motor drive for a washing machine or similar application, which illustrates a method to implement sensorless FOC control for a 3-phase PMSM with a FAST software encoder or eSMO. With a modular design, this reference design supports both the C2000 MCU and MSPM0 series microcontroller daughter-board on the same motherboard. The hardware and software available with this reference design are tested and ready-to-use to help accelerate development time to market. The hardware design details and test results are found in this design guide. This reference design is a 750-W motor drive for a washing machine or similar application, which illustrates a method to implement sensorless FOC control for a 3-phase PMSM with a FAST software encoder or eSMO. With a modular design, this reference design supports both the C2000 MCU and MSPM0 series microcontroller daughter-board on the same motherboard. The hardware and software available with this reference design are tested and ready-to-use to help accelerate development time to market. The hardware design details and test results are found in this design guide. This reference design is a 750-W motor drive for a washing machine or similar application, which illustrates a method to implement sensorless FOC control for a 3-phase PMSM with a FAST software encoder or eSMO. With a modular design, this reference design supports both the C2000 MCU and MSPM0 series microcontroller daughter-board on the same motherboard. The hardware and software available with this reference design are tested and ready-to-use to help accelerate development time to market. The hardware design details and test results are found in this design guide.FASTC2000 Resources no TIDA-010265 Design Folder TMS320F2800137 Product Folder MSPM0G1507 Product Folder UCC28881, TPS54202, TLV9062 Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder Ask our TI E2E support experts Resources no no no no TIDA-010265 Design Folder TMS320F2800137 Product Folder MSPM0G1507 Product Folder UCC28881, TPS54202, TLV9062 Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder Ask our TI E2E support experts TIDA-010265 Design Folder TMS320F2800137 Product Folder MSPM0G1507 Product Folder UCC28881, TPS54202, TLV9062 Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder TIDA-010265 Design Folder TMS320F2800137 Product Folder MSPM0G1507 Product Folder UCC28881, TPS54202, TLV9062 Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder TIDA-010265 Design Folder TMS320F2800137 Product Folder MSPM0G1507 Product Folder UCC28881, TPS54202, TLV9062 Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder TIDA-010265 Design Folder TIDA-010265 TIDA-010265Design Folder TMS320F2800137 Product Folder TMS320F2800137 TMS320F2800137Product Folder MSPM0G1507 Product Folder MSPM0G1507 MSPM0G1507Product Folder UCC28881, TPS54202, TLV9062 Product Folder UCC28881, TPS54202, TLV9062 UCC28881TPS54202TLV9062Product Folder C2000WARE-MOTORCONTROL-SDK Tool Folder C2000WARE-MOTORCONTROL-SDK C2000WARE-MOTORCONTROL-SDKTool Folder Ask our TI E2E support experts Ask our TI E2E support experts Ask our TI E2E support experts Ask our TI E2E support experts Ask our TI E2E support experts Ask our TI E2E support expertsTI E2E Features Wide operating voltage input range: 165 to 265 VAC, 50|60 Hz. Up to 750-W inverter stage, 15-kHz switching frequency, torque compensation, and automatic field weakening control Modular design with either C2000 or MSPM0 controller daughter-board on the same power motherboard Sensorless Field Oriented Control (FOC) motor control, supports both FAST and eSMO observer User-friendly graphical user interface (GUI) to control, identify, and monitor the motor Features Wide operating voltage input range: 165 to 265 VAC, 50|60 Hz. Up to 750-W inverter stage, 15-kHz switching frequency, torque compensation, and automatic field weakening control Modular design with either C2000 or MSPM0 controller daughter-board on the same power motherboard Sensorless Field Oriented Control (FOC) motor control, supports both FAST and eSMO observer User-friendly graphical user interface (GUI) to control, identify, and monitor the motor Wide operating voltage input range: 165 to 265 VAC, 50|60 Hz. Up to 750-W inverter stage, 15-kHz switching frequency, torque compensation, and automatic field weakening control Modular design with either C2000 or MSPM0 controller daughter-board on the same power motherboard Sensorless Field Oriented Control (FOC) motor control, supports both FAST and eSMO observer User-friendly graphical user interface (GUI) to control, identify, and monitor the motor Wide operating voltage input range: 165 to 265 VAC, 50|60 Hz. Up to 750-W inverter stage, 15-kHz switching frequency, torque compensation, and automatic field weakening control Modular design with either C2000 or MSPM0 controller daughter-board on the same power motherboard Sensorless Field Oriented Control (FOC) motor control, supports both FAST and eSMO observer User-friendly graphical user interface (GUI) to control, identify, and monitor the motor Wide operating voltage input range: 165 to 265 VAC, 50|60 Hz.Up to 750-W inverter stage, 15-kHz switching frequency, torque compensation, and automatic field weakening controlModular design with either C2000 or MSPM0 controller daughter-board on the same power motherboardSensorless Field Oriented Control (FOC) motor control, supports both FAST and eSMO observerUser-friendly graphical user interface (GUI) to control, identify, and monitor the motor Applications Washer and dryer Air conditioner indoor unit Refrigerator and freezer Appliances: compressor Applications Washer and dryer Air conditioner indoor unit Refrigerator and freezer Appliances: compressor Washer and dryer Air conditioner indoor unit Refrigerator and freezer Appliances: compressor Washer and dryer Air conditioner indoor unit Refrigerator and freezer Appliances: compressor Washer and dryer Washer and dryer Air conditioner indoor unit Air conditioner indoor unit Refrigerator and freezer Refrigerator and freezer Appliances: compressor Appliances: compressor System Description Motor control for major appliances or similar applications today must meet a growing list of demands on lower cost, smaller size, more power, and higher energy efficiency. Magnet Synchronous Motors (PMSM) are becoming increasingly popular in major appliance applications. This reference design provides a single 750-W inverter motherboard with either the TMS320F2800137 and MSPM0G1507 daughter-card for control, making this reference design convenient for users to evaluate both the C2000 and MSPM0 series microcontroller on the same hardware platform. Software supports both FAST and eSMO observer, so performance of the two devices can be compared. A user-friendly GUI also helps identify the motor, as well as tune the control parameters, thus accelerating the development time. Terminology SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor BLDC Brushless Direct Current BEMF Back Electromotive Force PWM Pulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor RMS Root Mean Square MTPA Maximum Torque Per Ampere FWC Field Weakening Control FOC Field Oriented Control HVAC Heating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer PLL Phase Locked Loop FAST Flux, Angle, Speed and Toque observer Key System Specifications The TIDA-010265 specifications are listed in #GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9. Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use. TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property. Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present. Do not leave the design powered when unattended. System Description Motor control for major appliances or similar applications today must meet a growing list of demands on lower cost, smaller size, more power, and higher energy efficiency. Magnet Synchronous Motors (PMSM) are becoming increasingly popular in major appliance applications. This reference design provides a single 750-W inverter motherboard with either the TMS320F2800137 and MSPM0G1507 daughter-card for control, making this reference design convenient for users to evaluate both the C2000 and MSPM0 series microcontroller on the same hardware platform. Software supports both FAST and eSMO observer, so performance of the two devices can be compared. A user-friendly GUI also helps identify the motor, as well as tune the control parameters, thus accelerating the development time. Motor control for major appliances or similar applications today must meet a growing list of demands on lower cost, smaller size, more power, and higher energy efficiency. Magnet Synchronous Motors (PMSM) are becoming increasingly popular in major appliance applications. This reference design provides a single 750-W inverter motherboard with either the TMS320F2800137 and MSPM0G1507 daughter-card for control, making this reference design convenient for users to evaluate both the C2000 and MSPM0 series microcontroller on the same hardware platform. Software supports both FAST and eSMO observer, so performance of the two devices can be compared. A user-friendly GUI also helps identify the motor, as well as tune the control parameters, thus accelerating the development time. Motor control for major appliances or similar applications today must meet a growing list of demands on lower cost, smaller size, more power, and higher energy efficiency. Magnet Synchronous Motors (PMSM) are becoming increasingly popular in major appliance applications.This reference design provides a single 750-W inverter motherboard with either the TMS320F2800137 and MSPM0G1507 daughter-card for control, making this reference design convenient for users to evaluate both the C2000 and MSPM0 series microcontroller on the same hardware platform.Software supports both FAST and eSMO observer, so performance of the two devices can be compared. A user-friendly GUI also helps identify the motor, as well as tune the control parameters, thus accelerating the development time. Terminology SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor BLDC Brushless Direct Current BEMF Back Electromotive Force PWM Pulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor RMS Root Mean Square MTPA Maximum Torque Per Ampere FWC Field Weakening Control FOC Field Oriented Control HVAC Heating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer PLL Phase Locked Loop FAST Flux, Angle, Speed and Toque observer Terminology SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor BLDC Brushless Direct Current BEMF Back Electromotive Force PWM Pulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor RMS Root Mean Square MTPA Maximum Torque Per Ampere FWC Field Weakening Control FOC Field Oriented Control HVAC Heating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer PLL Phase Locked Loop FAST Flux, Angle, Speed and Toque observer SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor BLDC Brushless Direct Current BEMF Back Electromotive Force PWM Pulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor RMS Root Mean Square MTPA Maximum Torque Per Ampere FWC Field Weakening Control FOC Field Oriented Control HVAC Heating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer PLL Phase Locked Loop FAST Flux, Angle, Speed and Toque observer SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor BLDC Brushless Direct Current BEMF Back Electromotive Force PWM Pulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor RMS Root Mean Square MTPA Maximum Torque Per Ampere FWC Field Weakening Control FOC Field Oriented Control HVAC Heating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer PLL Phase Locked Loop FAST Flux, Angle, Speed and Toque observer SLYZ022 TI Glossary: This glossary lists and explains terms, acronyms, and definitions SLYZ022 SLYZ022TI Glossary: This glossary lists and explains terms, acronyms, and definitions PMSM Permanent Magnet Synchronous Motor PMSMPermanent Magnet Synchronous Motor BLDC Brushless Direct Current BLDCBrushless Direct Current BEMF Back Electromotive Force BEMFBack Electromotive Force PWM Pulse Width Modulation PWMPulse Width Modulation FET, MOSFET Metal Oxide Semiconductor Field Effect Transistor FET, MOSFETMetal Oxide Semiconductor Field Effect Transistor IGBT Insulated Gate Bipolar Transistor IGBTInsulated Gate Bipolar Transistor RMS Root Mean Square RMSRoot Mean Square MTPA Maximum Torque Per Ampere MTPAMaximum Torque Per Ampere FWC Field Weakening Control FWCField Weakening Control FOC Field Oriented Control FOCField Oriented Control HVAC Heating, Ventilation, and Air Conditioning HVACHeating, Ventilation, and Air Conditioning ESMO Enhanced Sliding-Mode Observer ESMOEnhanced Sliding-Mode Observer PLL Phase Locked Loop PLLPhase Locked Loop FAST Flux, Angle, Speed and Toque observer FASTFlux, Angle, Speed and Toque observer Key System Specifications The TIDA-010265 specifications are listed in #GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9. Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use. TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property. Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present. Do not leave the design powered when unattended. Key System Specifications The TIDA-010265 specifications are listed in #GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9. Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use. TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property. Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present. Do not leave the design powered when unattended. The TIDA-010265 specifications are listed in #GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9. Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use. TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property. Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present. Do not leave the design powered when unattended. The TIDA-010265 specifications are listed in #GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9.#GUID-492122A0-85C8-4AFD-84E1-C29CBB944538/GUID-3EE71A7D-5C7A-4092-AFB5-45B92B6EFBF9 Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 Key System Specifications Parameters TEST CONDITIONS MIN NOM MAX UNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 Parameters TEST CONDITIONS MIN NOM MAX UNIT Parameters TEST CONDITIONS MIN NOM MAX UNIT Parameters ParametersTEST CONDITIONSMINNOMMAXUNIT SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Frequency (fLINE) – 47 50 63 Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz Rated output power (POUT) VINAC = nom – 500 750 W Output current (IRMS) VINAC = nom – 3 – A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 SYSTEM INPUT CHARACTERISTICS SYSTEM INPUT CHARACTERISTICS Input Voltage (VINAC) – 165 230 265 VAC Input Voltage (VINAC)INAC–165230265VAC Input Frequency (fLINE) – 47 50 63 Hz Input Frequency (fLINE) Input Frequency (fLINE)LINE–475063Hz No Load Standby Power (PNL) VINAC = 230 V, Iout = 0 A – 3.0 – W No Load Standby Power (PNL) No Load Standby Power (PNL)NLVINAC = 230 V, Iout = 0 AINACout–3.0–W Input Current (IIN) VINAC = 230 V, Iout = IMAX – 8 – A Input Current (IIN) Input Current (IIN)INVINAC = 230 V, Iout = IMAX INACout = IMAX MAX– 8 8–A MOTOR INVERTER CHARACTERSITICS MOTOR INVERTER CHARACTERSITICS MOTOR INVERTER CHARACTERSITICS PWM switching frequency (fSW) – – 15 20 kHz PWM switching frequency (fSW) PWM switching frequency (fSW)SW––15 20 20kHz Rated output power (POUT) VINAC = nom – 500 750 W Rated output power (POUT) Rated output power (POUT)OUTVINAC = nomINAC–500 750 750W Output current (IRMS) VINAC = nom – 3 – A Output current (IRMS) Output current (IRMS)RMSVINAC = nomINAC– 3 3–A Inverter efficiency (Ƞ) VINAC = nom, POUT = nom – 98 – % Inverter efficiency (Ƞ) Inverter efficiency (Ƞ)VINAC = nom, POUT = nom INACOUT = nom–98–% Motor electrical frequency (f) VINAC = min to max 20 200 400 Hz Motor electrical frequency (f) Motor electrical frequency (f)VINAC = min to maxINAC20200400Hz Fault protections Overcurrent, stall with recovery, undervoltage, overvoltage Fault protections Fault protectionsOvercurrent, stall with recovery, undervoltage, overvoltage Drive control method and features Sensorless-FOC with three or single shunt resistors for current sensing Drive control method and features Drive control method and featuresSensorless-FOC with three or single shunt resistors for current sensing SYSTEM CHARACTERISTICS SYSTEM CHARACTERISTICS Built-in auxiliary power supply VINAC = min to max 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Built-in auxiliary power supply Built-in auxiliary power supplyVINAC = min to maxINAC 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA 15 V ±10%, 200 mA , 3.3 V ±10%, 300 mA Operating ambient Open frame –10 25 55 °C Operating ambient Operating ambientOpen frame–102555°C Board size Length × width × height 105 mm × 85 mm × 60 mm mm3 Board size Board sizeLength × width × height 105 mm × 85 mm × 60 mm 105 mm × 85 mm × 60 mmmm3 3 TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use. TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property. Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present. TI intends this reference design to be operated in a lab environment only and does not consider the device to be a finished product for general consumer use.TI Intends this reference design to be used only by qualified engineers and technicians familiar with risks associated with handling high-voltage electrical and mechanical components, systems, and subsystems. High voltage! There are accessible high voltages present on the board. The board operates at voltages and currents that can cause shock, fire, or injury if not properly handled or applied. Use the equipment with necessary caution and appropriate safeguards to avoid injuring yourself or damaging property.High voltage! Hot surface! Contact can cause burns. Do not touch! Some components can reach high temperatures > 55°C when the board is powered on. The user must not touch the board at any point during operation or immediately after operating, as high temperatures can be present.Hot surface! Do not touch!Do not leave the design powered when unattended. System Overview Block Diagram Updated yes shows the block diagram of this reference design. TIDA-010265 750-W Motor Inverter Block Diagram The entire system is represented in seven blocks: EMI filter Bridge rectifier 3-phase inverter Auxiliary power supply TMS320F2800137 daughter-card MSPM0G1507 daughter card Design Considerations The design supports either the C2000 or MSPM0 controller for a single motor control. Highly noise-immune current and voltage sensing designs are necessary for precise motor drives. The following details the sensing and drive circuit that are used on this design. The hardware design files are available under the C2000Ware Motor Control SDK Install directory at <install_location>\solutions \tida_010265_wminv\hardware. Highlighted Products The following highlighted products are used in this reference design. Key features for selecting the devices for this reference design are revealed in the following sections. Find more details of the highlighted devices in respective product data sheets. TMS320F2800137 The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement. MSPM0G1507 The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)). TMP6131 The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating. With built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. UCC28881 The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current. The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. TPS54202 The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count. Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss. Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. TLV9062 The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition. TLV74033 TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%. The TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. System Design Theory The main focus of this reference design is single motor control for washers or similar appliance applications. Hardware Design A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. Modular Design This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard High-Voltage Buck Auxiliary Power Supply A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit DC Link Voltage Sensing The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit Motor Phase Voltage Sensing C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. Motor Phase Current Sensing The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. External Overcurrent Protection This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit Internal Overcurrent Protection for TMS320F2800F137 The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. Three-Phase PMSM Drive Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Field-Oriented Control of PM Synchronous Motor To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Sensorless Control of PM Synchronous Motor In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Hardware Prerequisites for Motor Drive The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit System Overview Block Diagram Updated yes shows the block diagram of this reference design. TIDA-010265 750-W Motor Inverter Block Diagram The entire system is represented in seven blocks: EMI filter Bridge rectifier 3-phase inverter Auxiliary power supply TMS320F2800137 daughter-card MSPM0G1507 daughter card Block Diagram Updated yes Updated yes Updated yes Updatedyes shows the block diagram of this reference design. TIDA-010265 750-W Motor Inverter Block Diagram The entire system is represented in seven blocks: EMI filter Bridge rectifier 3-phase inverter Auxiliary power supply TMS320F2800137 daughter-card MSPM0G1507 daughter card shows the block diagram of this reference design. TIDA-010265 750-W Motor Inverter Block Diagram The entire system is represented in seven blocks: EMI filter Bridge rectifier 3-phase inverter Auxiliary power supply TMS320F2800137 daughter-card MSPM0G1507 daughter card shows the block diagram of this reference design. TIDA-010265 750-W Motor Inverter Block Diagram TIDA-010265 750-W Motor Inverter Block DiagramThe entire system is represented in seven blocks: EMI filter Bridge rectifier 3-phase inverter Auxiliary power supply TMS320F2800137 daughter-card MSPM0G1507 daughter card EMI filterBridge rectifier3-phase inverterAuxiliary power supplyTMS320F2800137 daughter-cardMSPM0G1507 daughter card Design Considerations The design supports either the C2000 or MSPM0 controller for a single motor control. Highly noise-immune current and voltage sensing designs are necessary for precise motor drives. The following details the sensing and drive circuit that are used on this design. The hardware design files are available under the C2000Ware Motor Control SDK Install directory at <install_location>\solutions \tida_010265_wminv\hardware. Design Considerations The design supports either the C2000 or MSPM0 controller for a single motor control. Highly noise-immune current and voltage sensing designs are necessary for precise motor drives. The following details the sensing and drive circuit that are used on this design. The hardware design files are available under the C2000Ware Motor Control SDK Install directory at <install_location>\solutions \tida_010265_wminv\hardware. The design supports either the C2000 or MSPM0 controller for a single motor control. Highly noise-immune current and voltage sensing designs are necessary for precise motor drives. The following details the sensing and drive circuit that are used on this design. The hardware design files are available under the C2000Ware Motor Control SDK Install directory at <install_location>\solutions \tida_010265_wminv\hardware. The design supports either the C2000 or MSPM0 controller for a single motor control. Highly noise-immune current and voltage sensing designs are necessary for precise motor drives. The following details the sensing and drive circuit that are used on this design. The hardware design files are available under the C2000Ware Motor Control SDK Install directory at <install_location>\solutions \tida_010265_wminv\hardware.<install_location>\solutions \tida_010265_wminv\hardware Highlighted Products The following highlighted products are used in this reference design. Key features for selecting the devices for this reference design are revealed in the following sections. Find more details of the highlighted devices in respective product data sheets. TMS320F2800137 The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement. MSPM0G1507 The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)). TMP6131 The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating. With built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. UCC28881 The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current. The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. TPS54202 The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count. Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss. Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. TLV9062 The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition. TLV74033 TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%. The TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. Highlighted Products The following highlighted products are used in this reference design. Key features for selecting the devices for this reference design are revealed in the following sections. Find more details of the highlighted devices in respective product data sheets. The following highlighted products are used in this reference design. Key features for selecting the devices for this reference design are revealed in the following sections. Find more details of the highlighted devices in respective product data sheets. The following highlighted products are used in this reference design. Key features for selecting the devices for this reference design are revealed in the following sections. Find more details of the highlighted devices in respective product data sheets. TMS320F2800137 The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement. TMS320F2800137 The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement. The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement. The TMS320F280013x is a member of the C2000™ real-time microcontroller family of scalable, ultra-low latency devices designed for efficiency in power electronics applications. The real-time control subsystem is based on TI’s 32-bit C28x digital-signal processor (DSP) core, which provides 120 MHz of signal-processing performance for floating- or fixed-point code running from either on-chip flash or SRAM. The C28x CPU is further boosted by the Trigonometric Math Unit (TMU) and Cyclical Redundancy Check (VCRC) extended instruction sets, speeding up common algorithms key to real-time control systems. High-performance analog blocks are integrated on the F280013x real-time microcontroller (MCU) and are closely coupled with the processing and PWM units to provide exceptional real-time signal chain performance. Fourteen PWM channels, all supporting frequency-independent resolution modes, enable control of various power stages from a 3-phase inverter to advanced multilevel power topologies. Interfacing is supported through various industry-standard communication ports (such as SPI, three SCI|URAT, I2C, and CAN) and offers multiple pin-MUXing options for excellent signal placement.TMS320F280013x MSPM0G1507 The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)). MSPM0G1507 The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)). The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)). The MSPM0G150x microcontrollers (MCUs) are part of the highly-integrated, ultra-low-power, 32-bit MCU family from mixed-signal processing (MSP) based on the enhanced Arm Cortex-M0+ 32-bit core platform operating at up to 80-MHz frequency. These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature ranges from –40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. The MSPM0G150x devices provide up to 128-KB embedded Flash program memory with built-in error correction code (ECC) and up to 32-KB SRAM with hardware parity option. The devices also incorporate a memory protection unit, seven-channel DMA, math accelerator, and a variety of high-performance analog peripherals such as two 12-bit 4-MSPS ADCs, configurable internal shared voltage reference, one 12-bit 1-MSPS DAC, three high-speed comparators with built-in reference digital-to-analog converters (DACs), two zero-drift, zero-crossover op amps with programmable gain, and one general-purpose amplifier. These devices also offer intelligent digital peripherals such as three 16-bit advanced control timers, three 16-bit general purpose timers, one 24-bit high-resolution timer, two windowed-watchdog timers, and one RTC with alarm and calendar mode. These devices provide data integrity and encryption peripherals and enhanced communication interfaces (four UARTs, two I2Cs, two serial-peripheral interfaces (SPIs)).MSPM0G150xArmCortex TMP6131 The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating. With built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. TMP6131 The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating. With built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating. With built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. The TMP61x linear thermistor offers linearity and consistent sensitivity across temperature to enable simple and accurate methods for temperature conversion. The low power consumption and a small thermal mass of the device minimizes the impact of self-heating.TMP61xWith built-in fail-safe behaviors at high temperatures and powerful immunity to environmental variation, these devices are designed for a long lifetime of high performance. The small size of the TMP6 series also allows for close placement to heat sources and quick response times. UCC28881 The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current. The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. UCC28881 The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current. The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current. The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. The UCC28881 integrates the controller and a 14-Ω, 700-V power MOSFET into one monolithic device. The device also integrates a high-voltage current source, enabling start-up and operation directly from the rectified mains voltage. The UCC28881 is the same family device of the UCC28880, with higher current.UCC28881The low quiescent current of the device enables excellent efficiency. With the UCC28881, the most common converter topologies, such as buck, buck- boost, and flyback can be built using a minimum number of external components. TPS54202 The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count. Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss. Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. TPS54202 The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count. Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss. Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count. Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss. Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. The TPS54202 is a 4.5-V to 28-V input voltage range, 2-A synchronous buck converter. The device includes two integrated switching FETs, internal loop compensation and 5-ms internal soft start to reduce component count.TPS54202Advanced Eco-mode implementation maximizes the light load efficiency and reduces the power loss.Cycle-by-cycle current limit in both high-side MOSFETs protects the converter in an overload condition and is enhanced by a low-side MOSFET freewheeling current limit which prevents current runaway. TLV9062 The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition. TLV9062 The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition. The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition. The TLV9062 is a dual-low-voltage (1.8 V to 5.5 V) operational amplifier (op amp) with rail-to-rail input- and output-swing capabilities. This device is a highly cost-effective design for applications where low-voltage operation, a small footprint, and high capacitive load drive are required. Although the capacitive load drive of the TLV906x is 100 pF, the resistive open-loop output impedance makes stabilizing with higher capacitive loads simpler. The TLV906xS devices include a shutdown mode that allow the amplifiers to switch into standby mode with typical current consumption less than 1 µA. The TLV906xS family helps simplify system design, because the family is unity-gain stable, integrates the RFI and EMI rejection filter, and provides no phase reversal in overdrive condition.TLV9062 TLV74033 TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%. The TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. TLV74033 TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%. The TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%. The TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. TheTLV740P low-dropout (LDO) linear regulator is a low quiescent current LDO with excellent line and load transient performance designed for power-sensitive applications. This device provides a typical accuracy of 1%.TLV740PThe TLV740P also provides inrush current control during device power up and enabling. The TLV740P limits the input current to the defined current limit to avoid large currents from flowing from the input power source. This functionality is especially important in battery-operated devices. System Design Theory The main focus of this reference design is single motor control for washers or similar appliance applications. Hardware Design A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. Modular Design This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard High-Voltage Buck Auxiliary Power Supply A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit DC Link Voltage Sensing The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit Motor Phase Voltage Sensing C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. Motor Phase Current Sensing The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. External Overcurrent Protection This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit Internal Overcurrent Protection for TMS320F2800F137 The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. Three-Phase PMSM Drive Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Field-Oriented Control of PM Synchronous Motor To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Sensorless Control of PM Synchronous Motor In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Hardware Prerequisites for Motor Drive The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit System Design Theory The main focus of this reference design is single motor control for washers or similar appliance applications. The main focus of this reference design is single motor control for washers or similar appliance applications. The main focus of this reference design is single motor control for washers or similar appliance applications. Hardware Design A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. Modular Design This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard High-Voltage Buck Auxiliary Power Supply A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit DC Link Voltage Sensing The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit Motor Phase Voltage Sensing C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. Motor Phase Current Sensing The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. External Overcurrent Protection This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit Internal Overcurrent Protection for TMS320F2800F137 The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. Hardware Design A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. A typical motor control board has several blocks: auxiliary power supply, inverter, current and voltage sensing, protection circuit, and a microcontroller. These design concepts are explained in this section. Modular Design This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard Modular Design This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard This reference design has two daughterboards and one motherboard for a modular design. One daughterboard has the MSPM0G1507 microcontroller and a two-phase current-amplifying circuit based on the two internal high-end op amps. Another daughterboard has the TMS320F2800137 microcontroller and two TLV9062 devices as phase-current amplifiers. The motherboard holds all the power devices including AC filters, rectifier, and the Intelligent Power Module (IPM). and show the motherboard and daughterboards. TIDA-010265 Daughterboards TIDA-010265 Motherboard TIDA-010265 Daughterboards TIDA-010265 Daughterboards TIDA-010265 Motherboard TIDA-010265 Motherboard High-Voltage Buck Auxiliary Power Supply A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit High-Voltage Buck Auxiliary Power Supply A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit A non-isolated UCC28881-based high-voltage buck supply provides auxiliary power supply for this reference design to delivery up to 200 mA for 15 VDC. shows the UCC28881 high-voltage buck supply circuit. High-Voltage Buck Power Supply Circuit High-Voltage Buck Power Supply Circuit DC Link Voltage Sensing The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit DC Link Voltage Sensing The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit The DC voltage sensing circuit is used to convert the rectified voltage signal into a low-voltage signal implemented by a low-cost resistor network as shown in . The DC bus voltage can also be used to estimate AC input voltage. DC Bus Voltage Sensing Circuit DC Bus Voltage Sensing Circuit DC Bus Voltage Sensing Circuit Motor Phase Voltage Sensing C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. Motor Phase Voltage Sensing C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design. C2000 software for the TIDA-010265 supports both enhanced Slide Mode Observer (eSMO) and Flux, Angle, Speed, and Torque (FAST™) observer. The FAST observer can improve low-speed performance and reduce speed tolerance; however, FAST needs 3 motor phase voltage sensing in addition to 3-phase current sensing. has a detailed explanation of motor phase voltage sensing design.™ Motor Phase Current Sensing The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. Motor Phase Current Sensing The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. The MS320F2800137 daughterboard is designed to support 1-3 phase current sensing, while the MSPM0G1507 daughterboard supports 1-2 phase current sensing. has the details for motor phase current sensing design. External Overcurrent Protection This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit External Overcurrent Protection This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A Both MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit This reference design implements overcurrent protection (OCP) with both external comparator and internal comparator. shows OCP with the external comparator, this circuit summarizes three phases of current, then compares to a reference voltage at negative input of U10 to create a high voltage to IPM, then IPM creates overcurrent fault signal and report to microcontroller. The exact overcurrent protection current can be calculated by below equations. V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V - = 3 . 3 V R 20 + R 108 × R 108 = 3 . 3 V 20 k + 1 k × 1 k = 0 . 1571 V V - V-= 3 . 3 V R 20 + R 108 3 . 3 V 3.3V R 20 + R 108 R 20 R20+ R 108 R108× R 108 R108= 3 . 3 V 20 k + 1 k 3 . 3 V 3.3V 20 k + 1 k 20k+1k×1k=0.1571V V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 V + = I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) × ( ( R 104 + R 105 ) / 2 ) = 0 . 05 × I ocp 300 + 150 × 150 = 0 . 05 × I ocp 3 V + V+= I ocp × R 80 R 87 + ( R 104 + R 105 ) / 2 ) I ocp × R 80 I ocp Iocp× R 80 R80 R 87 + ( R 104 + R 105 ) / 2 ) R87+( R 104 R104+ R 105 R105)/2)×(( R 104 R104+ R 105 R105)/2)= 0 . 05 × I ocp 300 + 150 0 . 05 × I ocp 0.05× I ocp Iocp 300 + 150 300+150×150= 0 . 05 × I ocp 3 0 . 05 × I ocp 0.05× I ocp Iocp3 I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A I ocp = V + R 87 × 3 = 0 . 1571 0 . 05 × 3 = 9 . 4286 A I ocp Iocp= V + R 87 V + V+ R 87 R87×3= 0 . 1571 0 . 05 0 . 1571 0.1571 0 . 05 0.05×3=9.4286ABoth MS320F2800137 and MSPM01507 daughterboards can be triggered by this external OCP circuit. External Overcurrent Protection Circuit External Overcurrent Protection Circuit Internal Overcurrent Protection for TMS320F2800F137 The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. Internal Overcurrent Protection for TMS320F2800F137 The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. The TMS320F2800F137 has internal window comparators which can be configured to monitor three phases current, there is not any software or interrupt delay for internal comparators to trigger overcurrent to stop PWM, this quickly protects external IPM or power devices. Three-Phase PMSM Drive Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Field-Oriented Control of PM Synchronous Motor To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Sensorless Control of PM Synchronous Motor In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Hardware Prerequisites for Motor Drive The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Three-Phase PMSM Drive Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Permanent Magnet Synchronous motor (PMSM) has a wound stator, a permanent magnet rotor assembly, and internal or external devices to sense rotor position. The sensing devices provide position feedback for adjusting frequency and amplitude of stator voltage reference properly to maintain rotation of the magnet assembly. The combination of an inner permanent magnet rotor and outer windings offers the advantages of low rotor inertia, efficient heat dissipation, and reduction of the motor size. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled. The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired. The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in . The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions. The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting. The angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field. The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Synchronous motor construction: Permanent magnets are rigidly fixed to the rotating axis to create a constant rotor flux. This rotor flux usually has a constant magnitude. When energized, the stator windings create a rotating electromagnetic field. To control the rotating magnetic field, the stator currents must be controlled.The actual structure of the rotor varies depending on the power range and rated speed of the machine. Permanent magnets are an excellent choice for synchronous machines ranging up-to a few Kilowatts. For higher power ratings the rotor usually consists of windings in which a DC current circulates. The mechanical structure of the rotor is designed for number of poles desired, and the desired flux gradients desired.The interaction between the stator and rotor fluxes produces torque. Since the stator is firmly mounted to the frame, and the rotor is free to rotate, the rotor rotates, producing a useful mechanical output as shown in .The angle between the rotor magnetic field and stator field must be carefully controlled to produce maximum torque and achieve high electromechanical conversion efficiency. For this purpose fine-tuning is needed after closing the speed loop using a sensorless algorithm to draw the minimum amount of current under the same speed and torque conditions.The rotating stator field must rotate at the same frequency as the rotor permanent magnetic field; otherwise, the rotor experiences rapidly alternating positive and negative torque. This results in less than excellent torque production, and excessive mechanical vibration, noise, and mechanical stresses on the machine parts. In addition, if the rotor inertia prevents the rotor from being able to respond to these oscillations, the rotor stops rotating at the synchronous frequency, and responds to the average torque as seen by the stationary rotor: Zero. This means that the machine experiences a phenomenon known as pull-out. This is also the reason why the synchronous machine is not self starting.pull-outThe angle between the rotor field and the stator field must be equal to 90º to obtain the highest mutual torque production. This synchronization requires knowing the rotor position to generate the right stator field.The stator magnetic field can be made to have any direction and magnitude by combining the contribution of different stator phases to produce the resulting stator flux. Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Interaction Between the Rotating Stator Flux and the Rotor Flux Produces Torque Field-Oriented Control of PM Synchronous Motor To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Field-Oriented Control of PM Synchronous Motor To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC). In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model The goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better. According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r This expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor. In brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds. The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q By maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector. To achieve better dynamic performance, a more complex control scheme needs to be applied, to control the PM motor. With the mathematical processing power offered by the microcontrollers, advanced control strategies can be implemented, which use mathematical transformations to decouple the torque generation and the magnetization functions in PM motors. Such de-coupled torque and magnetization control is commonly called rotor flux oriented control, or simply Field-Oriented Control (FOC).In a direct current (DC) motor, the excitation for the stator and rotor is independently controlled, the produced torque and the flux can be independently tuned as shown in . The strength of the field excitation (for example, the magnitude of the field excitation current) sets the value of the flux. The current through the rotor windings determines how much torque is produced. The commutator on the rotor plays an interesting part in the torque production. The commutator is in contact with the brushes, and the mechanical construction is designed to switch into the circuit the windings that are mechanically aligned to produce the maximum torque. This arrangement then means that the torque production of the machine is fairly near exceptional all the time. The key point here is that the windings are managed to keep the flux produced by the rotor windings orthogonal to the stator field. Flux and Torque are Independently Controlled in DC Motor Model Flux and Torque are Independently Controlled in DC Motor ModelThe goal of the FOC (also called vector control) on synchronous and asynchronous machines is to be able to separately control the torque-producing and magnetizing flux components. FOC control allows decoupling of the torque and of the magnetizing flux components of stator current. With decoupled control of the magnetization, the torque producing component of the stator flux can now be thought of as independent torque control. To decouple the torque and flux, it is necessary to engage several mathematical transforms, and this is where the microcontrollers add the most value. The processing capability provided by the microcontrollers enables these mathematical transformations to be carried out very quickly. This, in turn, implies that the entire algorithm controlling the motor can be executed at a fast rate, enabling higher dynamic performance. In addition to the decoupling, a dynamic model of the motor is now used for the computation of many quantities such as rotor flux angle and rotor speed. This means that the effect is accounted for, and the overall quality of control is better.According to the electromagnetic laws, the torque produced in the synchronous machine is equal to the vector cross product of the two existing magnetic fields as in . τ e m = B → s t a t o r × B → r o t o r τ e m = B → s t a t o r × B → r o t o r τ e m = B → s t a t o r × B → r o t o r τ e m τ e m em= B → s t a t o r B → B→ s t a t o r stator× B → r o t o r B → B→ r o t o r rotorThis expression shows that the torque is maximum if stator and rotor magnetic fields are orthogonal meaning to maintain the load at 90 degrees. If this condition can be provided all the time and if the flux can be oriented correctly, the torque ripple is reduced and a better dynamic response is provided. However, the constraint is to know the rotor position: this can be achieved with a position sensor such as incremental encoder. For low-cost applications where the rotor is not accessible, different rotor position observer strategies are applied to get rid of position sensor.orthogonalIn brief, the goal is to maintain the rotor and stator flux in quadrature: the goal is to align the stator flux with the q axis of the rotor flux, for example, orthogonal to the rotor flux. To do this, the stator current component in quadrature with the rotor flux is controlled to generate the commanded torque, and the direct component is set to zero. The direct component of the stator current can be used in some cases for field weakening, which has the effect of opposing the rotor flux, and reducing the back-emf, which allows for operation at higher speeds.The FOC consists of controlling the stator currents represented by a vector. This control is based on projections which transform a three-phase time and speed dependent system into a two coordinate (d and q coordinates) time invariant system. These projections lead to a structure similar to that of a DC machine control. FOC machines need two constants as input references: the torque component (aligned with the q coordinate) and the flux component (aligned with d coordinate). As FOC is simply based on projections, the control structure handles instantaneous electrical quantities. This makes the control accurate in every working operation (steady state and transient) and independent of the limited bandwidth mathematical model. The FOC thus solves the classic scheme problems, in the following ways: The ease of reaching constant reference (torque component and flux component of the stator current) The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q The ease of reaching constant reference (torque component and flux component of the stator current)The ease of applying direct torque control because in the (d, q) reference frame the expression of the torque is defined in . τ e m ∝ ψ R × i s q τ e m ∝ ψ R × i s q τ e m ∝ ψ R × i s q τ e m ∝ ψ R × i s q τ e m τ e m em∝ ψ R ψR× i s q i s q sqBy maintaining the amplitude of the rotor flux (ψR) at a fixed value, a linear relationship between torque and torque component (iSq) is obtained. Therefore, the torque can be controlled by controlling the torque component of the stator current vector.RSq Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. Space Vector Definition and Projection The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in . i ¯ s = i a + α i b + α 2 i c where α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame where a, b, and c are the three-phase system axes This current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system The 3-phase voltages, currents, and fluxes of AC motors can be analyzed in terms of complex space vectors. With regard to the currents, the space vector can be defined as follows. Assuming that ia, ib, ic are the instantaneous currents in the stator phases, then the complex stator current vector is defined in .abc i ¯ s = i a + α i b + α 2 i c i ¯ s = i a + α i b + α 2 i c i ¯ s = i a + α i b + α 2 i c i ¯ s i ¯ i¯s= i a ia+α i b ib+ α 2 α2 i c icwhere α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators α = e j 2 3 π and α 2 = e j 4 3 π represent the spatial operators α = e j 2 3 π α = e j 2 3 π α = e j 2 3 π α= e j 2 3 π e e j 2 3 π j 2 3 2 2 3 3π α 2 = e j 4 3 π α 2 = e j 4 3 π α 2 = e j 4 3 π α 2 α α 2 2= e j 4 3 π e e j 4 3 π j 4 3 4 4 3 3π shows the stator current complex space vector. Stator Current Space Vector and Component in (a, b, c) Frame Stator Current Space Vector and Component in (a, b, c) Framewhere a, b, and c are the three-phase system axes a, b, and c are the three-phase system axesThis current space vector depicts the three-phase sinusoidal system which still needs to be transformed into a two time invariant co-ordinate system. This transformation can be split into two steps: ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system ( a ,   b ) ⇒ ( α , β ) (Clarke transformation) which outputs a 2-coordinate time-variant system ( a ,   b ) ⇒ ( α , β ) ( a ,   b ) ⇒ ( α , β ) ( a ,   b ) ⇒ ( α , β ) (a, b)⇒(α,β) α , β ⇒ ( d ,   q ) (Park transformation) which outputs a 2-coordinate time-invariant system α , β ⇒ ( d ,   q ) α , β ⇒ ( d ,   q ) α , β ⇒ ( d ,   q ) α , β α , β α,β⇒(d, q) ( a ,   b ) ( α , β ) Clarke Transformation The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. ( a ,   b ) ( α , β ) Clarke Transformation ( a ,   b ) ⇒ ( α , β ) ( a ,   b ) ⇒ ( α , β ) ( a ,   b ) ⇒ ( α , β ) (a, b)⇒(α,β) The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in . Stator Current Space Vector in the Stationary Reference Frame The projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b The two phase (α, β) currents are still dependent on time and speed. The space vector can be reported in another reference frame with only two orthogonal axis called (α, β). Assuming that the axis a and the axis αlpha are in the same direction yields the vector diagram shown in .lpha Stator Current Space Vector in the Stationary Reference Frame Stator Current Space Vector in the Stationary Reference FrameThe projection that modifies the 3-phase system into the (α, β) 2-dimension orthogonal system is presented in . i s α = i a i s β = 1 3 i a + 2 3 i b i s α = i a i s β = 1 3 i a + 2 3 i b i s α = i a i s β = 1 3 i a + 2 3 i b i s α i s α sα= i a ia i s β i s β sβ= 1 3 1 3 3 i a ia+ 2 3 2 3 3 i b ibThe two phase (α, β) currents are still dependent on time and speed. α , β ( d ,   q ) Park Transformation This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. α , β ( d ,   q ) Park Transformation α , β ⇒ ( d ,   q ) α , β ⇒ ( d ,   q ) α , β ⇒ ( d ,   q ) α , β α , β α,β⇒(d, q) This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame The flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ where θ is the rotor flux position These components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently. This is the most important transformation in the FOC. In fact, this projection modifies a 2-phase orthogonal system (α, β) in the (d, q) rotating reference frame. Considering the d axis aligned with the rotor flux, shows the relationship for the current vector from the two reference frame. Stator Current Space Vector in the d,q Rotating Reference Frame Stator Current Space Vector in the d,q Rotating Reference FrameThe flux and torque components of the current vector are determined by . i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ i s d = i s α cos θ + i s β sin θ i s q = - i s α sin θ + i s β cos θ i s d i s d sd= i s α i s α sαcos θ θ+ i s β i s β sβsin θ θ i s q i s q sq=- i s α i s α sαsin θ θ+ i s β i s β sβcos θ θwhere θ is the rotor flux position θ is the rotor flux positionThese components depend on the current vector (α, β) components and on the rotor flux position; if the right rotor flux position is known then, by this projection, the d,q component becomes a constant. Two phase currents now turn into dc quantity (time-invariant). At this point the torque control becomes easier where constant isd (flux component) and isq (torque component) current components controlled independently.sdsq Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). Basic Scheme of FOC for AC Motor summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Two motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine). summarizes the basic scheme of torque control with FOC. Basic Scheme of FOC for AC Motor Basic Scheme of FOC for AC MotorTwo motor phase currents are measured. These measurements feed the Clarke transformation module. The outputs of this projection are designated isα and isβ. These two components of the current are the inputs of the Park transformation that gives the current in the d,q rotating reference frame. The isd and isq components are compared to the references isdref (the flux reference component) and isqref (the torque reference component). At this point, this control structure shows an interesting advantage: the structure can be used to control either synchronous or induction machines by simply changing the flux reference and obtaining rotor flux position. As in synchronous permanent magnet a motor, the rotor flux is fixed determined by the magnets; there is no need to create one. Hence, when controlling a PMSM, set isdref to zero. As an AC induction motor needs a rotor flux creation to operate, the flux reference must not be zero. This conveniently solves one of the major drawbacks of the classic control structures: the portability from asynchronous to synchronous drives. The torque command isqref can be the output of the speed regulator when a speed FOC is used. The outputs of the current regulators are Vsdref and Vsqref; these outputs are applied to the inverse Park transformation. The outputs of this projection are Vsαref and Vsβref which are the components of the stator vector voltage in the (α, β) stationary orthogonal reference frame. These are the inputs of the Space Vector PWM. The outputs of this block are the signals that drive the inverter. Note that both Park and inverse Park transformations need the rotor flux position. Obtaining this rotor flux position depends on the AC machine type (synchronous or asynchronous machine).sαsβsdsqsdrefsqrefsdrefclassicsqrefsdrefsqrefsαrefsβref Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Rotor Flux Position Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed. Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame The measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. Theoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Knowledge of the rotor flux position is the core of the FOC. In fact if there is an error in this variable the rotor flux is not aligned with the d-axis and isd and isq are incorrect flux and torque components of the stator current. shows the (a, b, c), (α, β) and (d, q) reference frames, and the correct position of the rotor flux, the stator current and stator voltage space vector that rotates with d, q reference at synchronous speed.sdsqd, q Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference Frame Current, Voltage and Rotor Flux Space Vectors in the (d, q) Rotating Reference FrameThe measure of the rotor flux position is different when considering the synchronous or asynchronous motor: In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed. In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame. In the synchronous machine the rotor speed is equal to the rotor flux speed. Then θ (rotor flux position) is directly measured by the position sensor or by integration of rotor speed.In the asynchronous machine, the rotor speed is not equal to the rotor flux speed (there is a slip speed), then a particular method is needed to calculate θ. The basic method is the use of the current model which needs two equations of the motor model in d, q reference frame.d, qTheoretically, the FOC for the PMSM drive allows the motor torque to be controlled independently with the flux like DC motor operation. In other words, the torque and flux are decoupled from each other. The rotor position is required for variable transformation from stationary reference frame to synchronously rotating reference frame. As a result of this transformation (so called Park transformation), q-axis current is controlling torque while d-axis current is forced to zero. Therefore, the key module of this system is the estimation of rotor position using enhance Sliding-Mode Observer (eSMO) or FAST estimator. shows the overall block diagram of sensorless FOC of fan PMSM using eSMO with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using eSMO with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. shows the overall block diagram of sensorless FOC of fan PMSM using FAST with flying start in this reference design. shows the overall block diagram of sensorless FOC of compressor PMSM using FAST with field weakening control (FWC) and maximum torque per ampere (MTPA) in this reference design. Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With Flying Start (FS) Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using eSMO With FWC and MTPA Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With Flying Start (FS) Sensorless FOC of PMSM Using FAST With FWC and MTPA Sensorless FOC of PMSM Using FAST With FWC and MTPA Sensorless Control of PM Synchronous Motor In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Sensorless Control of PM Synchronous Motor In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. In home appliance applications, using a mechanical sensor increases cost, size, and reliability problems. To overcome these problems, sensorless control methods are implemented. Several estimation methods are used to get the rotor speed and position information without mechanical position sensor. The sliding mode observer (SMO) is commonly utilized due to the various attractive features including reliability, desired performance, and robustness against system parameter variations. Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Enhanced Sliding Mode Observer With Phase-Locked Loop A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. A model-based method is used to achieve position sensorless control of the IPMSM drive system when the motor runs at middle or high speed. The model method estimates the rotor position by the back-EMF or the flux linkage model. The sliding mode observer is an observer-design method based on sliding mode control. The structure of the system is not fixed but purposefully changed according to the current state of the system, forcing the system to move according to the predetermined sliding mode trajectory. The advantages include fast response, strong robustness, and insensitivity to both parameter changes and disturbances. Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Mathematical Model and FOC Structure of an IPMSM The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System An IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m where v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor Definitions of Coordinate Reference Frames for PMSM Modeling By using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β where e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β Since the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β where i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value The sensorless FOC structure for an IPMSM is illustrated in . In this system, the eSMO is used for achieving the sensorless control an IPMSM system, and the eSMO model is designed by utilizing the back EMF model together with a PLL model for estimating the rotor position and speed. Sensorless FOC Structure of an IPMSM System Sensorless FOC Structure of an IPMSM SystemAn IPMSM consists of a three-phase stator winding (a, b, c axes), and permanent magnets (PM) rotor for excitation. The motor is controlled by a standard three-phase inverter. An IPMSM can be modeled by using phase a-b-c quantities. Through proper coordinate transformations, the dynamic PMSM models in the d-q rotor reference frame and the α-β stationary reference frame can be obtained. The relationship among these reference frames are illustrated in . The dynamic model of a generic PMSM can be written in the d-q rotor reference frame as: v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m v d v q = R s + p L d - ω e L q ω e L d R s + p L q i d i q + 0 ω e λ p m v d v q v d v q v d v q v d v d v d v v d d v q v q v q v v q q= R s + p L d - ω e L q ω e L d R s + p L q R s + p L d - ω e L q ω e L d R s + p L q R s + p L d - ω e L q ω e L d R s + p L q R s + p L d - ω e L q R s + p L d R s R R s s+ p L d p L pL d d - ω e L q - ω e - ω -ω e e L q L L q q ω e L d R s + p L q ω e L d ω e ω ω e e L d L L d d R s + p L q R s R R s s+ p L q p L pL q q i d i q i d i q i d i q i d i d i d i i d d i q i q i q i i q q+ 0 ω e λ p m 0 ω e λ p m 0 ω e λ p m 0 0 0 ω e λ p m ω e λ p m ω e ω ω e e λ p m λ λ p m pmwhere v d and v q are the q-axis and d-axis stator terminal voltages, respectively i d and i q are the d-axis and q-axis stator currents, respectively L d and L q are the q-axis and d-axis inductances, respectively p is the derivative operator, a short notation of d d t λ p m is the flux linkage generated by the permanent magnets R s is the resistance of the stator windings ω e is the electrical angular velocity of the rotor v d and v q are the q-axis and d-axis stator terminal voltages, respectively v d v d v d v d v v d d v q v q v q v q v v q q i d and i q are the d-axis and q-axis stator currents, respectively i d i d i d i d i i d d i q i q i q i q i i q q L d and L q are the q-axis and d-axis inductances, respectively L d L d L d L d L L d d L q L q L q L q L L q q p is the derivative operator, a short notation of d d t p d d t d d t d d t d d t d d d t dt λ p m is the flux linkage generated by the permanent magnets λ p m λ p m λ p m λ p m λ λ p m pm R s is the resistance of the stator windings R s R s R s R s R R s s ω e is the electrical angular velocity of the rotor ω e ω e ω e ω e ω ω e e Definitions of Coordinate Reference Frames for PMSM Modeling Definitions of Coordinate Reference Frames for PMSM ModelingBy using the inverse Park transformation as shown in , the dynamics of the PMSM can be modeled in the α-β stationary reference frame as shown in : v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β v α v β = R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q i α i β + e α e β v α v β v α v β v α v β v α v α v α v v α α v β v β v β v v β β= R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q R s + p L d ω e ( L d - L q ) - ω e ( L d - L q ) R s + p L q R s + p L d ω e ( L d - L q ) R s + p L d R s R R s s+ p L d p L pL d d ω e ( L d - L q ) ω e ω ω e e( L d L L d d- L q L L q q) - ω e ( L d - L q ) R s + p L q - ω e ( L d - L q ) - ω e - ω -ω e e( L d L L d d- L q L L q q) R s + p L q R s R R s s+ p L q p L pL q q i α i β i α i β i α i β i α i α i α i i α α i β i β i β i i β β+ e α e β e α e β e α e β e α e α e α e e α α e β e β e β e e β βwhere e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α and e β are components of extended electromotive force (EEMF) in the α-β axis and can be defined as shown in : e α e α e α e α e e α α e β e β e β e β e e β β e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) e α e β = λ p m + L d - L q i d ω e - s i n ( θ e ) c o s ( θ e ) e α e β e α e β e α e β e α e α e α e e α α e β e β e β e e β β= λ p m + L d - L q i d λ p m + L d - L q i d λ p m λ λ p m pm+ L d - L q L d - L q L d L L d d- L q L L q q i d i i d d ω e ω ω e e - s i n ( θ e ) c o s ( θ e ) - s i n ( θ e ) c o s ( θ e ) - s i n ( θ e ) c o s ( θ e ) - s i n ( θ e ) - s i n ( θ e ) -sin( θ e θ θ e e) c o s ( θ e ) c o s ( θ e ) cos( θ e θ θ e e)According to and , the rotor position information can be decoupled from the inductance matrix by means of the equivalent transformation and the introduction of the EEMF concept, so that the EEMF is the only term that contains the rotor pole position information. And then the EEMF phase information can be directly used to realize the rotor position observation. Rewrite the IPMSM voltage equation as a state equation using the stator current as a state variable: i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β i ˙ α i ˙ β = 1 L d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s i α i β + 1 L d V α - e α V β - e β i ˙ α i ˙ β i ˙ α i ˙ β i ˙ α i ˙ β i ˙ α i ˙ α i ˙ α i ˙ i ˙ i i˙ α α i ˙ β i ˙ β i ˙ β i ˙ i ˙ i i˙ β β= 1 L d 1 1 L d L d L L d d - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s - R s - ω e ( L d - L q ) ω e ( L d - L q ) - R s - R s - ω e ( L d - L q ) - R s - R s - R -R s s - ω e ( L d - L q ) - ω e - ω -ω e e( L d L L d d- L q L L q q) ω e ( L d - L q ) - R s ω e ( L d - L q ) ω e ω ω e e( L d L L d d- L q L L q q) - R s - R s - R -R s s i α i β i α i β i α i β i α i α i α i i α α i β i β i β i i β β+ 1 L d 1 1 L d L d L L d d V α - e α V β - e β V α - e α V β - e β V α - e α V β - e β V α - e α V α - e α V α - e α V α - e V α V V α α-e α α V β - e β V β - e β V β - e β V β - e V β V V β β-e β βSince the stator current is the only physical quantity that can be directly measured, the sliding surface is selected on the stator current path: S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β S x = i ^ α - i α i ^ β - i β = i ~ α i ~ β S x x x= i ^ α - i α i ^ β - i β i ^ α - i α i ^ β - i β i ^ α - i α i ^ β - i β i ^ α - i α i ^ α - i α i ^ α i ^ i ^ i i^ α α- i α i i α α i ^ β - i β i ^ β - i β i ^ β i ^ i ^ i i^ β β- i β i i β β= i ~ α i ~ β i ~ α i ~ β i ~ α i ~ β i ~ α i ~ α i ~ α i ~ i ~ i i~ α α i ~ β i ~ β i ~ β i ~ i ~ i i~ β βwhere i ^ α and i ^ β are the estimated currents the superscript ^ indicates the estimated value the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value i ^ α and i ^ β are the estimated currents i ^ α i ^ α i ^ α i ^ α i ^ i ^ i i^ α α i ^ β i ^ β i ^ β i ^ β i ^ i ^ i i^ β βthe superscript ^ indicates the estimated value^the superscript “˜” indicates the variable error which refers to the difference between the observed value and the actual measurement value Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) Design of ESMO for the IPMSM shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM The traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β where z α and z β are sliding-mode feedback components and are defined as shown in : z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis If k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . Block Diagram of Traditional Sliding-Mode Observer The estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ β = ω c s + ω c z α z β where ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current Therefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β Low-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e In a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) where the matrix F and G are given by and as: F α F β = e - R s L d e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q The time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) shows the conventional PLL integrated into the SMO. Block Diagram of eSMO With PLL for a PMSM Block Diagram of eSMO With PLL for a PMSMThe traditional reduced-order sliding-mode observer is constructed, with the mathematical model shown in and the block diagram shown in . i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β i ^ ˙ α i ^ ˙ β = 1 L d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s i ^ α i ^ β + 1 L d V α - e ^ α + z α V β - e ^ β + z β i ^ ˙ α i ^ ˙ β i ^ ˙ α i ^ ˙ β i ^ ˙ α i ^ ˙ β i ^ ˙ α i ^ ˙ α i ^ ˙ α i ^ ˙ i ^ ˙ i ^ i ^ i i^˙ α α i ^ ˙ β i ^ ˙ β i ^ ˙ β i ^ ˙ i ^ ˙ i ^ i ^ i i^˙ β β= 1 L d 1 1 L d L d L L d d - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s - R s - ω ^ e ( L d - L q ) ω ^ e ( L d - L q ) - R s - R s - ω ^ e ( L d - L q ) - R s - R s - R -R s s - ω ^ e ( L d - L q ) - ω ^ e ω ^ ω ^ ω ω^ e e( L d L L d d- L q L L q q) ω ^ e ( L d - L q ) - R s ω ^ e ( L d - L q ) ω ^ e ω ^ ω ^ ω ω^ e e( L d L L d d- L q L L q q) - R s - R s - R -R s s i ^ α i ^ β i ^ α i ^ β i ^ α i ^ β i ^ α i ^ α i ^ α i ^ i ^ i i^ α α i ^ β i ^ β i ^ β i ^ i ^ i i^ β β+ 1 L d 1 1 L d L d L L d d V α - e ^ α + z α V β - e ^ β + z β V α - e ^ α + z α V β - e ^ β + z β V α - e ^ α + z α V β - e ^ β + z β V α - e ^ α + z α V α - e ^ α + z α V α V V α α- e ^ α e ^ e ^ e e^ α α+ z α z z α α V β - e ^ β + z β V β - e ^ β + z β V β V V β β- e ^ β e ^ e ^ e e^ β β+ z β z z β βwhere z α and z β are sliding-mode feedback components and are defined as shown in : z α and z β are sliding-mode feedback components and are defined as shown in : z α z α z α z α z z α α z β z β z β z β z z β β z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) z α z β = k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) z α z β z α z β z α z β z α z α z α z z α α z β z β z β z z β β= k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) k α s i g n ( i ^ α - i α ) k β s i g n ( i ^ β - i β ) k α s i g n ( i ^ α - i α ) k α s i g n ( i ^ α - i α ) k α k k α αsign( i ^ α i ^ i ^ i i^ α α- i α i i α α) k β s i g n ( i ^ β - i β ) k β s i g n ( i ^ β - i β ) k β k k β βsign( i ^ β i ^ i ^ i i^ β β- i β i i β β)where k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis k α and k β are the constant sliding-mode gain designed by Lyapunov stability analysis k α k α k α k α k k α α k β k β k β k β k k β βIf k α and k β are positive and significant enough to provide the stable operation of the SMO, then k α and k β are large enough to hold k α > m a x ⁡ ( e α ) and k β > m a x ⁡ ( e β ) . k α k α k α k α k k α α k β k β k β k β k k β β k α k α k α k α k k α α k β k β k β k β k k β β k α > m a x ⁡ ( e α ) k α > m a x ⁡ ( e α ) k α > m a x ⁡ ( e α ) k α k k α α>max⁡( e α e α e α e e α α) k β > m a x ⁡ ( e β ) k β > m a x ⁡ ( e β ) k β > m a x ⁡ ( e β ) k β k k β β>max⁡( e β e β e β e e β β) Block Diagram of Traditional Sliding-Mode Observer Block Diagram of Traditional Sliding-Mode ObserverThe estimated value of EEMF in α-β axes ( e ^ α , e ^ β ) can be obtained by low-pass filter from the discontinuous switching signals z α and z α : e ^ α e ^ α e ^ α e ^ α e ^ e ^ e e^ α α e ^ β e ^ β e ^ β e ^ β e ^ e ^ e e^ β β z α z α z α z α z z α α z α z α z α z α z z α α e ^ α e ^ β = ω c s + ω c z α z β e ^ α e ^ β = ω c s + ω c z α z β e ^ α e ^ β = ω c s + ω c z α z β e ^ α e ^ β e ^ α e ^ β e ^ α e ^ β e ^ α e ^ α e ^ α e ^ e ^ e e^ α α e ^ β e ^ β e ^ β e ^ e ^ e e^ β β= ω c s + ω c ω c ω c ω ω c c s + ω c s+ ω c ω ω c c z α z β z α z β z α z β z α z α z α z z α α z β z β z β z z β βwhere ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current ω c = 2 π f c is the cutoff angular frequency of the LPF, which is usually selected according to the fundamental frequency of the stator current ω c = 2 π f c ω c = 2 π f c ω c = 2 π f c ω c ω ω c c=2π f c f f c cTherefore, the rotor position can be directly calculated from arc-tangent the back EMF, as defines: θ ^ e = - tan - 1 ⁡ e ^ α e ^ β θ ^ e = - tan - 1 ⁡ e ^ α e ^ β θ ^ e = - tan - 1 ⁡ e ^ α e ^ β θ ^ e θ ^ θ ^ θ θ^ e e=- tan - 1 ⁡ e ^ α e ^ β tan - 1 tan - 1 tan tan - 1 -1⁡ e ^ α e ^ β e ^ α e ^ β e ^ α e ^ β e ^ α e ^ β e ^ α e ^ α e ^ e ^ e e^ α α e ^ β e ^ β e ^ e ^ e e^ β βLow-pass filters remove the high-frequency term of the sliding-mode function, which results in phase delay. The delay can be compensated by the relationship between the cut-off frequency ω c and back EMF frequency ω e , which is defined as shown in : ω c ω c ω c ω c ωc ω e ω e ω e ω e ω ω e e ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) ∆ θ e = - tan - 1 ⁡ ( ω e ω c ) ∆ θ e θ θ e e=- tan - 1 ⁡ ( ω e ω c ) tan - 1 tan - 1 tan tan - 1 -1⁡ ( ω e ω c ) ( ω e ω c ω e ω e ω ω e e ω c ω c ω ω c c)Then the estimated rotor position by using SMO method is found with : θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e θ ^ e = - tan - 1 ⁡ e ^ α e ^ β + ∆ θ e θ ^ e θ ^ θ ^ θ θ^ e e=- tan - 1 ⁡ e ^ α e ^ β + ∆ θ e tan - 1 tan - 1 tan tan - 1 -1⁡ e ^ α e ^ β + ∆ θ e e ^ α e ^ β e ^ α e ^ β e ^ α e ^ β e ^ α e ^ α e ^ e ^ e e^ α α e ^ β e ^ β e ^ e ^ e e^ β β+∆ θ e θ θ e eIn a digital control application, a time-discrete equation of the SMO is needed. The Euler method is the appropriate way to transform to a time-discrete observer. The time-discrete system matrix of in α-β coordinates is given by as: i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) = F α F β i ˙ ^ α ( n ) i ˙ ^ β ( n ) + G α G β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) i ˙ ^ α ( n + 1 ) i ˙ ^ β ( n + 1 ) i ˙ ^ α ( n + 1 ) i ˙ ^ α ( n + 1 ) i ˙ ^ α i ˙ ^ i ˙ ^ i ˙ i ˙ i i˙^ α α(n+1) i ˙ ^ β ( n + 1 ) i ˙ ^ β ( n + 1 ) i ˙ ^ β i ˙ ^ i ˙ ^ i ˙ i ˙ i i˙^ β β(n+1)= F α F β F α F β F α F β F α F α F α F F α α F β F β F β F F β β i ˙ ^ α ( n ) i ˙ ^ β ( n ) i ˙ ^ α ( n ) i ˙ ^ β ( n ) i ˙ ^ α ( n ) i ˙ ^ β ( n ) i ˙ ^ α ( n ) i ˙ ^ α ( n ) i ˙ ^ α i ˙ ^ i ˙ ^ i ˙ i ˙ i i˙^ α α(n) i ˙ ^ β ( n ) i ˙ ^ β ( n ) i ˙ ^ β i ˙ ^ i ˙ ^ i ˙ i ˙ i i˙^ β β(n)+ G α G β G α G β G α G β G α G α G α G G α α G β G β G β G G β β V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) V α * ( n ) - e ^ α ( n ) + z α ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) V α * ( n ) - e ^ α ( n ) + z α ( n ) V α * ( n ) - e ^ α ( n ) + z α ( n ) V α * V V α α * *(n)- e ^ α e ^ e ^ e e^ α α(n)+ z α z z α α(n) V β * ( n ) - e ^ β ( n ) + z β ( n ) V β * ( n ) - e ^ β ( n ) + z β ( n ) V β * V V β β * *(n)- e ^ β e ^ e ^ e e^ β β(n)+ z β z z β β(n)where the matrix F and G are given by and as: the matrix F and G are given by and as: F F F F F G G G G G F α F β = e - R s L d e - R s L q F α F β = e - R s L d e - R s L q F α F β = e - R s L d e - R s L q F α F β F α F β F α F β F α F α F α F F α α F β F β F β F F β β= e - R s L d e - R s L q e - R s L d e - R s L q e - R s L d e - R s L q e - R s L d e - R s L d e - R s L d e e - R s L d - R s L d R s R s R R s s L d L d L L d d e - R s L q e - R s L q e - R s L q e e - R s L q - R s L q R s R s R R s s L q L q L L q q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q G α G β = 1 R s 1 - e - R s L d 1 - e - R s L q G α G β G α G β G α G β G α G α G α G G α α G β G β G β G G β β= 1 R s 1 1 R s R s R R s s 1 - e - R s L d 1 - e - R s L q 1 - e - R s L d 1 - e - R s L q 1 - e - R s L d 1 - e - R s L q 1 - e - R s L d 1 - e - R s L d 1 - e - R s L d 1 - e 1-e - R s L d - R s L d R s R s R R s s L d L d L L d d 1 - e - R s L q 1 - e - R s L q 1- e - R s L q e e - R s L q - R s L q R s R s R R s s L q L q L L q qThe time-discrete form of is given by as: e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) e ^ α ( n + 1 ) e ^ β ( n + 1 ) = e ^ α ( n ) e ^ β ( n ) + 2 π f c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) e ^ α ( n + 1 ) e ^ β ( n + 1 ) e ^ α ( n + 1 ) e ^ β ( n + 1 ) e ^ α ( n + 1 ) e ^ β ( n + 1 ) e ^ α ( n + 1 ) e ^ α ( n + 1 ) e ^ α e ^ e ^ e e^ α α(n+1) e ^ β ( n + 1 ) e ^ β ( n + 1 ) e ^ β e ^ e ^ e e^ β β(n+1)= e ^ α ( n ) e ^ β ( n ) e ^ α ( n ) e ^ β ( n ) e ^ α ( n ) e ^ β ( n ) e ^ α ( n ) e ^ α ( n ) e ^ α e ^ e ^ e e^ α α(n) e ^ β ( n ) e ^ β ( n ) e ^ β e ^ e ^ e e^ β β(n)+2π f c f f c c z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) z α ( n ) - e ^ α ( n ) z β ( n ) - e ^ β ( n ) z α ( n ) - e ^ α ( n ) z α ( n ) - e ^ α ( n ) z α z z α α(n)- e ^ α e ^ e ^ e e^ α α(n) z β ( n ) - e ^ β ( n ) z β ( n ) - e ^ β ( n ) z β z z β β(n)- e ^ β e ^ e ^ e e^ β β(n) Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Rotor Position and Speed Estimation With PLL With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . Block Diagram of Phase-Locked Loop Position Tracker Since e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) where E is the magnitude of the EEMF, which is proportional to the motor speed ω e When ( θ e - θ ^ e ) < π 2 , then can be simplified as . ε = E ( θ e - θ ^ e ) Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e According to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 where k p and k i are the proportional and the integral gains of the standard PI regulator The natural frequency ω n and the damping ratio ξ are given in : k p = 2 ξ ω n ,     k i = ω n 2 Simplified Block Diagram of Phase-Locked Loop Position Tracker With the arc tangent method, the accuracy of the position and velocity estimations are affected due to the existence of noise and harmonic components. To eliminate this issue, the PLL model can be used for velocity and position estimations in the sensorless control structure of the IPMSM. illustrates the PLL structure used with SMO. The back-EMF estimations e ^ α and e ^ β can be used with a PLL model to estimate the motor angular velocity and position as shown in . e ^ α e ^ α e ^ α e ^ α e ^ e ^ e e^ α α e ^ β e ^ β e ^ β e ^ β e ^ e ^ e e^ β β Block Diagram of Phase-Locked Loop Position Tracker Block Diagram of Phase-Locked Loop Position TrackerSince e α = E cos ⁡ θ e , e β = E sin ⁡ θ e , and E = ω e λ p m , the position error can be defined as : e α = E cos ⁡ θ e e α = E cos ⁡ θ e e α = E cos ⁡ θ e e α e e α α=E cos ⁡ θ e cos cos⁡ θ e θ e θ e θ e θ θ e e e β = E sin ⁡ θ e e β = E sin ⁡ θ e e β = E sin ⁡ θ e e β e e β β=E sin ⁡ θ e sin sin⁡ θ e θ e θ e θ e θ θ e e E = ω e λ p m E = ω e λ p m E = ω e λ p m E= ω e ωe λ p m λ p m pm ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) ε = e ^ β cos ⁡ θ ^ e - e ^ α sin ⁡ θ ^ e = E sin ⁡ θ e cos ⁡ θ ^ e - E cos ⁡ θ e sin ⁡ θ ^ e = E s i n ⁡ ( θ e - θ ^ e ) ε= e ^ β e ^ e^βcos⁡ θ ^ e θ ^ e θ ^ θ^e- e ^ α e ^ e^αsin⁡ θ ^ e θ ^ e θ ^ θ^e=Esin⁡ θ e θ e θecos⁡ θ ^ e θ ^ e θ ^ θ^e-Ecos⁡ θ e θ e θesin⁡ θ ^ e θ ^ e θ ^ θ^e=Esin⁡( θ e θe- θ ^ e θ ^ θ^e)where E is the magnitude of the EEMF, which is proportional to the motor speed ω e E is the magnitude of the EEMF, which is proportional to the motor speed ω e ω e ω e ω e ω e ω ω e eWhen ( θ e - θ ^ e ) < π 2 , then can be simplified as . ( θ e - θ ^ e ) < π 2 ( θ e - θ ^ e ) < π 2 ( θ e - θ ^ e ) < π 2 ( θ e θe- θ ^ e θ ^ θ^e)< π 2 π2 ε = E ( θ e - θ ^ e ) ε = E ( θ e - θ ^ e ) ε = E ( θ e - θ ^ e ) ε=E( θ e θ θ e e- θ ^ e θ ^ θ ^ θ θ^ e e)Further, the position error after the normalization of the EEMF can be obtained (): ε n = θ e - θ ^ e ε n = θ e - θ ^ e ε n = θ e - θ ^ e ε n ε ε n n= θ e θ θ e e- θ ^ e θ ^ θ ^ θ θ^ e eAccording to the analysis, the simplified block diagram of the quadrature phase-locked loop position tracker can be obtained as shown in . The closed-loop transfer functions of the PLL can be expressed as : θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 θ ^ e θ e = k p s + k i s 2 + k p s + k i = 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 θ ^ e θ e θ ^ e θ ^ e θ ^ θ ^ θ θ^ e e θ e θ e θ θ e e= k p s + k i s 2 + k p s + k i k p s + k i k p k k p ps+ k i k k i i s 2 + k p s + k i s 2 s s 2 2+ k p k k p ps+ k i k k i i= 2 ξ ω n s + ω n 2 s 2 + 2 ξ ω n s + ω n 2 2 ξ ω n s + ω n 2 2ξ ω n ω ω n ns+ ω n 2 ω ω n n 2 2 s 2 + 2 ξ ω n s + ω n 2 s 2 s s 2 2+2ξ ω n ω ω n ns+ ω n 2 ω ω n n 2 2where k p and k i are the proportional and the integral gains of the standard PI regulator k p and k i are the proportional and the integral gains of the standard PI regulator k p k p k p k p k k p p k i k i k i k i k k i iThe natural frequency ω n and the damping ratio ξ are given in : ω n ω n ω n ω n ω ω n n ξ ξ ξ ξ k p = 2 ξ ω n ,     k i = ω n 2 k p = 2 ξ ω n ,     k i = ω n 2 k p = 2 ξ ω n ,     k i = ω n 2 k p kp=2ξ ω n ωn,   k i ki= ω n 2 ωn2 Simplified Block Diagram of Phase-Locked Loop Position Tracker Simplified Block Diagram of Phase-Locked Loop Position Tracker Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Field Weakening (FW) and Maximum Torque Per Ampere (MTPA) Control Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range. The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor The total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q In most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x V a = v d 2 + v q 2 ≤ V m a x where V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor In a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m The current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . Conventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. I s = i d 2 + i q 2 I d = I s cos ⁡ β I q = I s sin ⁡ β where β is the stator current angle in the synchronous (d-q) reference frame can be expressed as where I s substituted for i d and i q . shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β This equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s Thus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I q = I s × sin ⁡ β m t p a However, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . L d = f 1 i d ,   i q = f 1 i d L q = f 2 i q ,   i d = f 2 i q Reduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a = K m t p a / I s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . Current Phasor Diagram of an IPMSM During FW and MTPA The switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . β = β f w   i f   β f w > β m t p a β = β m p t a   i f   β f w < β m t p a The flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt. Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Permanent magnet synchronous motor (PMSM) is widely used in home appliance applications due to the high power density, high efficiency, and wide speed range. The PMSM includes two major types: the surface-mounted PMSM (SPM), and the interior PMSM (IPM). SPM motors are easier to control due to the linear relationship between the torque and q-axis current. However, the IPMSM has electromagnetic and reluctance torques due to a large saliency ratio. The total torque is non-linear with respect to the rotor angle. As a result, the MTPA technique can be used for IPM motors to optimize torque generation in the constant torque region. The aim of the field-weakening control is to optimize to reach the highest power and efficiency of a PMSM drive. Field-weakening control can enable a motor operation over the base speed, expanding the operating limits to reach speeds higher than rated speed and allow exceptional control across the entire speed and voltage range.The voltage equations of the mathematical model of an IPMSM can be described in d-q coordinates as shown in and . v d = L d d i d d t + R s i d - p ω m L q i q   v d = L d d i d d t + R s i d - p ω m L q i q   v d = L d d i d d t + R s i d - p ω m L q i q   v d v v d d= L d L L d d d i d d t d i d d i d d i di d d d t dt+ R s i d R s i R s R R s si d d-p ω m ω ω m m L q L L q q i q i i q q  v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m v q = L q d i q d t + R s i q + p ω m L d i d + p ω m ψ m v q v v q q= L q L L q q d i q d t d i q d i q d i di q q d t dt+ R s i q R s i R s R R s si q q+p ω m ω ω m m L d L L d d i d i i d d+p ω m ω ω m m ψ m ψ ψ m m shows the dynamic equivalent circuit of an IPM synchronous motor. Equivalent Circuit of an IPM Synchronous Motor Equivalent Circuit of an IPM Synchronous MotorThe total electromagnetic torque generated by the IPMSM can be expressed as that the produced torque is composed of two distinct terms. The first term corresponds to the mutual reaction torque occurring between torque current i q and the permanent magnet ψ m , while the second term corresponds to the reluctance torque due to the differences in d-axis and q-axis inductance. i q i q i q i q i i q q ψ m ψ m ψ m ψ m ψ ψ m m T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q T e = 3 2 p   ψ m i q + ( L d - L q ) i d i q T e T T e e= 3 2 3 3 2 2p   ψ m i q + ( L d - L q ) i d i q   ψ m i q + ( L d - L q ) i d i q   ψ m i q + ( L d - L q   ψ m i q + ( L d - L   ψ m   ψ  ψ m m i q i i q q+( L d L L d d-L q q) i d i i d d i q i i q qIn most applications, IPMSM drives have speed and torque constraints, mainly due to inverter or motor rating currents and available DC link voltage limitations respectively. These constraints can be expressed with the mathematical equations and . I a = i d 2 + i q 2 ≤ I m a x I a = i d 2 + i q 2 ≤ I m a x I a = i d 2 + i q 2 ≤ I m a x I a I I a a= i d 2 + i q 2 i d 2 i i d d 2 2+ i q 2 i i q q 2 2≤ I m a x I I m a x max V a = v d 2 + v q 2 ≤ V m a x V a = v d 2 + v q 2 ≤ V m a x V a = v d 2 + v q 2 ≤ V m a x V a V V a a= v d 2 + v q 2 v d 2 v v d d 2 2+ v q 2 v v q q 2 2≤ V m a x V V m a x maxwhere V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor V m a x and I m a x are the maximum allowable voltage and current of the inverter or motor V m a x V m a x V m a x V m a x V V m a x max I m a x I m a x I m a x I m a x I I m a x maxIn a two-level three-phase Voltage Source Inverter (VSI) fed machine, the maximum achievable phase voltage is limited by the DC link voltage and the PWM strategy. The maximum voltage is limited to the value as shown in if Space Vector Modulation (SVPWM) is adopted. v d 2 + v q 2 ≤ v m a x = v d c 3 v d 2 + v q 2 ≤ v m a x = v d c 3 v d 2 + v q 2 ≤ v m a x = v d c 3 v d 2 + v q 2 v d 2 v v d d 2 2+ v q 2 v v q q 2 2≤ v m a x v v m a x max= v d c 3 v d c v d c v v d c dc 3 3 3Usually the stator resistance R s is negligible at high speed operation and the derivative of the currents is zero in steady state, thus is obtained as shown. R s R s R s R s R R s s L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   ≤ V m a x ω m L d 2 ( i d + ψ p m L d ) 2 + L q 2 i q 2   L d 2 Ld2( i d id+ ψ p m L d ψ p m ψ p m pm L d Ld ) 2 )2+ L q 2 Lq2 i q 2 iq2 ≤ V m a x ω m V m a x V m a x max ω m ωmThe current limitation of produces a circle of radius I m a x in the d-q plane, and the voltage limitation of produces an ellipse whose radius V m a x decreases as speed increases. The resultant d-q plane current vector must be controlled to obey the current and voltage constraints simultaneously. According to these constraints, three operation regions for the IPMSM can be distinguished as shown in . I m a x I m a x I m a x I m a x I I m a x max V m a x V m a x V m a x V m a x V V m a x max IPMSM Control Operation Regions IPMSM Control Operation Regions Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation. Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached. Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation. Constant Torque Region: MTPA can be implemented in this operation region to provide maximum torque generation.Constant Power Region: Field-weakening control must be employed and the torque capacity is reduced as the current constraint is reached.Constant Voltage Region: In this operation region, deep field-weakening control keeps a constant stator voltage to maximize the torque generation.In the constant torque region, according to , the total torque of an IPMSM includes the electromagnetic torque from the magnet flux linkage and the reluctance torque from the saliency between L d and L q . The electromagnetic torque is proportional to the q-axis current i q , and the reluctance torque is proportional to the multiplication of the d-axis current i d , the q-axis current i q , and the difference between L d and L q . L d L d L d L d L L d d L q L q L q L q L L q q i q i q i q i q i i q q i d i d i d i d i i d d i q i q i q i q i i q q L d L d L d L d L L d d L q L q L q L q L L q qConventional vector control systems of SPM motors only utilizes electromagnetic torque by setting the commanded i d to zero for non-field-weakening modes. But while the IPMSM utilizes the reluctance torque of the motor, the designer must also control the d-axis current. The aim of the MTPA control is to calculate the reference currents i d and i q to maximize the ratio between produced electromagnetic torque and reluctance torque. The relationship between i d and i q , and the vectorial sum of the stator current I s is shown in the following equations. i d i d i d i d i i d d i d i d i d i d i i d d i q i q i q i q i i q q i d i d i d i d i i d d i q i q i q i q i i q q I s I s I s I s I I s s I s = i d 2 + i q 2 I s = i d 2 + i q 2 I s = i d 2 + i q 2 I s I I s s= i d 2 + i q 2 i d 2 i i d d 2 2+ i q 2 i i q q 2 2 I d = I s cos ⁡ β I d = I s cos ⁡ β I d = I s cos ⁡ β I d I I d d= I s I I s s cos ⁡ β cos cos⁡ β β I q = I s sin ⁡ β I q = I s sin ⁡ β I q = I s sin ⁡ β I q I I q q= I s I I s s sin ⁡ β sin sin⁡ β βwhere β is the stator current angle in the synchronous (d-q) reference frame β is the stator current angle in the synchronous (d-q) reference frame β β β β can be expressed as where I s substituted for i d and i q . I s I s I s I s I I s s i d i d i d i d i i d d i q i q i q i q i i q q shows that motor torque depends on the angle of the stator current vector: T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β T e = 3 2 p I s sin ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β T e T T e e= 3 2 3 3 2 2p I s I I s s sin ⁡ β sin sin⁡ β β   ψ m + ( L d - L q ) I s cos ⁡ β   ψ m + ( L d - L q ) I s cos ⁡ β   ψ m + ( L d - L q   ψ m + ( L d - L   ψ m   ψ  ψ m m+( L d L L d d-L q q) I s I I s s cos ⁡ β cos cos⁡ β βThis equation shows the maximum efficiency point can be calculated when the motor torque differential is equal to zero. The MTPA point can be found when this differential, d T e d β is zero as given in . d T e d β d T e d β d T e d β d T e d β d T e d T e T T e e d β dβ d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   d T e d β = 3 2 p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β = 0   d T e d β d T e d T e T T e e d β dβ= 3 2 3 3 2 2p   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β   ψ m I s cos ⁡ β + ( L d - L q ) I s 2 cos ⁡ 2 β   ψ m   ψ  ψ m m I s I I s s cos ⁡ β cos cos⁡ β β + ( L d - L q + ( L d - L +( L d L L d d-L q q) I s 2 I I s s 2 2 cos ⁡ 2 β cos cos⁡ 2 β 2β=0 Following this equation, the current angle of the MTPA control can be derived as in . β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s β m t p a = cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s β m t p a β β m t p a mtpa= cos - 1 ⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s cos - 1 cos - 1 cos cos - 1 -1⁡ - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 4 × L d - L q × I s - ψ m + ψ m 2 + 8 × L d - L q 2 × I s 2 - ψ m ψ ψ m m+ ψ m 2 + 8 × L d - L q 2 × I s 2 ψ m 2 ψ ψ m m 2 2+ 8 × L d - L q 2 8 × L d - L q 8× L d - L q L d - L q L d L L d d- L q L L q q 2 2× I s 2 I I s s 2 2 4 × L d - L q × I s 4× L d - L q L d - L q L d L L d d- L q L L q q× I s I I s sThus, the effective d-axis and q-axis reference currents can be expressed by and using the current angle of the MTPA control. I d = I s × cos ⁡ β m t p a I d = I s × cos ⁡ β m t p a I d = I s × cos ⁡ β m t p a I d I I d d= I s I I s s× cos ⁡ β m t p a cos cos⁡ β m t p a β m t p a β β m t p a mtpa I q = I s × sin ⁡ β m t p a I q = I s × sin ⁡ β m t p a I q = I s × sin ⁡ β m t p a I q I I q q= I s I I s s× sin ⁡ β m t p a sin sin⁡ β m t p a β m t p a β β m t p a mtpaHowever, as shown in , the angle of the MTPA control, β m t p a is related to d-axis and q-axis inductance. This means that the variation of inductance impedes the ability to find the exceptional MTPA point. To improve the efficiency of a motor drive, estimate the d-axis and q-axis inductance online, but the parameters L d and L q are not easily measured online and are influenced by saturation effects. A robust Look-Up Table (LUT) method provides controllability under electrical parameter variations. Usually, to simplify the mathematical model, the coupling effect between d-axis and q-axis inductance can be neglected. Thus, assume that L d changes with i d only, and L q changes with i q only. Consequently, d- and q-axis inductance can be modeled as a function of the d-q currents respectively, as shown in and . β m t p a β m t p a β m t p a β m t p a β β m t p a mtpa L d L d L d L d L L d d L q L q L q L q L L q q L d L d L d L d L L d d i d i d i d i d i i d d L q L q L q L q L L q q i q i q i q i q i i q q L d = f 1 i d ,   i q = f 1 i d L d = f 1 i d ,   i q = f 1 i d L d = f 1 i d ,   i q = f 1 i d L d L L d d= f 1 f f 1 1 i d ,   i q i d ,   i q i d i i d d,  i q i i q q= f 1 f f 1 1 i d i d i d i i d d L q = f 2 i q ,   i d = f 2 i q L q = f 2 i q ,   i d = f 2 i q L q = f 2 i q ,   i d = f 2 i q L q L L q q= f 2 f f 2 2 i q ,   i d i q ,   i d i q i i q q ,   i d ,   i , i d d= f 2 f f 2 2 i q i q i q i i q qReduce the ISR calculation burden by simplifying . The motor-parameter-based constant, K m t p a is expressed instead as , where K m t p a is computed in the background loop using the updated L d and L q . K m t p a K m t p a K m t p a K m t p a K K m t p a mtpa K m t p a K m t p a K m t p a K m t p a K K m t p a mtpa L d L d L d L d L L d d L q L q L q L q L L q q K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d K m t p a = ψ m 4 × L q - L d = 0.25 × ψ m L q - L d K m t p a K K m t p a mtpa= ψ m 4 × L q - L d ψ m ψ m ψ ψ m m 4 × L q - L d 4× L q - L d L q - L d L q L L q q- L d L L d d=0.25× ψ m L q - L d ψ m ψ m ψ ψ m m L q - L d L q - L d L q - L d L q L L q q- L d L L d d β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 β m t p a = c o s - 1 K m t p a / I s - K m t p a / I s 2 + 0.5 β m t p a β β m t p a mtpa= c o s - 1 c o s cos - 1 -1 K m t p a / I s - K m t p a / I s 2 + 0.5 K m t p a / I s - K m t p a / I s 2 + 0.5 K m t p a K K m t p a mtpa/ I s I I s s- K m t p a / I s 2 + 0.5 K m t p a / I s 2 K m t p a / I s K m t p a / I s K m t p a / I s K m t p a / I s K m t p a K m t p a K K m t p a mtpa/ I s I s I I s s 2 2+0.5A second intermediate variable, G m t p a described in , is defined to further simplify the calculation. Using G m t p a , the angle of the MTPA control, β m t p a can be calculated as . These two calculations are performed in the ISR to achieve a real current angle β m t p a . G m t p a G m t p a G m t p a G m t p a G G m t p a mtpa G m t p a G m t p a G m t p a G m t p a G G m t p a mtpa β m t p a β m t p a β m t p a β m t p a β β m t p a mtpa β m t p a β m t p a β m t p a β m t p a β β m t p a mtpa G m t p a = K m t p a / I s G m t p a = K m t p a / I s G m t p a = K m t p a / I s G m t p a G G m t p a mtpa= K m t p a / I s K m t p a K m t p a K K m t p a mtpa/ I s I s I I s s β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 β m t p a = c o s - 1 G m t p a - G m t p a 2 + 0.5 β m t p a β β m t p a mtpa= c o s - 1 c o s cos - 1 -1 G m t p a - G m t p a 2 + 0.5 G m t p a - G m t p a 2 + 0.5 G m t p a G G m t p a mtpa- G m t p a 2 + 0.5 G m t p a 2 G G m t p a mtpa 2 2+0.5In all cases, the magnetic flux can be weakened to extend the achievable speed range by acting on the direct axis current i d . As a consequence of entering this constant power operating region, field-weakening control is chosen instead of the MTPA control used in constant power and voltage regions. Since the maximum inverter voltage is limited, PMSM motors cannot operate in such speed regions where the back-electromotive force, almost proportional to the permanent magnet field and motor speed, is higher than the maximum output voltage of the inverter. The direct control of magnet flux is not an option in PM motors. However, the air gap flux can be weakened by the demagnetizing effect due to the d-axis armature reaction by adding a negative i d . Considering the voltage and current constraints, the armature current and the terminal voltage are limited as and . The inverter input voltage (DC-Link voltage) variation limits the maximum output of the motor. Furthermore, the maximum fundamental motor voltage also depends on the PWM method used. In , the IPMSM has two factors: one is a permanent magnet value and the other is made by inductance and current of flux. i d i d i d i d i i d d i d i d i d i d i i d d shows the typical control structure is used to implement field weakening. β f w is the output of the field-weakening (FW) PI controller and generates the reference i d and i q . Before the voltage magnitude reaches the limit, the input of the PI controller of FW is always positive and therefore the output is always saturated at 0. β f w β f w β f w β f w β β f w fw i d i d i d i d i i d d i q i q i q i q i i q q Block Diagram of Field-Weakening and Maximum Torque per Ampere Control Block Diagram of Field-Weakening and Maximum Torque per Ampere Control and show the implementation of FAST or eSMO based FOC block diagram. The block diagrams provide an overview of the functions and variables of the FOC system. There are two control modules in the motor drive FOC system: one is MTPA control and the other one is field-weakening control. These two modules generate current angle β m t p a and β f w , respectively, based on input parameters as shown in . β m t p a β m t p a β m t p a β m t p a β β m t p a mtpa β f w β f w β f w β f w β β f w fw Current Phasor Diagram of an IPMSM During FW and MTPA Current Phasor Diagram of an IPMSM During FW and MTPAThe switching control module is used to determine angle of application, and then calculate the reference i d and i q as shown in and . The current angle is chosen as in the following: and . i d i d i d i d i i d d i q i q i q i q i i q q β = β f w   i f   β f w > β m t p a β = β f w   i f   β f w > β m t p a β = β f w   i f   β f w > β m t p a β= β f w β β f w fw if  β f w β β f w fw> β m t p a β β m t p a mtpa β = β m p t a   i f   β f w < β m t p a β = β m p t a   i f   β f w < β m t p a β = β m p t a   i f   β f w < β m t p a β= β m p t a β m p t a mpta if  β f w β f w fw< β m t p a β m t p a mtpaThe flow chart in shows the steps required to run InstaSPIN-FOC with FW and MPTA in the main loop and interrupt.InstaSPIN Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Flow Chart for an InstaSPIN-FOC Project With FW and MTPA Hardware Prerequisites for Motor Drive The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Hardware Prerequisites for Motor Drive The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. The algorithm for controlling the motor makes use of sampled measurements of the motor conditions, including dc bus power supply voltage, the voltage on each motor phase, the current of each motor phase. There are a few hardware-dependent parameters that need to be set correctly to identify the motor properly and run the motor effectively using Field Oriented Control (FOC). The following sections show how to calculate the current scale value, voltage scale value, and voltage filter pole for motor control with FAST or eSMO. Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Current Feedback Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Either one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in . Two techniques are supported to measure phase currents of the motor. Three-shunt current sensing Single-shunt current sensing Three-shunt current sensingSingle-shunt current sensingEither one of these two current sensing techniques can be selected in the build configuration of the project. The Flash_MtrInv_3SC build configuration supports three-shunt current sensing method, the Flash_MtrInv_1SC supports single-shunt current sensing method as described in .Flash_MtrInv_3SCFlash_MtrInv_1SC Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit Three-Shunt Current Sensing The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i where Rshunt = 0.05 Ω Voffset = 1.65 V The calculated resistance values lead to the sensing circuit shown in , Gi is given by . G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A This has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file: //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f) Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h: // define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit The current through the motor is sampled by microcontroller as part of the motor control algorithm during every one PWM cycle. TMS320F2800137 daughter board supports 1-3 shunt current sensing, MSPM0G1507 daughterboard supports 1-2 shunt current sensing. To measure bidirectional currents of the motor phase, that is, positive and negative currents, the circuits below require a reference voltage of 1.65 V. This offset reference voltage is created by a voltage follower as shown in . 1.65-V Reference From 3.3-V Input Circuit 1.65-V Reference From 3.3-V Input Circuit shows how the motor current is represented as a voltage signal, with filtering, amplification, and offset to the center of the ADC input range for TMS320F2800137 daughterboard. This circuit is used for each phase of the 3-phase PMSM of compressor and fan. The transfer function of this circuit is given by . V O U T = V O F F S E T + I I N × R S H U N T × G i V O U T = V O F F S E T + I I N × R S H U N T × G i V O U T = V O F F S E T + I I N × R S H U N T × G i V O U T V O U T OUT= V O F F S E T V O F F S E T OFFSET+ I I N × R S H U N T × G i I I N × R S H U N T × G i I I N I I N IN× R S H U N T R S H U N T SHUNT× G i Giwhere Rshunt = 0.05 Ω Voffset = 1.65 V Rshunt = 0.05 Ω Rshunt = 0.05 Ωshunt Voffset = 1.65 V Voffset = 1.65 VoffsetThe calculated resistance values lead to the sensing circuit shown in , Gi is given by .Gi i G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 G i = R f b R i n = R 18 ( R 97 + R 15 ) = 10 kΩ 20 + 2 . 4 kΩ = 4 . 132 G i Gi= R f b R i n R f b R f b fb R i n R i n in= R 18 ( R 97 + R 15 ) R 18 R18 ( R 97 + R 15 ) (R97+R15)= 10 kΩ 20 + 2 . 4 kΩ 10 kΩ 10kΩ 20 + 2 . 4 kΩ 20+2.4kΩ=4.132The maximum peak-to-peak current measurable by the microcontroller is given by . I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A I s c a l e _ m a x = V A D C _ m a x R S H U N T × G i = 3 . 3 0 . 05 × 4 . 132 = 15 . 97 A I s c a l e _ m a x I s c a l e _ m a x scale_max= V A D C _ m a x R S H U N T × G i V A D C _ m a x V A D C _ m a x ADC_max R S H U N T × G i R S H U N T R S H U N T SHUNT× G i Gi= 3 . 3 0 . 05 × 4 . 132 3 . 3 3.3 0 . 05 × 4 . 132 0.05×4.132=15.97AThis has the peak-to-peak value of ±7.99 A. The following code snippet shows how this is defined for compressor motor in user_mtr1.h file://! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.97f)Correct polarity of the current feedback is also important so that the microcontroller has an accurate current measurement. In this hardware board configuration, the negative pin of the shunt resistor, which is connected to ground, is also connected to the inverting pin of the operational amplifier. The highlighted sign is required to be configured to have the correct polarity for the current feedback in software as shown in the following code snippet in user.mtr1.h:// define the sign of current feedback based on hardware board #define USER_M1_SIGN_CURRENT_SF (1.0f) Three-Shunt Current Sensing Circuit for TMS320F2800137 Three-Shunt Current Sensing Circuit for TMS320F2800137On the MSPM0 daughterboard, two shunt current sensing are implemented with the two high-end internal amplifiers to save system cost. The amplifier gain is also 4.132, and the cutoff frequency is 70 kHz. shows the two-shunt current sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Two-Shunt Current-Sensing Circuit MSPM0G1507 Two-Shunt Current-Sensing Circuit Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Single-Shunt Current Sensing The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. On this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit By default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout The DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard The transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts. For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . The single-shunt current-sensing technique measures the DC-link bus current, with knowledge of the power FET switching states and reconstructs the three-phase current of the motor. The detailed description of the single shunt technique is described in the Sensorless-FOC for PMSM With Single DC-Link Shunt application note. Sensorless-FOC for PMSM With Single DC-Link Shunt Sensorless-FOC for PMSM With Single DC-Link ShuntOn this reference board, implement the single-shunt current-sensing technique by removing two shunts and shorting the connection of the U, V, W ground of the power module as shown in . On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current. On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling. On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling. Use a thick wire to connect the NU, NV, and NW pins together. On the motherboard, remove current shunt resistors R81, and R82, just keep only shunt resistor R80 to sense the DC-Link current.On TMS320F2800137 daughterboard, remove C86 to increase U2A bandwidth for single-shunt sampling.On the MSPM0G1507 daughterboard, remove C29 to increase the bandwidth for single-shunt sampling.Use a thick wire to connect the NU, NV, and NW pins together. Single-Shunt Current-Sensing Circuit for TMS320F2800137 Single-Shunt Current-Sensing Circuit for TMS320F2800137 shows the single-shunt current-sensing circuit for the MSPM0G1507 daughterboard. MSPM0G1507 Single-Shunt Current-Sensing Circuit MSPM0G1507 Single-Shunt Current-Sensing CircuitBy default, the board has three shunt resistors, shows the layout of the shunt resistors. To run with a single-shunt resistor, remove R81 and R82 while keeping R80, solder NU, NV and NW (pin 2 of R80, R81, and R82) together, then all three phase currents flow through only R80. Shunt Resistors Layout Shunt Resistors LayoutThe DC-Link current is a unidirectional signal, so the DC current offset can be set to a minimum or maximum value to improve the ADC sampling range for the DC-Link current as shows. On the TMS320F2800137 daughterboard, change R7 from 10 kΩ to 1 kΩ/1% resistor for the reference voltage to have 0.3-V offset for DC current sensing. DC Offset Reference for Single Shunt of TMS320F2800137 Daughterboard DC Offset Reference for Single Shunt of TMS320F2800137 DaughterboardThe transfer function of this current sampling circuit and the calculation for single shunt are the same as the three shunts.For the MSPM0 daughterboard, offset for single-shunt current sensing can also be reduced to 0.3 V by reducing R31 from 20 kΩ to 2 kΩ, as shown in . Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Motor Voltage Feedback Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus. The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V where Gv is attenuation factor, Gv is calculated with G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz. In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   The following code example shows how this is defined in user_mtr1.h: //! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Voltage feedback is needed in the FAST estimator to allow the best performance at the widest speed range, the phase voltages are measured directly from the motor phases instead of a software estimate. The eSMO relies on software estimation values to represent the voltage phases without using the motor phase voltage-sensing circuit. This software value (USER_ADC_FULL_SCALE_VOLTAGE_V) depends on the circuit that senses the voltage feedback from the motor phases. shows how the motor voltage is filtered and scaled for the ADC input range using a voltage feedback circuit based on resistor dividers. The similar circuit is used to measure all three of both compressor and fan motors, and dc bus.The maximum phase voltage feedback measurable by the microcontroller in this reference design can be calculated as given in , considering the maximum voltage for the ADC input is 3.3 V. V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V V F S = V A D C _ F S × G v = 3 . 3 V × 122 . 46 = 404 . 13 V V F S V F S FS= V A D C _ F S V A D C _ F S ADC_FS× G v Gv=3.3V×122.46=404.13Vwhere Gv is attenuation factor, Gv is calculated with Gv is attenuation factor, Gv is calculated with vv G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 G V = R 62 + R 67 + R 70 + R 74 R 74 = 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ = 122 . 46 G V GV= R 62 + R 67 + R 70 + R 74 R 74 R 62 + R 67 + R 70 + R 74 R 62 + R 67 + R 70 + R 74 R62+R67+R70+R74 R 74 R74= 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 332kΩ+332kΩ+332kΩ+8.2kΩ 8 . 2 kΩ 8.2kΩ=122.46With that voltage feedback circuit, the following setting is done in user_mtr1.h: //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the maximum voltage at the AD converter #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f)The voltage filter pole is needed by the FAST estimator to allow an accurate detection of the voltage feedback. Make the filter low enough to filter out the PWM signals, and at the same time allow a high-speed voltage feedback signal to pass through the filter. As a general guideline, a cutoff frequency of a few hundred Hz is enough to filter out a PWM frequency of 5 to 20 kHz. Change the hardware filter only when ultra-high-speed motors are run, which generate phase-voltage frequencies in the order of a few kHz.In this reference design the filter pole setting can be calculated with : f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   f f i l t e r _ p o l e = 1 2 × π × R P a r a l l e l × C = 405 . 15 H z w h e r e ,   C = 47 n F   R P a r a l l e l   =   332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ = 8 . 133 k Ω   f f i l t e r _ p o l e f f i l t e r _ p o l e filter_pole= 1 2 × π × R P a r a l l e l × C 1 2 × π × R P a r a l l e l × C 2 × π × R P a r a l l e l × C 2×π× R P a r a l l e l R P a r a l l e l Parallel×C=405.15Hzwhere, C=47nF  R P a r a l l e l R P a r a l l e l Parallel =  332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ × 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ 332 kΩ + 332 kΩ + 332 kΩ 332kΩ+332kΩ+332kΩ × ×8.2kΩ 332 kΩ + 332 kΩ + 332 kΩ + 8 . 2 kΩ 332 kΩ + 332 kΩ + 332 kΩ 332 kΩ + 332 kΩ + 332 kΩ 332kΩ+332kΩ+332kΩ+8.2kΩ=8.133kΩ The following code example shows how this is defined in user_mtr1.h://! \brief Defines the analog voltage filter pole location, Hz #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) Motor Voltage Sensing Circuit Motor Voltage Sensing Circuit Hardware, Software, Testing Requirements, and Test Results Getting Started Hardware This section details the necessary equipment, test setup, and procedure instructions for the design board and software testing and validation. Hardware Board Overview shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. Test Conditions Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. Test Equipment Required for Board Validation The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer Getting Started GUI Source code for this reference design is provided so the designer can debug firmware directly, as explained in . However, software debugging needs more time. To speed up development time, a UART based GUI software is provided to help quickly tune parameters on any customized application. This section introduces how to debug and tune the motor control parameters with the GUI software. For now, only the C2000 daughter-board firmware supports the GUI. Use caution when connecting the host PC to this reference board via UART, because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the Kit. Test Setup The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Add ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible. The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. Overview of GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth. GUI Software Setup Serial Port Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port A successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running. Successful Communication Status Motor Identification Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware. For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters. First, choose the motor identification command in the Control Window tab as shown in . Motor Identification Command Next, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings. Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification. Start Motor Identification After identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph. Store Motor Identification Result Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct. Motor Drive Parameters On the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor. Steps to Spin Motor Motor Fault Status Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in . Fault Status Monitor Faults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash. Tune Control Parameters Virtual Oscilloscope The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages. Virtual Oscilloscope for Rotor Angle and Phase Voltages Command Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in . Virtual Oscilloscope for Rotor Angle of FAST and eSMO Getting Started C2000 Firmware Download and install C2000WARE-MOTORCONTROL-SDK v5.01.00.00 or newer software from the link provided by TI. Install this Motor Control SDK software in the default folder. The software project then resides inside the C2000Ware Motor Control SDK folder at <install_location>\solutions\tida_010265_wminv\. Follow these steps to build and run this code with different incremental builds. Download and Install Software Required for Board Test Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. Opening Project Inside CCS The projectspec file for F280013x based reference design is in the directory below <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control Import the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method. Configure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in . Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties Project Structure Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h. The folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions. The folder src_board includes board drivers for this hardware board. The folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks. TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram The project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz. To simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options. Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Test Procedure There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices. Use caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit. Build Level 1: CPU and Board Setup Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 2: Open-Loop Check With ADC Feedback Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Build Level 3: Closed Current Loop Check Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Build Level 4: Full Motor Drive Control no Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Test Results The following sections show the test data from characterizing the design. The test results are divided in multiple sections that cover the steady-state performance and data, functional performance waveforms, and transient performance waveforms of the fan and compressor motor. Load and Thermal Test is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz This board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 Overcurrent Protection by External Comparator Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS Migrate Firmware to a New Hardware Board If the designer wants to migrate the reference design to a hardware board, change the motor related PWM, CMPSS, ADC peripherals configuration, hardware parameters, and motor parameters, accordingly in the hal.c, hal.h, and user_mtr1.h files as described in the following sections. Configure the PWM, CMPSS, and ADC Modules The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes. Configure PWM and CMPSS base address for motor drive: // EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE Configure ADC base address and channels for motor drive: // Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 Configure peripheral interrupt for motor drive control: // Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1 Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15 Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual. // XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15 The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor. void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() function The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes. void HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; } Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes. void HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() function The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control. static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function Setup Hardware Board Parameters The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent. All of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes. //! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) Configure Faults Protection Parameters Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent. //! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Setup Motor Electrical Parameters The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet. #define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Getting Started MSPM0 Firmware Contact the local TI sales representative for firmware for the MSPM0G1507 daughterboard. Hardware, Software, Testing Requirements, and Test Results Getting Started Hardware This section details the necessary equipment, test setup, and procedure instructions for the design board and software testing and validation. Hardware Board Overview shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. Test Conditions Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. Test Equipment Required for Board Validation The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer Getting Started Hardware This section details the necessary equipment, test setup, and procedure instructions for the design board and software testing and validation. This section details the necessary equipment, test setup, and procedure instructions for the design board and software testing and validation. This section details the necessary equipment, test setup, and procedure instructions for the design board and software testing and validation. Hardware Board Overview shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. Hardware Board Overview shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. shows an overview of a typical motor inverter system. Hardware Board Block Diagram of TIDA-010265 Hardware Board Block Diagram of TIDA-010265The motor control board has functional groups that enable a complete motor drive system. The following is a list of the blocks (and functions) on the board, shows the top view of the board and different blocks of the TIDA-010265 PCB. Power line input filter 3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Control Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Interface for external motor temperature sensing Isolated UART port Auxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V Power line input filter3-phase inverter Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Up to 750-W 3-phase inverter supports PMSM or IPM 15-kHz switching frequency 1-3 shunts current sensing Up to 750-W 3-phase inverter supports PMSM or IPM15-kHz switching frequency1-3 shunts current sensingControl Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP package Amplify and input filters for the analog signals Single TMS320F2800137 or MSPM0G1507 series MCU in 48-pin LQFP packageAmplify and input filters for the analog signalsInterface for external motor temperature sensingIsolated UART portAuxiliary power supply Onboard power supply +3.3 V, +5 V and +15 V Onboard power supply +3.3 V, +5 V and +15 V Onboard power supply +3.3 V, +5 V and +15 V TIDA-010265 Reference Design Board Layout TIDA-010265 Reference Design Board LayoutTI recommends taking the following precautions when using the board: Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. Do not touch any part of the board or components connected to the board when the board is energized. Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source. Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.) Control Ground can be hot. Do not touch any part of the board or components connected to the board when the board is energized.Use the AC Mains or wall power supply to power the kit. TI recommends an isolation AC source.Do not touch any part of the board, the kit or the assembly when energized. (Though the power module heat sink is isolated from the board, high-voltage switching generates some capacitive coupled voltages over the heat sink body.)Control Ground can be hot. Test Conditions Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. Test Conditions Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. Observe the following for testing the reference design software: For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up. For the output, use a 3-phase PMSM with dynamo meters. For input, the power supply source must range from 165-V to 265-V AC if using the AC source, or must range from 100 V to 400 V if using the DC power supply. Set the input current limit of input AC source to 10 A or DC power supply to 6.5 A, but start with a lower current limit during initial board bring up.For the output, use a 3-phase PMSM with dynamo meters. Test Equipment Required for Board Validation The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer Test Equipment Required for Board Validation The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer The designer must use the following equipment for board validation: Isolated AC source Single-phase power analyzer Digital oscilloscope Multimeters DC power supply 750-W, 3-phase PM synchronous motors Dynamo meters Three-phase power analyzer Isolated AC sourceSingle-phase power analyzerDigital oscilloscopeMultimetersDC power supply750-W, 3-phase PM synchronous motorsDynamo metersThree-phase power analyzer Getting Started GUI Source code for this reference design is provided so the designer can debug firmware directly, as explained in . However, software debugging needs more time. To speed up development time, a UART based GUI software is provided to help quickly tune parameters on any customized application. This section introduces how to debug and tune the motor control parameters with the GUI software. For now, only the C2000 daughter-board firmware supports the GUI. Use caution when connecting the host PC to this reference board via UART, because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the Kit. Test Setup The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Add ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible. The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. Overview of GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth. GUI Software Setup Serial Port Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port A successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running. Successful Communication Status Motor Identification Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware. For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters. First, choose the motor identification command in the Control Window tab as shown in . Motor Identification Command Next, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings. Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification. Start Motor Identification After identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph. Store Motor Identification Result Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct. Motor Drive Parameters On the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor. Steps to Spin Motor Motor Fault Status Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in . Fault Status Monitor Faults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash. Tune Control Parameters Virtual Oscilloscope The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages. Virtual Oscilloscope for Rotor Angle and Phase Voltages Command Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in . Virtual Oscilloscope for Rotor Angle of FAST and eSMO Getting Started GUI Source code for this reference design is provided so the designer can debug firmware directly, as explained in . However, software debugging needs more time. To speed up development time, a UART based GUI software is provided to help quickly tune parameters on any customized application. This section introduces how to debug and tune the motor control parameters with the GUI software. For now, only the C2000 daughter-board firmware supports the GUI. Use caution when connecting the host PC to this reference board via UART, because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the Kit. Source code for this reference design is provided so the designer can debug firmware directly, as explained in . However, software debugging needs more time. To speed up development time, a UART based GUI software is provided to help quickly tune parameters on any customized application. This section introduces how to debug and tune the motor control parameters with the GUI software. For now, only the C2000 daughter-board firmware supports the GUI. Use caution when connecting the host PC to this reference board via UART, because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the Kit. Source code for this reference design is provided so the designer can debug firmware directly, as explained in . However, software debugging needs more time. To speed up development time, a UART based GUI software is provided to help quickly tune parameters on any customized application. This section introduces how to debug and tune the motor control parameters with the GUI software.For now, only the C2000 daughter-board firmware supports the GUI.Use caution when connecting the host PC to this reference board via UART, because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the Kit.HOT Ground Test Setup The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Add ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible. The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. Test Setup The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Add ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible. The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Add ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible. The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. The GUI software needs only a UART connection between the host PC and the reference design board. shows the hardware connection for testing with the GUI. Setup the hardware using the following steps: Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter. Connect motor wires to J10. Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parameters Power on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. Connect only TX, RX, and GND on J15 to the host PC through a UART-to-USB adapter. 3.3 V is not needed from the adapter.Connect motor wires to J10.Connect the multimeter, oscilloscope probes, and other measurement equipment to probe or analyze various signals and parametersPower on the board with a DC bus power, AC power supply or AC mains power to the inverter at J5 and J7. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. The maximum output of the DC power supply is 380 VDC. The maximum output of the AC power supply is 265 VAC, 50/60 Hz. AC main power is 220 VAC, 50/60 Hz. The maximum output of the DC power supply is 380 VDC.The maximum output of the AC power supply is 265 VAC, 50/60 Hz.AC main power is 220 VAC, 50/60 Hz. Hardware Connection for Testing With GUI Software Hardware Connection for Testing With GUI SoftwareAdd ferrite beads on JTAG signals and the USB cable if the external emulator has connectivity issues while testing. Make the connection lines as short as possible.The ground planes of both the power domains can be the same or different depending on the hardware configuration. Meet proper isolation requirements before connecting any test equipment with the board for personal safety and to prevent damaging equipment. Review the GND connections before powering the board. An isolator is required if measurement equipment is connected to the board. Overview of GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth. GUI Software Overview of GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth. GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth. GUI Software The GUI software can be run on a Microsoft Windows based system. The GUI has 6 tabs: Control Window, Debug Windows, Control Parameters, Motor Parameters, System Parameters, and Communication Setting, as shown in . The Analysis Windows is not available in this version GUI. Those tabs provides multiple functions, such as motor control, identification, control parameters tuning, virtual oscilloscope, read and write MCU flash, and so forth.MicrosoftWindows GUI Software GUI Software Setup Serial Port Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port A successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running. Successful Communication Status Setup Serial Port Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port A successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running. Successful Communication Status Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port A successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running. Successful Communication Status Run the GUI software on the host PC, wait for GUI window to pop up. shows the steps to connect the host PC to this reference design board via UART. The default baud rate is 258600bps. The user must change the baud rate setting on both GUI and C2000 if they want to use the different UART speed. Setup Serial Port Setup Serial PortA successful connection and communication can be verified by the number of Transmitted Data and Received Data. shows that both numbers increase continuously with a successful connection. Those transmitted and received data can be viewed by checking View Tx Text and View Rx Text; however, do not check these features to view when the motor is running.Transmitted DataReceived DataView Tx TextView Rx Text Successful Communication Status Successful Communication Status Motor Identification Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware. For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters. First, choose the motor identification command in the Control Window tab as shown in . Motor Identification Command Next, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings. Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification. Start Motor Identification After identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph. Store Motor Identification Result Motor Identification Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware. For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters. First, choose the motor identification command in the Control Window tab as shown in . Motor Identification Command Next, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings. Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification. Start Motor Identification After identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph. Store Motor Identification Result Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware. For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters. First, choose the motor identification command in the Control Window tab as shown in . Motor Identification Command Next, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings. Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification. Start Motor Identification After identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph. Store Motor Identification Result Implementing the correct motor parameters is critical for the firmware to control the motor successfully. The parameters include Stator resistance, Stator inductance, flux, and so forth, and those parameters have a default value for a default motor inside the firmware.For a different PMSM motor, those parameters are usually found from the specification; however, if those parameters cannot be found, the GUI software can identify those parameters.First, choose the motor identification command in the Control Window tab as shown in .Control Window Motor Identification Command Motor Identification CommandNext, select the Motor Parameters tab. The motor identification applies current to the motor to estimate motor parameters, those identification parameters, such as current for stator resistor estimation, current for stator inductor estimation and R/L Excitation Frequency (Hz) can be changed or left on the default settings.Motor ParametersR/L Excitation Frequency (Hz)Click the START button to start motor identification. An audible noise is heard, and the motor spins at low speed during identification. Monitor the identification status and motor parameters, the overall identification time is about 2 minutes. shows the steps to start motor identification.START Start Motor Identification Start Motor IdentificationAfter identification is complete, the Motor Pairs, Stator resistance, Stator inductance, flux, and so forth, must be written to MCU flash to make sure those parameters are saved inside the MCU. Select the Control Parameters tab, choose to store motor and control parameters to MCU Flash, or save them to a file. To verify writing is successful, click the Read Settings from MCU Flash button, then select the Motor Parameters tab to make sure motor parameters are the same as what were written before. shows the locations of the buttons mentioned in this paragraph.Control ParametersRead Settings from MCU FlashMotor Parameters Store Motor Identification Result Store Motor Identification Result Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct. Motor Drive Parameters On the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor. Steps to Spin Motor Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct. Motor Drive Parameters On the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor. Steps to Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct. Motor Drive Parameters On the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor. Steps to Spin Motor shows the Motor Parameters tab indicating the motor and control parameters. Make sure the motor electrical parameters are correct.Motor Parameters Motor Drive Parameters Motor Drive ParametersOn the Control Window tab, if the DC BUS voltage is high enough (> 230 VDC),the Control Command and GUI Command button are in green, the motor spin commands are effective. Follow the steps in to spin the motor.Control WindowControl CommandGUI Command Steps to Spin Motor Steps to Spin Motor Motor Fault Status Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in . Fault Status Monitor Faults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Motor Fault Status Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in . Fault Status Monitor Faults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in . Fault Status Monitor Faults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Faults can be found while the motor is spinning, especially when motor parameters are incorrect or the motor control parameters are not well tuned. Watch the Control Window carefully, and pay attention to any faults reported as shown in .Control Window Fault Status Monitor Fault Status MonitorFaults detection can be enabled or disabled as shown in . Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Disabling some faults can cause the board can break. Do not disable fault protections without full knowledge of acceptable settings. Motor Control Parameters and Faults Detection Disable Motor Control Parameters and Faults Detection Disable Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash. Tune Control Parameters Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash. Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash. Tune Control Parameters On the Debug Window tab, the PI regulators can be tuned for speed, current, and power control as shown in . The values are coefficient, the final gains are that these coefficients multiply the setting value in the C2000 controller. The setting gains are calculated per the motor electrical parameters. As shows, those tuned values can be written to MCU flash.Debug Window Tune Control Parameters Tune Control Parameters Virtual Oscilloscope The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages. Virtual Oscilloscope for Rotor Angle and Phase Voltages Command Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in . Virtual Oscilloscope for Rotor Angle of FAST and eSMO Virtual Oscilloscope The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages. Virtual Oscilloscope for Rotor Angle and Phase Voltages Command Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in . Virtual Oscilloscope for Rotor Angle of FAST and eSMO The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages. Virtual Oscilloscope for Rotor Angle and Phase Voltages Command Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in . Virtual Oscilloscope for Rotor Angle of FAST and eSMO The GUI software has a virtual oscilloscope function, and can show the waveform of angle, phase current, and phase voltage. shows how to configure the command to show the rotor angle and phase current. Virtual Oscilloscope for Rotor Angle and Phase Current Virtual Oscilloscope for Rotor Angle and Phase Current illustrates the command Test and Group 2 (A9) and shows the rotor angle and phase voltages.Test and Group 2 (A9) Virtual Oscilloscope for Rotor Angle and Phase Voltages Virtual Oscilloscope for Rotor Angle and Phase VoltagesCommand Test and Group 5 (AC) can show the rotor angle of FAST and EMO as shown in .Test and Group 5 (AC) Virtual Oscilloscope for Rotor Angle of FAST and eSMO Virtual Oscilloscope for Rotor Angle of FAST and eSMO Getting Started C2000 Firmware Download and install C2000WARE-MOTORCONTROL-SDK v5.01.00.00 or newer software from the link provided by TI. Install this Motor Control SDK software in the default folder. The software project then resides inside the C2000Ware Motor Control SDK folder at <install_location>\solutions\tida_010265_wminv\. Follow these steps to build and run this code with different incremental builds. Download and Install Software Required for Board Test Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. Opening Project Inside CCS The projectspec file for F280013x based reference design is in the directory below <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control Import the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method. Configure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in . Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties Project Structure Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h. The folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions. The folder src_board includes board drivers for this hardware board. The folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks. TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram The project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz. To simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options. Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Test Procedure There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices. Use caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit. Build Level 1: CPU and Board Setup Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 2: Open-Loop Check With ADC Feedback Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Build Level 3: Closed Current Loop Check Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Build Level 4: Full Motor Drive Control no Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Getting Started C2000 Firmware Download and install C2000WARE-MOTORCONTROL-SDK v5.01.00.00 or newer software from the link provided by TI. Install this Motor Control SDK software in the default folder. The software project then resides inside the C2000Ware Motor Control SDK folder at <install_location>\solutions\tida_010265_wminv\. Follow these steps to build and run this code with different incremental builds. Download and install C2000WARE-MOTORCONTROL-SDK v5.01.00.00 or newer software from the link provided by TI. Install this Motor Control SDK software in the default folder. The software project then resides inside the C2000Ware Motor Control SDK folder at <install_location>\solutions\tida_010265_wminv\. Follow these steps to build and run this code with different incremental builds. Download and install C2000WARE-MOTORCONTROL-SDK v5.01.00.00 or newer software from the link provided by TI. Install this Motor Control SDK software in the default folder. The software project then resides inside the C2000Ware Motor Control SDK folder at <install_location>\solutions\tida_010265_wminv\. Follow these steps to build and run this code with different incremental builds.C2000WARE-MOTORCONTROL-SDK<install_location>\solutions\tida_010265_wminv\ Download and Install Software Required for Board Test Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. Download and Install Software Required for Board Test Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended. Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Once installation is complete, close CCS, and create a new workspace for importing the project. Download and install Code Composer Studio IDE from the Code Composer Studio (CCS) Integrated Development Environment (IDE) tools folder. Version 12.5 or newer is recommended.Code Composer Studio Code Composer Studio (CCS) Integrated Development Environment (IDE)Install C2000WARE-MOTORCONTROL-SDK in one of two ways: Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Download the software through the C2000Ware MotorControl SDK tools folder Go to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button. Download the software through the C2000Ware MotorControl SDK tools folder C2000Ware MotorControl SDKGo to CCS and under View → Resource Explorer. Under the TI Resource Explorer, go to Software → C2000Ware_MotorControl_SDK, and click the install button.ViewResource ExplorerSoftwareC2000Ware_MotorControl_SDKOnce installation is complete, close CCS, and create a new workspace for importing the project. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device. This reference design supports SysConfig for configuring device pins and initializing device peripherals in an easy-to-use graphical interface. This feature is just for a reference in the current release. The designer can download SysConfig, and refer to C2000 SysConfig Software Guide to implement the SysConfig to migrate the reference design to the board for configuring the device.SysConfigC2000 SysConfig Software Guide Opening Project Inside CCS The projectspec file for F280013x based reference design is in the directory below <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control Import the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method. Configure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in . Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties Opening Project Inside CCS The projectspec file for F280013x based reference design is in the directory below <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control Import the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method. Configure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in . Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties The projectspec file for F280013x based reference design is in the directory below <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control Import the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method. Configure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in . Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control motor_controlImport the project within CCS and select the right build configurations by right-clicking on project name as shown in . Select the right build configuration for the HVAC reference design. The Flash_MtrInv_3SC build configuration supports the three-shunt current sensing method, Flash_MtrInv_1SC supports the single-shunt current sensing method.Flash_MtrInv_3SCFlash_MtrInv_1SCConfigure the project to select the supporting functions in the project by clicking Project → Import CCS Projects, and browse to <install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control for F280013x based reference design, and then right-click on the imported project name, click Properties command to set the pre-define symbols for the project as shown in .ProjectImport CCS Projects<install_location>\solutions\tida_010265_wminv\f280013x\ccs\motor_control motor_controlProperties Select the Correct Build Configurations Select the Correct Build Configurations Select the Correct Predefined Symbols in Project Properties Select the Correct Predefined Symbols in Project Properties Project Structure Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h. The folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions. The folder src_board includes board drivers for this hardware board. The folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks. TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram The project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz. To simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options. Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Project Structure Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h. The folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions. The folder src_board includes board drivers for this hardware board. The folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks. TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram The project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz. To simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options. Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h. The folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions. The folder src_board includes board drivers for this hardware board. The folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks. TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram The project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz. To simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options. Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Once the project is imported, the project explore appears inside CCS as shown in . The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h.hal.chal.hThe folder src_control includes hal.c and user_mtr1.c, in which users can change codes and definitions.src_controlhal.cuser_mtr1.cThe folder src_board includes board drivers for this hardware board.src_boardThe folder src_control includes motor drive files that call motor control core algorithm functions within the interrupt service routines and background tasks.src_control TIDA-010265 Project Explorer View TIDA-010265 Project Explorer View shows the project software flow diagram of ISR for motor control, a main loop for motor control parameters update in background loop. Firmware Project Flow Diagram Firmware Project Flow DiagramThe project consists of a motor control interrupt service routine, which are called every PWM cycle. A few background tasks are called in a loop forever in main() and can be used to run slow tasks for which absolute timing accuracy is not required, motor control parameters update, and so on. A CPU timer is used to trigger slow background tasks. motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 that is periodically triggered at USER_M1_ISR_FREQ_Hz.motor1CtrlISRTo simplify the system, the bring up and design of the software for this reference design is organized in four labs with incremental builds (DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. lists the detailed incremental build options. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting the rebuild all compiler option. provides more details to run each of the build level options.sys_settings.hrebuild all Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO Incremental Build Options OPERATION BUILD OPTION DESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO OPERATION BUILD OPTION DESCRIPTION OPERATION BUILD OPTION DESCRIPTION OPERATIONBUILD OPTIONDESCRIPTION MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO MOTOR DRIVE DMC_LEVEL_1 50% PWM duty, verify ADC offset calibration, PWM output and phase shift MOTOR DRIVEDMC_LEVEL_150% PWM duty, verify ADC offset calibration, PWM output and phase shift DMC_LEVEL_2 Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_2Open-loop v/f control to check current and voltage sensing signals for motor DMC_LEVEL_3 Closed current loop to check the hardware settings DMC_LEVEL_3Closed current loop to check the hardware settings DMC_LEVEL_4 Motor parameters identify and run with InstaSPIN-FOC or eSMO DMC_LEVEL_4Motor parameters identify and run with InstaSPIN-FOC or eSMO Test Procedure There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices. Use caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit. Build Level 1: CPU and Board Setup Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 2: Open-Loop Check With ADC Feedback Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Build Level 3: Closed Current Loop Check Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Build Level 4: Full Motor Drive Control no Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Test Procedure There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices. Use caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit. There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices. Use caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit. There are high voltages present on the board. To safely evaluate this board, use an appropriate isolated and current limited power source. Before power is applied to the board, an appropriate resistive or electronic load must be connected at the output. Do not handle the unit when power is applied. Only use appropriately rated equipment and follow proper isolation and safety practices.high voltagesUse caution when connecting scopes and other test equipment to the board because the AC rectifier generates the DC-output voltage, which has a HOT Ground floating from the protective earth ground. Isolation transformers must be used when connecting grounded equipment to the kit.HOT Ground Build Level 1: CPU and Board Setup Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 1: CPU and Board Setup Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Because this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter. In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Objectives learned in this build level: Evaluate the open-loop operation of the system Use the HAL object to set up the MCU controller and initialize the inverter Verify the PWM and ADC driver modules Become familiar with the operation of CCS Evaluate the open-loop operation of the systemUse the HAL object to set up the MCU controller and initialize the inverterVerify the PWM and ADC driver modulesBecome familiar with the operation of CCSBecause this system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. Only bias power supply for MCU controller and gate drivers is used in this build level. The high-voltage AC and DC power supply are not implemented on the inverter.In this build level, the board is executed in open-loop fashion with a fixed duty cycle. The duty cycles are set to 50% for the motor. This build level verifies the sensing of feedback values from the power stage and also operation of the PWM gate driver and makes sure there are no hardware issues. Additionally calibration of input and output voltage sensing can be performed in this build level. The software flow for this build level is shown in . Control Software Block Diagram: Build Level 1 – Offset Validation Control Software Block Diagram: Build Level 1 – Offset Validation Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware To start CCS and open the project, complete the following steps: Connect the emulator at J15. Connect AC or DC power supply to J5 as shown in . Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project. In the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the emulator at J15.Connect AC or DC power supply to J5 as shown in .Open CCSv12.5 (or newer). A project contains all the files and build options needed to generate an executable output file (.out), which can be run on the C2000 controller-based hardware. On the menu bar, click Project → Import CCS Projects. Below Select search-directory:, browse to the C2000Ware Motor Control SDK folder and select <install_location>\solutions\tida_010265_wminv. Click Finish to import the related project into CCS. This project invokes all the necessary tools (compiler, assembler, linker) to build the project.ProjectImport CCS ProjectsSelect search-directory:<install_location>\solutions\tida_010265_wminvFinishIn the project window on the left, click the plus sign (+) to the left of Project. An example project window is shown in . Connect the External AC or DC Power Supply to Verify the Hardware Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Build and Load Project To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). To build and load the project, complete the following steps: Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1. If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully. In the Project Explorer make sure the correct target configuration file is set as Active as shown in . Turn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main(). Right-click on the project name, click the Properties command, move to pre-defined symbols to change GUI_SCI_EN to GUI_SCI_N to disable the SCI function for the GUI as shown in . The SCI function can be enabled again to allow GUI control through SCI, as described in . PropertiesGUI_SCI_ENGUI_SCI_NThe SCI function can be enabled again to allow GUI control through SCI, as described in .Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_1.If another build option was built previously, right click on the project name and click on Clean Project, and then click on Build Project. Watch the tools run in the build window. The project builds successfully.Clean ProjectBuild ProjectIn the Project Explorer make sure the correct target configuration file is set as Active as shown in .Project ExplorerTurn on the AC or DC power supply to apply 30 VAC or 40 VDC to J5, to create the +15 V and 3.3 V for the controller and gate driver. Click on the Debug button or click Run → Debug. The build level 1 code can be compiled and loaded on the C2000 device. Notice the CCS Debug icon in the upper right-hand corner, indicating that the user is now in the Debug Perspective view. The program can be stopped at the start of main().RunDebugDebug Perspective Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset Setup Debug Environment Windows To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Build Level 1: Expressions Watch Window at Reset To watch local and global variables while debugging code is a standard debug practice. There are various methods for doing this in CCS, such as memory views and watch views. Additionally, CCS has the ability to make time (and frequency) domain plots. This ability allows the user to view waveforms using the graph tool. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing. Alternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed. Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance. Click View → Expressions on the menu bar to open an Expressions watch window . Move the mouse to the Expressions window to view the variables being used in the project. Add variables to the Expressions window as shown in . The window uses the number format associated with variables during declaration, and shows an example of the Expressions window. Select a desired number format for the variable by right clicking on expressions and choosing.ViewExpressionsExpressionsExpressionsExpressionsExpressionsAlternately, a group of variables can be imported into the Expressions window by right clicking within the Expressions window and clicking Import, and browse to the directory of the project at <install_location>\solutions\tida_010265_wminv\src_control\common\debug and pick BuildLevel1.txt and click the OK button to import the variables shown in .Some of the variables have not been initialized at this point in the main code and can contain some useless values. ExpressionsExpressionsImport<install_location>\solutions\tida_010265_wminv\src_control\common\debugBuildLevel1.txtOKSome of the variables have not been initialized at this point in the main code and can contain some useless values.The structure variables motorVars_M1[] have references to most variables that are related to controlling the motor. By expanding this variable, you can see and edit all the variables, as needed.motorVars_M1[]Click on the Continuous Refresh button in the expressions window. This enables the window to run with real-time mode. By clicking the down arrow in this Expressions window, you can select Customize Continuous Refresh Interval and edit the refresh rate of the expressions window. Choosing too fast an interval can affect performance.Continuous RefreshExpressionsCustomize Continuous Refresh Interval Build Level 1: Expressions Watch Window at Reset Build Level 1: Expressions Watch Window at Reset Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Run the Code To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. To run the code, complete the following steps: Run the project by clicking the button , or click Run → Resume in the Debug tab. In the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window. The project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference. In the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously. Check calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in . Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz. The controller can now be halted, and the debug connection terminated. Fully halt 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. Erase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. Close the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate. Run the project by clicking the button , or click Run → Resume in the Debug tab.RunResumeDebugIn the Expressions window, set the variables motorVars_M1.flagEnableRunAndIdentify to "1" after systemVars.flagEnableSystem was automatically set to "1" in the watch window.ExpressionsmotorVars_M1.flagEnableRunAndIdentifysystemVars.flagEnableSystemThe project can now run, and the values in the graphs and Expressions window can continuously update as shown in while using this project. The windows can be resized according to user preference.ExpressionsIn the watch view, the variables motorVars_M1.flagRunIdentAndOnLine can be set to "1" automatically. The ISRCount is increasing continuously.motorVars_M1.flagRunIdentAndOnLineISRCountCheck calibration offsets of the motor, the offset value of the motor phase current sensing can be equal to approximately half of the scale current of ADC as shown in .Probe the PWM output for motor drive control with an oscilloscope at J15 as shown in . All of the PWM duty are set to 50% in this build level, the PWM output waveforms are as shown in . The PWM switching frequency of motor_1 is 15 kHz.The controller can now be halted, and the debug connection terminated. Fully halt 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.HaltTargetHaltRunResetErase the code in the controller for the next build level by clicking Tools → On-Chip Flash, and click Erase Flash in the On-Chip Flash tab (make sure that all of the flash banks are checked) as shown in . This operation erases all of the program code stored in flash. (This step is optional, the user can ignore this step to load the new program code in next build level.)Do not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash. ToolsOn-Chip FlashErase FlashOn-Chip FlashDo not click Cancel, turn off the power of the board, or disconnect the emulator when erasing flash.CancelClose the CCS debug session by clicking the Terminate Debug Session button or clicking Run → Terminate.Terminate Debug SessionRunTerminate Build Level 1: Expressions Window at Run Time Build Level 1: Expressions Window at Run Time Build Level 1: Expressions Window at Run Time Build Level 1: MCU PWM Output and IPM Output Build Level 1: MCU PWM Output and IPM Output Build Level 1: MCU PWM Output and IPM Output Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 1: Erase Program Code in Flash for Next Build Level Build Level 2: Open-Loop Check With ADC Feedback Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Build Level 2: Open-Loop Check With ADC Feedback Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Objectives learned in this build level: Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit. Test InstaSPIN-FOC FAST or eSMO modules for motor control. Implements a simple scalar v/f control of motor to drive motor for validating current and voltage sensing circuit, and IPM circuit.Test InstaSPIN-FOC FAST or eSMO modules for motor control.This system is running with open-loop control, the ADC measured values are only used for instrumentation purposes in this build level. The high-voltage DC power supply is implemented on the inverter, the bias power supply for the MCU controller and IPM is provided by the auxiliary power-supply module. shows the software flow for this build level. Control Software Block Diagram: Build Level 2 – Open-Loop Control Control Software Block Diagram: Build Level 2 – Open-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware To start CCS and open the project, complete the following steps: Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time. Connect a motor to J10. Follow Steps 2 and 3 of to open the project. Connect an isolated AC power source capable of providing universal input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A. Do not turn the power supply on at this time.Connect a motor to J10.Follow Steps 2 and 3 of to open the project. Connect the External AC or DC Power Supply to Verify the Hardware Connect the External AC or DC Power Supply to Verify the Hardware Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Build and Load Project To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Set DMC_BUILDLEVEL to DMC_LEVEL_2. Follow Steps 2 to 4 of to build the project and load code into controller. Set DMC_BUILDLEVEL to DMC_LEVEL_2.Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel2.txt. The Expressions window appears as shown in .ExpressionsBuildLevel2.txtExpressions Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Run the Code To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current To run the code, complete the following steps: Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC. Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in . To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in . Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in . Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10". 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Set the AC power source output to 0 V, turn on the AC power source, slowly increase the output voltage from 0-V to 100-VAC.Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in .RunResumeDebugmotorVars_M1.faultMtrUse.allTo verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly. #define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt motorVars_M1.flagEnableRunAndIdentifyExpressionsuser_mtr1.h#define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz #define USER_MOTOR1_FREQ_HIGH_Hz (200.0f) // Hz #define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt #define USER_MOTOR1_VOLT_MAX_V (200.0f) // VoltThe motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in .motorVars_M1.speedRef_Hz,motorVars_M1.speed_HzExpressionsConnect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in .Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10".motorVars_M1.overCurrent_AmotorVars_M1.overCurrent_AmotorVars_M1.flagEnableRunAndIdentifymotorVars_M1.faultMtrUse.allThe 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.HaltTargetHaltRunResetClose the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate.Terminate Debug SessionRunTerminate Build Level 2: Expressions Window at Run Time Build Level 2: Expressions Window at Run Time Build Level 2: Motor Phase Voltage and Current Build Level 2: Motor Phase Voltage and Current Build Level 3: Closed Current Loop Check Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Build Level 3: Closed Current Loop Check Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Objectives learned in this build level: Evaluate the closed current loop of motor operation. In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Objectives learned in this build level: Evaluate the closed current loop of motor operation. Evaluate the closed current loop of motor operation.In this build level, the motor is controlled using i/f control that the rotor angle is generated from ramp generator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Control Software Block Diagram: Build Level 3 – Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Connect a programmable, isolated AC power supply capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the power supply current limit to 2 A and the output frequency to 50/60 Hz. Do not turn the power supply on at this time.Connect a motor (compressor) to J10.Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3. Follow Steps 2 to 4 of to build the project and load code into controller. Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_3.Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel3.txt. The Expressions window appears as shown in .ExpressionsBuildLevel3.txtExpressions Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in . To verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close. The motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly. If the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC.Run the project by clicking the button, or click Run → Resume in the Debug tab. Set systemVars.flagEnableSystem to "1" after a fixed time, that means the offsets calibration has been done and the power relay for inrush is turned on. The motor fault flags for motorVars_M1.faultMtrUse.all need to equal to "0" , if the values do not, check the current and voltage sensing circuit as described in .RunResumeDebugsystemVars.flagEnableSystemmotorVars_M1.faultMtrUse.allTo verify current closed-loop control for motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in . The motor needs to run with a closed-loop control using the angle from the angle generator at a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVarsM1.speed_Hz in Expressions window, both variables value need to be very close.motorVars_M1.flagEnableRunAndIdentifyExpressionsmotorVars_M1.speedRef_Hz,motorVarsM1.speed_HzThe motor current Iq can be set and changed with motorVars_M1.Idq_Set_A.value[1] motorVars_M1.Idq_Set_A.value[1]Connect oscilloscope probes to IPM output to watch the motor phase voltage and current as shown in . Change the Idq_set_A[0].value[1] in the Expressions window, the motor phase current needs to be increasing accordingly.Idq_set_A[0].value[1] ExpressionsIf the motor cannot run with current-closed loop and appears to experience an overcurrent fault, check if the sign of adcData[0].current_sf and the value of userParams[0].current_sf are set correctly according to the hardware board.adcData[0].current_sfuserParams[0].current_sfThe controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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.motorVars_M1.flagEnableRunAndIdentifyHaltTargetHaltRunResetClose CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate.Terminate Debug SessionRunTerminate Build Level 3: Expressions Window at Run Time Build Level 3: Expressions Window at Run Time Build Level 3: Motor Current Under 2-A IQ Setting Build Level 3: Motor Current Under 2-A IQ SettingQ Build Level 4: Full Motor Drive Control no Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Build Level 4: Full Motor Drive Control no no no no Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system In this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Objectives learned in this build level: Evaluate the complete motor drive Evaluate the additional features, field weakening control for motor Evaluate the completed system Evaluate the complete motor driveEvaluate the additional features, field weakening control for motorEvaluate the completed systemIn this build level, the outer speed loop is closed with the inner current loop for the motor such that the rotor angle is from the FAST or eSMO estimator module. shows the software flow for this build level. Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Control Software Block Diagram: Build Level 4 – Speed and Current Close-Loop Control Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Start CCS and Open Project To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. To start CCS and open the project, complete the following steps: Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time. Connect a motor (compressor) to J10. Follow Steps 2 and 3 of to open the project. Connect a programmable, isolated AC source capable of providing universal AC input up to 750 W to the input terminals (connector J5) of the reference board as shown in . Set the AC source current limit to 8 A. Do not turn the power supply on at this time.Connect a motor (compressor) to J10.Follow Steps 2 and 3 of to open the project. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Build and Load Project To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. To build and load the project, complete the following steps: Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4. Follow Steps 2 to 4 of to build the project and load code into controller. Open the sys_settings.h file, set DMC_BUILDLEVEL to DMC_LEVEL_4.Follow Steps 2 to 4 of to build the project and load code into controller. Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Setup Debug Environment Windows Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in . Follow Steps 1 to 4 of to import the variables into the Expressions window by picking BuildLevel4.txt. The Expressions window appears as shown in .ExpressionsBuildLevel4.txtExpressions Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Run the Code To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor To run the code, complete the following steps: Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC. The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in . Set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value Set both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. The controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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 the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate. Set the AC source output to 0 V at 50/60 Hz, turn on the AC power supply, slowly increase the input voltage from 0-V to 220-V AC.The required motor parameters must be recorded in the header files (user_mtr1.h) as shown in the following example codes. If the motor parameters are not well known, the motor identification can be used to achieve the motor parameters if the FAST estimator is implemented in the reference design.#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) user_mtr1.h#define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f)Change the userParams_M1.flag_bypassMotorId value to "false" to enable the motor identification as the following example code for motor.// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false; userParams_M1.flag_bypassMotorId// true->enable identification, false->disable identification userParams[MTR_1].flag_bypassMotorId = false;Set the right identification variables value in the user_mtr1.h according to the specification of the motor. #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 user_mtr1.h #define USER_MOTOR1_RES_EST_CURRENT_A (1.0f) // 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 (6.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 motorRebuild the project and load the code into the controller, run the project by clicking on the button, or click Run → Resume in the Debug tab. The systemVars.flagEnableSystem needs to 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 motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0", if not, check the current and voltage sensing circuit as described in .RunResumeDebugsystemVars.flagEnableSystemmotorVars_M1.faultMtrUse.allSet the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in , the motor identification can be executed, the whole process takes about 150 s. Once motorVars_M1.flagEnableRunAndIdentify is equal to "0", the motor parameters have been identified. Record the watch window values with the newly-defined motor parameters in user_mtr1.h as follows: USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value motorVars_M1.flagEnableRunAndIdentifyExpressionsmotorVars_M1.flagEnableRunAndIdentify USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s value USER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s value USER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s value USER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s value USER_MOTOR1_Rs = motorVars_M1.Rs_Ohm’s valueUSER_MOTOR1_Ls_d = motorVars_M1.Ls_d_H’s valueUSER_MOTOR1_Ls_q = motorVars_M1.Ls_q_H’s valueUSER_MOTOR_RATED_FLUX = motorVars_M1.flux_VpHz’s valueSet both userParams_M1.flag_bypassMotorId to "true" after successfully identify the motors parameters, rebuild the project and load the code into the controller. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. userParams_M1.flag_bypassMotorId Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor. Set the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows. To change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps. Set the variables motorVars_M1.flagEnableRunAndIdentify equal to "1" again for starting to run the motor.motorVars_M1.flagEnableRunAndIdentifySet the variables motorVars_M1.speedRef_Hz to a different value and watch how the motor shaft speed follows.motorVars_M1.speedRef_HzTo change the acceleration, enter a different acceleration value for the variables motorVars_M1.accelerationMax_Hzps and motorVars_M1.accelerationMax_Hzps.motorVars_M1.accelerationMax_HzpsmotorVars_M1.accelerationMax_HzpsThe controller can now be halted before setting the motorVars_M1.flagEnableRunAndIdentify to "0", 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. motorVars_M1.flagEnableRunAndIdentifyHaltTargetHaltRunResetClose the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate.Terminate Debug SessionRunTerminate Build Level 4: Expressions Window at Run Time Build Level 4: Expressions Window at Run Time Build Level 4: Rotor Angle, Phase Current of Motor Build Level 4: Rotor Angle, Phase Current of Motor Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Tuning Motor Drive FOC Parameters The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files. // Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f) The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. The sliding mode current observer consists of a model-based current observer and a bang-bang control generator driven by error between estimated motor currents and actual motor currents. The F and G parameters are calculated based on the motor parameters Rs, and Ls as described in . The observer gain k for bang-bang control, the cutoff frequency for LPF, and the Kp and Ki for PLL angle tracker must be tuned according to the testing state, and try to get the best parameters. The user can run the FAST estimator and eSMO in parallel to validate the angle from the eSMO for tuning the parameters. The initial parameters are defined in the user-mtr1.h files.pi// Only for eSMO #define USER_MOTOR1_KSLIDE_MAX (1.50f) #define USER_MOTOR1_KSLIDE_MIN (0.75f) #define USER_MOTOR1_PLL_KP_MAX (10.0f) #define USER_MOTOR1_PLL_KP_MIN (2.0f) #define USER_MOTOR1_PLL_KP_SF (5.0f) #define USER_MOTOR1_BEMF_THRESHOLD (0.5f) #define USER_MOTOR1_BEMF_KSLF_FC_Hz (2.0f) #define USER_MOTOR1_THETA_OFFSET_SF (1.0f) #define USER_MOTOR1_SPEED_LPF_FC_Hz (200.0f)The speed and current PI regulator gains are calculated according to the motor parameters, the user can tune these gains online to optimize the control performance of the system. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values. Adding the motorVars[0].Kp_spd, motorVars[0].Ki_spd, motorVars[0].Kp_Iq, motorVars[0].Ki_Iq, motorVars[0].Kp_Id, and motorVars[0].Ki_Id to the Expressions window in CCS Debug Perspective. Change the PI gains for the compressor motor drive and record the values.Expressions Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Tuning Field Weakening and MTPA Control Parameters The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively. In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor. Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system. After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control MTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in for enabling the FWC and MTPA, respectively.MOTOR1_FWCMOTOR1_MTPAIn the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor.user_mtr1.hmtpa.hAdd the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system.ExpressionsAfter tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control. USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control user_mtr1.hUSER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control.USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening ControlUSER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening ControlMTPA control parameters are calculated according to the motor parameters, L d , L q , and ψ m , so there are not any additional parameters to be tuned online. L d L d L d L d L L d d L q L q L q L q L L q q ψ m ψ m ψ m ψ m ψ ψ m m Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Tuning Current Sensing Parameters Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. //! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). //! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). //! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Accurate current sensing is important to estimate the rotor angle and speed, and also have the best dynamic motor control. The current sensing parameters must match the hardware by setting the following related parameters: Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design. Dead-band time, the rising edge delay time must be greater than (high-side turn on time) + (low side turn-off time) of the power module, and the falling edge delay time must be greater than (high-side turn-off time) + (low-side turn-on time) of the power module as shown in the following setting for a power module used in the reference design.//! \brief Defines the PWM deadband falling edge delay count (system clocks) #define MTR1_PWM_DBFED_CNT (uint16_t)(2.5f * 120.0f) // 2.5us, (>2.0us) //! \brief Defines the PWM deadband rising edge delay count (system clocks) #define MTR1_PWM_DBRED_CNT (uint16_t)(2.5f * 120.0f) // 2.50us, (>2.0us) Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time). Minimum duration of pulse width PWM, specifies to be greater than (Hardware delay time + Dead band time + Ringing duration + ADC sampling time).//! \brief Defines the minimum duration, Clock Cycle #define USER_M1_DCLINKSS_MIN_DURATION (450U) Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time). Sample and hold delay time, specifies the time delay from PWM output to ADC sample time for current sensing. The delay time is dependent on the hardware and includes the propagation delay of the gate driver circuit and turn on and turn off delay of the power FET, and is less than or equal to (Minimum duration – ADC sampling time).//! \brief Defines the sample delay, Clock Cycle #define USER_M1_DCLINKSS_SAMPLE_DELAY (430U) Test Results The following sections show the test data from characterizing the design. The test results are divided in multiple sections that cover the steady-state performance and data, functional performance waveforms, and transient performance waveforms of the fan and compressor motor. Load and Thermal Test is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz This board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 Overcurrent Protection by External Comparator Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS Test Results The following sections show the test data from characterizing the design. The test results are divided in multiple sections that cover the steady-state performance and data, functional performance waveforms, and transient performance waveforms of the fan and compressor motor. The following sections show the test data from characterizing the design. The test results are divided in multiple sections that cover the steady-state performance and data, functional performance waveforms, and transient performance waveforms of the fan and compressor motor. The following sections show the test data from characterizing the design. The test results are divided in multiple sections that cover the steady-state performance and data, functional performance waveforms, and transient performance waveforms of the fan and compressor motor. Load and Thermal Test is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz This board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz Load and Thermal Test is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz This board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz This board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz is a waveform at 3000 RPM (200 Hz) under 500-W dyno load. The waveform includes the following display: CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U CH1 (Blue): DCBUS voltageCH2 (Light Blue): AC Input VoltageCH4 (Green): Current of phase U Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz Phase Current and Voltage Waveforms of Motor at 500 W, 200 Hz shows a waveform at 3300 RPM (220 Hz) under 300-W dyno load with field weakening enabled. The motor tested is rated at 3000 RPM (200 Hz) and now works at field-weakening status. CH1 (Blue): DCBUS voltage CH2 (Light Blue): AC Input Voltage CH4 (Green): Current of phase U CH1 (Blue): DCBUS voltageCH2 (Light Blue): AC Input VoltageCH4 (Green): Current of phase U Field Weakening Test at 300 W, 220 Hz Field Weakening Test at 300 W, 220 HzThis board is designed to work at 750 W for a short amount of time (≤ 1 minute), pay attention to rising temperatures. If running the board at high power or for a long time, use an external cooling fan to cool down the heat sink. shows the board temperature rising at 500 W, 3000 RPM (200 Hz). Thermal Test Under 220 VAC, 500 W, 200 Hz Thermal Test Under 220 VAC, 500 W, 200 Hz Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 Overcurrent Protection by External Comparator Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 Overcurrent Protection by External Comparator As explained in , there is a comparator U10 for external overcurrent protection. shows the eternal overcurrent protection waveform. Output (net IPM_CIN) of U10 is high when current on R80 exceeds the reference point set by negative input of U10, high-level IPM_CIN then triggers IPM fault protect to output a low-level signal at IPM_FAULT, which is connected to the microcontroller. CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of R80 CH1 (Blue):IPM_FAULTCH2 (Light Blue): IPM_CINCH4 (Green): Current of R80 Overcurrent Protection by External Comparator Overcurrent Protection by External Comparator Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS As explained in , the internal CMPSS can be configured for overcurrent protection. shows the internal overcurrent protection waveform, is triggered by internal CMPSS, since both IPM_FALUT and IPM_CIN are not triggered. Overcurrent can be set with the following codes. objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; objSets->maxPeakCurrent_A = USER_M1_ADC_FULL_SCALE_CURRENT_A * 0.4975f; CH1 (Blue):IPM_FAULT CH2 (Light Blue): IPM_CIN CH4 (Green): Current of phase U CH1 (Blue):IPM_FAULTCH2 (Light Blue): IPM_CINCH4 (Green): Current of phase U Overcurrent Protection by Internal CMPSS Overcurrent Protection by Internal CMPSS Migrate Firmware to a New Hardware Board If the designer wants to migrate the reference design to a hardware board, change the motor related PWM, CMPSS, ADC peripherals configuration, hardware parameters, and motor parameters, accordingly in the hal.c, hal.h, and user_mtr1.h files as described in the following sections. Configure the PWM, CMPSS, and ADC Modules The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes. Configure PWM and CMPSS base address for motor drive: // EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE Configure ADC base address and channels for motor drive: // Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 Configure peripheral interrupt for motor drive control: // Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1 Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15 Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual. // XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15 The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor. void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() function The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes. void HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; } Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes. void HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() function The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control. static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function Setup Hardware Board Parameters The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent. All of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes. //! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) Configure Faults Protection Parameters Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent. //! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Setup Motor Electrical Parameters The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet. #define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Migrate Firmware to a New Hardware Board If the designer wants to migrate the reference design to a hardware board, change the motor related PWM, CMPSS, ADC peripherals configuration, hardware parameters, and motor parameters, accordingly in the hal.c, hal.h, and user_mtr1.h files as described in the following sections. If the designer wants to migrate the reference design to a hardware board, change the motor related PWM, CMPSS, ADC peripherals configuration, hardware parameters, and motor parameters, accordingly in the hal.c, hal.h, and user_mtr1.h files as described in the following sections. If the designer wants to migrate the reference design to a hardware board, change the motor related PWM, CMPSS, ADC peripherals configuration, hardware parameters, and motor parameters, accordingly in the hal.c, hal.h, and user_mtr1.h files as described in the following sections.hal.chal.huser_mtr1.h Configure the PWM, CMPSS, and ADC Modules The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes. Configure PWM and CMPSS base address for motor drive: // EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE Configure ADC base address and channels for motor drive: // Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 Configure peripheral interrupt for motor drive control: // Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1 Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15 Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual. // XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15 The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor. void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() function The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes. void HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; } Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes. void HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() function The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control. static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function Configure the PWM, CMPSS, and ADC Modules The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes. Configure PWM and CMPSS base address for motor drive: // EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE Configure ADC base address and channels for motor drive: // Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 Configure peripheral interrupt for motor drive control: // Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1 Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15 Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual. // XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15 The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor. void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() function The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes. void HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; } Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes. void HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() function The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control. static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes. Configure PWM and CMPSS base address for motor drive: // EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE Configure ADC base address and channels for motor drive: // Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 Configure peripheral interrupt for motor drive control: // Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1 Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15 Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual. // XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15 The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor. void HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() function The CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes. void HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; } Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes. void HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() function The configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control. static inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function The application parameters to control the motor are written as #define configuring the PWM, CMPSS, and ADC modules base address in hal.h according to the hardware. The PWM, CMPSS, and ADC of the compressor motor defines are shown in the following codes.#definehal.hConfigure PWM and CMPSS base address for motor drive:// EPWM #define MTR1_PWM_U_BASE EPWM2_BASE #define MTR1_PWM_V_BASE EPWM3_BASE #define MTR1_PWM_W_BASE EPWM4_BASE // CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASEConfigure ADC base address and channels for motor drive:// Three shunts // Using ADCA/ADCC for current sensing #define MTR1_ADC_TRIGGER_SOC ADC_TRIGGER_EPWM2_SOCA // EPWM2_SOCA #define MTR1_ADC_I_SAMPLEWINDOW 14 #define MTR1_ADC_V_SAMPLEWINDOW 20 #define MTR1_IU_ADC_BASE ADCC_BASE // ADCC-A7/C3*/CMP4 -SOC1 #define MTR1_IV_ADC_BASE ADCA_BASE // ADCA-A4*/C14/CMP2 -SOC2 #define MTR1_IW_ADC_BASE ADCA_BASE // ADCA-A0*/C15/CMP3 -SOC1 #define MTR1_IU_ADCRES_BASE ADCCRESULT_BASE // ADCC-A7/C3* #define MTR1_IV_ADCRES_BASE ADCARESULT_BASE // ADCA-A4*/C14 #define MTR1_IW_ADCRES_BASE ADCARESULT_BASE // ADCA-A0*/C15 #define MTR1_IU_ADC_CH_NUM ADC_CH_ADCIN3 // ADCC-A7/C3* #define MTR1_IV_ADC_CH_NUM ADC_CH_ADCIN4 // ADCA-A4*/C14 #define MTR1_IW_ADC_CH_NUM ADC_CH_ADCIN0 // ADCA-A0*/C15 #define MTR1_IU_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_SOC_NUM ADC_SOC_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_SOC_NUM ADC_SOC_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1 #define MTR1_IU_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCC-A7/C3* -SOC1-PPB1 #define MTR1_IV_ADC_PPB_NUM ADC_PPB_NUMBER2 // ADCA-A4*/C14 -SOC2-PPB2 #define MTR1_IW_ADC_PPB_NUM ADC_PPB_NUMBER1 // ADCA-A0*/C15 -SOC1-PPB1Configure peripheral interrupt for motor drive control:// Interrupt #define MTR1_PWM_INT_BASE MTR1_PWM_U_BASE // EPWM1 #define MTR1_ADC_INT_BASE ADCC_BASE // ADCC-A11/C0*-SOC4 #define MTR1_ADC_INT_NUM ADC_INT_NUMBER1 // ADCC_INT1 -SOC4 #define MTR1_ADC_INT_SOC ADC_SOC_NUMBER4 // ADCC_INT1 -SOC4 #define MTR1_PIE_INT_NUM INT_ADCC1 // ADCC_INT1 -SOC4 #define MTR1_CPU_INT_NUM INTERRUPT_CPU_INT1 // ADCC_INT1-CPU_INT1 #define MTR1_INT_ACK_GROUP INTERRUPT_ACK_GROUP1 // ADCC_INT1-CPU_INT1Configure the connections between the ADC pin and CMPSS modules in hal.h based on the hardware, the details refer to the Table, Analog Pins, and Internal Connections in the TMS320F280013x Real-Time Microcontrollers Technical Reference Manual hal.hTMS320F280013x Real-Time Microcontrollers Technical Reference Manual// CMPSS->Iu/Iv/Iw #define MTR1_CMPSS_U_BASE CMPSSLITE4_BASE #define MTR1_CMPSS_V_BASE CMPSSLITE2_BASE #define MTR1_CMPSS_W_BASE CMPSSLITE3_BASE #define MTR1_IU_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_4 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_4 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_2 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_2 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_SEL ASYSCTL_CMPHPMUX_SELECT_3 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_SEL ASYSCTL_CMPLPMUX_SELECT_3 // CMPSS3L-A0*/C15 #define MTR1_IU_CMPHP_MUX 1 // CMPSS4H-A7/C3* #define MTR1_IU_CMPLP_MUX 1 // CMPSS4L-A7/C3* #define MTR1_IV_CMPHP_MUX 0 // CMPSS2H-A4*/C14 #define MTR1_IV_CMPLP_MUX 0 // CMPSS2L-A4*/C14 #define MTR1_IW_CMPHP_MUX 2 // CMPSS3H-A0*/C15 #define MTR1_IW_CMPLP_MUX 2 // CMPSS3L-A0*/C15Configure the trip signals from CMPSS to be passed to EPWM and GPIO output in hal.h based on the hardware, the details refer to Table, ePWM X-BAR MUX Configuration Table and Table, OUTPUT X-BAR MUX Configuration Table in TMS320F280013x Real-Time Microcontrollers Technical Reference Manual.hal.hTMS320F280013x Real-Time Microcontrollers Technical Reference Manual// XBAR-EPWM #define MTR1_XBAR_TRIP_ADDRL XBAR_O_TRIP8MUX0TO15CFG #define MTR1_XBAR_TRIP_ADDRH XBAR_O_TRIP8MUX16TO31CFG #define MTR1_XBAR_INPUT1 XBAR_INPUT1 #define MTR1_TZ_OSHT1 EPWM_TZ_SIGNAL_OSHT1 #define MTR1_XBAR_TRIP XBAR_TRIP8 #define MTR1_DCTRIPIN EPWM_DC_COMBINATIONAL_TRIPIN8y // XBAR-EPWM->Iu/Iv/Iw #define MTR1_IU_XBAR_EPWM_MUX XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_EPWM_MUX XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_EPWM_MUX XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L // CMPSS3-HP&LP, A0*/C15 #define MTR1_IU_XBAR_MUX XBAR_MUX06 // CMPSS4-HP&LP, A7/C3* #define MTR1_IV_XBAR_MUX XBAR_MUX02 // CMPSS2-HP&LP, A4*/C14 #define MTR1_IW_XBAR_MUX XBAR_MUX04 // CMPSS3-HP&LP, A0*/C15The related ADC channels are used for motor-current sensing which pins are internally connected to the Comparator Subsystem (CMPSS), configure the CMPSS registers in the HAL_setupCMPSSs() function in the hal.c file as shown in the following codes. Three CMPSS modules are used to implement positive and negative overcurrent protection of U-phase, V-phase, and W-phase of the motor.hal.cvoid HAL_setupCMPSSsMTR(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) #if !defined(MOTOR1_DCLINKSS) || !defined(MOTOR2_DCLINKSS) uint16_t cmpsaDACH; #endif // !(MOTOR1_DCLINKSS || MOTOR2_DCLINKSS) uint16_t cmpsaDACL; ... ... #else // !MOTOR1_DCLINKSS, Three-shunt cmpsaDACH = MTR1_CMPSS_DACH_VALUE; cmpsaDACL = MTR1_CMPSS_DACL_VALUE; ASysCtl_selectCMPHPMux(MTR1_IU_CMPHP_SEL, MTR1_IU_CMPHP_MUX); ASysCtl_selectCMPHPMux(MTR1_IV_CMPHP_SEL, MTR1_IV_CMPHP_MUX); ASysCtl_selectCMPLPMux(MTR1_IW_CMPLP_SEL, MTR1_IW_CMPLP_MUX); ... ... return; } // end of HAL_setupCMPSSs() functionThe CMPSS-generated signals go to the X-Bar, where signals can be combined in different and unique fashions to flag unique trip events from multiple sources including external TZ signal from IPM #Fault to implement the fault protection. The faults include the overcurrent signals from the CMPSS and the fault indicator output from the power module. Configure the XBAR registers in HAL_setupMtrFaults() function in the hal.c file as shown in the following codes.hal.cvoid HAL_setupMtrFaults(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; uint16_t cnt; // Configure TRIP 7 to OR the High and Low trips from both // comparator 5, 3 & 1, clear everything first EALLOW; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRL) = 0; HWREG(XBAR_EPWM_CFG_REG_BASE + MTR1_XBAR_TRIP_ADDRH) = 0; EDIS; ... ... // What do we want the OST/CBC events to do? // TZA events can force EPWMxA // TZB events can force EPWMxB EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(obj->pwmHandle[cnt], EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); ... ... // Clear any spurious fault EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZFLAG_INTERRUPT_ALL); EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZFLAG_INTERRUPT_ALL); return; }Configure the GPIOs based on the hardware in HAL_setupGPIOs() in the hal.c file as shown in the following codes.hal.cvoid HAL_setupGPIOs(HAL_Handle handle) { ... ... // GPIO2->EPWM2A->M1_UH GPIO_setPinConfig(GPIO_2_EPWM2_A); GPIO_writePin(2, 0); GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD); // GPIO3->EPWM2B->M1_UL GPIO_setPinConfig(GPIO_3_EPWM2_B); GPIO_writePin(3, 0); GPIO_setDirectionMode(3, GPIO_DIR_MODE_OUT); GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD); ... ... return; } // end of HAL_setupGPIOs() functionThe configuration codes need to be changed in HAL_enableMtrPWM() and HAL_clearMtrFaultStatus() in the hal.h file as below marked in bold according to the used CMPSS for motor control.hal.hboldstatic inline void HAL_enableMtrPWM(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; obj->flagEnablePWM = true; #if defined(DMCPFC_REV3P2) || defined(DMCPFC_REV3P1) if(obj->motorNum == MTR_1) { #if defined(MOTOR1_DCLINKSS) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); #else // !MOTOR1_DCLINKSS // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_enableMtrPWM() function static inline void HAL_clearMtrFaultStatus(HAL_MTR_Handle handle) { HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle; ... ... #if defined(HVMTRPFC_REV1P1) || defined(WMINVBRD_REV1P0) || defined(TIDSMPFC_REV3P2) // Clear any comparator digital filter output latch CMPSS_clearFilterLatchHigh(obj->cmpssHandle[0]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[0]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[1]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[1]); CMPSS_clearFilterLatchHigh(obj->cmpssHandle[2]); CMPSS_clearFilterLatchLow(obj->cmpssHandle[2]); ... ... return; } // end of HAL_clearMtrFaultStatus() function Setup Hardware Board Parameters The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent. All of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes. //! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) Setup Hardware Board Parameters The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent. All of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes. //! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent. All of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes. //! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) The user_mtr1.h file is where all user parameters are stored for motor control. The maximum phase current and phase voltage at the input to the AD converter, these values are hardware-dependent and need to be based on the current and voltage sensing and scaling to the ADC input. The number of current sensors and voltage (phase) sensors used are defined in user_mtr1.h that are hardware dependent.user_mtr1.huser_mtr1.hAll of the configurable parameters are defined in the user_mtr1.h file. These parameters can be calculated using the Motor_Drive_Parameters_Calculation.xlsx Microsoft Excel spreadsheet. This file is included with the TIDA-010265 archive file at the folder ..\solutions\tida_010265\docs to calculate these values and copy these parameters marked bold to user_mtr1.h as shown in the following codes.user_mtr1.hMotor_Drive_Parameters_Calculation.xlsxMicrosoftExcel..\solutions\tida_010265\docs bold bolduser_mtr1.h//! \brief Defines the maximum voltage at the AD converter // Full scale voltage of AD converter, not the current voltage #define USER_M1_ADC_FULL_SCALE_VOLTAGE_V (404.1292683f) //! \brief Defines the analog voltage filter pole location, Hz //! #define USER_M1_VOLTAGE_FILTER_POLE_Hz (416.3602877f) //! \brief Defines the maximum current at the AD converter #define USER_M1_ADC_FULL_SCALE_CURRENT_A (15.972f) Configure Faults Protection Parameters Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent. //! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Configure Faults Protection Parameters Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent. //! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent. //! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Fault management is implemented in this system that includes overcurrent, overvoltage, undervoltage, stall, overload, start-up failed. The faults protection parameters are defined in user_mtr1.h as shown in the following codes, which are hardware board, motors, and system dependent.user_mtr1.h//! \brief motor over current threshold #define USER_MOTOR1_OVER_CURRENT_A (6.5f) // A //! \brief motor lost phase current threshold #define USER_M1_LOST_PHASE_CURRENT_A (0.2f) //! \brief motor unbalance ratio percent threshold #define USER_M1_UNBALANCE_RATIO (0.2f)0.2f0.2f//! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_FAULT_V (380.0f) //! \brief DC bus over voltage threshold #define USER_M1_OVER_VOLTAGE_NORM_V (350.0f) //! \brief DC bus under voltage threshold #define USER_M1_UNDER_VOLTAGE_FAULT_V (100.0f) Setup Motor Electrical Parameters The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet. #define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Setup Motor Electrical Parameters The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet. #define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet. #define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) The parameters provided in user_mtr1.h for PMSM and BLDC motors are listed as shown in the following codes. The motor parameters can be identified if the FAST technique is implemented on this motor or by getting the parameters from the motor data sheet.user_mtr1.h#define USER_MOTOR1_TYPE MOTOR_TYPE_PM #define USER_MOTOR1_NUM_POLE_PAIRS (4) #define USER_MOTOR1_Rr_Ohm (0.0f) #define USER_MOTOR1_Rs_Ohm (2.68207002f) #define USER_MOTOR1_Ls_d_H (0.00926135667f) #define USER_MOTOR1_Ls_q_H (0.00926135667f) #define USER_MOTOR1_RATED_FLUX_VpHz (0.381890297f) Getting Started MSPM0 Firmware Contact the local TI sales representative for firmware for the MSPM0G1507 daughterboard. Getting Started MSPM0 Firmware Contact the local TI sales representative for firmware for the MSPM0G1507 daughterboard. Contact the local TI sales representative for firmware for the MSPM0G1507 daughterboard. Contact the local TI sales representative for firmware for the MSPM0G1507 daughterboard. Design and Documentation Support Design Files Schematics To download the schematics, see the design files at TIDA-010265. Bill of Materials To download the bill of materials (BOM), see the design files at TIDA-010265. PCB Layout Recommendations This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. Altium Project To download the Altium project files, see the design files at TIDA-010265. Gerber Files To download the Gerber files, see the design files at TIDA-010265. Software Files Download the Code Composer Studio Integrated Development Environment at CCSTUDIO. Download the TIDA-010265 hardware-specific software design files from the design files at C2000WARE-MOTORCONTROL-SDK. Documentation Support no Texas Instruments, TMS320F280013x Microcontrollers data sheet Texas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual Texas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Texas Instruments, C2000 SysConfig application note Support Resources TI E2E support forums are an engineer's go-to source for fast, verified answers and design help — straight from the experts. Search existing answers or ask your own question to get the quick design help you need. Linked content is provided "AS IS" by the respective contributors. They do not constitute TI specifications and do not necessarily reflect TI's views; see TI's Terms of Use. Trademarks Design and Documentation Support Design Files Schematics To download the schematics, see the design files at TIDA-010265. Bill of Materials To download the bill of materials (BOM), see the design files at TIDA-010265. PCB Layout Recommendations This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. Altium Project To download the Altium project files, see the design files at TIDA-010265. Gerber Files To download the Gerber files, see the design files at TIDA-010265. Design Files Schematics To download the schematics, see the design files at TIDA-010265. Schematics To download the schematics, see the design files at TIDA-010265. To download the schematics, see the design files at TIDA-010265. To download the schematics, see the design files at TIDA-010265.TIDA-010265 Bill of Materials To download the bill of materials (BOM), see the design files at TIDA-010265. Bill of Materials To download the bill of materials (BOM), see the design files at TIDA-010265. To download the bill of materials (BOM), see the design files at TIDA-010265. To download the bill of materials (BOM), see the design files at TIDA-010265.TIDA-010265 PCB Layout Recommendations This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. PCB Layout Recommendations This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. This reference design is implemented using a PCB with two-layer, 2-oz copper with the bottom-side SMD component placement to save cost and board area. There are several important aspects to remember while designing the PCB. In the following bullets, system-level placement and layout of each block is explained. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference. Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals. AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. Separate components (or singles) into high and low voltage, high and low current, high and low independence groups. Place and route low-voltage and high-impedance components and signals together, such as microcontroller-related signals and the input side of IPM. Use a whole copper pour to provide an integrated GND plane for these area. AC input, filter, and rectifiers and IPM output sides are high-voltage, high-current and low-impedance parts and signals, route them with wider traces or copper pours to provide high-current paths, and also separate them from above low voltage and high-impedance signals to reduce interference.Components in the high power path are kept on the outer edges of the PCB with the minimum distance possible. The microcontroller is placed at the center considering the optimum distance from all the power blocks that need to be controlled. Pin assignment is set to minimize the control signal or feedback signal trace distance and the crossing between analog and digital signals.AC Line Protection and EMI Filter AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit. AC line protection components are closely placed within the minimum distance to the connection path. Earth connection guarding is provided around protection and EMI filter circuit.Motor Drive For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank. The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection. For the high ripple requirement, the motor drive is placed as close as possible to the film capacitor and DC bus capacitor bank.The low-side shunt resistor method with four-wire sensing is implemented for current sensing. A differential pair with impedance matching resistor is used to connect the sensing signal from the shunt resistors to the op-amp circuit. Shunt resistors are placed near the module with an immediate ground copper plane connection.Auxiliary Power Supply The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. The GND of the auxiliary power supply connects the DC bus capacitor bank directly and independently to separate low current from high current and high frequency GND trace for the inverter. Altium Project To download the Altium project files, see the design files at TIDA-010265. Altium Project To download the Altium project files, see the design files at TIDA-010265. To download the Altium project files, see the design files at TIDA-010265.TIDA-010265 Gerber Files To download the Gerber files, see the design files at TIDA-010265. Gerber Files To download the Gerber files, see the design files at TIDA-010265. To download the Gerber files, see the design files at TIDA-010265.TIDA-010265 Software Files Download the Code Composer Studio Integrated Development Environment at CCSTUDIO. Download the TIDA-010265 hardware-specific software design files from the design files at C2000WARE-MOTORCONTROL-SDK. Software Files Download the Code Composer Studio Integrated Development Environment at CCSTUDIO. Download the TIDA-010265 hardware-specific software design files from the design files at C2000WARE-MOTORCONTROL-SDK. Download the Code Composer Studio Integrated Development Environment at CCSTUDIO. Download the TIDA-010265 hardware-specific software design files from the design files at C2000WARE-MOTORCONTROL-SDK. Download the Code Composer Studio Integrated Development Environment at CCSTUDIO.CCSTUDIODownload the TIDA-010265 hardware-specific software design files from the design files at C2000WARE-MOTORCONTROL-SDK.C2000WARE-MOTORCONTROL-SDK Documentation Support no Texas Instruments, TMS320F280013x Microcontrollers data sheet Texas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual Texas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Texas Instruments, C2000 SysConfig application note Documentation Support no no no no Texas Instruments, TMS320F280013x Microcontrollers data sheet Texas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual Texas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Texas Instruments, C2000 SysConfig application note Texas Instruments, TMS320F280013x Microcontrollers data sheet Texas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual Texas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Texas Instruments, C2000 SysConfig application note Texas Instruments, TMS320F280013x Microcontrollers data sheet Texas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual Texas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Texas Instruments, C2000 SysConfig application note Texas Instruments, TMS320F280013x Microcontrollers data sheet TMS320F280013x Microcontrollers TMS320F280013x MicrocontrollersTexas Instruments, TMS320F280013x Real-Time Microcontrollers technical reference manual TMS320F280013x Real-Time Microcontrollers TMS320F280013x Real-Time MicrocontrollersTexas Instruments, InstaSPIN-FOC and InstaSPIN-MOTION user's guide InstaSPIN-FOC and InstaSPIN-MOTION InstaSPIN-FOC and InstaSPIN-MOTION Texas Instruments, Motor Control SDK Universal Project and Lab user's guide Motor Control SDK Universal Project and Lab Motor Control SDK Universal Project and Lab Texas Instruments, C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer user's guide C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer C2000™ Software Frequency Response Analyzer (SFRA) Library and Compensation Designer Texas Instruments, Sensorless-FOC for PMSM With Single DC-Link Shunt application note Sensorless-FOC for PMSM With Single DC-Link Shunt Sensorless-FOC for PMSM With Single DC-Link ShuntTexas Instruments, C2000 SysConfig application note C2000 SysConfig C2000 SysConfig Support Resources TI E2E support forums are an engineer's go-to source for fast, verified answers and design help — straight from the experts. Search existing answers or ask your own question to get the quick design help you need. Linked content is provided "AS IS" by the respective contributors. They do not constitute TI specifications and do not necessarily reflect TI's views; see TI's Terms of Use. Support Resources TI E2E support forums are an engineer's go-to source for fast, verified answers and design help — straight from the experts. Search existing answers or ask your own question to get the quick design help you need. Linked content is provided "AS IS" by the respective contributors. They do not constitute TI specifications and do not necessarily reflect TI's views; see TI's Terms of Use. TI E2E support forums are an engineer's go-to source for fast, verified answers and design help — straight from the experts. Search existing answers or ask your own question to get the quick design help you need. TI E2E support forumsTI E2ELinked content is provided "AS IS" by the respective contributors. They do not constitute TI specifications and do not necessarily reflect TI's views; see TI's Terms of Use.Terms of Use Trademarks Trademarks About the Author HELY ZHANG is a System Application Engineer at Texas Instruments, where he is responsible for developing home appliance related power delivery and motor inverters. Hely earned his masters degree from Anhui University of Science and Technology with Power electronics in 2002, and worked in SolarEdge and General Electric before joining TI. About the Author HELY ZHANG is a System Application Engineer at Texas Instruments, where he is responsible for developing home appliance related power delivery and motor inverters. Hely earned his masters degree from Anhui University of Science and Technology with Power electronics in 2002, and worked in SolarEdge and General Electric before joining TI. HELY ZHANG is a System Application Engineer at Texas Instruments, where he is responsible for developing home appliance related power delivery and motor inverters. Hely earned his masters degree from Anhui University of Science and Technology with Power electronics in 2002, and worked in SolarEdge and General Electric before joining TI. HELY ZHANG is a System Application Engineer at Texas Instruments, where he is responsible for developing home appliance related power delivery and motor inverters. Hely earned his masters degree from Anhui University of Science and Technology with Power electronics in 2002, and worked in SolarEdge and General Electric before joining TI.HELY ZHANG IMPORTANT NOTICE AND DISCLAIMER TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated IMPORTANT NOTICE AND DISCLAIMER TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. TI PROVIDES TECHNICAL AND RELIABILITY DATA (INCLUDING DATA SHEETS), DESIGN RESOURCES (INCLUDING REFERENCE DESIGNS), APPLICATION OR OTHER DESIGN ADVICE, WEB TOOLS, SAFETY INFORMATION, AND OTHER RESOURCES “AS IS” AND WITH ALL FAULTS, AND DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are intended for skilled developers designing with TI products. You are solely responsible for (1) selecting the appropriate TI products for your application, (2) designing, validating and testing your application, and (3) ensuring your application meets applicable standards, and any other safety, security, regulatory or other requirements. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. These resources are subject to change without notice. TI grants you permission to use these resources only for development of an application that uses the TI products described in the resource. Other reproduction and display of these resources is prohibited. No license is granted to any other TI intellectual property right or to any third party intellectual property right. TI disclaims responsibility for, and you will fully indemnify TI and its representatives against, any claims, damages, costs, losses, and liabilities arising out of your use of these resources. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products. TI’s products are provided subject to TI’s Terms of Sale or other applicable terms available either on ti.com or provided in conjunction with such TI products. TI’s provision of these resources does not expand or otherwise alter TI’s applicable warranties or warranty disclaimers for TI products.TI’s Terms of Saleti.com TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE TI objects to and rejects any additional or different terms you may have proposed. IMPORTANT NOTICE IMPORTANT NOTICE Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright © 2023, Texas Instruments Incorporated Copyright © 2023, Texas Instruments Incorporated
has the details for motor phase current sensing design.