CurrentControl#
Toolbox for a standard CurrentControl with parallel PI-Controllers, linear decoupling and a space vector limitation. A space vector output limitation and a linear decoupling function are integrated. The decoupling function can be deactivated in the CurrentControl configuration struct.
Setup#
Configuration#
In order to configure the CurrentControl, multiple configuration structs have to be initialized.
-
enum uz_CurrentControl_decoupling_select#
enum for readable configuring for the decoupling in the CurrentControl sample function
Values:
-
enumerator no_decoupling#
-
enumerator linear_decoupling#
-
enumerator static_nonlinear_decoupling#
-
enumerator no_decoupling#
-
struct uz_CurrentControl_config#
Configuration struct for CurrentControl. Accessible by the user.
Public Members
-
enum uz_CurrentControl_decoupling_select decoupling_select#
CurrentControl decoupling selector
no_decoupling
linear_decoupling
-
struct uz_PI_Controller_config config_id#
Configuration struct for id-Controller
-
struct uz_PI_Controller_config config_iq#
Configuration struct for iq-Controller
-
bool Kp_adjustment_flag#
Flag to turn the adjustment of Kp via nonlinear flux-maps (gain scheduling) on or off
-
float max_modulation_index#
Max possible modulation index for the chosen modulation method. I.e. 1/sqrt(3) for Space-Vector-Modulation
-
enum uz_CurrentControl_decoupling_select decoupling_select#
Example#
1#include "uz/uz_CurrentControl/uz_CurrentControl.h"
2int main(void) {
3 struct uz_PMSM_t config_PMSM = {
4 .Ld_Henry = 0.0001f,
5 .Lq_Henry = 0.0002f,
6 .Psi_PM_Vs = 0.008f
7 };//these parameters are only needed if linear decoupling is selected
8 struct uz_PI_Controller_config config_id = {
9 .Kp = 10.0f,
10 .Ki = 10.0f,
11 .samplingTime_sec = 0.00005f
12 };
13 struct uz_PI_Controller_config config_iq = {
14 .Kp = 10.0f,
15 .Ki = 10.0f,
16 .samplingTime_sec = 0.00005f
17 };
18 struct uz_CurrentControl_config CC_config = {
19 .decoupling_select = linear_decoupling,
20 .Kp_adjustment_flag = false,
21 .config_PMSM = config_PMSM,
22 .config_id = config_id,
23 .config_iq = config_iq,
24 .max_modulation_index = 1.0f / sqrtf(3.0f)
25 };
26}
Note
The limitation of the internal PI-Controllers are deactivated, since only the Space vector limitation will be used. The limits can be left at 0 in the config.
Description#
With these config structs one can customize the CurrentControl and the included PI-Controller and PMSM config.
It is possible to use the CurrentControl with or without the linear decoupling via the CurrentControl_config member decoupling_select
.
If no decoupling is selected, no variables for the struct uz_PMSM_t
have to be configured and can be left 0.
Each of the two PI-Controller need their own config struct.
One for the id-Controller and the other one for the iq-Controller.
Init function#
-
typedef struct uz_CurrentControl_t uz_CurrentControl_t#
Object definition for CurrentControl.
-
uz_CurrentControl_t *uz_CurrentControl_init(struct uz_CurrentControl_config config)#
Initialization of the uz_CurrentControl object.
- Parameters:
config – configuration struct for CurrentControl
- Returns:
uz_CurrentControl_t* Pointer to uz_CurrentControl_t instance
Example#
1int main(void) {
2 uz_CurrentControl_t* CC_instance = uz_CurrentControl_init(CC_config);
3}
Description#
Allocates the memory for the CurrentControl instance and the included PI-Controller instances. Furthermore the input values of the configuration structs are asserted.
Reset#
-
void uz_CurrentControl_reset(uz_CurrentControl_t *self)#
Resets the CurrentControl and the integrators of the PI-Controllers.
- Parameters:
self – uz_CurrentControl_t instance
Example#
1int main(void) {
2 uz_CurrentControl_reset(CC_instance);
3}
Description#
Resets the CurrentControl and the integrated PI-Controller. The initial condition for the integrator after the reset is 0.0f.