Set Ki or Kp according to optimisation criteria#

void uz_CurrentControl_tune_magnitude_optimum(uz_CurrentControl_t *self, float tau_sigma_sec)#

Function to change the Ki- and Kp-values of the iq- and id-PI-Controllers according to the magnitude optimum.

Parameters:
  • self – uz_CurrentControl_t instance

  • tau_sigma_sec – Dead time due to measurement, calculation and the actuator

void uz_CurrentControl_tune_symmetric_optimum(uz_CurrentControl_t *self, float tau_sigma_sec)#

Function to change the Ki- and Kp-values of the iq- and id-PI-Controllers according to the symmetric optimum.

Parameters:
  • self – uz_CurrentControl_t instance

  • tau_sigma_sec – Dead time due to measurement, calculation and the actuator

void uz_CurrentControl_tune_bandwidth(uz_CurrentControl_t *self, float bandwidth_rad_per_sec)#

Function to change the Ki- and Kp-values of the iq- and id-PI-Controllers according to a desired bandwidth.

Parameters:
  • self – uz_CurrentControl_t instance

  • bandwidth_rad_per_sec – Desired bandwidth of current controller

Example#

Listing 89 Example function call to set Kp and Ki parameters.#
 1int main(void) {
 2   struct uz_PMSM_t config_PMSM = {
 3    .Ld_Henry = 0.0001f,
 4    .Lq_Henry = 0.0002f,
 5    .R_ph_Ohm = 0.008f
 6   };
 7   float tau_sigma_sec = 0.0001;
 8   float bandwidth_rad_per_sec = 2500;
 9   uz_CurrentControl_tune_magnitude_optimum(uz_CurrentControl_t *self, float tau_sigma_sec);
10   uz_CurrentControl_tune_symmetric_optimum(uz_CurrentControl_t *self, float tau_sigma_sec);
11   uz_CurrentControl_tune_bandwidth(uz_CurrentControl_t *self, float bandwidth_rad_per_sec);
12}

Description#

This only works for a UZ_PI_PARALLEL PI-controller configuration. Calculates the values of Kp and Ki according to different optimization criteria and the parameters of the PMSM. The magnitude optimum provides a good compromise between a fast response to a step change in the reference variable with low overshoot and good disturbance behaviour [[3]] (p.94). The controlled system is simplified to a PT2 system consisting of the respective current control loop (PT1 system) and an additional PT1 system representing the dead time due to the measuring process and actuator:

\[G_S(s) = \frac{1}{R} \cdot \frac{1}{1 + \tau_{d/q} \cdot s} \cdot \frac{1}{1 + \tau_{\sigma} \cdot s}\]

With the respective time constants:

\[\tau_{d/q} = \frac{L_{d/q}}{R}, \qquad \tau_{\sigma} = 1...2 \cdot T_{ISR}\]

\(T_{ISR}\) represents the selected period of the ISR. This time must be multiplied by a factor between 1 and 2 to obtain the real dead time. [[3]] (p.98), for example, selects a factor of 1.5. The transfer function of the current controller can be expressed as follows:

\[G_R(s) = V_R \cdot \frac{1 + T_n \cdot s}{T_n \cdot s}\]

According to the magnitude optimum, the controller settings for a controlled system of the form

\[G_S(s) = \frac{V_S}{1 + T_1 \cdot s} \cdot \frac{1}{1 + T_{\sigma} \cdot s}\]

have to be selected as follows:

\[T_n = T_1 \quad and \quad V_R = \frac{T_1}{2 V_S T_{\sigma}}\]

Where \(T_1\) is the larger time constant. Comparing this to the real transfer function \(G_S\) from above and noting that \(\tau_{d/q}\) is the larger time constant, the following tuning rules are obtained:

\[T_n = \tau_{d/q}, \qquad V_R = R \cdot \frac{\tau_{d/q}}{2 \cdot \tau_{\sigma}}\]

With this, the controller parameters of a parallel PI-controller can be determined:

\[\begin{split}G_R(s) &= R \cdot \frac{\tau_{d/q}}{2 \cdot \tau_{\sigma}} \cdot \frac{1 + \tau_{d/q} \cdot s}{\tau_{d/q} \cdot s}\\ &= \frac{L_{d/q}}{2 \cdot \tau_{\sigma}} \cdot \frac{1 + \tau_{d/q} \cdot s}{\tau_{d/q} \cdot s}\\ &= \frac{L_{d/q}}{2 \cdot \tau_{\sigma}} + \frac{L_{d/q}}{2 \cdot \tau_{\sigma} \cdot \tau_{d/q}} \cdot \frac{1}{s}\\ &= \frac{L_{d/q}}{2 \cdot \tau_{\sigma}} + \frac{R}{2 \cdot \tau_{\sigma}} \cdot \frac{1}{s}\\\end{split}\]
\[K_{p,d/q} = \frac{L_{d/q}}{2 \cdot \tau_{\sigma}}, \qquad K_{i,d/q} = \frac{R}{2 \cdot \tau_{\sigma}}\]

For controlled systems with an integrating component or when optimisation by the magnitude optimum is difficult due to unfavourable time constants, the symmetrical optimum can be used [[1]] (p.81). In this case, the controller settings must be selected differently:

\[T_n = 4 T_{\sigma}, \qquad V_R = \frac{T_1}{2 V_S T_{\sigma}}\]

For the parallel PI controller, the following formulas result accordingly:

\[\begin{split}G_R(s) &= \frac{T_1}{2 V_S T_{\sigma}} \cdot \frac{1 + 4 T_{\sigma} \cdot s}{4 T_{\sigma} \cdot s}\\ &= \frac{\tau_{d/q}}{2 \frac{1}{R} \tau_{\sigma}} \cdot \frac{1 + 4 \tau_{\sigma} \cdot s}{4 \tau_{\sigma} \cdot s}\\ &= \frac{L_{d/q}}{2 \tau_{\sigma}} \cdot \frac{1 + 4 \tau_{\sigma} \cdot s}{4 \tau_{\sigma} \cdot s}\\ &= \frac{L_{d/q}}{2 \tau_{\sigma}} + \frac{L_{d/q}}{8 \tau_{\sigma}^2} \cdot \frac{1}{s}\end{split}\]
\[K_{p,d/q} = \frac{L_{d/q}}{2 \cdot \tau_{\sigma}}, \qquad K_{i,d/q} = \frac{L_{d/q}}{8 \tau_{\sigma}^2}\]

As a third option, the current controllers can be adjusted according to a desired bandwidth. The corresponding formulas are based on pole placement:

\[K_{p,d/q} = \frac{R}{L_{d/q}}, \qquad K_{i,d/q} = R \cdot Bandwidth (rad/sec)\]

For a detailed explanation of how these formulae are derived, please refer to [[2]] (p.406).

Example calculation#

Consider a PMSM with the maschine data from above:

\[\begin{split}L_d &= 0.0001 H\\ L_q &= 0.0002 H\\ R &= 0.008 \Omega\end{split}\]

In this case a ISR frequency of \(f_{ISR} = 10kHz\) is chosen. See also Mux Axi / ISR Trigger Control to determine the value of \(f_{ISR}\). The controller settings are calculated according to the magnitude optimum as follows:

\[\begin{split}K_{p,d} &= \frac{L_{d}}{2 \cdot \tau_{sigma}} = \frac{0.0001 H}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 0.0003\\ K_{i,d} &= \frac{R}{2 \cdot \tau_{sigma}} = \frac{0.008 \Omega}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 26.67\\ K_{p,q} &= \frac{L_{q}}{2 \cdot \tau_{sigma}} = \frac{0.0002 H}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 0.0006\\ K_{i,q} &= \frac{R}{2 \cdot \tau_{sigma}} = \frac{0.008 \Omega}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 26.67\end{split}\]

For the symmetric optimum:

\[\begin{split}K_{p,d} &= \frac{L_{d}}{2 \cdot \tau_{sigma}} = \frac{0.0001 H}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 0.0003\\ K_{i,d} &= \frac{L_{d}}{8 \tau_{sigma}^2} = \frac{0.0001 H}{8 \cdot \frac{1}{10000 Hz}^2} = 1.25\\ K_{p,q} &= \frac{L_{q}}{2 \cdot \tau_{sigma}} = \frac{0.0002 H}{2 \cdot 1.5 \cdot \frac{1}{10000 Hz}} = 0.0006\\ K_{i,q} &= \frac{L_{q}}{8 \tau_{sigma}^2} = \frac{0.0002 H}{8 \cdot \frac{1}{10000 Hz}^2} = 2.5\end{split}\]

Note that here the ISR time has been multiplied by 1.5. As mentioned above, this factor can be chosen by the user. For optimisation based on a desired bandwidth of \(2500 rad/s\), the controller parameters are calculated as follows:

\[\begin{split}K_{p,d} &= \frac{R}{L_{d}} = \frac{0.008 \Omega}{0.0001 H} = 80\\ K_{i,d} &= R \cdot Bandwidth = 0.008 \Omega \cdot 2500 \frac{rad}{s} = 20\\ K_{p,q} &= \frac{R}{L_{q}} = \frac{0.008 \Omega}{0.0002 H} = 40\\ K_{i,q} &= R \cdot Bandwidth = 0.008 \Omega \cdot 2500 \frac{rad}{s} = 20\end{split}\]

Sources#