MICROCHIP AN1292 Tuning Guide User Guide
- June 10, 2024
- MICROCHIP
Table of Contents
MICROCHIP AN1292 Tuning Guide User Guide
This document provides a step-by-step procedure on running a motor with the algorithm described in AN1292 “Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW)” (DS01292).
SETTING SOFTWARE PARAMETERS
All of the main configurable parameters are defined in the userparms.h file.
The adaptation of the parameters to the internal numerical format is done
using the tuning_params.xls Excel® spreadsheet (see Figure 1-1). This file is
included with the AN1292 archive file, which is available for download from
the Microchip website (www.microchip.com). After
entering the motor and hardware information into the spreadsheet, the
calculated parameters need to be entered into the userparms.h header file, as
indicated by the following steps.
FIGURE 1-1: tuning_params.xls
STEP 1 – Fill in the tuning_params.xls Excel spreadsheet with the following
parameters:
a) Peak Voltage
Peak voltage represents the peak voltage on the DC link capacitors. It also
represents the DC voltage itself when a DC power supply is connected to the DC
link. If the DC link is supplied from a single-phase rectifier bridge, the AC
peak voltage is connected to the rectifier:
V ACpeak V ACrms = √ 2
b) Peak Current
Peak current represents the maximum real value of the current that can be
internally represented, which depends on the acquisition block. Considering
the maximum input to the ADC of 3.3V, the gain of the acquisition circuitry
and the value of the current shunts determine the maximum value of the
current that will fit to the dsPIC® DSC internal number representation.
Conversely, a current of which the internal number representation is at the
upper limit, represents the peak current as it may be entered in the indicated
Excel spreadsheet field.
FIGURE 1-2: SIGNAL CONDITIONING CIRCUITRY
For the circuit presented in Figure 1-2 above, the current acquisition
circuitry has an amplification gain of:
The shunt resistor value for the MCLV is 5 mΩ and, with a maximum voltage
accepted at the ADC input of 3.3V, results in the maximum current read of:
Notice that the calculated value of Peak current (Imax) differs from the one
indicated in the Excel spreadsheet file (Figure 1-1) – the reason being that
the second value is experimentally determined as it will be described later in
this document (Step 3-d).
c) PWM Period and Dead Time
PWM Period is the sampling and control period for this algorithm (AN1292).
Dead time represents the time needed for the power semiconductor devices to
recover from the previous state so that no shoot-through occurs on any
inverter leg. The values entered in these fields should coincide with the ones
used. The demonstration software included in the application note implements a
value of 2 µs for dead time, and for the PWM period, a value of 50 µs is used,
which is a PWM frequency of 20 kHz.
d) Motor’s Electrical Parameters
For the parameters Stator resistance (Rs), Stator inductance (Ls), and Voltage
constant (Kfi) enter them from the motor’s manufacturer’s information or they
may be determined experimentally. Please consult the “Tuning and Experimental
Results” section of the application note, AN1292 for details on experimentally
calculating Kfi.
e) Nominal and Maximum Speed
Nominal speed is a parameter provided by the manufacturer and represents the
speed achievable with the nominal current and voltage provided on the motor’s
plate. Maximum speed is a parameter provided by the manufacturer and depends
mostly on the mechanical parameters of the motor. It may be observed that the
maximum speed is higher than the nominal speed, and the region in between
being covered in constant power mode, where the field weakening technique is
implied.
f) Predivision Factors
Predivision column corresponds to a scaling constant used for bringing the
resulting calculation of normalized values into the numerical representation
range, [-32768, 32767]. The Predivision scaling should not only bring the
constants into the range but also, in case of the inverse voltage constant
(Kfi), to divide its initial calculated value so that when it is multiplied
afterwards due to field weakening technique, it does not overflow the
numerical representation range. The Predivision factors can be found in the
software code in the form of division
operation term (left shift).
For example, NORM_LSDTBASE Predivision scaling is 256 in the spreadsheet,
which reflects in the following line of code:
estim.c
As it may be observed, instead of shifting to the left with 15, because of previous predivision with 28, it is finally shifted with 7. The same happens for NORM_RS, which is predivided by 2 to keep NORM_RS within range, which prevents a numeric overflow. This results in the estim.c corresponding code section to counter balance the initial predivision by a shift of 14 instead of 15:
In the case of NORM_INVKFIBASE, the Predivision is 2 and the reverse multiplication is done on the following line of code:
STEP 2 – Export produced parameters to userparms.h.
The resulting values in the right side columns grouped as Output parameters
are to be entered in the userparms.h file corresponding definitions. Notice
that the items on the Output parameters are colored differently, indicating
precisely which of them are to be copied and pasted directly into the software
code.
STEP 3 – First, tune the open loop
a) Activate Open Loop Functioning
The open loop tuning can be operated separately, by enabling a special #define
in the FOC software code; otherwise, the transition to close loop control is
automatically done. Make sure you disable closed loop transition for the
initial tuning of open loop.
b) Set Up Open Loop Parameters
Current Scaling
The prescaling constant needs to be set to adapt the ADC output to correspond
to the real value in terms of sign (direction), and if necessary, to prescale
it to an intermediary value, adequate for further processing.
The scaling factor for currents are negative because the acquisition for
shunts is getting the reverse sense of the currents, and therefore, the value
of Q15(-0.5) represents a (-1) multiplication of the Q15 value returned by the
ADC.
Start-up Torque Current
Choose nominal current for the given motor as a starting point, as indicated
below (in this case, a value of 1.41 amperes was used):
If the start-up current is too low, the load will not move. If it is too high, the motor can overheat if it runs in open loop for a long period of time.
Lock Time
In general, a lock time of a value of a few hundred milliseconds is selected
The lock time value depends on the PWM frequency. For example, at 20 kHz, the value 4000 would represent 0.2 seconds.
Ramp Increase Rate
The open loop acceleration should be set as small as possible at the
beginning. The smaller this value, the more capable the motor is to start with
a higher resistant torque or moment of inertia.
End Speed
End speed value setup is a trade-off between the efficiency of the control and
the
estimator’s minimum speed limit to accurately estimate speed and position.
Normally, the user would want to set the open loop end speed value as low as
possible so that the transitions to closed loop functioning occur as soon as
possible from the startup. Keeping in mind the compromise stated above,
consider an end speed of one third of nominal speed of the motor under tuning
for the beginning.
FIGURE 1-3:
-
PI Current Controllers
Some general guidelines for effective tuning of this application’s PI controllers are: -
Both controllers, on the D and Q axis, will have the same values for corresponding Proportional (D_CURRCNTR_PTERM, Q_CURRCNTR_PTERM), Integral (D_CURRCNTR_ITERM, Q_CURRCNTR_ITERM), Anti-windup Compensation (D_CURRCNTR_CTERM, Q_CURRCNTR_ITERM), and Minimum-Maximum (D_CURRCNTR_OUTMAX, Q_CURRCNTR_OUTMAX, D_CURRCNTR_OUTMIN, Q_CURRCNTR_OUTMIN) terms.
-
In general, whenever current oscillation happens, lower the proportional gain term making sure integral gain is from 5 to 10 times smaller than proportional gain.
Use the values shown below as a starting point.
c) Open Loop Parameters Optimization
The settings above would enable open loop operation. Once it has been verified
that everything is working fine with the setup previously explained, try to
fine tune the parameters for smoother and more efficient operation by:
- decreasing startup torque current
- increasing speedup ramp rate
- reducing the lock time
- decreasing end speed
STEP 4 – Tuning the Closed Loop Operation
a) Enable Close Loop Transition
Step forward to close loop tuning once the open loop is running fine, by
removing the define of the OPEN_LOOP_FUNCTIONING macro definition.
b) Set Up Close Loop Parameters
Initial Angle Offset Tuning
The transition between open loop to close loop implies an initial estimation
error, for which pre-selection of an initial offset angle is required:
Depending on the resistant torque of the load, the moment of inertia, or depending on the motor’s electrical constants, modify the angle to eliminate the eventual open loop/close loop transition glitches.
Estimator Filter Coefficients
The default constants set up for the filters’ coefficients should give good
results for most motors. Nevertheless, decreasing the coefficients would
decrease the phase delay, which could be particularly helpful at high speeds,
where armature current variation is faster. A compromise between the filtering
role and its counter back effect, the introduction of phase shift, should be
achieved.
PI Speed Controller
For the speed controller tuning, P and I gain can be adjusted using multiple
methods. For more information, search for “PID Controller” on the Wikipedia
website and go to the “Loop Tuning” section.
For cases where no speed controller is needed, the torque mode can be activated by defining TORQUE_MODE.
STEP 5 – Optionally, Tune the High-Speed Field Weakening Parameters
CAUTION
Usually, the motor manufacturer indicates the maximum speed achievable by the
motor without it being damaged (which could be higher than the brake point
speed at rated current). If not, it is possible to run it at higher speeds
but only for small periods (intermittent) assuming the risks of
demagnetization or mechanical damage of the motor or of the devices attached
to it. In Field Weakening mode, if the controller becomes lost due to a
miscalculation of the angle at high speed above the nominal value, the
possibility of damaging the inverter is imminent. The reason is that the Back
Electromotive Force (BEMF) will have a greater value than the one that would
be obtained for the nominal speed, thereby exceeding the DC bus voltage value,
which the inverter’s power semiconductors and DC link capacitors would have to
support. Since the tuning proposed implies iterative coefficient corrections
until the optimum functioning is achieved, the protection of the inverter with
corresponding circuitry should be modified to handle higher voltages in case
of stalling at high speeds.
a) Set Up Initial Parameters
Nominal and Maximum Speed
Start with a value for nominal speed RPM (i.e., a couple of hundred RPM less
than the motor rated speed). In this example, the motor is rated for 3000 RPM;
therefore, we set NOMINAL_SPEED_RPM to 2800. Consult the motor specification
for the maximum field weakening speed, and enter this value into
MAXIMUM_SPEED_RPM.
Be aware of the fact that for these values above (over) Nominal speed, the field weakening strategy is enabled, and therefore, lowering the nominal speed used for smoothing this transition implies additional energy is spent on airgap flux decrease, which overall, leads to lower efficiency.
D-axis Current Reference
D-axis reference current lookup table (ID) has values between 0 and the
nominal stator current, distributed evenly on 18 entries of the lookup. The
nominal stator current can be taken from the motor specification. If it is
unknown, this value can be approximated by dividing the rated power over the
rated voltage.
Voltage Constant Inverse
The lookup table entry corresponding to the maximum speed achievable in field
weakening is proportional to the percentage of increase of mechanical speed
from nominal to the maximum values. In the lookup table entries, the values
are evenly distributed and if the inverse voltage constant for maximum speed
exceeds the numerical representation range (32,767), adjust the corresponding
Predivision scaling factor. Note that the following numbers are predivided by
2 (see Figure 1-1).
Inductance Variation
For the inductance variation (LsOver2Ls0) lookup table, the first value in the
table should always be one-half since the base speed inductance is divided by
its own doubled value. These values should work for most motors.
b) Runtime Parameters Adjustment
If the results of running the software in these conditions will stall the
motor at a speed higher than nominal, it is due to the fact that the lookup
tables were filled with estimated values, which at some point do not match the
real non-linearities. Once the motor stalls, immediately halt the program
execution, capturing the value of the index (FdWeakParm.qIndex) in the
debugger watch window. The index indicates the point where the values of IDREF
(see the IDREF table in Step 5a), in ascending order, were not effective and
should be updated. In order to further improve the performance, the value
indicated by the current index in the lookup table should be replaced by the
value indicated by the next index (FdWeakParm.qIndex + 1) and the motor’s
behavior should be checked again. The achievable speed should increase and
repeating this process for several times the maximum speed for the nominal
current reference imposed on the d-axis will be reached. If the maximum speed
obtained for the nominal current is lower than the targeted one, the absolute
value of the d-axis current reference should be increased above the nominal
value. As an example, if 5500 RPM cannot be reached, change IDREF_SPEED17
current from -1.53 to -1.60 and try again. The d current reference increase
should be started from the value denoted by the index where the motor stalled.
The index value should correspond to the actual speed of the motor, measured
at the shaft using a tachometer, keeping in mind that the lookup index is
calculated using the reference speed, not the actual speed. Once the d-current
increase stops increasing the speed (increasing the current too much will
generally stall the motor), the index corresponding to the stall will indicate
where the value for inductance should be adjusted (increasing or decreasing
its value). The inductance variation lookup table is the last to be updated.
Note the following details of the code protection feature on Microchip devices:
- Microchip products meet the specification contained in their particular Microchip Data Sheet.
- Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.
- There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
- Microchip is willing to work with the customer who is concerned about the integrity of their code.
- Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the- Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Octopus, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2010, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
WORLDWIDE SALES AND SERVICE
AMERICAS
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
References
- {波多野42部无码喷潮在线,18禁美女裸身无遮挡免费网站,国产成人精品一区二三区在线观看,久久精品国产亚洲AⅤ无码}
- Microchip Lightning Support
- Empowering Innovation | Microchip Technology
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>