Initial Position Estimation and Field-Weakening Control of IPMSM Using Pulsating High-Frequency Injection and Extended EMF Observer
This example uses sensorless techniques such as pulsating high-frequency injection and extended EMF observer to estimate and track motor position to run an interior permanent magnet synchronous motor (IPMSM) operation using field-weakening control (FWC).
Extended EMF (EEMF) relies on back-emf to estimate the motor position. However, the back-emf generated in motor at lower speeds is not high enough for measurement due to which EEMF cannot function at lower speeds. To overcome this limitation, the usual back-emf based sensorless control strategies begin running a motor using open-loop control at lower speeds and eventually transition to closed-loop control requiring real time position tracking at higher speeds.
However, to increase motor efficiency and avoid drawing large currents during open-loop control execution, the example directly starts running the motor in a closed-loop by using the sensorless technique of pulsating high-frequency injection to estimate and track motor position. Afterwards, when the speed rises and back-emf is high enough for measurement, the example transitions to EEMF based position tracking to run the motor at higher speeds (including speeds above the rated speed of the motor). The example uses Extended EMF Observer block to implement EEMF based position tracking. For more information about this block, see Extended EMF Observer.
The Pulsating High Freq Observer (PHFO) block performs initial position estimation (IPE) with a stationary motor. The block later injects a pulsating high-frequency (PHF) signal at lower speeds to track the motor position as shown in the following figure.
For more information about PHFO block operation, see Pulsating High Freq Observer.
The example uses the stationary rotor position obtained by PHFO block in Stage - 1 to compute the fundamental frequency voltages and to start running the motor. However, once the motor starts running, the example needs real time position tracking, which can be done by PHFO Stage - 2.
Therefore, when the motor is running, the example superimposes PHF voltage with the fundamental frequency voltages. This results in motor currents that have a lower fundamental frequency component and two high frequency components. PHFO expects high-frequency currents as feedback, whereas the FWC technique expects the fundamental frequency current. To achieve this, the example uses a filter to separate out the high- and low-frequency currents.
The filter can successfully separate these frequencies only upto a specific motor speed. This is because when motor speed increases the fundamental frequencies also increase, which brings them closer to the higher frequencies. Therefore, PHFO can function only at lower motor speeds within an upper speed limit.
Therefore, the example broadly considers the speed operating region of the motor as a combination of following two regions or states:
Low-speed region (state-1) - Region where the motor runs using field-orienced control (FOC) with PHFO.
High-speed region (state-4) - Region where the motor runs using FOC with EEMF observer.
In addition, the example can also attain the following two states at the boundary operating point (transition speed, ) between the low-speed and high-speed regions:
State-2 - State when the motor runs using FOC with PHFO but keeps EEMF observer active. This state assists the controller to transit to state-3, if required.
State-3 - State when the motor runs using FOC with EEMF observer but keeps PHFO active. This state assists the controller to transit to state-2, if required.
Therefore, during the preceding two states, both PHFO and EEMF observers actively work in parallel.
The following figure shows these four states across the motor operating region.
Common Scenarios for Switching Between Low-Speed and High-Speed Regions
Depending on the sequence of reference speed input values (or commanded speed values), the controller can switch between the low-speed and high-speed regions. The following sections describe the common scenarios when such a switch can happen.
Switching From Low to High Reference Speed
This scenario occurs when you set the reference speed to a high value (in high-speed region) at a time when the motor is running at a low speed (in low-speed region). Therefore, the controller must transition from the low-speed region to the high-speed region to match the new reference speed input.
To make the transition from low-speed region (state-1) to high-speed region (state-4), at first, the controller switches to transition speed () by using the as an intermediate reference speed for the motor. When the motor reaches , the controller transitions to state-2 and activates the EEMF observer (but continues to use PHFO to run the motor). Then it transitions to state-3 and starts using EEMF to run the motor (but keeps PHFO active). It then transitions to state-4 to run the motor using EEMF and achieve the original reference speed (in the high-speed region) as shown in the following figure.
The duration during which controller stays in state-2 and state-3 depends on the variables TimeToActivateEEMF and TimeToActivatePHFO respectively. You can update these variables in the state-machine constants section of the model initialization script SensorlessIPMSMControlUsingHighFrquencyInjectionData.
The variable TimeToActivateEEMF defines the time required to activate the EEMF block during state-2.
The variable TimeToActivatePHFO defines the time required to activate the PHFO block during state-3.
During the time period when the controller transitions from state-1 to state-4 (via state-2 and state-3), it does not respond to the changes in the reference speed value. The controller immediately checks the reference speed (and responds to it) as soon as it reaches state-4 (original reference speed, ).
The following figure shows the variation of the original and internal reference speed values in time-domain.
Switching From High to Low Reference Speed
This scenario occurs when you set the reference speed to a low value (in low-speed region) at a time when the motor is running at a high speed (in high-speed region). Therefore, the controller must transition from the high-speed region to the low-speed region to match the new reference speed input.
To make the transition from high-speed region (state-4) to low-speed region (state-1), at first, the controller switches to transition speed () by using the as an intermediate reference speed for the motor. When the motor reaches , the controller transitions to state-3 and activates the PHFO (but continues to use EEMF to run the motor). Then it transitions to state-2 and starts using PHFO to run the motor (but keeps EEMF active). It then transitions to state-1 to run the motor using PHFO and achieve the original reference speed (in the low-speed region) as shown in the following figure.
During the time period when the controller transitions from state-4 to state-1 (via state-3 and state-2), it does not respond to the changes in the reference speed value. The controller immediately checks the reference speed (and responds to it) as soon as it reaches state-1 (original reference speed, ).
The following figure shows the variation of the original and internal reference speed values in time-domain.
Switching to Transition Speed
This scenario occurs when you set the reference speed to the transition speed () at a time when the motor is running in either low-speed region or high-speed region.
If the motor is operating at a low speed (in low-speed region), the controller transitions to by switching from state-1 to state-2.
State-2 ensures that PHFO actively runs the motor so that controller can quickly return to state-1 (if the reference speed changes to a lower value). However, this state also ensures that EEMF remains active in parallel so that the controller remains prepared to transition to the high-speed region (if the reference speed changes to a higher value).
If the motor is operating at a high speed (in high-speed region), the controller transitions to by switching from state-4 to state-3.
State-3 ensures that EEMF actively runs the motor so that controller can quickly return to state-4 (if the reference speed changes to a higher value). However, this state also ensures that PHFO remains active in parallel so that the controller remains prepared to transition to the low-speed region (if the reference speed changes to a lower value).
In this scenario, the controller stays in state-2 or state-3 as long as the reference speed remains identical to . Therefore, in this scenario, the variables TimeToActivateEEMF and TimeToActivatePHFO have no effect.
Note: The controller cannot directly transition from state-2 to state-4 (or state-3 to state-1). The transition away from always happens using one of the following sequences:
State-2 State-3 State-4
State-2 State-1
State-3 State-2 State-1
State-3 State-4
During the time period when the controller makes the preceding transitions, it does not respond to the changes in the reference speed value. The controller immediately checks the reference speed (and responds to it) as soon as it reaches the final state.
Note: To continue to run the motor smoothly after transitioning from PHFO to EEMF, the position detected by PHFO must be close enough to the one detected by EEMF. The motor can stop running if there is a big difference in position during the transition.
PHFO requires good saliency (or a good difference between Ld and Lq values). A motor with low-saliency can take more time to estimate position using PHFO when compared to a motor with high-saliency. Therefore, set the the variables TimeToActivateEEMF and TimeToActivatePHFO appropriately to ensure that state-2 and state-3 have enough time to estimate position.
In addition, the dual pulse (DP) method (which is part of the IPE stage of PHFO operation) requires non-linear motor data showing variation of Ld against Id.
The example uses the PMSM HDL block to implement a non-linear PMSM. The PMSM HDL block uses the default non-linear motor parameters that you can simulate directly.
However, if you have a custom non-linear motor, you can use the code generation capabilites of the example to run your motor and generate an array of non-linear inductance and current data for the motor. The example enables you to import this data and use it to run your motor using FWC in simulation.
Model
This example includes the SensorlessIPMSMControlUsingHighFrquencyInjection target Simulink® model.
Click SensorlessIPMSMControlUsingHighFrquencyInjection or run the following command to access the target model. Alternatively, you can also run the following command to access the target model.
openExample('mcb/IpeFwciPMSMPhfoSensorlessEemfExample','supportingFile','SensorlessIPMSMControlUsingHighFrquencyInjection.slx');
You can use this model for both simulation and code-generation.
Required MathWorks Products
To simulate model:
Motor Control Blockset™
Stateflow®
To generate code and deploy model
Motor Control Blockset
Stateflow
Embedded Coder®
C2000™ Microcontroller Blockset
Fixed-Point Designer™ (only needed for optimized code generation)
Prerequisites
1. Obtain the motor parameters. The example includes default motor parameters with the Simulink® model, which you can replace with values from the motor datasheet or other sources.
However, if you have the motor control hardware, you can estimate the parameters for the motor that you want to use with the Motor Control Blockset parameter estimation tool. For instructions, see Estimate PMSM Parameters Using Recommended Hardware.
The parameter estimation tool updates the motorParam
variable (in the MATLAB® workspace) with the estimated motor parameters.
2. Update the motor and inverter parameters in the model initialization script SensorlessIPMSMControlUsingHighFrquencyInjectionData.m associated with the Simulink® model. For instructions, see Estimate Control Gains and Use Utility Functions.
Simulate Model
This example supports simulation. It uses default non-linear motor parameters that you can simulate directly.
However, if you have your own custom non-linear motor, you can follow the instructions in the Simulate Nonlinear Stator Core Behavior section to generate Ld, Id, and Lq data and use the data to introduce high saliency in the motor block available in the example target model. You can then follow these steps to simulate the target model using a motor block that matches your custom motor.
1. Open a model included with this example.
2. Click Run on the Simulation tab to simulate the model. The example starts running the motor in the closed-loop FWC using PHFO and transitions to EEMF at transition speed (). After gradually reaching the motor rated speed, the example also transitions beyond the motor base speed.
3. Click Data Inspector on the Simulation tab to view and analyze the simulation results.
Generate Code and Deploy Model to Target Hardware
Follow the instructions in this section to generate code and run the example on the target hardware.
This example uses a host and a target model. The host model is a user interface to the controller hardware board. You can run the host model on the host computer. Before you run the host model on the host computer, deploy the target model to the controller hardware board. The host model uses serial communication to command the target Simulink model and run the motor in closed-loop control.
Required Hardware
The example supports this hardware configuration. You can also use the target model name to open the model from the MATLAB command prompt.
LAUNCHXL-F28379D controller + BOOSTXL-DRV8305 inverter + iPMSM (such as Adlee
BM-180 motor): SensorlessIPMSMControlUsingHighFrquencyInjection
For connections related to this hardware configuration, see LAUNCHXL-F28069M and LAUNCHXL-F28379D Configurations.
Generate Code and Run Model on Target Hardware
This example supports code-generation.
Click SensorlessIPMSMControlUsingHighFrquencyInjectionData to open the model initialization script.
If the motor that you are using matches one of the motor profiles (IPMSM001, Adlee, or Teknic2310P) listed in this script, then use the System Parameters section of the script to select a profile that matches your motor. In this case, you can directly deploy the target model to the hardware using the following procedure.
However, if you have a custom non-linear motor that does not match the available motor profiles, follow the instructions in the Simulate Nonlinear Stator Core Behavior section to generate the Ld, Id, and Lq data and update this data in the example target model (to customize the control algorithm for the non-linear motor). You can then use the following procedure to deploy the target model and run the custom non-linear motor using FOC (and eventually FWC).
1. Simulate the target model and observe the simulation results.
2. Complete the hardware connections.
3. By default, the model computes the ADC offset values for phase current measurement. To disable this functionality, update the value of the inverter.ADCOffsetCalibEnable
variable in the model initialization script to 0
.
Alternatively, you can compute the ADC offset values and update them manually in the model initialization script. For instructions, see Run 3-Phase AC Motors in Open-Loop Control and Calibrate ADC Offset.
4. Open the target model. If you want to change the default hardware configuration settings for the model, see Model Configuration Parameters.
5. Load a sample program to CPU2 of the LAUNCHXL-F28379D board. For example, load the program that operates the CPU2 blue LED by using GPIO31 (c28379D_cpu2_blink.slx
). This ensures that CPU2 is not mistakenly configured to use the board peripherals intended for CPU1. For more information about the sample program or model, see the Task 2 - Create, Configure and Run the Model for TI Delfino F28379D LaunchPad (Dual Core) section in Getting Started with Texas Instruments C2000 Microcontroller Blockset (C2000 Microcontroller Blockset).
6. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware. Verify the variables that the target model adds to the workspace.
7. Click the host model hyperlink in the target model to open the associated host model.
For details on serial communication between the host and target models, see Host-Target Communication.
8. In the model initialization script SensorlessIPMSMControlUsingHighFrquencyInjectionData associated with the target model, specify the communication port using the variable target.comport. The example uses this variable to update the Port parameter of the Host Serial Setup, Host Serial Receive, and Host Serial Transmit blocks available in the host model.
9. Click Run on the Simulation tab to run the host model.
10. Use the Reference Speed (RPM) field in the host model to set a reference speed that deployed target model should use to run the motor.
11. Use the Motor switch to start running the motor.
The Initial Position Estimation and Transition Speed (RPM) display boxes display the estimated initial rotor position and the transition speed used by the example respectively.
In addition, the PHFO Active and EEMF Active LEDs indicate the status of PHFO and EEMF respectively.
12. Use the Debug Signals combo box to select a debug signal. Monitor the selected signal in the Scope and Display blocks available in the host model.
Simulate Nonlinear Stator Core Behavior
The example includes both simulation and code-generation capabilities to run a non-linear motor with good saliency. To generate the non-linear behavior in simulation as well as customize the controller according to the non-linear motor for code-generation, the target model uses the PMSM HDL motor block from Motor Control Blockset.
The following procedure enables you to generate Ld, Id, and Lq data (in tabulated form) for the actual non-linear motor you are using. The procedure enables you to make the motor block non-linear so that you can use either simulation or code-generation to run your motor.
Determine Ld Data
1. Create a target model to run a PMSM using open-loop control. Modify the algorithm so that it injects the voltages and into the actual motor. This generates the current in the motor where:
is the voltage that the algorithm computes and injects along the rotor's d-axis.
is the frequency at which you can measure the phase difference. This frequency should be approximately 10 times lower than the PWM switching frequency but should be high enough to keep the rotor stationary (a frequency value that is too low can spin the rotor).
is the AC component of (such that and are constants that the algorithm can assume).
is the DC component of that you provide as an input.
is the current along the d-axis of the rotor that the algorithm computes from the measured and phase currents.
is the AC component of ( is the phase difference between and that the algorithm should measure).
is the DC component of , which is fixed for a input (the algorithm should compute this value by using and the motor resistance).
Note: Because , the rotor remains stationary.
a. Add an algorithm to read the and phase currents that the motor draws.
b. Add an algorithm to convert the and phase current values into the equivalent value by using Clarke and Park transforms.
c. Add an algorithm to compute and .
d. Add an algorithm to compute .
e. Add an algorithm to compute .
(for a fixed )
For details about designing a control algorithm and configuring it for deployment to the target hardware, see Control Algorithm Design and Deployment and Validation.
2. Create a model initialization script (.m
file) to initialize the parameters and perform other calculations. Use the Model Properties > Callbacks to integrate this script with the target model. For details about how to use this script with Motor Control Blockset, see Estimate Control Gains and Use Utility Functions.
3. Configure the target model to run on the target hardware. For instructions, see Model Configuration Parameters.
4. Create a separate host model to control and communicate with the target model running on the motor-control hardware in real time. You can add an Edit box on the host model and use it to send input to the target hardware. Use Display boxes to obtain the computed and values from the target hardware.
For details about the host-target communication interface, see Host-Target Communication.
5. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.
6. Simulate the host model. Send a input to the target hardware and record the and values that you obtain.
7. Change manually across a range between a negative and positive voltage and record the resulting and values for each operating point.
Determine Lq Value
Perform these steps to determine a value that is higher than the sequence of values obtained from the Determine Ld Data section. This is necessary to maintain a high saliency ratio () for the PMSM HDL motor block that the example uses.
1. Modify the target model that you used in the Determine Ld Data section so that it injects the voltages and into the actual motor. This generates a current in the motor where:
is the constant DC voltage that the algorithm injects along the d-axis of the rotor. should be high enough to hold the rotor at zero position and keep it stationary.
is the AC voltage that the algorithm computes and injects along the q-axis of the rotor (such that and are constants that the algorithm assumed in the Determine Ld Data section).
is the AC current along the q-axis of the rotor that the algorithm computes from the measured and phase currents ( is the phase difference between and that the algorithm should measure).
a. Update the existing algorithm to convert the and phase current values into the equivalent value by using Clarke and Park transforms.
b. Update the existing algorithm to compute .
c. Update the existing algorithm to compute .
d. Add an algorithm to compute .
2. Update the model initialization script to perform the preceding modified calculations.
3. Update the host model to obtain and display the value computed by the target hardware.
4. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.
5. Simulate the host model. Send a input to the target hardware and record the value that you obtain.
Design High Saliency Motor Block
The Determine Ld Data and Determine Lq Value sections in this page provide the following data:
Sequence of values
Sequence of ( for a DC current) values
Constant value
In addition, you can assume a set of values to add high saliency to the PMSM HDL motor block.
Update the sequence of and values in the variables pmsm.nonlin.Ld_data and pmsm.nonlin.idVec, respectively, available in the System Parameters section of the model initialization script SensorlessIPMSMControlUsingHighFrquencyInjectionData. The subsystem SensorlessIPMSMControlUsingHighFrquencyInjection/Inverter and Motor - Plant Model/Simulation/Motor Parameters
uses these two variables to feed the non-linear and values to the PMSM HDL block.
Note: This script is different from the model initialization script used in the Determine Ld Data and Determine Lq Value sections.
In addition, update the constant value in the variable pmsm.Lq available in the System Parameters section of the model initialization script. The PMSM Configuration block available in the SensorlessIPMSMControlUsingHighFrquencyInjection/Inverter and Motor - Plant Model/Simulation/Motor Parameters
subsystem uses this variable to feed the constant value to the PMSM HDL block.
See Also
Pulsating High Freq Observer | Extended EMF Observer | PMSM Configuration | PMSM HDL
Related Examples
- Sensorless Field-Oriented Control of PMSM
- Estimate Initial Rotor Position Using Pulsating High-Frequency and Dual-Pulse Methods
- Sensorless Field-Oriented Control of PMSM Using I-F Control-Based Startup