ElectricalID#

Description#

This state includes an automated identification process for typical parameters of a PMSM. It is based on [[1]] and has been modified to fit into the ParameterID library of the UltraZohm. This includes the identification of the theta_offset \(\theta_{offset}\) of an incremental encoder, stator resistance \(R_s\), direct inductance \(L_d\), quadrature inductance \(L_q\), permanent magnet flux \(\psi_{PM}\) and the inertia \(J\). The control parameters of a FOC will be calculated with the identified parameters and are therefore tuned for the used machine. This state requires some sort of speed control.

This state does require multiple ACCEPT flags to continue since, for the identification of \(L_q\), manual operation on the motor is required.

Figure made with TikZ

Fig. 287 Schematic overview of the ElectricalID

Necessary measurement values#

  • V_abc

  • I_abc

  • i_dq

  • v_dq

  • omega_m

  • omega_el

  • theta_m

ElectricalID object#

typedef struct uz_ParaID_ElectricalID_t uz_ParaID_ElectricalID_t#

Object definition for uz_ParaID_ElectricalID_t.

ElectricalID config#

struct uz_ParaID_ElectricalIDConfig_t#

configuration struct for ElectricalID specific settings

Public Members

real32_T goertzlFreq#

frequency of sine wave for vibration to identify J

real32_T dutyCyc#

manual input for DutyCycle during identification of thetaOffset, Ld and Lq. If the value is left at 0.0f, the DutyCycle will be identified automatically.

real32_T n_ref_measurement#

reference speed for identification of Psi_PM

boolean_T identLq#

flag to enable identification of Lq. If false, Lq=Ld

real32_T goertzlTorque#

max torque of sine wave for vibration to identify J

real32_T min_n_ratio#

minimal ratio of rated speed for automatic DutyCycle identification. i.e. 0.025f @3000rpm rated speed -> 75rpm. If this value is reached, the algorithm assumes the DutyCycle is strong enough to properly turn the rotor.

boolean_T extended_psi#

Input wether extended (high) or basic (low) psi pm determination is done

boolean_T extended_offset#

Input wether extended (high) or basic (low) theta determination is done

real32_T manual_offset#

give already predetermined offset angle in rad (optional)

ElectricalID output#

struct uz_ParaID_ElectricalID_output_t#

output struct of ElectricalID

Public Members

real32_T PWM_Switch_0#

DutyCycle for PWM Switch 0 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T PWM_Switch_2#

DutyCycle for PWM Switch 2 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T PWM_Switch_4#

DutyCycle for PWM Switch 4 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T PWM_Switch_a2#

DutyCycle for PWM Switch 6 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T PWM_Switch_b2#

DutyCycle for PWM Switch 8 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T PWM_Switch_c2#

DutyCycle for PWM Switch 10 (only needed from the start of ElectricalID, until Ld and Lq have been identified)

boolean_T enable_TriState[3]#

System 1: array to signal which halfbridge of the inverter should be in tristate mode. true signals, that the halfbridge should be in tristate mode. (only needed from the start of ElectricalID, until Ld and Lq have been identified)

boolean_T enable_TriState_set_2[3]#

System 2: array to signal which halfbridge of the inverter should be in tristate mode. true signals, that the halfbridge should be in tristate mode. (only needed from the start of ElectricalID, until Ld and Lq have been identified)

real32_T thetaOffset#

determined offset of theta in rad

uz_PMSM_t PMSM_parameters#

identified motor parameters

uz_6ph_dq_t inductances_6ph#

identified stator inductances

uz_6ph_dq_t resistances_6ph#

identified stator resistances

real32_T psi_pm[5]#

identified psi pm magnitudes

real32_T psi_pm_angle[5]#

identified psi pm agnles

real32_T set_rpm_val#

setpoint speed in rpm for psi pm identification

ElectricalID additional (for 6ph ParameterID)#

struct uz_ParaID_ElectricalID_fft_in_t#

Public Members

boolean_T finished_flag#

finished calculation

real32_T psi_pm_frequency[5]#

frequencies of higher orders

real32_T psi_pm_amplitude[5]#

magnitudes for each frequency

real32_T psi_pm_angle[5]#

angle for each frequency

struct uz_ParaID_ElectricalID_offset_estimation_t#

Public Members

boolean_T finished_flag#

finished offset estimation

uz_3ph_dq_t i_dq_ref#

ref currents from offset estimation

real32_T progress#

progress of offset estimation

real32_T offset_angle_rad#

offset angle in rad

ElectricalID functions#

uz_ParaID_ElectricalID_t *uz_ElectricalID_init(void)#

Initializes the uz_ParaID_ElectricalID_t object.

Returns:

uz_ParaID_ElectricalID_t pointer to object

void uz_ElectricalID_step(uz_ParaID_ElectricalID_t *self)#

steps the ElectricalID state once

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

void uz_ElectricalID_set_Config(uz_ParaID_ElectricalID_t *self, uz_ParaID_ElectricalIDConfig_t Config)#

Sets the config struct for the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

  • Config – configuration struct for ElectricalID

void uz_ElectricalID_set_ActualValues(uz_ParaID_ElectricalID_t *self, uz_ParaID_ActualValues_t ActualValues)#

Sets the ActualValues struct for the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

  • ActualValues – struct for the measurement values

void uz_ElectricalID_set_GlobalConfig(uz_ParaID_ElectricalID_t *self, uz_ParaID_GlobalConfig_t GlobalConfig)#

Sets the GlobalConfig struct for the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

  • GlobalConfig – struct for the general settings of the ParameterID

void uz_ElectricalID_set_ControlFlags(uz_ParaID_ElectricalID_t *self, uz_ParaID_ControlFlags_t *ControlFlags)#

Sets the ControlFlags struct for the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

  • ControlFlags – pointer to the struct with the enable signals of the ParameterID

bool uz_ElectricalID_get_enteredElectricalID(uz_ParaID_ElectricalID_t *self)#

Gets the status of the enteredElectricalID flag.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

Returns:

true state has been entered

Returns:

false state hasn’t been entered

bool uz_ElectricalID_get_finishedElectricalID(uz_ParaID_ElectricalID_t *self)#

Gets the status of the finishedElectricalID flag.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

Returns:

true state has finished

Returns:

false state hasn’t finished

uz_ParaID_Controller_Parameters_output_t *uz_ElectricalID_get_FOC_output(uz_ParaID_ElectricalID_t *self)#

Gets the pointer to the output controller struct of the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

Returns:

uz_ParaID_Controller_Parameters_output_t* pointer to the FOC controller parameters struct

uz_ParaID_ElectricalID_output_t *uz_ElectricalID_get_output(uz_ParaID_ElectricalID_t *self)#

Gets the pointer to the output struct of the ElectricalID.

Parameters:
  • self – pointer to uz_ParaID_ElectricalID_t object

Returns:

uz_ParaID_ElectricalID_output_t* pointer to the output struct

Sources#