AN 669: Drive-On-Chip Design Example for Cyclone V Devices

ID 683466
Date 5/15/2022
Public
Document Table of Contents

9.8. Motor Control Modes

The Drive-On-Chip Design Example supports various control algorithms and commutation modes.
The design supports:
  • Open-loop Volts/Hz speed control with sinusoidal commutation
  • Speed and position control with field-oriented current control (FOC), sinusoidal commutation with quadrature encoder or resolver feedback
  • Sensorless speed control with field-oriented current control using a sliding-mode speed and position observer using current feedback
  • Speed control with trapezoidal commutation using Hall sensor feedback

Open Loop

The design supports open loop control using sinusoidal commutation and trapezoidal commutation. The design uses Volts per Hz control in which the voltage the design applies to the motor increases with increasing frequency (motor speed). After each interrupt the interrupt service routine (ISR) updates a ramp generator to represent the motor electrical angle based on the previous angle, desired speed, and sample rate. The ISR calculates the voltage to apply using a Volts per Hz control gain based on the frequency and motor parameters. In open loop sinusoidal commutation, the ISR applies the inverse Park Transform and SVM function from FOC to generate sinusoidal commutation.
Figure 39. Open Loop Sinusoidal Commutation

FOC with Position Sensor Feedback

The design supports FOC sensor control where the motor position feeds back to form a closed loop with position and speed PI control. The design senses the motor position by incremental (quadrature) encoders.

The design samples and uses the motor phase currents as feedback to the FOC algorithm.
Figure 40. FOC with Position Sensor Feedback

FOC Sensorless

The design supports FOC sensorless control in which the design samples and uses both the motor phase voltages and currents as the feedback to the control loop.

The phase voltage calc block derives signals Vα and Vβ, scaled and normalized with respect to the DC bus voltage (Vdclink). The DC bus voltage may drop during quick acceleration or rise during regeneration. If you do not expect the bus voltage to change much (e.g. large bus capacitance), you may use Vα and Vβ generated from the inverse Clarke transform. The software function Phase_Volt_Calc_f() implements the phase voltage calculations using floating-point arithmetic.

The design integrates the speed estimator with the sliding mode observer (SMO) to allow a second order observer to calculate both estimated angle and estimated speed together. In FOC sensorless mode, the motor starts initially in open loop with a requested speed and switches to sensorless mode after a preset time to allow the SMO to settle. The software function SMO_Calc_f() implements the SMO calculations using floating-point arithmetic.

Figure 41. FOC Sensorless Control

Sliding Mode Observer Theory

Figure 42. SMO_Calc_f() software function

The observer, based on the electrical model, estimates the rotating back-EMF vector. The rotor position determines the direction of the back-EMF, which enables estimation of position. At constant speed, back-EMF components are sinusoidal in quadrature, as are error signals. Considering voltage V and current I in one motor phase with resistance Rs, inductance Ls. Net applied voltage V is at the motor terminal, and the centre of the motor is at 0 V.

Solvinge the differential equation for i, assuming a constant v applied over sample time T, initial current i , and current at the end of T i +1, gives:

Normalizing by some V max and I max to create variables that are non-dimensional and always <1, gives:

Aparm is non-dimensional, represents the electrical system dynamics. Ls/Rs is the electrical time constant, Ts is the discrete sample time. Aparm should be close to 1 if the sample time is much faster than the motor time constant.

Bparm uses Vmax/(Imax*Rs) so is also nondimensional. (1-Aparm) is small.

Aparm and Bparm are constant and are calculated once during initialization of the software.

Angle Tracking Observer Theory

The angle tracking observer (part of SMO_Calc_f()) takes the estimated back-EMF vector as input and outputs an estimated rotor position (phi_SMO). The back-EMF estimate may be noisy so the observer filters it and converts it to position. The design provides two methods:

  1. #if (TRACKER_ENABLE == 0), arctan method: A first order filter with gain Lpf_Gain is applied to both alpha and beta components of the back-EMF before using arctan to convert them to phi_SMO. The advantage is simplicity, but velocity must be estimated separately. The design does not use this method as the speed estimation may introduce lag.
  2. Angle observer method: The design combines the back-EMF estimates with the last phi_SMO to calculate AObsError, which is proportional to speed*sin(actual-estimate). Assuming small errors and constant speed, AobsError=K*(θElec - phi_SMO). Phi_SMO has units of fraction of 1rev (0..1 for 0..2π rad).
Figure 43. Angle Tracking ObserverInduced voltage ve = d/dt(φ) = Rotor back-EMF in q-direction in FOC. Rotor electrical angle θelec = direction of magnetic flux vector φ = d-direction in FOC.

The back-EMF operates in the q-direction,, which is at right-angles to the d-direction (θelec_rad). The components of the back-EMF in the fixed alpha and beta directions are:

  • vBemfAlpha_V = -dθmech_dt_rad_s*Ke_Vs_rad*sin(θelec_rad)
  • vBemfBeta_V = dθmech_dt_rad_s*Ke_Vs_rad*cos(θelec_rad)
  • AobsError is the back-EMF in the estimated d direction (phi_SMO), which is zero if phi_SMO is equal to θelec_rad
  • AObsError = -vBemfAlpha_V*cos(phi_SMO)-vBemfBeta_V*sin(phi_SMO)

Substituting the Bemf equations into the AObsError equation:

AObsError = dθmech_dt_rad_s*Ke_Vs_rad*( sin(θelec_rad)*cos(phi_SMO)-cos(θelec_rad)*sin(phi_SMO) )

= dθmech_dt_rad_s*Ke_Vs_rad*sin(θelec_rad - phi_SMO)

Hence, if the BemfAlpha and BemfBeta values are correct, AObsError measures the angle estimation error (θelec_rad - phi_SMO).

For small error angles and at constant speed, assume AObsError = K*(θelec - phi_SMO)

AObsError = K(θk- φk)

The software creates a second-order filter from θelec to phi_SMO. Filter natural frequency Ω and damping coefficient ζ are design parameters tuned for the Tamagawa motors in the Tandem Motion-Power 48 V motor kit. The normalized scaling makes them suitable for other motors too with possible retuning. Carefully tune this non-linear observer because incorrect position estimates can make the FoC algorithm oscillate or become unstable by causing positive feedback.

Figure 44. Feedback System

SMO Parameters

The design derives various SMO parameters from the motor parameters for each motor type, such as resistance and inductance. Other SMO parameters, and default values, are:

Table 17.  SMO Parameters
Parameter Description
Lpf_Gain = 0.10

Arctan method of angle calculation only. The final two stages of the SMO are a low-pass filter on each component of the estimated BEMF followed by an inverse tangent (arctan observer). The output of the inverse tangent is the estimated angle. The parameter Lpf_Gain sets the cutoff frequency of the low-pass filter.

Lpf_Gain = 2*pi*fc*Ts

where: Ts is the sample period and fc is the desired cutoff frequency.

damping_coefficient = 1.4

These are both parameters of the angle tracking observer, which takes in both unfiltered components of the estimated BEMF, extracts the angle and filters in one module. The angle tracking observer has no speed dependent phase lag, unlike the arctan observer. Setting natural_frequency too low can result in instability in the speed estimation.

natural_frequency = 600

Hys_Gain = 0.8

This parameter sets the sliding mode gain on the current observer. This observer is responsible for estimating the BEMF signals that it ultimately feeds into the angle tracking observer. To adjust this parameter, run the motor and view the estimated angle waveform. If it looks like an undistorted triangle no adjustment should be necessary. If the triangle looks distorted, while running at constant speed, adjust this parameter to clean it up.

Trapezoidal

The design supports trapezoidal control of BLDC motors using Hall sensor feedback on the Tandem Motion-Power 48 V Board. The software supports Duty Mode and Torque Mode, but the demonstration GUI only uses Velocity Mode. The software reconstructs the motor current from the individual phase current readings using the Hall encoder state to determine which phase current is relevant.

Figure 45. Trapezoidal Commutation Using Hall Sensor Feedback

Did you find the information on this page useful?

Characters remaining:

Feedback Message