Added Sinusoidal Control Type
Sinusoidal Control Type is now available is this branch. To select it go in config.h and change CTRL_TYP_SEL to 1. By default FOC control type is selcted. Note: SPEED and TORQUE modes are not available for Sinusoidal control type.
This commit is contained in:
parent
420b95e281
commit
6c8b7f001d
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 189 KiB |
Binary file not shown.
Binary file not shown.
|
@ -10,7 +10,7 @@
|
||||||
% >> improved motor efficiency -> lower energy consumption
|
% >> improved motor efficiency -> lower energy consumption
|
||||||
%
|
%
|
||||||
% Author: Emanuel FERU
|
% Author: Emanuel FERU
|
||||||
% Copyright © 2019 Emanuel FERU <aerdronix@gmail.com>
|
% Copyright © 2019-2020 Emanuel FERU <aerdronix@gmail.com>
|
||||||
%
|
%
|
||||||
% This program is free software: you can redistribute it and/or modify
|
% This program is free software: you can redistribute it and/or modify
|
||||||
% it under the terms of the GNU General Public License as published by
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
@ -59,7 +59,8 @@ r_cos_M1 = cos((a_elecAngle_XA + 30)*(pi/180));
|
||||||
%% Control Manager
|
%% Control Manager
|
||||||
% Control type selection
|
% Control type selection
|
||||||
CTRL_COM = 0; % [-] Commutation Control
|
CTRL_COM = 0; % [-] Commutation Control
|
||||||
CTRL_FOC = 1; % [-] Field Oriented Control (FOC)
|
CTRL_SIN = 1; % [-] Sinusoidal Control
|
||||||
|
CTRL_FOC = 2; % [-] Field Oriented Control (FOC)
|
||||||
z_ctrlTypSel = CTRL_FOC; % [-] Control Type Selection (default)
|
z_ctrlTypSel = CTRL_FOC; % [-] Control Type Selection (default)
|
||||||
|
|
||||||
% Control model request
|
% Control model request
|
||||||
|
@ -89,7 +90,7 @@ cf_currFilt = 0.12; % [%] Current filter coefficient [0, 1]. Lower v
|
||||||
b_diagEna = 1; % [-] Diagnostics enable flag: 0 = Disabled, 1 = Enabled (default)
|
b_diagEna = 1; % [-] Diagnostics enable flag: 0 = Disabled, 1 = Enabled (default)
|
||||||
t_errQual = 0.6 * f_ctrl; % [s] Error qualification time
|
t_errQual = 0.6 * f_ctrl; % [s] Error qualification time
|
||||||
t_errDequal = 2.0 * f_ctrl; % [s] Error dequalification time
|
t_errDequal = 2.0 * f_ctrl; % [s] Error dequalification time
|
||||||
r_errInpTgtThres = 200; % [-] Error input target threshold (for "Blocked motor" detection)
|
r_errInpTgtThres = 400; % [-] Error input target threshold (for "Blocked motor" detection)
|
||||||
|
|
||||||
%% F04_Field_Oriented_Control
|
%% F04_Field_Oriented_Control
|
||||||
|
|
||||||
|
@ -146,10 +147,30 @@ iq_maxSca_M1 = sqrt(1 - iq_maxSca_XA.^2);
|
||||||
%-------------------------------
|
%-------------------------------
|
||||||
|
|
||||||
%% F05_Control_Type_Management
|
%% F05_Control_Type_Management
|
||||||
|
|
||||||
% Commutation method
|
% Commutation method
|
||||||
z_commutMap_M1 = [-1 -1 0 1 1 0; % Phase A
|
z_commutMap_M1 = [-1 -1 0 1 1 0; % Phase A
|
||||||
1 0 -1 -1 0 1; % Phase B
|
1 0 -1 -1 0 1; % Phase B
|
||||||
0 1 1 0 -1 -1]; % Phase C [-] Commutation method map
|
0 1 1 0 -1 -1]; % Phase C [-] Commutation method map
|
||||||
|
|
||||||
|
% Sinusoidal method
|
||||||
|
% The map below was experimentaly calibrated on the real motor. Objectives: minimum noise and minimum torque ripple
|
||||||
|
a_phaAdv_M1 = [0 0 0 0 0 2 3 5 9 16 25]; % [deg] Phase advance angle
|
||||||
|
r_phaAdv_XA = [0 100 200 300 400 500 600 700 800 900 1000]; % [-] Scaled input target grid
|
||||||
|
% plot(r_phaAdv_XA, a_phaAdv_M1);
|
||||||
|
|
||||||
|
omega = a_elecAngle_XA*(pi/180);
|
||||||
|
pha_adv = 30; % [deg] Phase advance to mach commands with the Hall position
|
||||||
|
r_sinPhaA_M1 = -sin(omega + pha_adv*(pi/180));
|
||||||
|
r_sinPhaB_M1 = -sin(omega - 120*(pi/180) + pha_adv*(pi/180));
|
||||||
|
r_sinPhaC_M1 = -sin(omega + 120*(pi/180) + pha_adv*(pi/180));
|
||||||
|
|
||||||
|
% Sinusoidal 3rd armonic method
|
||||||
|
A = 1.15; % Sine amplitude (tunable to get the Saddle sin maximum to value 1000)
|
||||||
|
sin3Arm = -0.224*sin(3*(omega + pha_adv*(pi/180))); % 3rd armonic
|
||||||
|
r_sin3PhaA_M1 = sin3Arm + A*r_sinPhaA_M1;
|
||||||
|
r_sin3PhaB_M1 = sin3Arm + A*r_sinPhaB_M1;
|
||||||
|
r_sin3PhaC_M1 = sin3Arm + A*r_sinPhaC_M1;
|
||||||
|
|
||||||
disp('---- BLDC_controller: Initialization OK ----');
|
disp('---- BLDC_controller: Initialization OK ----');
|
||||||
|
|
||||||
|
@ -158,64 +179,70 @@ show_fig = 0;
|
||||||
|
|
||||||
if show_fig
|
if show_fig
|
||||||
|
|
||||||
|
% Apply scaling
|
||||||
sca_factor = 1000; % [-] scalling factor (to avoid truncation approximations on integer data type)
|
sca_factor = 1000; % [-] scalling factor (to avoid truncation approximations on integer data type)
|
||||||
|
r_sinPhaA_M1sca = sca_factor * r_sinPhaA_M1;
|
||||||
|
r_sinPhaB_M1sca = sca_factor * r_sinPhaB_M1;
|
||||||
|
r_sinPhaC_M1sca = sca_factor * r_sinPhaC_M1;
|
||||||
|
r_sin3PhaA_M1sca = sca_factor * r_sin3PhaA_M1;
|
||||||
|
r_sin3PhaB_M1sca = sca_factor * r_sin3PhaB_M1;
|
||||||
|
r_sin3PhaC_M1sca = sca_factor * r_sin3PhaC_M1;
|
||||||
|
|
||||||
% Trapezoidal method
|
% Commutation method
|
||||||
a_trapElecAngle_XA = [0 60 120 180 240 300 360]; % [deg] Electrical angle grid
|
a_commElecAngle_XA = [0 60 120 180 240 300 360]; % [deg] Electrical angle grid
|
||||||
r_trapPhaA_M1 = sca_factor*[ 1 1 1 -1 -1 -1 1];
|
hall_A = [0 0 0 1 1 1 1] + 4;
|
||||||
r_trapPhaB_M1 = sca_factor*[-1 -1 1 1 1 -1 -1];
|
hall_B = [1 1 0 0 0 1 1] + 2;
|
||||||
r_trapPhaC_M1 = sca_factor*[ 1 -1 -1 -1 1 1 1];
|
hall_C = [0 1 1 1 0 0 0];
|
||||||
|
|
||||||
% Sinusoidal method
|
|
||||||
a_sinElecAngle_XA = 0:10:360;
|
|
||||||
omega = a_sinElecAngle_XA*(pi/180);
|
|
||||||
pha_adv = 30; % [deg] Phase advance to mach commands with the Hall position
|
|
||||||
r_sinPhaA_M1 = -sca_factor*sin(omega + pha_adv*(pi/180));
|
|
||||||
r_sinPhaB_M1 = -sca_factor*sin(omega - 120*(pi/180) + pha_adv*(pi/180));
|
|
||||||
r_sinPhaC_M1 = -sca_factor*sin(omega + 120*(pi/180) + pha_adv*(pi/180));
|
|
||||||
|
|
||||||
% SVM (Space Vector Modulation) calculation
|
% SVM (Space Vector Modulation) calculation
|
||||||
SVM_vec = [r_sinPhaA_M1; r_sinPhaB_M1; r_sinPhaC_M1];
|
SVM_vec = [r_sinPhaA_M1sca; r_sinPhaB_M1sca; r_sinPhaC_M1sca];
|
||||||
SVM_min = min(SVM_vec);
|
SVM_min = min(SVM_vec);
|
||||||
SVM_max = max(SVM_vec);
|
SVM_max = max(SVM_vec);
|
||||||
SVM_sum = SVM_min + SVM_max;
|
SVM_sum = SVM_min + SVM_max;
|
||||||
SVM_vec = SVM_vec - 0.5*SVM_sum;
|
SVM_vec = SVM_vec - 0.5*SVM_sum;
|
||||||
SVM_vec = (2/sqrt(3))*SVM_vec;
|
SVM_vec = (2/sqrt(3))*SVM_vec;
|
||||||
|
|
||||||
hall_A = [0 0 0 1 1 1 1] + 4;
|
|
||||||
hall_B = [1 1 0 0 0 1 1] + 2;
|
|
||||||
hall_C = [0 1 1 1 0 0 0];
|
|
||||||
|
|
||||||
color = ['m' 'g' 'b'];
|
color = ['m' 'g' 'b'];
|
||||||
lw = 1.5;
|
lw = 1.5;
|
||||||
figure
|
figure
|
||||||
s1 = subplot(221); hold on
|
s1 = subplot(231); hold on
|
||||||
stairs(a_trapElecAngle_XA, hall_A, color(1), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_A, color(1), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, hall_B, color(2), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_B, color(2), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, hall_C, color(3), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_C, color(3), 'Linewidth', lw);
|
||||||
xticks(a_trapElecAngle_XA);
|
xticks(a_commElecAngle_XA);
|
||||||
grid
|
grid
|
||||||
yticks(0:5);
|
yticks(0:5);
|
||||||
yticklabels({'0','1','0','1','0','1'});
|
yticklabels({'0','1','0','1','0','1'});
|
||||||
title('Hall sensors');
|
title('Hall sensors');
|
||||||
legend('Phase A','Phase B','Phase C','Location','NorthEast');
|
legend('Phase A','Phase B','Phase C','Location','NorthEast');
|
||||||
|
|
||||||
s2 = subplot(222); hold on
|
s2 = subplot(232); hold on
|
||||||
stairs(a_trapElecAngle_XA, hall_A, color(1), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_A, color(1), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, hall_B, color(2), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_B, color(2), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, hall_C, color(3), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_C, color(3), 'Linewidth', lw);
|
||||||
xticks(a_trapElecAngle_XA);
|
xticks(a_commElecAngle_XA);
|
||||||
grid
|
grid
|
||||||
yticks(0:5);
|
yticks(0:5);
|
||||||
yticklabels({'0','1','0','1','0','1'});
|
yticklabels({'0','1','0','1','0','1'});
|
||||||
title('Hall sensors');
|
title('Hall sensors');
|
||||||
legend('Phase A','Phase B','Phase C','Location','NorthEast');
|
legend('Phase A','Phase B','Phase C','Location','NorthEast');
|
||||||
|
|
||||||
s3 = subplot(223); hold on
|
s3 = subplot(233); hold on
|
||||||
stairs(a_trapElecAngle_XA, sca_factor*[z_commutMap_M1(1,:) z_commutMap_M1(1,1)] + 6000, color(1), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_A, color(1), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, sca_factor*[z_commutMap_M1(2,:) z_commutMap_M1(2,1)] + 3000, color(2), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_B, color(2), 'Linewidth', lw);
|
||||||
stairs(a_trapElecAngle_XA, sca_factor*[z_commutMap_M1(3,:) z_commutMap_M1(3,1)], color(3), 'Linewidth', lw);
|
stairs(a_commElecAngle_XA, hall_C, color(3), 'Linewidth', lw);
|
||||||
xticks(a_trapElecAngle_XA);
|
xticks(a_commElecAngle_XA);
|
||||||
|
grid
|
||||||
|
yticks(0:5);
|
||||||
|
yticklabels({'0','1','0','1','0','1'});
|
||||||
|
title('Hall sensors');
|
||||||
|
legend('Phase A','Phase B','Phase C','Location','NorthEast');
|
||||||
|
|
||||||
|
s4 = subplot(234); hold on
|
||||||
|
stairs(a_commElecAngle_XA, sca_factor*[z_commutMap_M1(1,:) z_commutMap_M1(1,1)] + 6000, color(1), 'Linewidth', lw);
|
||||||
|
stairs(a_commElecAngle_XA, sca_factor*[z_commutMap_M1(2,:) z_commutMap_M1(2,1)] + 3000, color(2), 'Linewidth', lw);
|
||||||
|
stairs(a_commElecAngle_XA, sca_factor*[z_commutMap_M1(3,:) z_commutMap_M1(3,1)], color(3), 'Linewidth', lw);
|
||||||
|
xticks(a_commElecAngle_XA);
|
||||||
yticks(-1000:1000:7000);
|
yticks(-1000:1000:7000);
|
||||||
yticklabels({'-1000','0','1000','-1000','0','1000','-1000','0','1000'});
|
yticklabels({'-1000','0','1000','-1000','0','1000','-1000','0','1000'});
|
||||||
ylim([-1000 7000]);
|
ylim([-1000 7000]);
|
||||||
|
@ -223,16 +250,27 @@ if show_fig
|
||||||
title('Commutation method [0]');
|
title('Commutation method [0]');
|
||||||
xlabel('Electrical angle [deg]');
|
xlabel('Electrical angle [deg]');
|
||||||
|
|
||||||
s4 = subplot(224); hold on
|
s5 = subplot(235); hold on
|
||||||
plot(a_sinElecAngle_XA, SVM_vec(1,:), color(1), 'Linewidth', lw);
|
plot(a_elecAngle_XA, r_sin3PhaA_M1sca, color(1), 'Linewidth', lw);
|
||||||
plot(a_sinElecAngle_XA, SVM_vec(2,:), color(2), 'Linewidth', lw);
|
plot(a_elecAngle_XA, r_sin3PhaB_M1sca, color(2), 'Linewidth', lw);
|
||||||
plot(a_sinElecAngle_XA, SVM_vec(3,:), color(3), 'Linewidth', lw);
|
plot(a_elecAngle_XA, r_sin3PhaC_M1sca, color(3), 'Linewidth', lw);
|
||||||
xticks(a_trapElecAngle_XA);
|
xticks(a_commElecAngle_XA);
|
||||||
ylim([-1000 1000])
|
ylim([-1000 1000])
|
||||||
grid
|
grid
|
||||||
title('FOC method [1]');
|
title('SIN method [1]');
|
||||||
xlabel('Electrical angle [deg]');
|
xlabel('Electrical angle [deg]');
|
||||||
linkaxes([s1 s2 s3 s4],'x');
|
|
||||||
|
s6 = subplot(236); hold on
|
||||||
|
plot(a_elecAngle_XA, SVM_vec(1,:), color(1), 'Linewidth', lw);
|
||||||
|
plot(a_elecAngle_XA, SVM_vec(2,:), color(2), 'Linewidth', lw);
|
||||||
|
plot(a_elecAngle_XA, SVM_vec(3,:), color(3), 'Linewidth', lw);
|
||||||
|
xticks(a_commElecAngle_XA);
|
||||||
|
ylim([-1000 1000])
|
||||||
|
grid
|
||||||
|
title('FOC method [2]');
|
||||||
|
xlabel('Electrical angle [deg]');
|
||||||
|
|
||||||
|
linkaxes([s1 s2 s3 s4 s5 s6],'x');
|
||||||
xlim([0 360]);
|
xlim([0 360]);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
*
|
*
|
||||||
* Code generated for Simulink model 'BLDC_controller'.
|
* Code generated for Simulink model 'BLDC_controller'.
|
||||||
*
|
*
|
||||||
* Model version : 1.1199
|
* Model version : 1.1212
|
||||||
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
||||||
* C/C++ source code generated on : Sun Nov 3 12:28:16 2019
|
* C/C++ source code generated on : Sat Nov 30 08:54:28 2019
|
||||||
*
|
*
|
||||||
* Target selection: ert.tlc
|
* Target selection: ert.tlc
|
||||||
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
||||||
|
@ -30,122 +30,138 @@
|
||||||
/* Forward declaration for rtModel */
|
/* Forward declaration for rtModel */
|
||||||
typedef struct tag_RTM RT_MODEL;
|
typedef struct tag_RTM RT_MODEL;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S11>/Counter' */
|
/* Block signals and states (auto storage) for system '<S10>/Counter' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int16_T UnitDelay_DSTATE; /* '<S17>/UnitDelay' */
|
int16_T UnitDelay_DSTATE; /* '<S14>/UnitDelay' */
|
||||||
} DW_Counter;
|
} DW_Counter;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S40>/PI_clamp_fixdt_id' */
|
/* Block signals and states (auto storage) for system '<S46>/PI_clamp_fixdt_id' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_T UnitDelay_DSTATE; /* '<S65>/UnitDelay' */
|
int32_T UnitDelay_DSTATE; /* '<S67>/UnitDelay' */
|
||||||
boolean_T UnitDelay1_DSTATE; /* '<S62>/UnitDelay1' */
|
boolean_T UnitDelay1_DSTATE; /* '<S64>/UnitDelay1' */
|
||||||
} DW_PI_clamp_fixdt;
|
} DW_PI_clamp_fixdt;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S31>/Low_Pass_Filter' */
|
/* Block signals and states (auto storage) for system '<S37>/Low_Pass_Filter' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int16_T UnitDelay3_DSTATE[2]; /* '<S44>/UnitDelay3' */
|
int16_T UnitDelay3_DSTATE[2]; /* '<S50>/UnitDelay3' */
|
||||||
} DW_Low_Pass_Filter;
|
} DW_Low_Pass_Filter;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S38>/PI_clamp_fixdt_n' */
|
/* Block signals and states (auto storage) for system '<S44>/PI_clamp_fixdt_n' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_T UnitDelay_DSTATE; /* '<S55>/UnitDelay' */
|
int32_T UnitDelay_DSTATE; /* '<S57>/UnitDelay' */
|
||||||
boolean_T UnitDelay1_DSTATE; /* '<S53>/UnitDelay1' */
|
boolean_T UnitDelay1_DSTATE; /* '<S55>/UnitDelay1' */
|
||||||
} DW_PI_clamp_fixdt_c;
|
} DW_PI_clamp_fixdt_c;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S22>/Counter' */
|
/* Block signals and states (auto storage) for system '<S19>/Counter' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_T UnitDelay_DSTATE; /* '<S27>/UnitDelay' */
|
uint16_T UnitDelay_DSTATE; /* '<S24>/UnitDelay' */
|
||||||
} DW_Counter_l;
|
} DW_Counter_l;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S18>/either_edge' */
|
/* Block signals and states (auto storage) for system '<S15>/either_edge' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
boolean_T UnitDelay_DSTATE; /* '<S23>/UnitDelay' */
|
boolean_T UnitDelay_DSTATE; /* '<S20>/UnitDelay' */
|
||||||
} DW_either_edge;
|
} DW_either_edge;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<S3>/Debounce_Filter' */
|
/* Block signals and states (auto storage) for system '<S3>/Debounce_Filter' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DW_either_edge either_edge_k; /* '<S18>/either_edge' */
|
DW_either_edge either_edge_k; /* '<S15>/either_edge' */
|
||||||
DW_Counter_l Counter_h; /* '<S21>/Counter' */
|
DW_Counter_l Counter_h; /* '<S18>/Counter' */
|
||||||
DW_Counter_l Counter_i0; /* '<S22>/Counter' */
|
DW_Counter_l Counter_i0; /* '<S19>/Counter' */
|
||||||
boolean_T UnitDelay_DSTATE; /* '<S18>/UnitDelay' */
|
boolean_T UnitDelay_DSTATE; /* '<S15>/UnitDelay' */
|
||||||
} DW_Debounce_Filter;
|
} DW_Debounce_Filter;
|
||||||
|
|
||||||
/* Block signals and states (auto storage) for system '<Root>' */
|
/* Block signals and states (auto storage) for system '<Root>' */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DW_either_edge either_edge_a; /* '<S3>/either_edge' */
|
DW_either_edge either_edge_a; /* '<S3>/either_edge' */
|
||||||
DW_Debounce_Filter Debounce_Filter_f;/* '<S3>/Debounce_Filter' */
|
DW_Debounce_Filter Debounce_Filter_f;/* '<S3>/Debounce_Filter' */
|
||||||
DW_PI_clamp_fixdt PI_clamp_fixdt_iq; /* '<S39>/PI_clamp_fixdt_iq' */
|
DW_PI_clamp_fixdt PI_clamp_fixdt_iq; /* '<S45>/PI_clamp_fixdt_iq' */
|
||||||
DW_PI_clamp_fixdt_c PI_clamp_fixdt_n_o;/* '<S38>/PI_clamp_fixdt_n' */
|
DW_PI_clamp_fixdt_c PI_clamp_fixdt_n_o;/* '<S44>/PI_clamp_fixdt_n' */
|
||||||
DW_Low_Pass_Filter Low_Pass_Filter_m;/* '<S31>/Low_Pass_Filter' */
|
DW_Low_Pass_Filter Low_Pass_Filter_m;/* '<S37>/Low_Pass_Filter' */
|
||||||
DW_PI_clamp_fixdt PI_clamp_fixdt_id; /* '<S40>/PI_clamp_fixdt_id' */
|
DW_PI_clamp_fixdt PI_clamp_fixdt_id; /* '<S46>/PI_clamp_fixdt_id' */
|
||||||
DW_Counter Counter_e; /* '<S11>/Counter' */
|
DW_Counter Counter_e; /* '<S10>/Counter' */
|
||||||
int32_T UnitDelay_DSTATE; /* '<S51>/UnitDelay' */
|
int32_T UnitDelay_DSTATE; /* '<S34>/UnitDelay' */
|
||||||
int16_T Gain4[3]; /* '<S33>/Gain4' */
|
int16_T Gain4[3]; /* '<S39>/Gain4' */
|
||||||
int16_T Sum1[2]; /* '<S44>/Sum1' */
|
int16_T Sum1[2]; /* '<S50>/Sum1' */
|
||||||
int16_T z_counterRawPrev; /* '<S16>/z_counterRawPrev' */
|
int16_T z_counterRawPrev; /* '<S13>/z_counterRawPrev' */
|
||||||
int16_T Merge; /* '<S5>/Merge' */
|
int16_T Merge; /* '<S5>/Merge' */
|
||||||
int16_T Divide1; /* '<S46>/Divide1' */
|
int16_T Divide1; /* '<S52>/Divide1' */
|
||||||
int16_T Divide4; /* '<S45>/Divide4' */
|
int16_T Divide4; /* '<S51>/Divide4' */
|
||||||
int16_T Switch1; /* '<S66>/Switch1' */
|
int16_T Switch1; /* '<S68>/Switch1' */
|
||||||
int16_T Divide11; /* '<S16>/Divide11' */
|
int16_T Divide11; /* '<S13>/Divide11' */
|
||||||
int16_T UnitDelay3_DSTATE; /* '<S11>/UnitDelay3' */
|
int16_T UnitDelay3_DSTATE; /* '<S10>/UnitDelay3' */
|
||||||
int16_T UnitDelay4_DSTATE; /* '<S6>/UnitDelay4' */
|
int16_T UnitDelay4_DSTATE; /* '<S13>/UnitDelay4' */
|
||||||
int16_T UnitDelay4_DSTATE_p; /* '<S16>/UnitDelay4' */
|
int16_T UnitDelay2_DSTATE; /* '<S13>/UnitDelay2' */
|
||||||
int16_T UnitDelay2_DSTATE; /* '<S16>/UnitDelay2' */
|
int16_T UnitDelay3_DSTATE_o; /* '<S13>/UnitDelay3' */
|
||||||
int16_T UnitDelay3_DSTATE_o; /* '<S16>/UnitDelay3' */
|
int16_T UnitDelay5_DSTATE; /* '<S13>/UnitDelay5' */
|
||||||
int16_T UnitDelay5_DSTATE; /* '<S16>/UnitDelay5' */
|
int16_T UnitDelay4_DSTATE_e; /* '<S10>/UnitDelay4' */
|
||||||
int16_T UnitDelay4_DSTATE_e; /* '<S11>/UnitDelay4' */
|
int16_T UnitDelay4_DSTATE_eu; /* '<S6>/UnitDelay4' */
|
||||||
int16_T UnitDelay4_DSTATE_er; /* '<S5>/UnitDelay4' */
|
int8_T Switch2; /* '<S9>/Switch2' */
|
||||||
int8_T Switch2; /* '<S10>/Switch2' */
|
int8_T UnitDelay2_DSTATE_b; /* '<S9>/UnitDelay2' */
|
||||||
int8_T UnitDelay2_DSTATE_b; /* '<S10>/UnitDelay2' */
|
|
||||||
int8_T If2_ActiveSubsystem; /* '<S1>/If2' */
|
int8_T If2_ActiveSubsystem; /* '<S1>/If2' */
|
||||||
|
int8_T If2_ActiveSubsystem_j; /* '<S27>/If2' */
|
||||||
int8_T If1_ActiveSubsystem; /* '<S1>/If1' */
|
int8_T If1_ActiveSubsystem; /* '<S1>/If1' */
|
||||||
int8_T If2_ActiveSubsystem_a; /* '<S5>/If2' */
|
int8_T If2_ActiveSubsystem_a; /* '<S5>/If2' */
|
||||||
int8_T If1_ActiveSubsystem_e; /* '<S5>/If1' */
|
int8_T If1_ActiveSubsystem_e; /* '<S5>/If1' */
|
||||||
int8_T If1_ActiveSubsystem_f; /* '<S35>/If1' */
|
int8_T If1_ActiveSubsystem_f; /* '<S41>/If1' */
|
||||||
int8_T If2_ActiveSubsystem_c; /* '<S35>/If2' */
|
int8_T If2_ActiveSubsystem_c; /* '<S41>/If2' */
|
||||||
int8_T SwitchCase_ActiveSubsystem; /* '<S5>/Switch Case' */
|
int8_T SwitchCase_ActiveSubsystem; /* '<S5>/Switch Case' */
|
||||||
uint8_T UnitDelay3_DSTATE_fy; /* '<S8>/UnitDelay3' */
|
uint8_T UnitDelay3_DSTATE_fy; /* '<S7>/UnitDelay3' */
|
||||||
uint8_T UnitDelay1_DSTATE; /* '<S8>/UnitDelay1' */
|
uint8_T UnitDelay1_DSTATE; /* '<S7>/UnitDelay1' */
|
||||||
uint8_T UnitDelay2_DSTATE_f; /* '<S8>/UnitDelay2' */
|
uint8_T UnitDelay2_DSTATE_f; /* '<S7>/UnitDelay2' */
|
||||||
uint8_T UnitDelay1_DSTATE_p; /* '<S4>/UnitDelay1' */
|
uint8_T UnitDelay1_DSTATE_p; /* '<S4>/UnitDelay1' */
|
||||||
uint8_T UnitDelay_DSTATE_c; /* '<S3>/UnitDelay' */
|
uint8_T UnitDelay_DSTATE_c; /* '<S3>/UnitDelay' */
|
||||||
uint8_T is_active_c1_BLDC_controller;/* '<S4>/F03_02_Control_Mode_Manager' */
|
uint8_T is_active_c1_BLDC_controller;/* '<S4>/F03_02_Control_Mode_Manager' */
|
||||||
uint8_T is_c1_BLDC_controller; /* '<S4>/F03_02_Control_Mode_Manager' */
|
uint8_T is_c1_BLDC_controller; /* '<S4>/F03_02_Control_Mode_Manager' */
|
||||||
uint8_T is_ACTIVE; /* '<S4>/F03_02_Control_Mode_Manager' */
|
uint8_T is_ACTIVE; /* '<S4>/F03_02_Control_Mode_Manager' */
|
||||||
boolean_T Merge_n; /* '<S18>/Merge' */
|
boolean_T Merge_n; /* '<S15>/Merge' */
|
||||||
boolean_T dz_cntTrnsDet; /* '<S16>/dz_cntTrnsDet' */
|
boolean_T dz_cntTrnsDet; /* '<S13>/dz_cntTrnsDet' */
|
||||||
boolean_T UnitDelay_DSTATE_g; /* '<S50>/UnitDelay' */
|
boolean_T UnitDelay_DSTATE_e; /* '<S33>/UnitDelay' */
|
||||||
boolean_T UnitDelay1_DSTATE_n; /* '<S16>/UnitDelay1' */
|
boolean_T UnitDelay1_DSTATE_n; /* '<S13>/UnitDelay1' */
|
||||||
boolean_T n_commDeacv_Mode; /* '<S11>/n_commDeacv' */
|
boolean_T n_commDeacv_Mode; /* '<S10>/n_commDeacv' */
|
||||||
boolean_T n_fieldWeakAuth_Mode; /* '<S32>/n_fieldWeakAuth' */
|
boolean_T n_fieldWeakAuth_Mode; /* '<S38>/n_fieldWeakAuth' */
|
||||||
boolean_T dz_cntTrnsDet_Mode; /* '<S16>/dz_cntTrnsDet' */
|
boolean_T n_fieldWeakAuth_Mode_m; /* '<S73>/n_fieldWeakAuth' */
|
||||||
|
boolean_T dz_cntTrnsDet_Mode; /* '<S13>/dz_cntTrnsDet' */
|
||||||
} DW;
|
} DW;
|
||||||
|
|
||||||
/* Constant parameters (auto storage) */
|
/* Constant parameters (auto storage) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Computed Parameter: z_commutMap_M1_table
|
/* Computed Parameter: r_sin3PhaA_M1_Table
|
||||||
* Referenced by: '<S6>/z_commutMap_M1'
|
* Referenced by: '<S71>/r_sin3PhaA_M1'
|
||||||
*/
|
*/
|
||||||
int16_T z_commutMap_M1_table[18];
|
int16_T r_sin3PhaA_M1_Table[181];
|
||||||
|
|
||||||
|
/* Computed Parameter: r_sin3PhaB_M1_Table
|
||||||
|
* Referenced by: '<S71>/r_sin3PhaB_M1'
|
||||||
|
*/
|
||||||
|
int16_T r_sin3PhaB_M1_Table[181];
|
||||||
|
|
||||||
|
/* Computed Parameter: r_sin3PhaC_M1_Table
|
||||||
|
* Referenced by: '<S71>/r_sin3PhaC_M1'
|
||||||
|
*/
|
||||||
|
int16_T r_sin3PhaC_M1_Table[181];
|
||||||
|
|
||||||
/* Computed Parameter: r_sin_M1_Table
|
/* Computed Parameter: r_sin_M1_Table
|
||||||
* Referenced by: '<S32>/r_sin_M1'
|
* Referenced by: '<S38>/r_sin_M1'
|
||||||
*/
|
*/
|
||||||
int16_T r_sin_M1_Table[181];
|
int16_T r_sin_M1_Table[181];
|
||||||
|
|
||||||
/* Computed Parameter: r_cos_M1_Table
|
/* Computed Parameter: r_cos_M1_Table
|
||||||
* Referenced by: '<S32>/r_cos_M1'
|
* Referenced by: '<S38>/r_cos_M1'
|
||||||
*/
|
*/
|
||||||
int16_T r_cos_M1_Table[181];
|
int16_T r_cos_M1_Table[181];
|
||||||
|
|
||||||
/* Computed Parameter: iq_maxSca_M1_Table
|
/* Computed Parameter: iq_maxSca_M1_Table
|
||||||
* Referenced by: '<S35>/iq_maxSca_M1'
|
* Referenced by: '<S41>/iq_maxSca_M1'
|
||||||
*/
|
*/
|
||||||
uint16_T iq_maxSca_M1_Table[50];
|
uint16_T iq_maxSca_M1_Table[50];
|
||||||
|
|
||||||
|
/* Computed Parameter: z_commutMap_M1_table
|
||||||
|
* Referenced by: '<S70>/z_commutMap_M1'
|
||||||
|
*/
|
||||||
|
int8_T z_commutMap_M1_table[18];
|
||||||
|
|
||||||
/* Computed Parameter: vec_hallToPos_Value
|
/* Computed Parameter: vec_hallToPos_Value
|
||||||
* Referenced by: '<S9>/vec_hallToPos'
|
* Referenced by: '<S8>/vec_hallToPos'
|
||||||
*/
|
*/
|
||||||
int8_T vec_hallToPos_Value[8];
|
int8_T vec_hallToPos_Value[8];
|
||||||
} ConstP;
|
} ConstP;
|
||||||
|
@ -178,27 +194,24 @@ typedef struct {
|
||||||
/* Parameters (auto storage) */
|
/* Parameters (auto storage) */
|
||||||
struct P_ {
|
struct P_ {
|
||||||
int32_T dV_openRate; /* Variable: dV_openRate
|
int32_T dV_openRate; /* Variable: dV_openRate
|
||||||
* Referenced by: '<S36>/dV_openRate'
|
* Referenced by: '<S31>/dV_openRate'
|
||||||
*/
|
*/
|
||||||
int16_T dz_cntTrnsDetHi; /* Variable: dz_cntTrnsDetHi
|
int16_T dz_cntTrnsDetHi; /* Variable: dz_cntTrnsDetHi
|
||||||
* Referenced by: '<S16>/dz_cntTrnsDet'
|
* Referenced by: '<S13>/dz_cntTrnsDet'
|
||||||
*/
|
*/
|
||||||
int16_T dz_cntTrnsDetLo; /* Variable: dz_cntTrnsDetLo
|
int16_T dz_cntTrnsDetLo; /* Variable: dz_cntTrnsDetLo
|
||||||
* Referenced by: '<S16>/dz_cntTrnsDet'
|
* Referenced by: '<S13>/dz_cntTrnsDet'
|
||||||
*/
|
|
||||||
int16_T r_errInpTgtThres; /* Variable: r_errInpTgtThres
|
|
||||||
* Referenced by: '<S3>/r_errInpTgtThres'
|
|
||||||
*/
|
*/
|
||||||
int16_T z_maxCntRst; /* Variable: z_maxCntRst
|
int16_T z_maxCntRst; /* Variable: z_maxCntRst
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S11>/Counter'
|
* '<S10>/Counter'
|
||||||
* '<S11>/z_maxCntRst'
|
* '<S10>/z_maxCntRst'
|
||||||
* '<S11>/z_maxCntRst2'
|
* '<S10>/z_maxCntRst2'
|
||||||
* '<S11>/UnitDelay3'
|
* '<S10>/UnitDelay3'
|
||||||
* '<S16>/z_counter'
|
* '<S13>/z_counter'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_speedCoef; /* Variable: cf_speedCoef
|
uint16_T cf_speedCoef; /* Variable: cf_speedCoef
|
||||||
* Referenced by: '<S16>/cf_speedCoef'
|
* Referenced by: '<S13>/cf_speedCoef'
|
||||||
*/
|
*/
|
||||||
uint16_T t_errDequal; /* Variable: t_errDequal
|
uint16_T t_errDequal; /* Variable: t_errDequal
|
||||||
* Referenced by: '<S3>/t_errDequal'
|
* Referenced by: '<S3>/t_errDequal'
|
||||||
|
@ -206,77 +219,90 @@ struct P_ {
|
||||||
uint16_T t_errQual; /* Variable: t_errQual
|
uint16_T t_errQual; /* Variable: t_errQual
|
||||||
* Referenced by: '<S3>/t_errQual'
|
* Referenced by: '<S3>/t_errQual'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_idKp; /* Variable: cf_idKp
|
|
||||||
* Referenced by: '<S40>/cf_idKp1'
|
|
||||||
*/
|
|
||||||
uint16_T cf_iqKp; /* Variable: cf_iqKp
|
|
||||||
* Referenced by: '<S39>/cf_iqKp'
|
|
||||||
*/
|
|
||||||
uint16_T cf_nKp; /* Variable: cf_nKp
|
|
||||||
* Referenced by: '<S38>/cf_nKp'
|
|
||||||
*/
|
|
||||||
int16_T Vd_max; /* Variable: Vd_max
|
int16_T Vd_max; /* Variable: Vd_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/Vd_max1'
|
* '<S41>/Vd_max1'
|
||||||
* '<S14>/Vd_max'
|
* '<S30>/Vd_max'
|
||||||
*/
|
*/
|
||||||
int16_T Vq_max_M1[46]; /* Variable: Vq_max_M1
|
int16_T Vq_max_M1[46]; /* Variable: Vq_max_M1
|
||||||
* Referenced by: '<S35>/Vq_max_M1'
|
* Referenced by: '<S41>/Vq_max_M1'
|
||||||
*/
|
*/
|
||||||
int16_T Vq_max_XA[46]; /* Variable: Vq_max_XA
|
int16_T Vq_max_XA[46]; /* Variable: Vq_max_XA
|
||||||
* Referenced by: '<S35>/Vq_max_XA'
|
* Referenced by: '<S41>/Vq_max_XA'
|
||||||
*/
|
*/
|
||||||
int16_T i_max; /* Variable: i_max
|
int16_T i_max; /* Variable: i_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/i_max'
|
* '<S41>/i_max'
|
||||||
* '<S14>/i_max'
|
* '<S30>/i_max'
|
||||||
*/
|
*/
|
||||||
int16_T id_fieldWeak_M1[12]; /* Variable: id_fieldWeak_M1
|
int16_T id_fieldWeak_M1[12]; /* Variable: id_fieldWeak_M1
|
||||||
* Referenced by: '<S32>/id_fieldWeak_M1'
|
* Referenced by: '<S38>/id_fieldWeak_M1'
|
||||||
*/
|
*/
|
||||||
int16_T n_commAcvLo; /* Variable: n_commAcvLo
|
int16_T n_commAcvLo; /* Variable: n_commAcvLo
|
||||||
* Referenced by: '<S11>/n_commDeacv'
|
* Referenced by: '<S10>/n_commDeacv'
|
||||||
*/
|
*/
|
||||||
int16_T n_commDeacvHi; /* Variable: n_commDeacvHi
|
int16_T n_commDeacvHi; /* Variable: n_commDeacvHi
|
||||||
* Referenced by: '<S11>/n_commDeacv'
|
* Referenced by: '<S10>/n_commDeacv'
|
||||||
*/
|
*/
|
||||||
int16_T n_fieldWeakAuthHi; /* Variable: n_fieldWeakAuthHi
|
int16_T n_fieldWeakAuthHi; /* Variable: n_fieldWeakAuthHi
|
||||||
* Referenced by: '<S32>/n_fieldWeakAuth'
|
* Referenced by:
|
||||||
|
* '<S38>/n_fieldWeakAuth'
|
||||||
|
* '<S73>/n_fieldWeakAuth'
|
||||||
*/
|
*/
|
||||||
int16_T n_fieldWeakAuthLo; /* Variable: n_fieldWeakAuthLo
|
int16_T n_fieldWeakAuthLo; /* Variable: n_fieldWeakAuthLo
|
||||||
* Referenced by: '<S32>/n_fieldWeakAuth'
|
* Referenced by:
|
||||||
|
* '<S38>/n_fieldWeakAuth'
|
||||||
|
* '<S73>/n_fieldWeakAuth'
|
||||||
*/
|
*/
|
||||||
int16_T n_max; /* Variable: n_max
|
int16_T n_max; /* Variable: n_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/n_max1'
|
* '<S41>/n_max1'
|
||||||
* '<S14>/n_max'
|
* '<S30>/n_max'
|
||||||
*/
|
*/
|
||||||
int16_T n_stdStillDet; /* Variable: n_stdStillDet
|
int16_T n_stdStillDet; /* Variable: n_stdStillDet
|
||||||
* Referenced by: '<S11>/n_stdStillDet'
|
* Referenced by: '<S10>/n_stdStillDet'
|
||||||
|
*/
|
||||||
|
int16_T r_errInpTgtThres; /* Variable: r_errInpTgtThres
|
||||||
|
* Referenced by: '<S3>/r_errInpTgtThres'
|
||||||
*/
|
*/
|
||||||
int16_T r_fieldWeak_XA[12]; /* Variable: r_fieldWeak_XA
|
int16_T r_fieldWeak_XA[12]; /* Variable: r_fieldWeak_XA
|
||||||
* Referenced by: '<S32>/r_fieldWeak_XA'
|
* Referenced by: '<S38>/r_fieldWeak_XA'
|
||||||
|
*/
|
||||||
|
int16_T r_phaAdv_XA[11]; /* Variable: r_phaAdv_XA
|
||||||
|
* Referenced by: '<S73>/r_phaAdv_XA'
|
||||||
|
*/
|
||||||
|
uint16_T cf_idKp; /* Variable: cf_idKp
|
||||||
|
* Referenced by: '<S46>/cf_idKp1'
|
||||||
|
*/
|
||||||
|
uint16_T cf_iqKp; /* Variable: cf_iqKp
|
||||||
|
* Referenced by: '<S45>/cf_iqKp'
|
||||||
|
*/
|
||||||
|
uint16_T cf_nKp; /* Variable: cf_nKp
|
||||||
|
* Referenced by: '<S44>/cf_nKp'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_currFilt; /* Variable: cf_currFilt
|
uint16_T cf_currFilt; /* Variable: cf_currFilt
|
||||||
* Referenced by: '<S31>/cf_currFilt'
|
* Referenced by: '<S37>/cf_currFilt'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_idKi; /* Variable: cf_idKi
|
uint16_T cf_idKi; /* Variable: cf_idKi
|
||||||
* Referenced by: '<S40>/cf_idKi1'
|
* Referenced by: '<S46>/cf_idKi1'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_iqKi; /* Variable: cf_iqKi
|
uint16_T cf_iqKi; /* Variable: cf_iqKi
|
||||||
* Referenced by: '<S39>/cf_iqKi'
|
* Referenced by: '<S45>/cf_iqKi'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_iqKiLimProt; /* Variable: cf_iqKiLimProt
|
uint16_T cf_iqKiLimProt; /* Variable: cf_iqKiLimProt
|
||||||
* Referenced by: '<S38>/cf_iqKiLimProt'
|
* Referenced by: '<S44>/cf_iqKiLimProt'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_nKi; /* Variable: cf_nKi
|
uint16_T cf_nKi; /* Variable: cf_nKi
|
||||||
* Referenced by: '<S38>/cf_nKi'
|
* Referenced by: '<S44>/cf_nKi'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_iqKpLimProt; /* Variable: cf_iqKpLimProt
|
uint16_T cf_iqKpLimProt; /* Variable: cf_iqKpLimProt
|
||||||
* Referenced by: '<S45>/cf_iqKpLimProt'
|
* Referenced by: '<S51>/cf_iqKpLimProt'
|
||||||
*/
|
*/
|
||||||
uint16_T cf_nKpLimProt; /* Variable: cf_nKpLimProt
|
uint16_T cf_nKpLimProt; /* Variable: cf_nKpLimProt
|
||||||
* Referenced by: '<S46>/cf_nKpLimProt'
|
* Referenced by: '<S52>/cf_nKpLimProt'
|
||||||
|
*/
|
||||||
|
int16_T a_phaAdv_M1[11]; /* Variable: a_phaAdv_M1
|
||||||
|
* Referenced by: '<S73>/a_phaAdv_M1'
|
||||||
*/
|
*/
|
||||||
uint8_T z_ctrlTypSel; /* Variable: z_ctrlTypSel
|
uint8_T z_ctrlTypSel; /* Variable: z_ctrlTypSel
|
||||||
* Referenced by: '<S1>/z_ctrlTypSel1'
|
* Referenced by: '<S1>/z_ctrlTypSel1'
|
||||||
|
@ -285,10 +311,12 @@ struct P_ {
|
||||||
* Referenced by: '<S1>/b_diagEna'
|
* Referenced by: '<S1>/b_diagEna'
|
||||||
*/
|
*/
|
||||||
boolean_T b_fieldWeakEna; /* Variable: b_fieldWeakEna
|
boolean_T b_fieldWeakEna; /* Variable: b_fieldWeakEna
|
||||||
* Referenced by: '<S32>/b_fieldWeakEna'
|
* Referenced by:
|
||||||
|
* '<S38>/b_fieldWeakEna'
|
||||||
|
* '<S73>/b_fieldWeakEna'
|
||||||
*/
|
*/
|
||||||
boolean_T b_selPhaABCurrMeas; /* Variable: b_selPhaABCurrMeas
|
boolean_T b_selPhaABCurrMeas; /* Variable: b_selPhaABCurrMeas
|
||||||
* Referenced by: '<S30>/b_selPhaABCurrMeas'
|
* Referenced by: '<S36>/b_selPhaABCurrMeas'
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,26 +341,24 @@ extern void BLDC_controller_step(RT_MODEL *const rtM);
|
||||||
/*-
|
/*-
|
||||||
* These blocks were eliminated from the model due to optimizations:
|
* These blocks were eliminated from the model due to optimizations:
|
||||||
*
|
*
|
||||||
* Block '<S11>/Scope2' : Unused code path elimination
|
* Block '<S10>/Scope2' : Unused code path elimination
|
||||||
* Block '<S12>/Scope' : Unused code path elimination
|
* Block '<S11>/Scope' : Unused code path elimination
|
||||||
* Block '<S47>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S35>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S47>/Data Type Propagation' : Unused code path elimination
|
* Block '<S35>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S48>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S53>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S48>/Data Type Propagation' : Unused code path elimination
|
* Block '<S53>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S52>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S54>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S52>/Data Type Propagation' : Unused code path elimination
|
* Block '<S54>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S5>/Scope12' : Unused code path elimination
|
* Block '<S5>/Scope12' : Unused code path elimination
|
||||||
* Block '<S5>/Scope8' : Unused code path elimination
|
* Block '<S5>/Scope8' : Unused code path elimination
|
||||||
* Block '<S5>/Scope9' : Unused code path elimination
|
* Block '<S5>/Scope9' : Unused code path elimination
|
||||||
* Block '<S58>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S60>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S58>/Data Type Propagation' : Unused code path elimination
|
* Block '<S60>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S63>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S65>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S63>/Data Type Propagation' : Unused code path elimination
|
* Block '<S65>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S67>/Data Type Duplicate' : Unused code path elimination
|
* Block '<S69>/Data Type Duplicate' : Unused code path elimination
|
||||||
* Block '<S67>/Data Type Propagation' : Unused code path elimination
|
* Block '<S69>/Data Type Propagation' : Unused code path elimination
|
||||||
* Block '<S1>/Data Type Conversion2' : Eliminate redundant data type conversion
|
* Block '<S73>/Scope' : Unused code path elimination
|
||||||
* Block '<S1>/Data Type Conversion3' : Eliminate redundant data type conversion
|
|
||||||
* Block '<S1>/Data Type Conversion6' : Eliminate redundant data type conversion
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -359,67 +385,74 @@ extern void BLDC_controller_step(RT_MODEL *const rtM);
|
||||||
* '<S4>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager'
|
* '<S4>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager'
|
||||||
* '<S5>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control'
|
* '<S5>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control'
|
||||||
* '<S6>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management'
|
* '<S6>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management'
|
||||||
* '<S7>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_01_Input_Scaling'
|
* '<S7>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_01_Edge_Detector'
|
||||||
* '<S8>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_02_Edge_Detector'
|
* '<S8>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_02_Position_Calculation'
|
||||||
* '<S9>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_03_Position_Calculation'
|
* '<S9>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_03_Direction_Detection'
|
||||||
* '<S10>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Direction_Detection'
|
* '<S10>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation'
|
||||||
* '<S11>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Speed_Estimation'
|
* '<S11>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Electrical_Angle_Estimation'
|
||||||
* '<S12>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_06_Electrical_Angle_Estimation'
|
* '<S12>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Counter'
|
||||||
* '<S13>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_01_Input_Scaling/Commutation_Control_Type'
|
* '<S13>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Raw_Motor_Speed_Estimation'
|
||||||
* '<S14>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_01_Input_Scaling/FOC_Control_Type'
|
* '<S14>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Counter/rst_Delay'
|
||||||
* '<S15>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Speed_Estimation/Counter'
|
* '<S15>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter'
|
||||||
* '<S16>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Speed_Estimation/Raw_Motor_Speed_Estimation'
|
* '<S16>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/either_edge'
|
||||||
* '<S17>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Speed_Estimation/Counter/rst_Delay'
|
* '<S17>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Default'
|
||||||
* '<S18>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter'
|
* '<S18>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification'
|
||||||
* '<S19>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/either_edge'
|
* '<S19>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification'
|
||||||
* '<S20>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Default'
|
* '<S20>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/either_edge'
|
||||||
* '<S21>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification'
|
* '<S21>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification/Counter'
|
||||||
* '<S22>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification'
|
* '<S22>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification/Counter/rst_Delay'
|
||||||
* '<S23>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/either_edge'
|
* '<S23>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification/Counter'
|
||||||
* '<S24>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification/Counter'
|
* '<S24>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification/Counter/rst_Delay'
|
||||||
* '<S25>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Dequalification/Counter/rst_Delay'
|
* '<S25>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_01_Mode_Transition_Calculation'
|
||||||
* '<S26>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification/Counter'
|
* '<S26>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_02_Control_Mode_Manager'
|
||||||
* '<S27>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Debounce_Filter/Qualification/Counter/rst_Delay'
|
* '<S27>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis'
|
||||||
* '<S28>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_01_Mode_Transition_Calculation'
|
* '<S28>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Default_Control_Type'
|
||||||
* '<S29>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_02_Control_Mode_Manager'
|
* '<S29>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Default_Mode'
|
||||||
* '<S30>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform'
|
* '<S30>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/FOC_Control_Type'
|
||||||
* '<S31>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Current_Filtering'
|
* '<S31>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode'
|
||||||
* '<S32>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Field_Weakening'
|
* '<S32>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter'
|
||||||
* '<S33>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Inv_Clarke_Transform'
|
* '<S33>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/rising_edge_init'
|
||||||
* '<S34>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Inv_Park_Transform'
|
* '<S34>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter/Delay_Init1'
|
||||||
* '<S35>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations'
|
* '<S35>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter/Saturation Dynamic'
|
||||||
* '<S36>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode'
|
* '<S36>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform'
|
||||||
* '<S37>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Park_Transform'
|
* '<S37>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Current_Filtering'
|
||||||
* '<S38>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode'
|
* '<S38>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Field_Weakening'
|
||||||
* '<S39>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode'
|
* '<S39>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Inv_Clarke_Transform'
|
||||||
* '<S40>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation'
|
* '<S40>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Inv_Park_Transform'
|
||||||
* '<S41>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Voltage_Mode'
|
* '<S41>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations'
|
||||||
* '<S42>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform/Clarke_PhasesAB'
|
* '<S42>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode'
|
||||||
* '<S43>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform/Clarke_PhasesBC'
|
* '<S43>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Park_Transform'
|
||||||
* '<S44>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Current_Filtering/Low_Pass_Filter'
|
* '<S44>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode'
|
||||||
* '<S45>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Current_Limit_Protection'
|
* '<S45>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode'
|
||||||
* '<S46>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Speed_Limit_Protection'
|
* '<S46>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation'
|
||||||
* '<S47>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Current_Limit_Protection/Saturation Dynamic'
|
* '<S47>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Voltage_Mode'
|
||||||
* '<S48>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Speed_Limit_Protection/Saturation Dynamic1'
|
* '<S48>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform/Clarke_PhasesAB'
|
||||||
* '<S49>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode/Rate_Limiter'
|
* '<S49>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Clarke_Transform/Clarke_PhasesBC'
|
||||||
* '<S50>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode/rising_edge_init'
|
* '<S50>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Current_Filtering/Low_Pass_Filter'
|
||||||
* '<S51>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode/Rate_Limiter/Delay_Init1'
|
* '<S51>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Current_Limit_Protection'
|
||||||
* '<S52>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Open_Mode/Rate_Limiter/Saturation Dynamic'
|
* '<S52>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Speed_Limit_Protection'
|
||||||
* '<S53>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n'
|
* '<S53>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Current_Limit_Protection/Saturation Dynamic'
|
||||||
* '<S54>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Clamping_circuit'
|
* '<S54>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Motor_Limitations/Speed_Limit_Protection/Saturation Dynamic1'
|
||||||
* '<S55>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Integrator'
|
* '<S55>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n'
|
||||||
* '<S56>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Saturation_hit'
|
* '<S56>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Clamping_circuit'
|
||||||
* '<S57>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq'
|
* '<S57>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Integrator'
|
||||||
* '<S58>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/Saturation Dynamic'
|
* '<S58>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Speed_Mode/PI_clamp_fixdt_n/Saturation_hit'
|
||||||
* '<S59>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Clamping_circuit'
|
* '<S59>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq'
|
||||||
* '<S60>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Integrator'
|
* '<S60>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/Saturation Dynamic'
|
||||||
* '<S61>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Saturation_hit'
|
* '<S61>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Clamping_circuit'
|
||||||
* '<S62>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id'
|
* '<S62>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Integrator'
|
||||||
* '<S63>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/Saturation Dynamic'
|
* '<S63>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Torque_Mode/PI_clamp_fixdt_iq/Saturation_hit'
|
||||||
* '<S64>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Clamping_circuit'
|
* '<S64>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id'
|
||||||
* '<S65>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Integrator'
|
* '<S65>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/Saturation Dynamic'
|
||||||
* '<S66>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Saturation_hit'
|
* '<S66>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Clamping_circuit'
|
||||||
* '<S67>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Voltage_Mode/Saturation Dynamic1'
|
* '<S67>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Integrator'
|
||||||
|
* '<S68>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Vd_Calculation/PI_clamp_fixdt_id/Saturation_hit'
|
||||||
|
* '<S69>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Oriented_Control/Voltage_Mode/Saturation Dynamic1'
|
||||||
|
* '<S70>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management/F05_00_COM_Method'
|
||||||
|
* '<S71>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management/F05_01_SIN_Method'
|
||||||
|
* '<S72>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management/F05_02_FOC_Method'
|
||||||
|
* '<S73>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management/F05_01_SIN_Method/Phase_Advance_Calculation'
|
||||||
|
* '<S74>' : 'BLDCmotorControl_FOC_R2017b_fixdt/BLDC_controller/F05_Control_Type_Management/F05_01_SIN_Method/Phase_Advance_Calculation/Modulo_fixdt'
|
||||||
*/
|
*/
|
||||||
#endif /* RTW_HEADER_BLDC_controller_h_ */
|
#endif /* RTW_HEADER_BLDC_controller_h_ */
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,8 @@
|
||||||
|
|
||||||
|
|
||||||
// ############################### MOTOR CONTROL (overwrite) #########################
|
// ############################### MOTOR CONTROL (overwrite) #########################
|
||||||
#define CTRL_TYP_SEL 1 // [-] Control type selection: 0 = Commutation , 1 = FOC Field Oriented Control (default)
|
#define CTRL_TYP_SEL 2 // [-] Control type selection: 0 = Commutation , 1 = Sinusoidal, 2 = FOC Field Oriented Control (default)
|
||||||
#define CTRL_MOD_REQ 1 // [-] Control mode request: 0 = Open mode, 1 = Voltage mode (default), 2 = Speed mode, 3 = Torque mode
|
#define CTRL_MOD_REQ 1 // [-] Control mode request: 0 = Open mode, 1 = VOLTAGE mode (default), 2 = SPEED mode, 3 = TORQUE mode. Note: SPEED and TORQUE modes are only available for FOC!
|
||||||
#define DIAG_ENA 1 // [-] Motor Diagnostics enable flag: 0 = Disabled, 1 = Enabled (default)
|
#define DIAG_ENA 1 // [-] Motor Diagnostics enable flag: 0 = Disabled, 1 = Enabled (default)
|
||||||
#define FIELD_WEAK_ENA 0 // [-] Field Weakening enable flag: 0 = Disabled (default), 1 = Enabled
|
#define FIELD_WEAK_ENA 0 // [-] Field Weakening enable flag: 0 = Disabled (default), 1 = Enabled
|
||||||
#define I_MOT_MAX (15 * A2BIT_CONV) << 4 // [A] Maximum motor current limit (Change only the first number, the rest is needed for fixed-point conversion, fixdt(1,16,4))
|
#define I_MOT_MAX (15 * A2BIT_CONV) << 4 // [A] Maximum motor current limit (Change only the first number, the rest is needed for fixed-point conversion, fixdt(1,16,4))
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
*
|
*
|
||||||
* Code generated for Simulink model 'BLDC_controller'.
|
* Code generated for Simulink model 'BLDC_controller'.
|
||||||
*
|
*
|
||||||
* Model version : 1.1197
|
* Model version : 1.1212
|
||||||
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
||||||
* C/C++ source code generated on : Thu Oct 31 21:29:42 2019
|
* C/C++ source code generated on : Sat Nov 30 08:54:28 2019
|
||||||
*
|
*
|
||||||
* Target selection: ert.tlc
|
* Target selection: ert.tlc
|
||||||
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
||||||
|
|
21
README.md
21
README.md
|
@ -21,7 +21,7 @@ The main firmware architecture includes:
|
||||||
- **Diagnostics**: implements error detection such as unconnected Hall sensor, motor blocked, MOSFET defective
|
- **Diagnostics**: implements error detection such as unconnected Hall sensor, motor blocked, MOSFET defective
|
||||||
- **Control Manager**: manages the transitions between control modes (Voltage, Speed, Torque)
|
- **Control Manager**: manages the transitions between control modes (Voltage, Speed, Torque)
|
||||||
- **FOC Algorithm**: implements the FOC strategy
|
- **FOC Algorithm**: implements the FOC strategy
|
||||||
- **Control Type Manager**: Manages the transition between Commutation and FOC Algorithm
|
- **Control Type Manager**: Manages the transition between Commutation, Sinusoidal, and FOC control type
|
||||||
|
|
||||||
![Firmware architecture](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/FW_architecture.png)
|
![Firmware architecture](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/FW_architecture.png)
|
||||||
|
|
||||||
|
@ -29,15 +29,17 @@ The FOC algorithm architecture is illustrated in the figure below:
|
||||||
|
|
||||||
![FOC algorithm](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/FOC_algorithm.png)
|
![FOC algorithm](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/FOC_algorithm.png)
|
||||||
|
|
||||||
In this firmware two control methods are available:
|
In this firmware 3 control types are available:
|
||||||
- Commutation method
|
- Commutation
|
||||||
- FOC method
|
- SIN (Sinusoidal)
|
||||||
|
- FOC (Field Oriented Control)
|
||||||
![Schematic representation of the available control methods](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/01_Matlab/02_Figures/control_methods.png)
|
![Schematic representation of the available control methods](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/01_Matlab/02_Figures/control_methods.png)
|
||||||
|
|
||||||
|
|
||||||
A short video showing the noise performance of the Commutation method vs Advanced control method:
|
Demo videos:
|
||||||
|
[►Video: Commutation vs Advanced control (constant speed)](https://drive.google.com/open?id=1vC_kEkp2LE2lAaMCJcmK4z2m3jrPUoBD)
|
||||||
[►Video: Commutation method vs Advanced control](https://drive.google.com/file/d/1vC_kEkp2LE2lAaMCJcmK4z2m3jrPUoBD/view)
|
[►Video: Commutation vs Advanced control (variable speed)](https://drive.google.com/open?id=1rrQ4k5VLhhAWXQzDSCar_SmEdsbM-hq2)
|
||||||
|
[►Video: Reliable Serial Communication demo](https://drive.google.com/open?id=1mUM-p7SE6gmyTH7zhDHy5DUyczXvmy5d)
|
||||||
|
|
||||||
![Hoverboard wheel](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/hoverboard_wheel.JPG)
|
![Hoverboard wheel](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/docs/pictures/hoverboard_wheel.JPG)
|
||||||
|
|
||||||
|
@ -71,7 +73,7 @@ Each motor is constantly monitored for errors. These errors are:
|
||||||
- **Error 002**: Hall sensor short circuit
|
- **Error 002**: Hall sensor short circuit
|
||||||
- **Error 004**: Motor NOT able to spin (Possible causes: motor phase disconnected, MOSFET defective, operational Amplifier defective, motor blocked)
|
- **Error 004**: Motor NOT able to spin (Possible causes: motor phase disconnected, MOSFET defective, operational Amplifier defective, motor blocked)
|
||||||
|
|
||||||
The error codes above are reported for each motor in the variables **errCode_Left** and **errCode_Right** for Left motor (long wired motor) and Right motor (short wired motor), respectively.
|
The error codes above are reported for each motor in the variables **errCode_Left** and **errCode_Right** for Left motor (long wired motor) and Right motor (short wired motor), respectively. In case of error, the motor power is reduced to 0, while an audible (fast beep) can be heard to notify the user.
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -146,9 +148,6 @@ Currently supported: Wii Nunchuck, analog potentiometer and PPM-Sum signal from
|
||||||
A good example of control via UART, eg. from an Arduino or raspberryPi, can be found here:
|
A good example of control via UART, eg. from an Arduino or raspberryPi, can be found here:
|
||||||
https://github.com/p-h-a-i-l/hoverboard-firmware-hack
|
https://github.com/p-h-a-i-l/hoverboard-firmware-hack
|
||||||
|
|
||||||
### Future work
|
|
||||||
- convert all calculations and remaining filters (for the battery voltage, current, and temperature) from floating point to fixed-point. This will reduce further the SMT32 computational load -> **DONE**
|
|
||||||
|
|
||||||
---
|
---
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,9 +3,9 @@
|
||||||
*
|
*
|
||||||
* Code generated for Simulink model 'BLDC_controller'.
|
* Code generated for Simulink model 'BLDC_controller'.
|
||||||
*
|
*
|
||||||
* Model version : 1.1199
|
* Model version : 1.1212
|
||||||
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
||||||
* C/C++ source code generated on : Sun Nov 3 12:28:16 2019
|
* C/C++ source code generated on : Sat Nov 30 08:54:28 2019
|
||||||
*
|
*
|
||||||
* Target selection: ert.tlc
|
* Target selection: ert.tlc
|
||||||
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
||||||
|
@ -21,13 +21,74 @@
|
||||||
|
|
||||||
/* Constant parameters (auto storage) */
|
/* Constant parameters (auto storage) */
|
||||||
const ConstP rtConstP = {
|
const ConstP rtConstP = {
|
||||||
/* Computed Parameter: z_commutMap_M1_table
|
/* Computed Parameter: r_sin3PhaA_M1_Table
|
||||||
* Referenced by: '<S6>/z_commutMap_M1'
|
* Referenced by: '<S71>/r_sin3PhaA_M1'
|
||||||
*/
|
*/
|
||||||
{ -1, 1, 0, -1, 0, 1, 0, -1, 1, 1, -1, 0, 1, 0, -1, 0, 1, -1 },
|
{ -13091, -13634, -14126, -14565, -14953, -15289, -15577, -15816, -16009,
|
||||||
|
-16159, -16269, -16340, -16377, -16383, -16362, -16317, -16253, -16172,
|
||||||
|
-16079, -15977, -15870, -15762, -15656, -15555, -15461, -15377, -15306,
|
||||||
|
-15248, -15206, -15180, -15172, -15180, -15206, -15248, -15306, -15377,
|
||||||
|
-15461, -15555, -15656, -15762, -15870, -15977, -16079, -16172, -16253,
|
||||||
|
-16317, -16362, -16383, -16377, -16340, -16269, -16159, -16009, -15816,
|
||||||
|
-15577, -15289, -14953, -14565, -14126, -13634, -13091, -12496, -11849,
|
||||||
|
-11154, -10411, -9623, -8791, -7921, -7014, -6075, -5107, -4115, -3104,
|
||||||
|
-2077, -1041, 0, 1041, 2077, 3104, 4115, 5107, 6075, 7014, 7921, 8791, 9623,
|
||||||
|
10411, 11154, 11849, 12496, 13091, 13634, 14126, 14565, 14953, 15289, 15577,
|
||||||
|
15816, 16009, 16159, 16269, 16340, 16377, 16383, 16362, 16317, 16253, 16172,
|
||||||
|
16079, 15977, 15870, 15762, 15656, 15555, 15461, 15377, 15306, 15248, 15206,
|
||||||
|
15180, 15172, 15180, 15206, 15248, 15306, 15377, 15461, 15555, 15656, 15762,
|
||||||
|
15870, 15977, 16079, 16172, 16253, 16317, 16362, 16383, 16377, 16340, 16269,
|
||||||
|
16159, 16009, 15816, 15577, 15289, 14953, 14565, 14126, 13634, 13091, 12496,
|
||||||
|
11849, 11154, 10411, 9623, 8791, 7921, 7014, 6075, 5107, 4115, 3104, 2077,
|
||||||
|
1041, 0, -1041, -2077, -3104, -4115, -5107, -6075, -7014, -7921, -8791,
|
||||||
|
-9623, -10411, -11154, -11849, -12496, -13091 },
|
||||||
|
|
||||||
|
/* Computed Parameter: r_sin3PhaB_M1_Table
|
||||||
|
* Referenced by: '<S71>/r_sin3PhaB_M1'
|
||||||
|
*/
|
||||||
|
{ 15172, 15180, 15206, 15248, 15306, 15377, 15461, 15555, 15656, 15762, 15870,
|
||||||
|
15977, 16079, 16172, 16253, 16317, 16362, 16383, 16377, 16340, 16269, 16159,
|
||||||
|
16009, 15816, 15577, 15289, 14953, 14565, 14126, 13634, 13091, 12496, 11849,
|
||||||
|
11154, 10411, 9623, 8791, 7921, 7014, 6075, 5107, 4115, 3104, 2077, 1041, 0,
|
||||||
|
-1041, -2077, -3104, -4115, -5107, -6075, -7014, -7921, -8791, -9623, -10411,
|
||||||
|
-11154, -11849, -12496, -13091, -13634, -14126, -14565, -14953, -15289,
|
||||||
|
-15577, -15816, -16009, -16159, -16269, -16340, -16377, -16383, -16362,
|
||||||
|
-16317, -16253, -16172, -16079, -15977, -15870, -15762, -15656, -15555,
|
||||||
|
-15461, -15377, -15306, -15248, -15206, -15180, -15172, -15180, -15206,
|
||||||
|
-15248, -15306, -15377, -15461, -15555, -15656, -15762, -15870, -15977,
|
||||||
|
-16079, -16172, -16253, -16317, -16362, -16383, -16377, -16340, -16269,
|
||||||
|
-16159, -16009, -15816, -15577, -15289, -14953, -14565, -14126, -13634,
|
||||||
|
-13091, -12496, -11849, -11154, -10411, -9623, -8791, -7921, -7014, -6075,
|
||||||
|
-5107, -4115, -3104, -2077, -1041, 0, 1041, 2077, 3104, 4115, 5107, 6075,
|
||||||
|
7014, 7921, 8791, 9623, 10411, 11154, 11849, 12496, 13091, 13634, 14126,
|
||||||
|
14565, 14953, 15289, 15577, 15816, 16009, 16159, 16269, 16340, 16377, 16383,
|
||||||
|
16362, 16317, 16253, 16172, 16079, 15977, 15870, 15762, 15656, 15555, 15461,
|
||||||
|
15377, 15306, 15248, 15206, 15180, 15172 },
|
||||||
|
|
||||||
|
/* Computed Parameter: r_sin3PhaC_M1_Table
|
||||||
|
* Referenced by: '<S71>/r_sin3PhaC_M1'
|
||||||
|
*/
|
||||||
|
{ -13091, -12496, -11849, -11154, -10411, -9623, -8791, -7921, -7014, -6075,
|
||||||
|
-5107, -4115, -3104, -2077, -1041, 0, 1041, 2077, 3104, 4115, 5107, 6075,
|
||||||
|
7014, 7921, 8791, 9623, 10411, 11154, 11849, 12496, 13091, 13634, 14126,
|
||||||
|
14565, 14953, 15289, 15577, 15816, 16009, 16159, 16269, 16340, 16377, 16383,
|
||||||
|
16362, 16317, 16253, 16172, 16079, 15977, 15870, 15762, 15656, 15555, 15461,
|
||||||
|
15377, 15306, 15248, 15206, 15180, 15172, 15180, 15206, 15248, 15306, 15377,
|
||||||
|
15461, 15555, 15656, 15762, 15870, 15977, 16079, 16172, 16253, 16317, 16362,
|
||||||
|
16383, 16377, 16340, 16269, 16159, 16009, 15816, 15577, 15289, 14953, 14565,
|
||||||
|
14126, 13634, 13091, 12496, 11849, 11154, 10411, 9623, 8791, 7921, 7014,
|
||||||
|
6075, 5107, 4115, 3104, 2077, 1041, 0, -1041, -2077, -3104, -4115, -5107,
|
||||||
|
-6075, -7014, -7921, -8791, -9623, -10411, -11154, -11849, -12496, -13091,
|
||||||
|
-13634, -14126, -14565, -14953, -15289, -15577, -15816, -16009, -16159,
|
||||||
|
-16269, -16340, -16377, -16383, -16362, -16317, -16253, -16172, -16079,
|
||||||
|
-15977, -15870, -15762, -15656, -15555, -15461, -15377, -15306, -15248,
|
||||||
|
-15206, -15180, -15172, -15180, -15206, -15248, -15306, -15377, -15461,
|
||||||
|
-15555, -15656, -15762, -15870, -15977, -16079, -16172, -16253, -16317,
|
||||||
|
-16362, -16383, -16377, -16340, -16269, -16159, -16009, -15816, -15577,
|
||||||
|
-15289, -14953, -14565, -14126, -13634, -13091 },
|
||||||
|
|
||||||
/* Computed Parameter: r_sin_M1_Table
|
/* Computed Parameter: r_sin_M1_Table
|
||||||
* Referenced by: '<S32>/r_sin_M1'
|
* Referenced by: '<S38>/r_sin_M1'
|
||||||
*/
|
*/
|
||||||
{ 8192, 8682, 9162, 9630, 10087, 10531, 10963, 11381, 11786, 12176, 12551,
|
{ 8192, 8682, 9162, 9630, 10087, 10531, 10963, 11381, 11786, 12176, 12551,
|
||||||
12911, 13255, 13583, 13894, 14189, 14466, 14726, 14968, 15191, 15396, 15582,
|
12911, 13255, 13583, 13894, 14189, 14466, 14726, 14968, 15191, 15396, 15582,
|
||||||
|
@ -48,7 +109,7 @@ const ConstP rtConstP = {
|
||||||
2280, 2845, 3406, 3964, 4516, 5063, 5604, 6138, 6664, 7182, 7692, 8192 },
|
2280, 2845, 3406, 3964, 4516, 5063, 5604, 6138, 6664, 7182, 7692, 8192 },
|
||||||
|
|
||||||
/* Computed Parameter: r_cos_M1_Table
|
/* Computed Parameter: r_cos_M1_Table
|
||||||
* Referenced by: '<S32>/r_cos_M1'
|
* Referenced by: '<S38>/r_cos_M1'
|
||||||
*/
|
*/
|
||||||
{ 14189, 13894, 13583, 13255, 12911, 12551, 12176, 11786, 11381, 10963, 10531,
|
{ 14189, 13894, 13583, 13255, 12911, 12551, 12176, 11786, 11381, 10963, 10531,
|
||||||
10087, 9630, 9162, 8682, 8192, 7692, 7182, 6664, 6138, 5604, 5063, 4516,
|
10087, 9630, 9162, 8682, 8192, 7692, 7182, 6664, 6138, 5604, 5063, 4516,
|
||||||
|
@ -69,7 +130,7 @@ const ConstP rtConstP = {
|
||||||
16026, 15897, 15749, 15582, 15396, 15191, 14968, 14726, 14466, 14189 },
|
16026, 15897, 15749, 15582, 15396, 15191, 14968, 14726, 14466, 14189 },
|
||||||
|
|
||||||
/* Computed Parameter: iq_maxSca_M1_Table
|
/* Computed Parameter: iq_maxSca_M1_Table
|
||||||
* Referenced by: '<S35>/iq_maxSca_M1'
|
* Referenced by: '<S41>/iq_maxSca_M1'
|
||||||
*/
|
*/
|
||||||
{ 65535U, 65523U, 65484U, 65418U, 65326U, 65207U, 65062U, 64890U, 64691U,
|
{ 65535U, 65523U, 65484U, 65418U, 65326U, 65207U, 65062U, 64890U, 64691U,
|
||||||
64465U, 64211U, 63930U, 63620U, 63281U, 62913U, 62516U, 62088U, 61630U,
|
64465U, 64211U, 63930U, 63620U, 63281U, 62913U, 62516U, 62088U, 61630U,
|
||||||
|
@ -78,45 +139,45 @@ const ConstP rtConstP = {
|
||||||
45470U, 44069U, 42581U, 40997U, 39307U, 37494U, 35541U, 33422U, 31105U,
|
45470U, 44069U, 42581U, 40997U, 39307U, 37494U, 35541U, 33422U, 31105U,
|
||||||
28540U, 25655U, 22323U, 18304U, 12974U },
|
28540U, 25655U, 22323U, 18304U, 12974U },
|
||||||
|
|
||||||
|
/* Computed Parameter: z_commutMap_M1_table
|
||||||
|
* Referenced by: '<S70>/z_commutMap_M1'
|
||||||
|
*/
|
||||||
|
{ -1, 1, 0, -1, 0, 1, 0, -1, 1, 1, -1, 0, 1, 0, -1, 0, 1, -1 },
|
||||||
|
|
||||||
/* Computed Parameter: vec_hallToPos_Value
|
/* Computed Parameter: vec_hallToPos_Value
|
||||||
* Referenced by: '<S9>/vec_hallToPos'
|
* Referenced by: '<S8>/vec_hallToPos'
|
||||||
*/
|
*/
|
||||||
{ 0, 2, 0, 1, 4, 3, 5, 0 }
|
{ 0, 2, 0, 1, 4, 3, 5, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
P rtP_Left = {
|
P rtP_Left = {
|
||||||
/* Variable: dV_openRate
|
/* Variable: dV_openRate
|
||||||
* Referenced by: '<S36>/dV_openRate'
|
* Referenced by: '<S31>/dV_openRate'
|
||||||
*/
|
*/
|
||||||
4096,
|
4096,
|
||||||
|
|
||||||
/* Variable: dz_cntTrnsDetHi
|
/* Variable: dz_cntTrnsDetHi
|
||||||
* Referenced by: '<S16>/dz_cntTrnsDet'
|
* Referenced by: '<S13>/dz_cntTrnsDet'
|
||||||
*/
|
*/
|
||||||
40,
|
40,
|
||||||
|
|
||||||
/* Variable: dz_cntTrnsDetLo
|
/* Variable: dz_cntTrnsDetLo
|
||||||
* Referenced by: '<S16>/dz_cntTrnsDet'
|
* Referenced by: '<S13>/dz_cntTrnsDet'
|
||||||
*/
|
*/
|
||||||
20,
|
20,
|
||||||
|
|
||||||
/* Variable: r_errInpTgtThres
|
|
||||||
* Referenced by: '<S3>/r_errInpTgtThres'
|
|
||||||
*/
|
|
||||||
200,
|
|
||||||
|
|
||||||
/* Variable: z_maxCntRst
|
/* Variable: z_maxCntRst
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S11>/Counter'
|
* '<S10>/Counter'
|
||||||
* '<S11>/z_maxCntRst'
|
* '<S10>/z_maxCntRst'
|
||||||
* '<S11>/z_maxCntRst2'
|
* '<S10>/z_maxCntRst2'
|
||||||
* '<S11>/UnitDelay3'
|
* '<S10>/UnitDelay3'
|
||||||
* '<S16>/z_counter'
|
* '<S13>/z_counter'
|
||||||
*/
|
*/
|
||||||
2000,
|
2000,
|
||||||
|
|
||||||
/* Variable: cf_speedCoef
|
/* Variable: cf_speedCoef
|
||||||
* Referenced by: '<S16>/cf_speedCoef'
|
* Referenced by: '<S13>/cf_speedCoef'
|
||||||
*/
|
*/
|
||||||
10667U,
|
10667U,
|
||||||
|
|
||||||
|
@ -130,30 +191,15 @@ P rtP_Left = {
|
||||||
*/
|
*/
|
||||||
9600U,
|
9600U,
|
||||||
|
|
||||||
/* Variable: cf_idKp
|
|
||||||
* Referenced by: '<S40>/cf_idKp1'
|
|
||||||
*/
|
|
||||||
819U,
|
|
||||||
|
|
||||||
/* Variable: cf_iqKp
|
|
||||||
* Referenced by: '<S39>/cf_iqKp'
|
|
||||||
*/
|
|
||||||
2048U,
|
|
||||||
|
|
||||||
/* Variable: cf_nKp
|
|
||||||
* Referenced by: '<S38>/cf_nKp'
|
|
||||||
*/
|
|
||||||
4833U,
|
|
||||||
|
|
||||||
/* Variable: Vd_max
|
/* Variable: Vd_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/Vd_max1'
|
* '<S41>/Vd_max1'
|
||||||
* '<S14>/Vd_max'
|
* '<S30>/Vd_max'
|
||||||
*/
|
*/
|
||||||
14400,
|
14400,
|
||||||
|
|
||||||
/* Variable: Vq_max_M1
|
/* Variable: Vq_max_M1
|
||||||
* Referenced by: '<S35>/Vq_max_M1'
|
* Referenced by: '<S41>/Vq_max_M1'
|
||||||
*/
|
*/
|
||||||
{ 14400, 14396, 14386, 14368, 14343, 14311, 14271, 14225, 14171, 14109, 14040,
|
{ 14400, 14396, 14386, 14368, 14343, 14311, 14271, 14225, 14171, 14109, 14040,
|
||||||
13963, 13879, 13786, 13685, 13576, 13459, 13333, 13198, 13053, 12900, 12736,
|
13963, 13879, 13786, 13685, 13576, 13459, 13333, 13198, 13053, 12900, 12736,
|
||||||
|
@ -161,7 +207,7 @@ P rtP_Left = {
|
||||||
9790, 9433, 9051, 8640, 8196, 7713, 7184, 6597, 5935, 5170, 4245, 3019, 0 },
|
9790, 9433, 9051, 8640, 8196, 7713, 7184, 6597, 5935, 5170, 4245, 3019, 0 },
|
||||||
|
|
||||||
/* Variable: Vq_max_XA
|
/* Variable: Vq_max_XA
|
||||||
* Referenced by: '<S35>/Vq_max_XA'
|
* Referenced by: '<S41>/Vq_max_XA'
|
||||||
*/
|
*/
|
||||||
{ 0, 320, 640, 960, 1280, 1600, 1920, 2240, 2560, 2880, 3200, 3520, 3840, 4160,
|
{ 0, 320, 640, 960, 1280, 1600, 1920, 2240, 2560, 2880, 3200, 3520, 3840, 4160,
|
||||||
4480, 4800, 5120, 5440, 5760, 6080, 6400, 6720, 7040, 7360, 7680, 8000, 8320,
|
4480, 4800, 5120, 5440, 5760, 6080, 6400, 6720, 7040, 7360, 7680, 8000, 8320,
|
||||||
|
@ -170,93 +216,127 @@ P rtP_Left = {
|
||||||
|
|
||||||
/* Variable: i_max
|
/* Variable: i_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/i_max'
|
* '<S41>/i_max'
|
||||||
* '<S14>/i_max'
|
* '<S30>/i_max'
|
||||||
*/
|
*/
|
||||||
12000,
|
12000,
|
||||||
|
|
||||||
/* Variable: id_fieldWeak_M1
|
/* Variable: id_fieldWeak_M1
|
||||||
* Referenced by: '<S32>/id_fieldWeak_M1'
|
* Referenced by: '<S38>/id_fieldWeak_M1'
|
||||||
*/
|
*/
|
||||||
{ 0, 80, 240, 560, 1040, 1680, 2400, 3040, 3520, 3840, 4000, 4000 },
|
{ 0, 80, 240, 560, 1040, 1680, 2400, 3040, 3520, 3840, 4000, 4000 },
|
||||||
|
|
||||||
/* Variable: n_commAcvLo
|
/* Variable: n_commAcvLo
|
||||||
* Referenced by: '<S11>/n_commDeacv'
|
* Referenced by: '<S10>/n_commDeacv'
|
||||||
*/
|
*/
|
||||||
240,
|
240,
|
||||||
|
|
||||||
/* Variable: n_commDeacvHi
|
/* Variable: n_commDeacvHi
|
||||||
* Referenced by: '<S11>/n_commDeacv'
|
* Referenced by: '<S10>/n_commDeacv'
|
||||||
*/
|
*/
|
||||||
480,
|
480,
|
||||||
|
|
||||||
/* Variable: n_fieldWeakAuthHi
|
/* Variable: n_fieldWeakAuthHi
|
||||||
* Referenced by: '<S32>/n_fieldWeakAuth'
|
* Referenced by:
|
||||||
|
* '<S38>/n_fieldWeakAuth'
|
||||||
|
* '<S73>/n_fieldWeakAuth'
|
||||||
*/
|
*/
|
||||||
3200,
|
3200,
|
||||||
|
|
||||||
/* Variable: n_fieldWeakAuthLo
|
/* Variable: n_fieldWeakAuthLo
|
||||||
* Referenced by: '<S32>/n_fieldWeakAuth'
|
* Referenced by:
|
||||||
|
* '<S38>/n_fieldWeakAuth'
|
||||||
|
* '<S73>/n_fieldWeakAuth'
|
||||||
*/
|
*/
|
||||||
2240,
|
2240,
|
||||||
|
|
||||||
/* Variable: n_max
|
/* Variable: n_max
|
||||||
* Referenced by:
|
* Referenced by:
|
||||||
* '<S35>/n_max1'
|
* '<S41>/n_max1'
|
||||||
* '<S14>/n_max'
|
* '<S30>/n_max'
|
||||||
*/
|
*/
|
||||||
12800,
|
12800,
|
||||||
|
|
||||||
/* Variable: n_stdStillDet
|
/* Variable: n_stdStillDet
|
||||||
* Referenced by: '<S11>/n_stdStillDet'
|
* Referenced by: '<S10>/n_stdStillDet'
|
||||||
*/
|
*/
|
||||||
48,
|
48,
|
||||||
|
|
||||||
|
/* Variable: r_errInpTgtThres
|
||||||
|
* Referenced by: '<S3>/r_errInpTgtThres'
|
||||||
|
*/
|
||||||
|
6400,
|
||||||
|
|
||||||
/* Variable: r_fieldWeak_XA
|
/* Variable: r_fieldWeak_XA
|
||||||
* Referenced by: '<S32>/r_fieldWeak_XA'
|
* Referenced by: '<S38>/r_fieldWeak_XA'
|
||||||
*/
|
*/
|
||||||
{ 9120, 9600, 10080, 10560, 11040, 11520, 12000, 12480, 12960, 13440, 13920,
|
{ 9120, 9600, 10080, 10560, 11040, 11520, 12000, 12480, 12960, 13440, 13920,
|
||||||
14400 },
|
14400 },
|
||||||
|
|
||||||
|
/* Variable: r_phaAdv_XA
|
||||||
|
* Referenced by: '<S73>/r_phaAdv_XA'
|
||||||
|
*/
|
||||||
|
{ 0, 1600, 3200, 4800, 6400, 8000, 9600, 11200, 12800, 14400, 16000 },
|
||||||
|
|
||||||
|
/* Variable: cf_idKp
|
||||||
|
* Referenced by: '<S46>/cf_idKp1'
|
||||||
|
*/
|
||||||
|
819U,
|
||||||
|
|
||||||
|
/* Variable: cf_iqKp
|
||||||
|
* Referenced by: '<S45>/cf_iqKp'
|
||||||
|
*/
|
||||||
|
2048U,
|
||||||
|
|
||||||
|
/* Variable: cf_nKp
|
||||||
|
* Referenced by: '<S44>/cf_nKp'
|
||||||
|
*/
|
||||||
|
4833U,
|
||||||
|
|
||||||
/* Variable: cf_currFilt
|
/* Variable: cf_currFilt
|
||||||
* Referenced by: '<S31>/cf_currFilt'
|
* Referenced by: '<S37>/cf_currFilt'
|
||||||
*/
|
*/
|
||||||
7864U,
|
7864U,
|
||||||
|
|
||||||
/* Variable: cf_idKi
|
/* Variable: cf_idKi
|
||||||
* Referenced by: '<S40>/cf_idKi1'
|
* Referenced by: '<S46>/cf_idKi1'
|
||||||
*/
|
*/
|
||||||
246U,
|
246U,
|
||||||
|
|
||||||
/* Variable: cf_iqKi
|
/* Variable: cf_iqKi
|
||||||
* Referenced by: '<S39>/cf_iqKi'
|
* Referenced by: '<S45>/cf_iqKi'
|
||||||
*/
|
*/
|
||||||
410U,
|
410U,
|
||||||
|
|
||||||
/* Variable: cf_iqKiLimProt
|
/* Variable: cf_iqKiLimProt
|
||||||
* Referenced by: '<S38>/cf_iqKiLimProt'
|
* Referenced by: '<S44>/cf_iqKiLimProt'
|
||||||
*/
|
*/
|
||||||
167U,
|
167U,
|
||||||
|
|
||||||
/* Variable: cf_nKi
|
/* Variable: cf_nKi
|
||||||
* Referenced by: '<S38>/cf_nKi'
|
* Referenced by: '<S44>/cf_nKi'
|
||||||
*/
|
*/
|
||||||
84U,
|
84U,
|
||||||
|
|
||||||
/* Variable: cf_iqKpLimProt
|
/* Variable: cf_iqKpLimProt
|
||||||
* Referenced by: '<S45>/cf_iqKpLimProt'
|
* Referenced by: '<S51>/cf_iqKpLimProt'
|
||||||
*/
|
*/
|
||||||
1843U,
|
1843U,
|
||||||
|
|
||||||
/* Variable: cf_nKpLimProt
|
/* Variable: cf_nKpLimProt
|
||||||
* Referenced by: '<S46>/cf_nKpLimProt'
|
* Referenced by: '<S52>/cf_nKpLimProt'
|
||||||
*/
|
*/
|
||||||
1280U,
|
1280U,
|
||||||
|
|
||||||
|
/* Variable: a_phaAdv_M1
|
||||||
|
* Referenced by: '<S73>/a_phaAdv_M1'
|
||||||
|
*/
|
||||||
|
{ 0, 0, 0, 0, 0, 512, 768, 1280, 2304, 4096, 6400 },
|
||||||
|
|
||||||
/* Variable: z_ctrlTypSel
|
/* Variable: z_ctrlTypSel
|
||||||
* Referenced by: '<S1>/z_ctrlTypSel1'
|
* Referenced by: '<S1>/z_ctrlTypSel1'
|
||||||
*/
|
*/
|
||||||
1U,
|
2U,
|
||||||
|
|
||||||
/* Variable: b_diagEna
|
/* Variable: b_diagEna
|
||||||
* Referenced by: '<S1>/b_diagEna'
|
* Referenced by: '<S1>/b_diagEna'
|
||||||
|
@ -264,12 +344,14 @@ P rtP_Left = {
|
||||||
1,
|
1,
|
||||||
|
|
||||||
/* Variable: b_fieldWeakEna
|
/* Variable: b_fieldWeakEna
|
||||||
* Referenced by: '<S32>/b_fieldWeakEna'
|
* Referenced by:
|
||||||
|
* '<S38>/b_fieldWeakEna'
|
||||||
|
* '<S73>/b_fieldWeakEna'
|
||||||
*/
|
*/
|
||||||
0,
|
0,
|
||||||
|
|
||||||
/* Variable: b_selPhaABCurrMeas
|
/* Variable: b_selPhaABCurrMeas
|
||||||
* Referenced by: '<S30>/b_selPhaABCurrMeas'
|
* Referenced by: '<S36>/b_selPhaABCurrMeas'
|
||||||
*/
|
*/
|
||||||
1
|
1
|
||||||
}; /* Modifiable parameters */
|
}; /* Modifiable parameters */
|
||||||
|
|
|
@ -74,7 +74,7 @@ typedef struct{
|
||||||
uint16_t checksum;
|
uint16_t checksum;
|
||||||
} Serialcommand;
|
} Serialcommand;
|
||||||
static volatile Serialcommand command;
|
static volatile Serialcommand command;
|
||||||
static int16_t timeoutCnt = 0 // Timeout counter for Rx Serial command
|
static int16_t timeoutCnt = 0; // Timeout counter for Rx Serial command
|
||||||
#endif
|
#endif
|
||||||
static uint8_t timeoutFlag = 0; // Timeout Flag for Rx Serial command: 0 = OK, 1 = Problem detected (line disconnected or wrong Rx data)
|
static uint8_t timeoutFlag = 0; // Timeout Flag for Rx Serial command: 0 = OK, 1 = Problem detected (line disconnected or wrong Rx data)
|
||||||
|
|
||||||
|
@ -99,7 +99,8 @@ static uint8_t serialSendCounter; // serial send counter
|
||||||
static uint8_t button1, button2;
|
static uint8_t button1, button2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t ctrlModReq = CTRL_MOD_REQ;
|
uint8_t ctrlModReqRaw = CTRL_MOD_REQ;
|
||||||
|
uint8_t ctrlModReq; // Final control mode request
|
||||||
static int cmd1; // normalized input value. -1000 to 1000
|
static int cmd1; // normalized input value. -1000 to 1000
|
||||||
static int cmd2; // normalized input value. -1000 to 1000
|
static int cmd2; // normalized input value. -1000 to 1000
|
||||||
static int16_t steer; // local variable for steering. -1000 to 1000
|
static int16_t steer; // local variable for steering. -1000 to 1000
|
||||||
|
@ -349,7 +350,7 @@ int main(void) {
|
||||||
cmd1 = 0;
|
cmd1 = 0;
|
||||||
cmd2 = 0;
|
cmd2 = 0;
|
||||||
} else {
|
} else {
|
||||||
ctrlModReq = CTRL_MOD_REQ; // Follow the Mode request
|
ctrlModReq = ctrlModReqRaw; // Follow the Mode request
|
||||||
}
|
}
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 61 KiB |
Loading…
Reference in New Issue