Sample function#

uz_3ph_dq_t uz_CurrentControl_sample(uz_CurrentControl_t *self, uz_3ph_dq_t i_reference_Ampere, uz_3ph_dq_t i_actual_Ampere, float V_dc_volts, float omega_el_rad_per_sec)#

calculates last sample for dq-reference voltages

Parameters:
  • self – uz_CurrentControl_t instance

  • i_reference_Ampere – uz_dq_t struct for reference dq-currents in Ampere

  • i_actual_Ampere – uz_dq_t struct for measured dq-currents in Ampere

  • V_dc_volts – DC link voltage. Must be greater than 0.0f

  • omega_el_rad_per_sec – electrical rotational speed in rad/s

Returns:

uz_dq_t Output dq-reference voltage struct

uz_3ph_abc_t uz_CurrentControl_sample_abc(uz_CurrentControl_t *self, uz_3ph_dq_t i_reference_Ampere, uz_3ph_dq_t i_actual_Ampere, float V_dc_volts, float omega_el_rad_per_sec, float theta_el_rad)#

calculates last sample and transforms the dq-output voltage into the abc-system

Parameters:
  • self – uz_CurrentControl_t instance

  • i_reference_Ampere – uz_dq_t struct for reference dq-currents in Ampere

  • i_actual_Ampere – uz_dq_t struct for measured dq-currents in Ampere

  • V_dc_volts – DC link voltage. Must be greater than 0.0f

  • omega_el_rad_per_sec – electrical rotational speed in rad/s

  • theta_el_rad – electrical rotor angle in rad

Returns:

uz_3ph_abc_t Output abc-voltage struct

Example#

Listing 85 Example function call to calculate the CurrentControl output. CurrentControl-Instance via init-function#
 1int main(void) {
 2   float V_dc_volts = 24.0f;
 3   float omega_el_rad_per_sec = 125.1f;
 4   float theta_el_rad = 1.2f;
 5   struct uz_3ph_dq_t i_actual_Ampere = {.d = 1.0f, .q = 2.0f, .zero = 0.0f};
 6   struct uz_3ph_dq_t i_reference_Ampere = {.d = 1.0f, .q = 2.0f, .zero = 0.0f};
 7   struct uz_3ph_dq_t v_dq_Volts = uz_CurrentControl_sample(CC_instance, i_reference_Ampere, i_actual_Ampere, V_dc_volts, omega_el_rad_per_sec);
 8   //Alternatively the sample function can output the UVW-values
 9   struct uz_3ph_abc_t v_abc_Volts = uz_CurrentControl_sample_abc(CC_instance, i_reference_Ampere, i_actual_Ampere, V_dc_volts, omega_el_rad_per_sec, theta_el_rad);
10}

Description#

Calculates one sample of the CurrentControl.

Note

Either use the uz_CurrentControl_sample function to get the output voltages in the dq0-frame or use the uz_CurrentControl_sample_abc function to get the output voltages in the ABC-system.

Warning

The sample function has to be called with the same sample time as specified in the samplingTime_sec member of the PI-Controller configuration struct.