mirror of https://github.com/commaai/body.git
551 lines
34 KiB
C
551 lines
34 KiB
C
/*
|
|
* File: BLDC_controller.h
|
|
*
|
|
* Code generated for Simulink model 'BLDC_controller'.
|
|
*
|
|
* Model version : 1.1297
|
|
* Simulink Coder version : 8.13 (R2017b) 24-Jul-2017
|
|
* C/C++ source code generated on : Sun Mar 6 11:02:11 2022
|
|
*
|
|
* Target selection: ert.tlc
|
|
* Embedded hardware selection: ARM Compatible->ARM Cortex
|
|
* Emulation hardware selection:
|
|
* Differs from embedded hardware (MATLAB Host)
|
|
* Code generation objectives:
|
|
* 1. Execution efficiency
|
|
* 2. RAM efficiency
|
|
* Validation result: Not run
|
|
*/
|
|
|
|
#ifndef RTW_HEADER_BLDC_controller_h_
|
|
#define RTW_HEADER_BLDC_controller_h_
|
|
#include "rtwtypes.h"
|
|
#ifndef BLDC_controller_COMMON_INCLUDES_
|
|
# define BLDC_controller_COMMON_INCLUDES_
|
|
#include "rtwtypes.h"
|
|
#endif /* BLDC_controller_COMMON_INCLUDES_ */
|
|
|
|
/* Macros for accessing real-time model data structure */
|
|
|
|
/* Forward declaration for rtModel */
|
|
typedef struct tag_RTM RT_MODEL;
|
|
|
|
/* Block signals and states (auto storage) for system '<S13>/Counter' */
|
|
typedef struct {
|
|
int16_T UnitDelay_DSTATE; /* '<S18>/UnitDelay' */
|
|
} DW_Counter;
|
|
|
|
/* Block signals and states (auto storage) for system '<S50>/Low_Pass_Filter' */
|
|
typedef struct {
|
|
int32_T UnitDelay1_DSTATE[2]; /* '<S56>/UnitDelay1' */
|
|
} DW_Low_Pass_Filter;
|
|
|
|
/* Block signals and states (auto storage) for system '<S25>/Counter' */
|
|
typedef struct {
|
|
uint16_T UnitDelay_DSTATE; /* '<S30>/UnitDelay' */
|
|
} DW_Counter_b;
|
|
|
|
/* Block signals and states (auto storage) for system '<S21>/either_edge' */
|
|
typedef struct {
|
|
boolean_T UnitDelay_DSTATE; /* '<S26>/UnitDelay' */
|
|
} DW_either_edge;
|
|
|
|
/* Block signals and states (auto storage) for system '<S20>/Debounce_Filter' */
|
|
typedef struct {
|
|
DW_either_edge either_edge_p; /* '<S21>/either_edge' */
|
|
DW_Counter_b Counter_e; /* '<S24>/Counter' */
|
|
DW_Counter_b Counter_n1; /* '<S25>/Counter' */
|
|
boolean_T UnitDelay_DSTATE; /* '<S21>/UnitDelay' */
|
|
} DW_Debounce_Filter;
|
|
|
|
/* Block signals and states (auto storage) for system '<S83>/I_backCalc_fixdt' */
|
|
typedef struct {
|
|
int32_T UnitDelay_DSTATE; /* '<S88>/UnitDelay' */
|
|
int32_T UnitDelay_DSTATE_m; /* '<S90>/UnitDelay' */
|
|
} DW_I_backCalc_fixdt;
|
|
|
|
/* Block signals and states (auto storage) for system '<S63>/PI_clamp_fixdt' */
|
|
typedef struct {
|
|
int32_T ResettableDelay_DSTATE; /* '<S77>/Resettable Delay' */
|
|
uint8_T icLoad; /* '<S77>/Resettable Delay' */
|
|
boolean_T UnitDelay1_DSTATE; /* '<S74>/UnitDelay1' */
|
|
} DW_PI_clamp_fixdt;
|
|
|
|
/* Block signals and states (auto storage) for system '<S61>/PI_clamp_fixdt' */
|
|
typedef struct {
|
|
int32_T ResettableDelay_DSTATE; /* '<S67>/Resettable Delay' */
|
|
uint8_T icLoad; /* '<S67>/Resettable Delay' */
|
|
boolean_T UnitDelay1_DSTATE; /* '<S65>/UnitDelay1' */
|
|
} DW_PI_clamp_fixdt_m;
|
|
|
|
/* Block signals and states (auto storage) for system '<S62>/PI_clamp_fixdt' */
|
|
typedef struct {
|
|
int16_T ResettableDelay_DSTATE; /* '<S72>/Resettable Delay' */
|
|
uint8_T icLoad; /* '<S72>/Resettable Delay' */
|
|
boolean_T UnitDelay1_DSTATE; /* '<S69>/UnitDelay1' */
|
|
} DW_PI_clamp_fixdt_g;
|
|
|
|
/* Block signals and states (auto storage) for system '<Root>' */
|
|
typedef struct {
|
|
DW_PI_clamp_fixdt_g PI_clamp_fixdt_kh;/* '<S62>/PI_clamp_fixdt' */
|
|
DW_PI_clamp_fixdt_m PI_clamp_fixdt_l4;/* '<S61>/PI_clamp_fixdt' */
|
|
DW_PI_clamp_fixdt PI_clamp_fixdt_i; /* '<S63>/PI_clamp_fixdt' */
|
|
DW_I_backCalc_fixdt I_backCalc_fixdt_j;/* '<S82>/I_backCalc_fixdt' */
|
|
DW_I_backCalc_fixdt I_backCalc_fixdt1;/* '<S83>/I_backCalc_fixdt1' */
|
|
DW_I_backCalc_fixdt I_backCalc_fixdt_i;/* '<S83>/I_backCalc_fixdt' */
|
|
DW_either_edge either_edge_i; /* '<S20>/either_edge' */
|
|
DW_Debounce_Filter Debounce_Filter_k;/* '<S20>/Debounce_Filter' */
|
|
DW_Low_Pass_Filter Low_Pass_Filter_m;/* '<S50>/Low_Pass_Filter' */
|
|
DW_Counter Counter_e; /* '<S13>/Counter' */
|
|
int32_T Divide1; /* '<S81>/Divide1' */
|
|
int32_T UnitDelay_DSTATE; /* '<S40>/UnitDelay' */
|
|
int16_T Gain4_e[3]; /* '<S57>/Gain4' */
|
|
int16_T DataTypeConversion[2]; /* '<S56>/Data Type Conversion' */
|
|
int16_T z_counterRawPrev; /* '<S17>/z_counterRawPrev' */
|
|
int16_T Merge; /* '<S59>/Merge' */
|
|
int16_T Switch1; /* '<S78>/Switch1' */
|
|
int16_T Vd_max1; /* '<S80>/Vd_max1' */
|
|
int16_T Gain3; /* '<S80>/Gain3' */
|
|
int16_T Vq_max_M1; /* '<S80>/Vq_max_M1' */
|
|
int16_T Gain5; /* '<S80>/Gain5' */
|
|
int16_T i_max; /* '<S80>/i_max' */
|
|
int16_T Divide1_n; /* '<S80>/Divide1' */
|
|
int16_T Gain1; /* '<S80>/Gain1' */
|
|
int16_T Gain4; /* '<S80>/Gain4' */
|
|
int16_T Switch2_i; /* '<S87>/Switch2' */
|
|
int16_T Switch2_o; /* '<S93>/Switch2' */
|
|
int16_T Switch2_a; /* '<S91>/Switch2' */
|
|
int16_T Divide3; /* '<S42>/Divide3' */
|
|
int16_T Merge1; /* '<S33>/Merge1' */
|
|
int16_T Abs1; /* '<S5>/Abs1' */
|
|
int16_T Abs5_h; /* '<S50>/Abs5' */
|
|
int16_T Divide11; /* '<S17>/Divide11' */
|
|
int16_T r_sin_M1; /* '<S52>/r_sin_M1' */
|
|
int16_T r_cos_M1; /* '<S52>/r_cos_M1' */
|
|
int16_T UnitDelay3_DSTATE; /* '<S13>/UnitDelay3' */
|
|
int16_T UnitDelay4_DSTATE; /* '<S17>/UnitDelay4' */
|
|
int16_T UnitDelay2_DSTATE; /* '<S17>/UnitDelay2' */
|
|
int16_T UnitDelay3_DSTATE_o; /* '<S17>/UnitDelay3' */
|
|
int16_T UnitDelay5_DSTATE; /* '<S17>/UnitDelay5' */
|
|
int16_T UnitDelay4_DSTATE_e; /* '<S13>/UnitDelay4' */
|
|
int16_T UnitDelay4_DSTATE_eu; /* '<S8>/UnitDelay4' */
|
|
int8_T Switch2_e; /* '<S12>/Switch2' */
|
|
int8_T UnitDelay2_DSTATE_b; /* '<S12>/UnitDelay2' */
|
|
int8_T If1_ActiveSubsystem; /* '<S7>/If1' */
|
|
int8_T If2_ActiveSubsystem; /* '<S7>/If2' */
|
|
int8_T If1_ActiveSubsystem_j; /* '<S47>/If1' */
|
|
int8_T SwitchCase_ActiveSubsystem; /* '<S59>/Switch Case' */
|
|
int8_T If1_ActiveSubsystem_a; /* '<S59>/If1' */
|
|
int8_T If1_ActiveSubsystem_o; /* '<S48>/If1' */
|
|
int8_T SwitchCase_ActiveSubsystem_d; /* '<S80>/Switch Case' */
|
|
int8_T If2_ActiveSubsystem_f; /* '<S33>/If2' */
|
|
int8_T If2_ActiveSubsystem_a; /* '<S45>/If2' */
|
|
uint8_T z_ctrlMod; /* '<S5>/F03_02_Control_Mode_Manager' */
|
|
uint8_T UnitDelay3_DSTATE_fy; /* '<S10>/UnitDelay3' */
|
|
uint8_T UnitDelay1_DSTATE; /* '<S10>/UnitDelay1' */
|
|
uint8_T UnitDelay2_DSTATE_f; /* '<S10>/UnitDelay2' */
|
|
uint8_T UnitDelay_DSTATE_e; /* '<S20>/UnitDelay' */
|
|
uint8_T is_active_c1_BLDC_controller;/* '<S5>/F03_02_Control_Mode_Manager' */
|
|
uint8_T is_c1_BLDC_controller; /* '<S5>/F03_02_Control_Mode_Manager' */
|
|
uint8_T is_ACTIVE; /* '<S5>/F03_02_Control_Mode_Manager' */
|
|
boolean_T Merge_p; /* '<S21>/Merge' */
|
|
boolean_T dz_cntTrnsDet; /* '<S17>/dz_cntTrnsDet' */
|
|
boolean_T UnitDelay2_DSTATE_c; /* '<S2>/UnitDelay2' */
|
|
boolean_T UnitDelay5_DSTATE_m; /* '<S2>/UnitDelay5' */
|
|
boolean_T UnitDelay6_DSTATE; /* '<S2>/UnitDelay6' */
|
|
boolean_T UnitDelay_DSTATE_b; /* '<S39>/UnitDelay' */
|
|
boolean_T UnitDelay1_DSTATE_n; /* '<S17>/UnitDelay1' */
|
|
boolean_T n_commDeacv_Mode; /* '<S13>/n_commDeacv' */
|
|
boolean_T dz_cntTrnsDet_Mode; /* '<S17>/dz_cntTrnsDet' */
|
|
} DW;
|
|
|
|
/* Constant parameters (auto storage) */
|
|
typedef struct {
|
|
/* Computed Parameter: r_sin_M1_Table
|
|
* Referenced by: '<S52>/r_sin_M1'
|
|
*/
|
|
int16_T r_sin_M1_Table[181];
|
|
|
|
/* Computed Parameter: r_cos_M1_Table
|
|
* Referenced by: '<S52>/r_cos_M1'
|
|
*/
|
|
int16_T r_cos_M1_Table[181];
|
|
|
|
/* Computed Parameter: r_sin3PhaA_M1_Table
|
|
* Referenced by: '<S96>/r_sin3PhaA_M1'
|
|
*/
|
|
int16_T r_sin3PhaA_M1_Table[181];
|
|
|
|
/* Computed Parameter: r_sin3PhaB_M1_Table
|
|
* Referenced by: '<S96>/r_sin3PhaB_M1'
|
|
*/
|
|
int16_T r_sin3PhaB_M1_Table[181];
|
|
|
|
/* Computed Parameter: r_sin3PhaC_M1_Table
|
|
* Referenced by: '<S96>/r_sin3PhaC_M1'
|
|
*/
|
|
int16_T r_sin3PhaC_M1_Table[181];
|
|
|
|
/* Computed Parameter: iq_maxSca_M1_Table
|
|
* Referenced by: '<S80>/iq_maxSca_M1'
|
|
*/
|
|
uint16_T iq_maxSca_M1_Table[50];
|
|
|
|
/* Computed Parameter: z_commutMap_M1_table
|
|
* Referenced by: '<S94>/z_commutMap_M1'
|
|
*/
|
|
int8_T z_commutMap_M1_table[18];
|
|
|
|
/* Computed Parameter: vec_hallToPos_Value
|
|
* Referenced by: '<S11>/vec_hallToPos'
|
|
*/
|
|
int8_T vec_hallToPos_Value[8];
|
|
} ConstP;
|
|
|
|
/* External inputs (root inport signals with auto storage) */
|
|
typedef struct {
|
|
boolean_T b_motEna; /* '<Root>/b_motEna' */
|
|
uint8_T z_ctrlModReq; /* '<Root>/z_ctrlModReq' */
|
|
int16_T r_inpTgt; /* '<Root>/r_inpTgt' */
|
|
uint8_T b_hallA; /* '<Root>/b_hallA ' */
|
|
uint8_T b_hallB; /* '<Root>/b_hallB' */
|
|
uint8_T b_hallC; /* '<Root>/b_hallC' */
|
|
int16_T i_phaAB; /* '<Root>/i_phaAB' */
|
|
int16_T i_phaBC; /* '<Root>/i_phaBC' */
|
|
int16_T i_DCLink; /* '<Root>/i_DCLink' */
|
|
int16_T a_mechAngle; /* '<Root>/a_mechAngle' */
|
|
} ExtU;
|
|
|
|
/* External outputs (root outports fed by signals with auto storage) */
|
|
typedef struct {
|
|
int16_T DC_phaA; /* '<Root>/DC_phaA' */
|
|
int16_T DC_phaB; /* '<Root>/DC_phaB' */
|
|
int16_T DC_phaC; /* '<Root>/DC_phaC' */
|
|
uint8_T z_errCode; /* '<Root>/z_errCode' */
|
|
int16_T n_mot; /* '<Root>/n_mot' */
|
|
int16_T a_elecAngle; /* '<Root>/a_elecAngle' */
|
|
int16_T iq; /* '<Root>/iq' */
|
|
int16_T id; /* '<Root>/id' */
|
|
} ExtY;
|
|
|
|
/* Parameters (auto storage) */
|
|
struct P_ {
|
|
int32_T dV_openRate; /* Variable: dV_openRate
|
|
* Referenced by: '<S37>/dV_openRate'
|
|
*/
|
|
int16_T dz_cntTrnsDetHi; /* Variable: dz_cntTrnsDetHi
|
|
* Referenced by: '<S17>/dz_cntTrnsDet'
|
|
*/
|
|
int16_T dz_cntTrnsDetLo; /* Variable: dz_cntTrnsDetLo
|
|
* Referenced by: '<S17>/dz_cntTrnsDet'
|
|
*/
|
|
int16_T n_cruiseMotTgt; /* Variable: n_cruiseMotTgt
|
|
* Referenced by: '<S61>/n_cruiseMotTgt'
|
|
*/
|
|
int16_T z_maxCntRst; /* Variable: z_maxCntRst
|
|
* Referenced by:
|
|
* '<S13>/Counter'
|
|
* '<S13>/z_maxCntRst'
|
|
* '<S13>/z_maxCntRst2'
|
|
* '<S13>/UnitDelay3'
|
|
* '<S17>/z_counter'
|
|
*/
|
|
uint16_T cf_speedCoef; /* Variable: cf_speedCoef
|
|
* Referenced by: '<S17>/cf_speedCoef'
|
|
*/
|
|
uint16_T t_errDequal; /* Variable: t_errDequal
|
|
* Referenced by: '<S20>/t_errDequal'
|
|
*/
|
|
uint16_T t_errQual; /* Variable: t_errQual
|
|
* Referenced by: '<S20>/t_errQual'
|
|
*/
|
|
int16_T Vd_max; /* Variable: Vd_max
|
|
* Referenced by:
|
|
* '<S36>/Vd_max'
|
|
* '<S80>/Vd_max1'
|
|
*/
|
|
int16_T Vq_max_M1[46]; /* Variable: Vq_max_M1
|
|
* Referenced by: '<S80>/Vq_max_M1'
|
|
*/
|
|
int16_T Vq_max_XA[46]; /* Variable: Vq_max_XA
|
|
* Referenced by: '<S80>/Vq_max_XA'
|
|
*/
|
|
int16_T a_phaAdvMax; /* Variable: a_phaAdvMax
|
|
* Referenced by: '<S42>/a_phaAdvMax'
|
|
*/
|
|
int16_T i_max; /* Variable: i_max
|
|
* Referenced by:
|
|
* '<S36>/i_max'
|
|
* '<S80>/i_max'
|
|
*/
|
|
int16_T id_fieldWeakMax; /* Variable: id_fieldWeakMax
|
|
* Referenced by: '<S42>/id_fieldWeakMax'
|
|
*/
|
|
int16_T n_commAcvLo; /* Variable: n_commAcvLo
|
|
* Referenced by: '<S13>/n_commDeacv'
|
|
*/
|
|
int16_T n_commDeacvHi; /* Variable: n_commDeacvHi
|
|
* Referenced by: '<S13>/n_commDeacv'
|
|
*/
|
|
int16_T n_fieldWeakAuthHi; /* Variable: n_fieldWeakAuthHi
|
|
* Referenced by: '<S42>/n_fieldWeakAuthHi'
|
|
*/
|
|
int16_T n_fieldWeakAuthLo; /* Variable: n_fieldWeakAuthLo
|
|
* Referenced by: '<S42>/n_fieldWeakAuthLo'
|
|
*/
|
|
int16_T n_max; /* Variable: n_max
|
|
* Referenced by:
|
|
* '<S36>/n_max'
|
|
* '<S80>/n_max1'
|
|
*/
|
|
int16_T n_stdStillDet; /* Variable: n_stdStillDet
|
|
* Referenced by: '<S13>/n_stdStillDet'
|
|
*/
|
|
int16_T r_errInpTgtThres; /* Variable: r_errInpTgtThres
|
|
* Referenced by: '<S20>/r_errInpTgtThres'
|
|
*/
|
|
int16_T r_fieldWeakHi; /* Variable: r_fieldWeakHi
|
|
* Referenced by: '<S42>/r_fieldWeakHi'
|
|
*/
|
|
int16_T r_fieldWeakLo; /* Variable: r_fieldWeakLo
|
|
* Referenced by: '<S42>/r_fieldWeakLo'
|
|
*/
|
|
uint16_T cf_KbLimProt; /* Variable: cf_KbLimProt
|
|
* Referenced by:
|
|
* '<S82>/cf_KbLimProt'
|
|
* '<S83>/cf_KbLimProt'
|
|
*/
|
|
uint16_T cf_idKp; /* Variable: cf_idKp
|
|
* Referenced by: '<S63>/cf_idKp1'
|
|
*/
|
|
uint16_T cf_iqKp; /* Variable: cf_iqKp
|
|
* Referenced by: '<S62>/cf_iqKp'
|
|
*/
|
|
uint16_T cf_nKp; /* Variable: cf_nKp
|
|
* Referenced by: '<S61>/cf_nKp'
|
|
*/
|
|
uint16_T cf_currFilt; /* Variable: cf_currFilt
|
|
* Referenced by: '<S50>/cf_currFilt'
|
|
*/
|
|
uint16_T cf_idKi; /* Variable: cf_idKi
|
|
* Referenced by: '<S63>/cf_idKi1'
|
|
*/
|
|
uint16_T cf_iqKi; /* Variable: cf_iqKi
|
|
* Referenced by: '<S62>/cf_iqKi'
|
|
*/
|
|
uint16_T cf_iqKiLimProt; /* Variable: cf_iqKiLimProt
|
|
* Referenced by:
|
|
* '<S81>/cf_iqKiLimProt'
|
|
* '<S83>/cf_iqKiLimProt'
|
|
*/
|
|
uint16_T cf_nKi; /* Variable: cf_nKi
|
|
* Referenced by: '<S61>/cf_nKi'
|
|
*/
|
|
uint16_T cf_nKiLimProt; /* Variable: cf_nKiLimProt
|
|
* Referenced by:
|
|
* '<S82>/cf_nKiLimProt'
|
|
* '<S83>/cf_nKiLimProt'
|
|
*/
|
|
uint8_T n_polePairs; /* Variable: n_polePairs
|
|
* Referenced by: '<S15>/n_polePairs'
|
|
*/
|
|
uint8_T z_ctrlTypSel; /* Variable: z_ctrlTypSel
|
|
* Referenced by: '<S1>/z_ctrlTypSel'
|
|
*/
|
|
uint8_T z_selPhaCurMeasABC; /* Variable: z_selPhaCurMeasABC
|
|
* Referenced by: '<S49>/z_selPhaCurMeasABC'
|
|
*/
|
|
boolean_T b_angleMeasEna; /* Variable: b_angleMeasEna
|
|
* Referenced by:
|
|
* '<S3>/b_angleMeasEna'
|
|
* '<S13>/b_angleMeasEna'
|
|
*/
|
|
boolean_T b_cruiseCtrlEna; /* Variable: b_cruiseCtrlEna
|
|
* Referenced by: '<S1>/b_cruiseCtrlEna'
|
|
*/
|
|
boolean_T b_diagEna; /* Variable: b_diagEna
|
|
* Referenced by: '<S4>/b_diagEna'
|
|
*/
|
|
boolean_T b_fieldWeakEna; /* Variable: b_fieldWeakEna
|
|
* Referenced by:
|
|
* '<S6>/b_fieldWeakEna'
|
|
* '<S97>/b_fieldWeakEna'
|
|
*/
|
|
};
|
|
|
|
/* Parameters (auto storage) */
|
|
typedef struct P_ P;
|
|
|
|
/* Real-time Model Data Structure */
|
|
struct tag_RTM {
|
|
P *defaultParam;
|
|
ExtU *inputs;
|
|
ExtY *outputs;
|
|
DW *dwork;
|
|
};
|
|
|
|
/* Constant parameters (auto storage) */
|
|
extern const ConstP rtConstP;
|
|
|
|
/* Model entry point functions */
|
|
extern void BLDC_controller_initialize(RT_MODEL *const rtM);
|
|
extern void BLDC_controller_step(RT_MODEL *const rtM);
|
|
|
|
/*-
|
|
* These blocks were eliminated from the model due to optimizations:
|
|
*
|
|
* Block '<S13>/Scope2' : Unused code path elimination
|
|
* Block '<S14>/Scope' : Unused code path elimination
|
|
* Block '<S41>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S41>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S43>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S43>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S44>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S44>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S70>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S70>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S75>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S75>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S79>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S79>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S84>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S84>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S87>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S87>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S91>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S91>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S93>/Data Type Duplicate' : Unused code path elimination
|
|
* Block '<S93>/Data Type Propagation' : Unused code path elimination
|
|
* Block '<S7>/Scope12' : Unused code path elimination
|
|
* Block '<S7>/Scope8' : Unused code path elimination
|
|
* Block '<S7>/toNegative' : Unused code path elimination
|
|
* Block '<S97>/Scope' : Unused code path elimination
|
|
* Block '<S2>/Data Type Conversion' : Eliminate redundant data type conversion
|
|
* Block '<S72>/Data Type Conversion1' : Eliminate redundant data type conversion
|
|
*/
|
|
|
|
/*-
|
|
* The generated code includes comments that allow you to trace directly
|
|
* back to the appropriate location in the model. The basic format
|
|
* is <system>/block_name, where system is the system number (uniquely
|
|
* assigned by Simulink) and block_name is the name of the block.
|
|
*
|
|
* Note that this particular code originates from a subsystem build,
|
|
* and has its own system numbers different from the parent model.
|
|
* Refer to the system hierarchy for this subsystem below, and use the
|
|
* MATLAB hilite_system command to trace the generated code back
|
|
* to the parent model. For example,
|
|
*
|
|
* hilite_system('BLDCmotor_FOC_R2017b_fixdt/BLDC_controller') - opens subsystem BLDCmotor_FOC_R2017b_fixdt/BLDC_controller
|
|
* hilite_system('BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/Kp') - opens and selects block Kp
|
|
*
|
|
* Here is the system hierarchy for this model
|
|
*
|
|
* '<Root>' : 'BLDCmotor_FOC_R2017b_fixdt'
|
|
* '<S1>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller'
|
|
* '<S2>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/Call_Scheduler'
|
|
* '<S3>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations'
|
|
* '<S4>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics'
|
|
* '<S5>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager'
|
|
* '<S6>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Weakening'
|
|
* '<S7>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control'
|
|
* '<S8>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management'
|
|
* '<S9>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/Task_Scheduler'
|
|
* '<S10>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_01_Edge_Detector'
|
|
* '<S11>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_02_Position_Calculation'
|
|
* '<S12>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_03_Direction_Detection'
|
|
* '<S13>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation'
|
|
* '<S14>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_05_Electrical_Angle_Estimation'
|
|
* '<S15>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_06_Electrical_Angle_Measurement'
|
|
* '<S16>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Counter'
|
|
* '<S17>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Raw_Motor_Speed_Estimation'
|
|
* '<S18>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_04_Speed_Estimation/Counter/rst_Delay'
|
|
* '<S19>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F01_Estimations/F01_06_Electrical_Angle_Measurement/Modulo_fixdt'
|
|
* '<S20>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled'
|
|
* '<S21>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter'
|
|
* '<S22>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/either_edge'
|
|
* '<S23>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Default'
|
|
* '<S24>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Dequalification'
|
|
* '<S25>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Qualification'
|
|
* '<S26>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/either_edge'
|
|
* '<S27>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Dequalification/Counter'
|
|
* '<S28>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Dequalification/Counter/rst_Delay'
|
|
* '<S29>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Qualification/Counter'
|
|
* '<S30>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F02_Diagnostics/Diagnostics_Enabled/Debounce_Filter/Qualification/Counter/rst_Delay'
|
|
* '<S31>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_01_Mode_Transition_Calculation'
|
|
* '<S32>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_02_Control_Mode_Manager'
|
|
* '<S33>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis'
|
|
* '<S34>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Default_Control_Type'
|
|
* '<S35>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Default_Mode'
|
|
* '<S36>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/FOC_Control_Type'
|
|
* '<S37>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode'
|
|
* '<S38>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter'
|
|
* '<S39>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/rising_edge_init'
|
|
* '<S40>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter/Delay_Init1'
|
|
* '<S41>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F03_Control_Mode_Manager/F03_03_Input_Target_Synthesis/Open_Mode/Rate_Limiter/Saturation Dynamic'
|
|
* '<S42>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Weakening/Field_Weakening_Enabled'
|
|
* '<S43>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Weakening/Field_Weakening_Enabled/Saturation Dynamic'
|
|
* '<S44>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F04_Field_Weakening/Field_Weakening_Enabled/Saturation Dynamic1'
|
|
* '<S45>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward'
|
|
* '<S46>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Inverse'
|
|
* '<S47>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC'
|
|
* '<S48>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations'
|
|
* '<S49>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Clarke_Transform'
|
|
* '<S50>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Current_Filtering'
|
|
* '<S51>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Park_Transform'
|
|
* '<S52>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Sine_Cosine_Approximation'
|
|
* '<S53>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Clarke_Transform/Clarke_PhasesAB'
|
|
* '<S54>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Clarke_Transform/Clarke_PhasesAC'
|
|
* '<S55>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Clarke_Transform/Clarke_PhasesBC'
|
|
* '<S56>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Forward/Current_Filtering/Low_Pass_Filter'
|
|
* '<S57>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Inverse/Inv_Clarke_Transform'
|
|
* '<S58>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Clarke_Park_Transform_Inverse/Inv_Park_Transform'
|
|
* '<S59>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled'
|
|
* '<S60>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Open_Mode'
|
|
* '<S61>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Speed_Mode'
|
|
* '<S62>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode'
|
|
* '<S63>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation'
|
|
* '<S64>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Voltage_Mode'
|
|
* '<S65>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Speed_Mode/PI_clamp_fixdt'
|
|
* '<S66>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Speed_Mode/PI_clamp_fixdt/Clamping_circuit'
|
|
* '<S67>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Speed_Mode/PI_clamp_fixdt/Integrator'
|
|
* '<S68>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Speed_Mode/PI_clamp_fixdt/Saturation_hit'
|
|
* '<S69>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode/PI_clamp_fixdt'
|
|
* '<S70>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode/Saturation Dynamic1'
|
|
* '<S71>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode/PI_clamp_fixdt/Clamping_circuit'
|
|
* '<S72>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode/PI_clamp_fixdt/Integrator'
|
|
* '<S73>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Torque_Mode/PI_clamp_fixdt/Saturation_hit'
|
|
* '<S74>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation/PI_clamp_fixdt'
|
|
* '<S75>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation/Saturation Dynamic'
|
|
* '<S76>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation/PI_clamp_fixdt/Clamping_circuit'
|
|
* '<S77>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation/PI_clamp_fixdt/Integrator'
|
|
* '<S78>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Vd_Calculation/PI_clamp_fixdt/Saturation_hit'
|
|
* '<S79>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/FOC/FOC_Enabled/Voltage_Mode/Saturation Dynamic1'
|
|
* '<S80>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled'
|
|
* '<S81>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Speed_Mode_Protection'
|
|
* '<S82>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Torque_Mode_Protection'
|
|
* '<S83>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection'
|
|
* '<S84>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Speed_Mode_Protection/Saturation Dynamic'
|
|
* '<S85>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Torque_Mode_Protection/I_backCalc_fixdt'
|
|
* '<S86>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Torque_Mode_Protection/I_backCalc_fixdt/Integrator'
|
|
* '<S87>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Torque_Mode_Protection/I_backCalc_fixdt/Saturation Dynamic1'
|
|
* '<S88>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt'
|
|
* '<S89>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt1'
|
|
* '<S90>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt/Integrator'
|
|
* '<S91>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt/Saturation Dynamic1'
|
|
* '<S92>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt1/Integrator'
|
|
* '<S93>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F05_Field_Oriented_Control/Motor_Limitations/Motor_Limitations_Enabled/Voltage_Mode_Protection/I_backCalc_fixdt1/Saturation Dynamic1'
|
|
* '<S94>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management/COM_Method'
|
|
* '<S95>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management/FOC_Method'
|
|
* '<S96>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management/SIN_Method'
|
|
* '<S97>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management/SIN_Method/Final_Phase_Advance_Calculation'
|
|
* '<S98>' : 'BLDCmotor_FOC_R2017b_fixdt/BLDC_controller/F06_Control_Type_Management/SIN_Method/Final_Phase_Advance_Calculation/Modulo_fixdt'
|
|
*/
|
|
#endif /* RTW_HEADER_BLDC_controller_h_ */
|
|
|
|
/*
|
|
* File trailer for generated code.
|
|
*
|
|
* [EOF]
|
|
*/
|