Structs for ParameterID_Data#

Every used struct, which is unique to the ParameterID, is declared in a separate header uz_ParameterID_data.h. This includes the global structs and individual structs of each ID-state. They are all declared in the common header to ensure data integrity over each separate ID-state. Listed below are the global structs, which are not specific to one individual state.

enum uz_ParaID_Control_selection#

enum for selection of control algorithm if all OfflineID states are finished

Values:

enumerator No_Control#
enumerator Current_Control#
enumerator Speed_Control#
enumerator Torque_Control#

Global ParameterID Data struct#

This struct is used to communicate with the ParameterID object. It is therefore intended as the data-out- and -input of the ParameterID. The ParameterID will check for updated config values during runtime and adjust itself accordingly. During each step of the ParameterID, the members of each output struct are automatically updated to the latest values. In order to save execution time, the output structs of the ID-states are realized as pointers since some ID-states have large arrays as part of their output struct. Using memcpy is therefore not performant enough.

struct uz_ParameterID_Data_t#

Data struct to share inputs and outputs to the encapsuled uz_ParameterID_t object.

Public Members

uz_ParaID_ActualValues_t ActualValues#

Input: measured values needed for the ParameterID

uz_ParaID_ControlFlags_t *ControlFlags#

Output: current values of the ControlFlags struct

uz_ParaID_GlobalConfig_t GlobalConfig#

Input: Global configuration struct for general settings of the ParameterID

uz_ParaID_ElectricalIDConfig_t ElectricalID_Config#

Input: Configuration struct for ElectricalID

uz_ParaID_TwoMassIDConfig_t TwoMassID_Config#

Input: Configuration struct for TwoMassID

uz_ParaID_FrictionIDConfig_t FrictionID_Config#

Input: Configuration struct for FrictionID

uz_ParaID_FluxMapIDConfig_t FluxMapID_Config#

Input:Configuration struct for FluxMapID

uz_ParaID_OnlineIDConfig_t OnlineID_Config#

Input: Configuration struct for OnlineID

uz_ParaID_AutoRefCurrentsConfig_t AutoRefCurrents_Config#

Input: Configuration struct for AutoReference current generator

uz_ParaID_ElectricalID_output_t *ElectricalID_Output#

Output: Pointer to output struct of ElectricalID

uz_ParaID_TwoMassID_output_t *TwoMassID_Output#

Output: Pointer to output struct of TwoMassID

uz_ParaID_FrictionID_output_t *FrictionID_Output#

Output: Pointer to output struct of FrictionID

uz_ParaID_FluxMapID_output_t *FluxMapID_Output#

Output: Pointer to output struct of FluxMapID

uz_ParaID_OnlineID_output_t *OnlineID_Output#

Output: Pointer to output struct of OnlineID

uz_ParaID_Controller_Parameters_output_t Controller_Parameters#

Output: output struct for control algorithm (i_dq_ref / n_ref etc.)

uz_ParaID_AutoRefCurrents_output_t AutoRefCurrents_Output#

Output: output struct for reference currents of the AutoReference current generator

uz_ParaID_FluxMapsData_t *FluxMap_Data#

Storage for calculated OnlineID FluxMaps

uz_ParaID_ElectricalID_fft_in_t ElectricalID_FFT#

Storage for FFT which is done in main

uz_ParaID_ElectricalID_offset_estimation_t ElectricalID_Offset_Estimation#

Output: Encoder offset estimation

bool calculate_flux_maps#

status bool to signal, that the OnlineID FluxMaps should be calculated

bool finished_voltage_measurement#

status bool to signal, that voltage measurement for psi pm is finished

bool finished_extended_offset_estimation#

status bool to signal, extended encoder offset estimation is finished

int FluxMap_counter#

counter to transmit FluxMaps 1by1 to the uz_GUI

int FluxMap_Control_counter#

control counter from the GUI to sync the FluxMaps counter

float Psi_D_pointer#

current value of the FluxMap array corresponding to the value of the FluxMap_counter

float Psi_Q_pointer#

current value of the FluxMap array corresponding to the value of the FluxMap_counter

int Array_counter#

counter to transmit meas arrays of FrictionID 1by1 to the uz_GUI

int Array_Control_counter#

control counter from the GUI to sync the array_counter

float MeasArraySpeed_pointer#

current value of the MeasSpeedArray corresponding to the value of the array_counter

float MeasArrayTorque_pointer#

current value of the MeasTorqueArray corresponding to the value of the array_counter

float FluxMap_MeasuringPoints#

amount of unique measuring points for the FluxMaps

enum uz_ParaID_Control_selection ParaID_Control_Selection#

ParaID_Control_Selection

0 = No_Control

1 = Current_Control

2 = Speed_Control

3 = Torque_Control

bool OnlineID_reset_was_pressed#

Signals the functions in the main.c, that the reset was pressed

Actual values struct#

This struct carries all the measurement data needed for the ParameterID. They are passed to the ParameterID object through the ParameterID_Data struct. Some states may not need every measurement value listed below. For further details on this, check the individual pages of the existing Stateflows.

struct uz_ParaID_ActualValues_t#

struct for the measured values which are needed for the ParameterID

Public Members

uz_3ph_abc_t V_abc#

measured three-phase voltages

uz_3ph_abc_t I_abc#

measured three-phase currents

uz_3ph_dq_t i_dq#

measured dq voltages

uz_3ph_dq_t v_dq#

measured dq currents

uz_6ph_abc_t v_abc_6ph#

measured six-phase voltages

uz_6ph_abc_t i_abc_6ph#

measured six-phase currents

uz_3ph_dq_t v_xy_rotating#

measured dq voltages

uz_3ph_dq_t i_xy_rotating#

measured dq currents

uz_3ph_dq_t v_zero_rotating#

measured dq voltages

uz_3ph_dq_t i_zero_rotating#

measured dq currents

uz_6ph_dq_t i_dq_6ph#

measured dq voltages

uz_6ph_dq_t v_dq_6ph#

measured dq currents

real32_T omega_m#

measured mechanical omega

real32_T omega_el#

measured electrical omega

real32_T theta_m#

measured mechanical theta

real32_T theta_el#

measured electrical theta

real32_T V_DC#

measured DC-link voltage

real32_T average_winding_temp#

Average winding temperature in deg C

Global config struct#

This struct carries all configuration values of the ParameterID, which affect multiple states. It consists of request flags for the individual ID-states, initial controller configuration and motor configuration values, ACCEPT and RESET flags, etc. Depending on the setup, some configuration values can be left at 0. For further information, check each struct member’s description.

struct uz_ParaID_GlobalConfig_t#

Global configuration struct for general settings of the ParameterID.

Public Members

uz_PMSM_t PMSM_config#

motor related parameters. Is needed, if ElectricalID should not be executed

boolean_T enableParameterID#

flag to enable the entire ParameterID

boolean_T Reset#

flag to Reset the entire ParameterID

real32_T Kp_id#

value for Kp_id, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

real32_T Kp_iq#

value for Kp_iq, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

real32_T Kp_n#

value for Kp_n, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

real32_T Ki_id#

value for Ki_id, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

real32_T Ki_iq#

value for Ki_iq, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

real32_T Ki_n#

value for Ki_n, which is needed, if ElectricalID should not be executed. Can be left at 0, if no FOC control algorithm is used

boolean_T ElectricalID#

flag to enable ElectricalID

boolean_T FrictionID#

flag to enable FrictionID

boolean_T TwoMassID#

flag to enable TwoMassID

boolean_T FluxMapID#

flag to enable FluxMapID

boolean_T OnlineID#

flag to enable OnlineID

boolean_T ACCEPT#

flag for the ACCEPT button

real32_T sampleTimeISR#

sampleTime of the ISR. i.e. sampleTime of the function call uz_ParameterID_step. Very important parameter

real32_T ratCurrent#

rated current of the motor

real32_T ratTorque#

rated torque of the motor

real32_T ratSpeed#

rated speed of the motor

uz_3ph_dq_t i_dq_ref#

Not needed for ID-states. Can be used to transmit reference currents to a control algorithm.

real32_T n_ref#

Not needed for ID-states. Can be used to transmit reference speed to a control algorithm.

real32_T M_ref#

Not needed for ID-states. Can be used to transmit reference speed to a control algorithm.

real32_T voltage_measurement_C#

Voltage measurement: capacitor

real32_T voltage_measurement_Rp#

Voltage measurement: parallel resistor to capacitor

real32_T voltage_measurement_Rs#

Voltage measurement: series resistor to capacitor

uz_3ph_dq_t i_xy_ref#

Not needed for ID-states. Can be used to transmit reference currents to a control algorithm.

boolean_T PI_dq#

select PI-control in dq

boolean_T PI_xy#

select PI-control in xy

boolean_T PI_zero#

select PI-control in zero

boolean_T resonant_dq#

select resonant-control in dq

boolean_T resonant_xy#

select resonant-control in xy

boolean_T resonant_zero#

select resonant-control in zero

boolean_T controllers_updated#

controller configs updated

boolean_T setpoint_filter#

filter setpoints

Control flags struct#

This struct carries the enable signals for the individual ID-states.

struct uz_ParaID_ControlFlags_t#

struct which contains the enable state flags

Public Members

boolean_T startFrictionID#

flag to start FrictionID

boolean_T startElectricalID#

flag to start ElectricalID

boolean_T startTwoMassID#

flag to start TwoMassID

boolean_T startFluxMapID#

flag to start FluxMapID

uint16_T transNr#

transistion number. 1 transistion number corresponds to one ID-state

boolean_T enableOnlineID#

flag to start OnlineID

boolean_T finished_all_Offline_states#

flag to signal, that all OfflineID-state are finished and OnlineID-state can be started

Controller parameters struct#

This struct bundles all the necessary commands and values for the external control algorithm. Some variables are geared toward a FOC-controller and, therefore, can be ignored if another control algorithm is used.

struct uz_ParaID_Controller_Parameters_output_t#

struct with config values for a control algorithm

Public Members

uz_3ph_dq_t i_dq_ref#

reference currents for current controller

real32_T M_ref_FOC#

reference torque for the setpoint function

uint16_T activeState#

activeState of the ID-states

real32_T n_ref_FOC#

reference speed for the speed controller

boolean_T enableFOC_torque#

flag to enable torque controller

boolean_T enableFOC_speed#

flag to enable speed controller

boolean_T enableFOC_current#

flag to enable current controller

boolean_T resetIntegrator#

flag to reset the integrators used in the control algorithm

real32_T Kp_id_out#

Kp_id for FOC control. Can be ignored, if another control algorithm is used

real32_T Kp_iq_out#

Kp_iq for FOC control. Can be ignored, if another control algorithm is used

real32_T Kp_n_out#

Kp_n for FOC control. Can be ignored, if another control algorithm is used

real32_T Ki_id_out#

Ki_id for FOC control. Can be ignored, if another control algorithm is used

real32_T Ki_iq_out#

Ki_iq for FOC control. Can be ignored, if another control algorithm is used

real32_T Ki_n_out#

Ki_n for FOC control. Can be ignored, if another control algorithm is used

uz_3ph_dq_t i_xy_ref#

reference currents for current controller

uz_3ph_dq_t i_zero_ref#

reference currents for current controller

boolean_T PI_dq#

select PI-control in dq

boolean_T PI_xy#

select PI-control in xy

boolean_T PI_zero#

select PI-control in zero

boolean_T resonant_dq#

select resonant-control in dq

boolean_T resonant_xy#

select resonant-control in xy

boolean_T resonant_zero#

select resonant-control in zero

boolean_T filter_dq#

select setpoint filtering in dq

boolean_T filter_xy#

select setpoint filtering in xy

boolean_T filter_zero#

select setpoint filtering in zero

FluxMap data struct#

This struct bundles all necessary information for the flux maps of the OnlineID state.

struct uz_ParaID_FluxMapsData_t#

struct which contains the calculated fluxmaps of the OnlineID state

Public Members

real32_T psid_grid[400]#

array of calculated values for Psi_D fluxmap

real32_T psiq_grid[400]#

array of calculated values for Psi_Q fluxmap

real32_T id_grid[400]#

array of calculated values for i_d inverse fluxmap

real32_T iq_grid[400]#

array of calculated values for i_q inverse fluxmap

real32_T range_id_Y[20]#

y-values for i_d inverse fluxmap

real32_T range_psid_Y[20]#

y-values for Psi_D fluxmap

real32_T range_psiq_Y[20]#

y-values for Psi_Q fluxmap

real32_T range_psid_X[20]#

x-values for Psi_D fluxmap

real32_T range_psiq_X[20]#

x-values for Psi_Q fluxmap

real32_T range_iq_Y[20]#

y-values for i_q inverse fluxmap

real32_T range_iq_X[20]#

x-values for i_q inverse fluxmap

real32_T range_id_X[20]#

x-values for i_d inverse fluxmap

real32_T psi_temp_const#

estimated temperature constant of psi_pm

real32_T psi_temp_error#

estimated error of psi_pm because of heat losses of the magnets

Controller objects struct#

This struct bundles all necessary controller pointers for the external controller algorithm.

struct uz_ParameterID_controller#

Data struct to collect all controller pointers.

Public Members

uz_CurrentControl_t *CC_instance_dq#

current control instance for dq system

uz_SpeedControl_t *SC_instance#

speed control instance

uz_SetPoint_t *SP_instance#

setpoint instance