/* * * File: BLDC_controller.h * * Code generated for Simulink model 'BLDC_controller'. * * Model version : 1.883 * Simulink Coder version : 8.13 (R2017b) 24-Jul-2017 * C/C++ source code generated on : Tue Jun 11 21:14:57 2019 * * 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 '' */ typedef struct { int32_T Switch_PhaAdv; /* '/Switch_PhaAdv' */ int32_T UnitDelay2_DSTATE; /* '/UnitDelay2' */ int16_T Merge; /* '/Merge' */ int16_T Merge1; /* '/Merge1' */ int16_T Merge2; /* '/Merge2' */ int16_T z_counterRawPrev; /* '/z_counterRawPrev' */ int16_T Sum4; /* '/Sum4' */ int16_T UnitDelay1_DSTATE; /* '/UnitDelay1' */ int16_T UnitDelay1_DSTATE_c; /* '/UnitDelay1' */ int16_T z_counter2_DSTATE; /* '/z_counter2' */ int8_T UnitDelay1; /* '/UnitDelay1' */ int8_T Switch2; /* '/Switch2' */ int8_T UnitDelay2_DSTATE_i; /* '/UnitDelay2' */ int8_T If1_ActiveSubsystem; /* '/If1' */ uint8_T UnitDelay_DSTATE; /* '/UnitDelay' */ uint8_T UnitDelay1_DSTATE_i; /* '/UnitDelay1' */ uint8_T UnitDelay2_DSTATE_h; /* '/UnitDelay2' */ boolean_T n_commDeacv_Mode; /* '/n_commDeacv' */ boolean_T dz_counter_Mode; /* '/dz_counter' */ } DW; /* Constant parameters (auto storage) */ typedef struct { /* Computed Parameter: r_trapPhaA_M1_Table * Referenced by: '/r_trapPhaA_M1' */ int16_T r_trapPhaA_M1_Table[7]; /* Computed Parameter: r_trapPhaB_M1_Table * Referenced by: '/r_trapPhaB_M1' */ int16_T r_trapPhaB_M1_Table[7]; /* Computed Parameter: r_trapPhaC_M1_Table * Referenced by: '/r_trapPhaC_M1' */ int16_T r_trapPhaC_M1_Table[7]; /* Computed Parameter: r_sinPhaA_M1_Table * Referenced by: '/r_sinPhaA_M1' */ int16_T r_sinPhaA_M1_Table[37]; /* Computed Parameter: r_sinPhaB_M1_Table * Referenced by: '/r_sinPhaB_M1' */ int16_T r_sinPhaB_M1_Table[37]; /* Computed Parameter: r_sinPhaC_M1_Table * Referenced by: '/r_sinPhaC_M1' */ int16_T r_sinPhaC_M1_Table[37]; /* Computed Parameter: r_sin3PhaA_M1_Table * Referenced by: '/r_sin3PhaA_M1' */ int16_T r_sin3PhaA_M1_Table[37]; /* Computed Parameter: r_sin3PhaB_M1_Table * Referenced by: '/r_sin3PhaB_M1' */ int16_T r_sin3PhaB_M1_Table[37]; /* Computed Parameter: r_sin3PhaC_M1_Table * Referenced by: '/r_sin3PhaC_M1' */ int16_T r_sin3PhaC_M1_Table[37]; /* Computed Parameter: z_commutMap_M1_table * Referenced by: '/z_commutMap_M1' */ int16_T z_commutMap_M1_table[18]; /* Computed Parameter: vec_hallToPos_Value * Referenced by: '/vec_hallToPos' */ int8_T vec_hallToPos_Value[8]; } ConstP; /* External inputs (root inport signals with auto storage) */ typedef struct { uint8_T b_hallA; /* '/b_hallA ' */ uint8_T b_hallB; /* '/b_hallB' */ uint8_T b_hallC; /* '/b_hallC' */ int32_T r_DC; /* '/r_DC' */ } ExtU; /* External outputs (root outports fed by signals with auto storage) */ typedef struct { int32_T DC_phaA; /* '/DC_phaA' */ int32_T DC_phaB; /* '/DC_phaB' */ int32_T DC_phaC; /* '/DC_phaC' */ int32_T n_mot; /* '/n_mot' */ int32_T a_elecAngle; /* '/a_elecAngle' */ } ExtY; /* Parameters (auto storage) */ struct P_ { int32_T cf_speedCoef; /* Variable: cf_speedCoef * Referenced by: '/cf_spdCoef' */ int32_T cf_speedFilt; /* Variable: cf_speedFilt * Referenced by: '/cf_speedFilt' */ int32_T n_commAcvLo; /* Variable: n_commAcvLo * Referenced by: '/n_commDeacv' */ int32_T n_commDeacvHi; /* Variable: n_commDeacvHi * Referenced by: '/n_commDeacv' */ int32_T n_motPhaAdvEna; /* Variable: n_motPhaAdvEna * Referenced by: '/n_motPhaAdvEna' */ int32_T r_commDCDeacv; /* Variable: r_commDCDeacv * Referenced by: '/r_commDCDeacv' */ int32_T r_phaAdvDC_XA[11]; /* Variable: r_phaAdvDC_XA * Referenced by: '/r_phaAdvDC_XA' */ int16_T a_phaAdv_M1[11]; /* Variable: a_phaAdv_M1 * Referenced by: '/a_phaAdv_M2' */ int16_T dz_counterHi; /* Variable: dz_counterHi * Referenced by: '/dz_counter' */ int16_T dz_counterLo; /* Variable: dz_counterLo * Referenced by: '/dz_counter' */ int16_T z_maxCntRst; /* Variable: z_maxCntRst * Referenced by: * '/z_counter' * '/z_counter2' * '/z_maxCntRst' * '/Constant1' * '/UnitDelay1' */ uint8_T z_ctrlTypSel; /* Variable: z_ctrlTypSel * Referenced by: '/z_ctrlTypSel1' */ boolean_T b_phaAdvEna; /* Variable: b_phaAdvEna * Referenced by: '/a_elecPeriod1' */ }; /* 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 '/Scope2' : Unused code path elimination * Block '/Scope' : Unused code path elimination */ /*- * The generated code includes comments that allow you to trace directly * back to the appropriate location in the model. The basic format * is /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('BLDCmotorControl_R2017b/BLDC_controller') - opens subsystem BLDCmotorControl_R2017b/BLDC_controller * hilite_system('BLDCmotorControl_R2017b/BLDC_controller/Kp') - opens and selects block Kp * * Here is the system hierarchy for this model * * '' : 'BLDCmotorControl_R2017b' * '' : 'BLDCmotorControl_R2017b/BLDC_controller' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/signal_log1' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/signal_log2' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/signal_log3' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/signal_log6' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F02_Electrical_Angle_Calculation' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F04_Control_Type_Management' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_01_Edge_Detector' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_02_Position_Calculation' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_03_Direction_Detection' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_04_Speed_Calculation' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_04_Speed_Calculation/Counter_Hold_and_Error_Calculation' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_04_Speed_Calculation/Motor_Speed_Calculation' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F01_Preliminary_Calculations/F01_04_Speed_Calculation/rst_DelayLim' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/F03_01_Pure_Trapezoidal_Method' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/F03_02_Sinusoidal_Method' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/F03_03_Sinusoidal3rd_Method' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/signal_log1' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/signal_log2' * '' : 'BLDCmotorControl_R2017b/BLDC_controller/BLDC_controller/F03_Control_Method_Selection/signal_log6' */ #endif /* RTW_HEADER_BLDC_controller_h_ */ /* * File trailer for generated code. * * [EOF] */