Controller SetPoint Filter#

Description#

The set-point filter function uses two IIR filter objects to filter the d- and q-current set-points of a controller. The intended use is for cascaded control structures as well as direct user input (e.g., via the GUI). As large changes in set-points may result in big current jumps, this function smoothes the set-point change and reduces stress on the system hardware. The suggested filter configuration in the Example configuration can be used as a baseline and has to be tuned to the specific application.

Example configuration#

Listing 78 Example to init the filter#
 1#include "uz/uz_controller_setpoint_filter/uz_controller_setpoint_filter.h"
 2#define ISR_SAMPLE_FREQ_HZ 10000.0f
 3const struct uz_IIR_Filter_config config_filter = {
 4  .selection = LowPass_first_order,
 5  .cutoff_frequency_Hz = 1.0f,
 6  .sample_frequency_Hz = ISR_SAMPLE_FREQ_HZ};
 7struct uz_dq_setpoint_filter_config config = {
 8  .config_filter_d = config_filter,
 9  .config_filter_q = config_filter};
10uz_dq_setpoint_filter* obj_1 = NULL;
11uz_dq_setpoint_filter* obj_2 = NULL;
12int main(void) {
13   //...
14   obj_1 = uz_uz_dq_setpoint_filter_init(config);
15   obj_2 = uz_uz_dq_setpoint_filter_init(config);
16   //...
17}
Listing 79 Example to use the filter (initialization of uz_current_control not included, code will not compile!)#
1#include "../uz_controller_setpoint_filter/uz_controller_setpoint_filter.h"
2extern uz_dq_setpoint_filter* obj_1;
3extern uz_dq_setpoint_filter* obj_2;
4void ISR_Control(void *data) {
5   //...
6   uz_3ph_dq_t setpoints_filtered = uz_signals_IIR_Filter_dq_setpoint(obj_1, Global_Data.rasv.i_ref_dq)
7   controller_out = uz_CurrentControl_sample(cc_instance, uz_signals_IIR_Filter_dq_setpoint(obj_2, Global_Data.rasv.i_ref_dq), Global_Data.av.i_actual_dq, Global_Data.av.V_dc, Global_Data.av.omega_el);
8   //...
9}

IIR filter set-point#

struct uz_dq_setpoint_filter_config#

Configuration struct for Setpoint Filter. Pass to init function. Accessible by the user.

Public Members

struct uz_IIR_Filter_config config_filter_d#

Filter config d-setpoint

struct uz_IIR_Filter_config config_filter_q#

Filter config q-setpoint

typedef struct uz_dq_setpoint_filter uz_dq_setpoint_filter#

Object definition for generating a PI-Controller.

uz_dq_setpoint_filter *uz_uz_dq_setpoint_filter_init(struct uz_dq_setpoint_filter_config config)#

Initialization of the uz_dq_setpoint_filter object.

Parameters:
  • config – uz_dq_setpoint_filter_config struct

Returns:

Pointer to uz_dq_setpoint_filter instance

uz_3ph_dq_t uz_signals_IIR_Filter_dq_setpoint(uz_dq_setpoint_filter *self, uz_3ph_dq_t setpoint)#

Function to filter/smooth out a dq setpoint e.g. for current control.

Parameters:
  • self – pointer to instance

  • setpoint – raw setpoint for control algorithm

Returns:

filtered dq struct