Motor Control
Motor control is a complex field which requires knowledge of linear algebra, control theory, and an understanding of electric machines. However, the overarching goal of every style of motor control is this keyword (look it up): rotating magnetic field, or RMF. This page aims to break down various styles of motor control, but focuses on the primary modern method, Field-Oriented Control or FOC.
Contents
- 1 Inverter Setup
- 2 Six-Step Control
- 3 Field Oriented Control for Synchronous Machines
- 4 Field Oriented Control for Asynchronous Machines
Inverter Setup
While the theory behind FOC is important to understand, most teams should be focusing on getting their motor controller working with their motor. This means understanding what parameters can be changed in a typical motor controller and how that may affect the operation of your motor. Some common parameters include:
- Resolver offset: informs the motor controller where the magnetic north, or D-axis of the rotor is relative to the position of the resolver/encoder on the motor shaft. Essentially, it's quite hard to get the resolver/encoder sensor perfectly aligned with the rotor field when installing the sensor, so this offset tells the controller the relative position of the sensor compared to the rotor. In other words, how off you were when you randomly threw the sensor on the motor shaft.
- Most controllers have a calibration procedure to dial this value in. Getting this value correct is essential to proper motor/controller operation & preventing errors or even damage to components
- Switching/carrier frequency: this is the switching frequency of the motor controller's power stage. Ranges from 4.4-20kHz. The higher the switching frequency, the smoother/higher-resolution the sine wave. This has the advantage of lowering eddy current losses & associated heating in the motor, but increases losses in the motor controller since more switching events -> IGBTs/MOSFETs are transitioning more frequently -> more heat generated in the controller
- Note: low-inductance/resistance motors require a higher switching frequency since having a high inductance/resistance helps to smooth the sine waves being generated from the controller. Thus, the sine waves coming out of the controller don't need to be as smooth = lower switching frequency if the motor has more of a smoothing effect
- Battery current limit: limits how much current the controller draws from the battery. This should be set relative to the maximum current the pack can produce without overheating
- Phase current limit: sets the limit of the current in any of the motor's 3 phases. This is directly proportional to the torque that the motor produces. This is NOT the same as the battery current and can be 2-3x higher based on the Kv (voltage constant) of the motor windings.
- PI loop gains: Changes the aggressiveness of the PI loops when there is an error between reference & measured DQ currents. These are typically preset by the controller manufacturer for specific motors and SHOULD NOT be changed unless there is an obvious issue with how the controller is commanding current
- One way to tune these is to observe overshoot & drift in the commanded DQ currents: more overshoot indicates Kp may be too high while excessive drift means Ki may be too low
Six-Step Control
Field Oriented Control for Synchronous Machines
Most FSAE-grade motor controllers use Field-Oriented Control. This decouples the torque and flux (magnetic field strength) control within the motor, which offers improved efficiency and dynamic performance of the motor & controller. To summarize, there are 7 main steps to FOC.
- Measure phase currents and rotor position - done using 2 or 3 phase current sensors + encoder/resolver for rotor position
- Clarke transform - linear transformation from the 3-phase stationary (abc) to 2-phase stationary (alpha/beta) of the currents in the stator windings
- Park transform - linear transformation from the 2-phase stationary (alpha/beta) to 2-phase rotating frame (DQ) - this turns the 2-phase currents in the stator windings into 2-phase currents that the rotor sees as it rotates
- Here is the important part: the Q-axis of the rotor is what controls torque while the D-axis of the rotor controls the flux. Since we can request D and Q-axis currents independently now, we can control the torque and flux separately respectively
- PI control loops: set the D-axis and Q-axis currents of the rotor based on the error between reference values given by throttle position and measured values from the phase current & rotor position sensors
- Inverse-Park transform: going back from the 2-phase rotating (DQ) frame to the 2-phase stationary (alpha/beta) frame
- Inverse-Clarke transform: going back from the 2-phase stationary (alpha/beta) to the 3-phase stationary (abc) frame
- SVPWM: space-vector pulse-width modulation: calculates the required PWM signals for the IGBT/MOSFET half-bridges to generate the correct 3x AC phase voltages which drive currents in each phase
Transformations
Clarke Transform
The Clarke transform is used to convert the measurements of the phase currents or voltages to a rectangular 2d space vector, which represents both a complex phasor representing the AC current in the phases, and a vector with the same direction of the magnetic field that the current will create. The real axis/the axis aligned with the phase A vector is called , while the imaginary axis/perpendicular axis is labeled . k is a scaling factor, where results in a vector with the same magnitude as the original 3-phase signals, and results in a power-invariant transform.
Park Transform
The Park transform is used to transform quantities from being referenced to the stator to being referenced to the rotor. The -frame is "stationary", as in the axes remain fixed while the current and voltage vector spins around with the rotor. in the DQ-frame, because it is referenced so the D axis always is aligned with a north pole on the rotor, constant current results in constant torque regardless of rotation. The transform itself is simply a rotation matrix, rotating the -frame by the electrical angle of the rotor.
Current Regulation
A PI controller is commonly used to regulate the currents. This is explained by starting with a simple motor model in the DQ-frame (the motor is represented by a voltage source, resistance, and inductance).
We can then write the equation for the system as follows:
The pole of the system can be cancelled out by a an appropriately tuned PI controller. The equation for the entire current controller can then be written as follows:
More explicitly, the desired output voltage at any given point in time can be written as:
The back EMF is estimated using motor parameters and rotational speed. Also note that the entire system simplifies as follows:
Torque Regulation
There are a couple ways to calculation the required current to achieve a desired torque
Zero D-Axis Current
This strategy is used for Surface Permanent Magnet (SPM) motors since they do not have a reluctance torque component. Maximum torque is generated when the stator field is 90* ahead of the rotor field (T = F x r). An important note is that negative current on the d-axis means that the stator field is oriented such that it fights, or weakens the rotor's magnetic field. This is called field weakening and allows SPMs to operate above their base speed.
Maximum Torque Per Amp (MTPA)
MPTA is a control strategy to obtain the greatest torque out of IPM motors, which have a difference in their Q-axis and D-axis inductances. Specifically the quantity (Lq-Ld) is positive. This is due to the fact that an IPM's rotor's magnets are buried in the rotor, rather than located on the surface as for Surface Permanent Magnet AC motors. MTPA works by introducing a small (compared to q-axis) negative d-axis current which takes advantage of reluctance torque of the IPM. Essentially, MTPA is maximizing the sum of magnetic and reluctance torque, rather than maximizing just magnetic torque with zero d-axis current.
Thermal Limiting
Losses in the motor and motor controller are a function of current. Therefore we need to reduce the current through the devices to limit the temperature of both the motor and controller.
Torque Ramp
Slowly ramp up torque (over a period of 10's or 100's of milliseconds) in order to prevent mechanical damage to drivetrain.
Surface Mount Permanent Magnet Machines
Interior Permanent Magnet Machines
Position Feedback
Field oriented control relies on having the magnetic angle of the motor for the park transform. This can either be directly measured through an encoder or resolver (sensored control), or estimated/calculated from either the back EMF or motor impedance (sensorless control). One of the main limitations of sensorless control is that the angle is only easily estimated at either high or low speeds (depending on the method). A sensor ensures reliable angle feedback across the operating range.