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#
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]].:
SM-PMSM[[3]]#
for \(\omega_{el} > \omega_c\\\):
I-PMSM[[2] S.1095ff.]#
Warning
\(L_d \neq L_q\) is necessary and will be checked.
This 4th order polynomial will be solved using the Newton-Raphson root approximation, with the initial guess being:
The d-current, depending on the saliency ratio, will be calculated like the following:
for \(\omega_{el} > \omega_c\\\):
This 4th order polynomial will be solved using the Newton-Raphson root approximation, with the initial guess and the coefficients being:
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.