Sample function#

uz_3ph_dq_t uz_SetPoint_sample(uz_SetPoint_t *self, float omega_m_rad_per_sec, float M_ref_Nm, float V_DC_Volts, uz_3ph_dq_t actual_currents_Ampere)#

Calculates reference currents based on MTPA or FW strategy and different motor topologies.

Parameters:
  • self – pointer to uz_SetPoint_t object

  • omega_m_rad_per_sec – mechanical rotational speed in rad/s

  • M_ref_Nm – reference torque in Nm

  • V_DC_Volts – DC-link voltage in Volts

  • actual_currents_Ampere – uz_3ph_dq_t struct with measured currents in Ampere

Returns:

uz_3ph_dq_t reference currents for current-control module in Ampere

Example#

Listing 143 Example function call to use the SetPoint module. SetPoint-Instance via init-function#
1int main(void) {
2   float omega_m_rad_per_sec = 1.5f;
3   float M_ref_Nm = 0.0045f;
4   float V_DC_Volts = 24.0f;
5   uz_3ph_dq_t actual_currents_Ampere = {1.0f, 2.0f, 0.0f};
6   uz_3ph_dq_t output = uz_SetPoint_sample(SP_instance, omega_m_rad_per_sec, M_ref_Nm, V_DC_Volts, actual_currents_Ampere);
7}

Description#

Calculates the reference currents based on the user selection. Depending on the operating condition of the machine, either an MTPA or a field-weakening is active. The reference currents are always limited to the max. allowed current. I.e. if \(I_{max} = 15A\), in all cases \(\sqrt{I_{d,ref}^2 + I_{q,ref}^2}\) will be lower than the max allowed current. To ensure, that the resulting set-currents after solving the polynomials for the MTPA and FW approximate with a sufficient degree of accuracy the reference torque, a comparison between the reference torque and the actual torque via the resulting set-currents is made. If the difference between these two variables exceeds a user-configurable threshold, an assertion is triggered. If a manual \(I_{d,manual}\) input current is set in the MPTA state, this current will be added on top of the \(I_{d,MTPA}\) current. In FW operation, the \(I_{d,manual}\) input will be ignored. The cut-off rotational speed for the field-weakening is calculated based on the max possible field excitation \(V_{FE,max}\) and the measured total current \(I_1\) [[1]].:

\[\begin{split}V_{FE,max} &= \sqrt{\frac{V_{DC}}{\sqrt{3}}} - R_{ph} I_{max}\\ I_1 &= \sqrt{i_{q,meas}^2 + i_{d,meas}^2}\\ \omega_c &= \frac{-R_{ph} \psi_{PM} I_1}{I_1^2 L_q^2 + \psi_{PM}^2} + \sqrt{\frac{R_{ph}^2 \psi_{PM}^2 I_1^2 }{(I_1^2 L_q^2 + \psi_{PM}^2)^2} - \frac{(I_1^2 - R_{ph}^2) - V_{FE,max}^2}{I_1^2 L_q^2 + \psi_{PM}^2}}\\\end{split}\]

SM-PMSM[[3]]#

\[\begin{split}I_{q,MTPA} &= \frac{M_{ref}}{\frac{3}{2} p \psi_{PM}}\\ I_{d,MTPA} &= I_{d,manual}\\\end{split}\]

for \(\omega_{el} > \omega_c\\\):

\[\begin{split}I_{d,fw} &= \frac{\psi_{PM}}{L_d}(\frac{\omega_c}{\omega_{el}}-1)\\ I_{q,fw} &= I_{q,MTPA}\\ I_{q,fw,max} &= \sqrt{I_{max}^2 - I_{d,fw}^2}\end{split}\]

I-PMSM[[2] S.1095ff.]#

Warning

\(L_d \neq L_q\) is necessary and will be checked.

\[\begin{split}M_{ref} &= \frac{3}{2} p I_{q,MTPA} \left(\psi_{PM} + \frac{1}{2} \left(-\psi_{PM} - \sqrt{\psi_{PM}^2 + 4 (L_d - L_q)^2 I_{q,MTPA}^2}\right)\right)\\ 0 &= I_{q,MTPA}^4 + \frac{2 M_{ref} \psi_{PM}}{3 (L_d - L_q)^2 p} I_{q,MTPA} - \frac{4 M_{ref}^2}{9 (L_d - L_q)^2 p^2} \\\end{split}\]

This 4th order polynomial will be solved using the Newton-Raphson root approximation, with the initial guess being:

\[\begin{split}I_{q,init} &= \frac{M_{ref}}{\frac{3}{2} p \psi_{PM}}\\\end{split}\]

The d-current, depending on the saliency ratio, will be calculated like the following:

\[\begin{split}I_{d,MTPA} &= \left(\frac{-\psi_{PM}}{2 (L_d - L_q)} - \sqrt{\frac{\psi_{PM}^2}{4 (L_d - L_q)^2} + I_{q,MTPA}^2}\right) + I_{d,manual}\ \ \ for \ \ (L_q > L_d)\\ I_{d,MTPA} &= \left(\frac{-\psi_{PM}}{2 (L_d - L_q)} + \sqrt{\frac{\psi_{PM}^2}{4 (L_d - L_q)^2} + I_{q,MTPA}^2}\right) + I_{d,manual}\ \ \ for \ \ (L_q < L_d)\\\end{split}\]

for \(\omega_{el} > \omega_c\\\):

\[\begin{split}M_{ref} &= \frac{3}{2} p \left(\psi_{PM} I_{q,FW} + \frac{(L_d - L_q)}{L_d} \left(-\psi_{PM} \pm \sqrt{\frac{V_{FE,max}^2}{\omega_{el}^2} - L_q^2 I_{q,FW}^2}\right)I_{q,FW}\right)\\ 0 &= I_{q,FW}^4 + a_2 I_{q,FW}^2 + a_1 I_{q,FW} + a_0 \\\end{split}\]

This 4th order polynomial will be solved using the Newton-Raphson root approximation, with the initial guess and the coefficients being:

\[ \begin{align}\begin{aligned}\begin{split}I_{q,init} &= \frac{I_{max}}{2}\\ a_2 &= \frac{\psi_{PM}^2 L_q^2 - (L_d - L_q)^2 \frac{V_{FE,max}^2}{\omega_{el}^2}}{L_q^2 (L_d - L_q)^2}\\ a_1 &= \frac{-4 M_{ref} L_d L_q \psi_{PM}}{3 L_q^2 p (L_d - L_q)^2}\\ a_0 &= \frac{4 (M_{ref} L_d)^2}{9 L_q^2 p^2 (L_d - L_q)^2}\\\end{split}\\\begin{split}I_{d,FW} = \frac{-\psi_{PM}}{L_d} + \frac{1}{L_d} \sqrt{\left(\frac{V_{FE,max}}{\omega_{el}}\right)^2 - (L_q I_{q,FW})^2}\\\end{split}\end{aligned}\end{align} \]

General notes:#

If the machine is in the MTPA state, the input id_ref_Ampere current will be added to the calculated \(I_{d,MTPA}\) current. If the machine is inside the field weakening territory, the input id_ref_Ampere will be ignored.

Sources#