@ -3,9 +3,9 @@
*
* Code generated for Simulink model ' BLDC_controller ' .
*
* Model version : 1.11 8 7
* Model version : 1.11 9 7
* Simulink Coder version : 8.13 ( R2017b ) 24 - Jul - 2017
* C / C + + source code generated on : Sun Oct 27 17 : 31 : 20 2019
* C / C + + source code generated on : Thu Oct 31 21 : 29 : 42 2019
*
* Target selection : ert . tlc
* Embedded hardware selection : ARM Compatible - > ARM Cortex
@ -35,27 +35,22 @@ typedef struct {
int16_T UnitDelay_DSTATE ; /* '<S17>/UnitDelay' */
} DW_Counter ;
/* Block signals and states (auto storage) for system '<S40>/PI_clamp_fixdt_id' */
typedef struct {
int32_T UnitDelay_DSTATE ; /* '<S65>/UnitDelay' */
boolean_T UnitDelay1_DSTATE ; /* '<S62>/UnitDelay1' */
} DW_PI_clamp_fixdt ;
/* Block signals and states (auto storage) for system '<S31>/Low_Pass_Filter' */
typedef struct {
int16_T UnitDelay3_DSTATE [ 2 ] ; /* '<S44>/UnitDelay3' */
} DW_Low_Pass_Filter ;
/* Block signals and states (auto storage) for system '<S40>/PI_backCalc_fixdt_Id' */
typedef struct {
int32_T UnitDelay_DSTATE ; /* '<S61>/UnitDelay' */
int32_T UnitDelay_DSTATE_l ; /* '<S63>/UnitDelay' */
} DW_PI_backCalc_fixdt ;
/* Block signals and states (auto storage) for system '<S38>/PI_backCalc_fixdt_n' */
/* Block signals and states (auto storage) for system '<S38>/PI_clamp_fixdt_n' */
typedef struct {
int32_T UnitDelay_DSTATE ; /* '<S53>/UnitDelay' */
int32_T UnitDelay_DSTATE_h ; /* '<S55>/UnitDelay' */
} DW_PI_backCalc_fixdt_f ;
/* Block signals and states (auto storage) for system '<S36>/Rate_Limiter' */
typedef struct {
int32_T UnitDelay_DSTATE ; /* '<S51>/UnitDelay' */
} DW_Rate_Limiter ;
int32_T UnitDelay_DSTATE ; /* '<S55>/UnitDelay' */
boolean_T UnitDelay1_DSTATE ; /* '<S53>/UnitDelay1' */
} DW_PI_clamp_fixdt_c ;
/* Block signals and states (auto storage) for system '<S22>/Counter' */
typedef struct {
@ -79,19 +74,19 @@ typedef struct {
typedef struct {
DW_either_edge either_edge_a ; /* '<S3>/either_edge' */
DW_Debounce_Filter Debounce_Filter_f ; /* '<S3>/Debounce_Filter' */
DW_Rate_Limiter Rate_Limiter_l ; /* '<S36>/Rate_Limiter' */
DW_PI_backCalc_fixdt PI_backCalc_fixdt_Iq ; /* '<S39>/PI_backCalc_fixdt_Iq' */
DW_PI_backCalc_fixdt_f PI_backCalc_fixdt_n_p ; /* '<S38>/PI_backCalc_fixdt_n' */
DW_PI_backCalc_fixdt PI_backCalc_fixdt_Id ; /* '<S40>/PI_backCalc_fixdt_Id' */
DW_PI_clamp_fixdt PI_clamp_fixdt_iq ; /* '<S39>/PI_clamp_fixdt_iq' */
DW_PI_clamp_fixdt_c PI_clamp_fixdt_n_o ; /* '<S38>/PI_clamp_fixdt_n' */
DW_Low_Pass_Filter Low_Pass_Filter_m ; /* '<S31>/Low_Pass_Filter' */
DW_PI_clamp_fixdt PI_clamp_fixdt_id ; /* '<S40>/PI_clamp_fixdt_id' */
DW_Counter Counter_e ; /* '<S11>/Counter' */
int32_T UnitDelay_DSTATE ; /* '<S51>/UnitDelay' */
int16_T Gain4 [ 3 ] ; /* '<S33>/Gain4' */
int16_T Sum1 [ 2 ] ; /* '<S44>/Sum1' */
int16_T z_counterRawPrev ; /* '<S16>/z_counterRawPrev' */
int16_T Merge ; /* '<S5>/Merge' */
int16_T Divide1 ; /* '<S46>/Divide1' */
int16_T Divide4 ; /* '<S45>/Divide4' */
int16_T Switch 2; /* '<S64>/Switch2 ' */
int16_T Switch 1; /* '<S66>/Switch1 ' */
int16_T Divide11 ; /* '<S16>/Divide11' */
int16_T UnitDelay3_DSTATE ; /* '<S11>/UnitDelay3' */
int16_T UnitDelay4_DSTATE ; /* '<S6>/UnitDelay4' */
@ -101,22 +96,23 @@ typedef struct {
int16_T UnitDelay5_DSTATE ; /* '<S16>/UnitDelay5' */
int16_T UnitDelay4_DSTATE_e ; /* '<S11>/UnitDelay4' */
int16_T UnitDelay4_DSTATE_er ; /* '<S5>/UnitDelay4' */
int8_T Switch2 _e ; /* '<S10>/Switch2' */
int8_T Switch2 ; /* '<S10>/Switch2' */
int8_T UnitDelay2_DSTATE_b ; /* '<S10>/UnitDelay2' */
int8_T If2_ActiveSubsystem ; /* '<S1>/If2' */
int8_T If1_ActiveSubsystem ; /* '<S1>/If1' */
int8_T If1_ActiveSubsystem_h ; /* '<S5>/If1' */
int8_T If2_ActiveSubsystem_a ; /* '<S5>/If2' */
int8_T If1_ActiveSubsystem_e ; /* '<S5>/If1' */
int8_T If1_ActiveSubsystem_f ; /* '<S35>/If1' */
int8_T If2_ActiveSubsystem_c ; /* '<S35>/If2' */
int8_T SwitchCase_ActiveSubsystem ; /* '<S5>/Switch Case' */
uint8_T UnitDelay1_DSTATE ; /* '<S4>/UnitDelay1' */
uint8_T UnitDelay3_DSTATE_fy ; /* '<S8>/UnitDelay3' */
uint8_T UnitDelay1_DSTATE _m ; /* '<S8>/UnitDelay1' */
uint8_T UnitDelay1_DSTATE ; /* '<S8>/UnitDelay1' */
uint8_T UnitDelay2_DSTATE_f ; /* '<S8>/UnitDelay2' */
uint8_T UnitDelay_DSTATE ; /* '<S3>/UnitDelay' */
uint8_T is_active_c1_BLDC_controller ; /* '<S4>/F02_02_Control_Mode_Manager' */
uint8_T is_c1_BLDC_controller ; /* '<S4>/F02_02_Control_Mode_Manager' */
uint8_T is_ACTIVE ; /* '<S4>/F02_02_Control_Mode_Manager' */
uint8_T UnitDelay1_DSTATE_p ; /* '<S4>/UnitDelay1' */
uint8_T UnitDelay_DSTATE_c ; /* '<S3>/UnitDelay' */
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_ACTIVE ; /* '<S4>/F03_02_Control_Mode_Manager' */
boolean_T Merge_n ; /* '<S18>/Merge' */
boolean_T dz_cntTrnsDet ; /* '<S16>/dz_cntTrnsDet' */
boolean_T UnitDelay_DSTATE_g ; /* '<S50>/UnitDelay' */
@ -206,7 +202,7 @@ struct P_ {
* Referenced by : ' < S3 > / t_errQual '
*/
uint16_T cf_idKp ; /* Variable: cf_idKp
* Referenced by : ' < S40 > / cf_idKp '
* Referenced by : ' < S40 > / cf_idKp 1 '
*/
uint16_T cf_iqKp ; /* Variable: cf_iqKp
* Referenced by : ' < S39 > / cf_iqKp '
@ -265,14 +261,8 @@ struct P_ {
uint16_T cf_currFilt ; /* Variable: cf_currFilt
* Referenced by : ' < S31 > / cf_currFilt '
*/
uint16_T cf_idKb ; /* Variable: cf_idKb
* Referenced by : ' < S40 > / cf_idKb '
*/
uint16_T cf_idKi ; /* Variable: cf_idKi
* Referenced by : ' < S40 > / cf_idKi '
*/
uint16_T cf_iqKb ; /* Variable: cf_iqKb
* Referenced by : ' < S39 > / cf_iqKb '
* Referenced by : ' < S40 > / cf_idKi1 '
*/
uint16_T cf_iqKi ; /* Variable: cf_iqKi
* Referenced by : ' < S39 > / cf_iqKi '
@ -280,9 +270,6 @@ struct P_ {
uint16_T cf_iqKiLimProt ; /* Variable: cf_iqKiLimProt
* Referenced by : ' < S38 > / cf_iqKiLimProt '
*/
uint16_T cf_nKb ; /* Variable: cf_nKb
* Referenced by : ' < S38 > / cf_nKb '
*/
uint16_T cf_nKi ; /* Variable: cf_nKi
* Referenced by : ' < S38 > / cf_nKi '
*/
@ -338,20 +325,12 @@ extern void BLDC_controller_step(RT_MODEL *const rtM);
* Block ' < S5 > / Scope12 ' : Unused code path elimination
* Block ' < S5 > / Scope8 ' : Unused code path elimination
* Block ' < S5 > / Scope9 ' : Unused code path elimination
* Block ' < S56 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S56 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S54 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S54 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S60 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S60 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S58 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S58 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S64 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S64 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S62 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S62 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S65 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S65 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S63 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S63 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S67 > / Data Type Duplicate ' : Unused code path elimination
* Block ' < S67 > / Data Type Propagation ' : Unused code path elimination
* Block ' < S1 > / Data Type Conversion2 ' : Eliminate redundant data type conversion
* Block ' < S1 > / Data Type Conversion3 ' : Eliminate redundant data type conversion
* Block ' < S1 > / Data Type Conversion6 ' : Eliminate redundant data type conversion
@ -402,8 +381,8 @@ extern void BLDC_controller_step(RT_MODEL *const rtM);
* ' < S25 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F02_Diagnostics / Debounce_Filter / Dequalification / Counter / rst_Delay '
* ' < S26 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F02_Diagnostics / Debounce_Filter / Qualification / Counter '
* ' < S27 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F02_Diagnostics / Debounce_Filter / Qualification / Counter / rst_Delay '
* ' < S28 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F03_Control_Mode_Manager / F0 2 _01_Mode_Transition_Calculation'
* ' < S29 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F03_Control_Mode_Manager / F0 2 _02_Control_Mode_Manager'
* ' < S28 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F03_Control_Mode_Manager / F0 3 _01_Mode_Transition_Calculation'
* ' < S29 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F03_Control_Mode_Manager / F0 3 _02_Control_Mode_Manager'
* ' < S30 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Clarke_Transform '
* ' < S31 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Current_Filtering '
* ' < S32 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Field_Weakening '
@ -427,19 +406,21 @@ extern void BLDC_controller_step(RT_MODEL *const rtM);
* ' < S50 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Open_Mode / rising_edge_init '
* ' < S51 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Open_Mode / Rate_Limiter / Delay_Init1 '
* ' < S52 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Open_Mode / Rate_Limiter / Saturation Dynamic '
* ' < S53 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ backCalc _fixdt_n'
* ' < S54 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / Saturation Dynamic1 '
* ' < S55 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ backCalc _fixdt_n/ Integrator '
* ' < S56 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ backCalc_fixdt_n/ Saturation Dynamic1 '
* ' < S57 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_ backCalc_fixdt_I q'
* ' < S53 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ clamp _fixdt_n'
* ' < S54 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_clamp_fixdt_n/ Clamping_circuit '
* ' < S55 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ clamp _fixdt_n/ Integrator '
* ' < S56 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Speed_Mode / PI_ clamp_fixdt_n/ Saturation_hit '
* ' < S57 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_ clamp_fixdt_i q'
* ' < S58 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / Saturation Dynamic '
* ' < S59 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_backCalc_fixdt_Iq / Integrator '
* ' < S60 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_backCalc_fixdt_Iq / Saturation Dynamic1 '
* ' < S61 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_backCalc_fixdt_Id '
* ' < S62 > ' : ' 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 / Vd_Calculation / PI_backCalc_fixdt_Id / Integrator '
* ' < S64 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_backCalc_fixdt_Id / Saturation Dynamic1 '
* ' < S65 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Voltage_Mode / Saturation Dynamic1 '
* ' < S59 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_clamp_fixdt_iq / Clamping_circuit '
* ' < S60 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_clamp_fixdt_iq / Integrator '
* ' < S61 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Torque_Mode / PI_clamp_fixdt_iq / Saturation_hit '
* ' < S62 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_clamp_fixdt_id '
* ' < S63 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / Saturation Dynamic '
* ' < S64 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_clamp_fixdt_id / Clamping_circuit '
* ' < S65 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_clamp_fixdt_id / Integrator '
* ' < S66 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Vd_Calculation / PI_clamp_fixdt_id / Saturation_hit '
* ' < S67 > ' : ' BLDCmotorControl_FOC_R2017b_fixdt / BLDC_controller / F04_Field_Oriented_Control / Voltage_Mode / Saturation Dynamic1 '
*/
# endif /* RTW_HEADER_BLDC_controller_h_ */