File: CONTROL_SYS.h1 /* 2 * File: CONTROL_SYS.h 3 * 4 * Code generated for Simulink model 'CONTROL_SYS'. 5 * 6 * Model version : 1.379 7 * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 8 * C/C++ source code generated on : Thu Dec 22 12:00:05 2016 9 * 10 * Target selection: ert.tlc 11 * Embedded hardware selection: Intel->x86-64 (Windows64) 12 * Code generation objectives: 13 * 1. Traceability 14 * 2. Execution efficiency 15 * 3. ROM efficiency 16 * 4. RAM efficiency 17 * Validation result: Not run 18 */ 19 20 #ifndef RTW_HEADER_CONTROL_SYS_h_ 21 #define RTW_HEADER_CONTROL_SYS_h_ 22 #include <math.h> 23 #include <string.h> 24 #ifndef CONTROL_SYS_COMMON_INCLUDES_ 25 # define CONTROL_SYS_COMMON_INCLUDES_ 26 #include "rtwtypes.h" 27 #endif /* CONTROL_SYS_COMMON_INCLUDES_ */ 28 29 #include "CONTROL_SYS_types.h" 30 #include "rt_defines.h" 31 32 /* Macros for accessing real-time model data structure */ 33 #ifndef rtmGetErrorStatus 34 # define rtmGetErrorStatus(rtm) ((rtm)->errorStatus) 35 #endif 36 37 #ifndef rtmSetErrorStatus 38 # define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val)) 39 #endif 40 41 /* Block signals for system '<S2>/PITCH_and_ROLL_CONT' */ 42 typedef struct { 43 real_T Gain3; /* '<S5>/Gain3' */ 44 real_T Gain4; /* '<S5>/Gain4' */ 45 } B_PITCH_and_ROLL_CONT_CONTROL_T; 46 47 /* Block signals for system '<S2>/YAW_CONT' */ 48 typedef struct { 49 real_T ProportionalGain; /* '<S27>/Proportional Gain' */ 50 } B_YAW_CONT_CONTROL_SYS_T; 51 52 /* Block signals for system '<S2>/Z_CONT' */ 53 typedef struct { 54 real_T ProportionalGain; /* '<S30>/Proportional Gain' */ 55 } B_Z_CONT_CONTROL_SYS_T; 56 57 /* Block signals for system '<S33>/MOTOR_1_CONTROL' */ 58 typedef struct { 59 real_T VOLTS; /* '<S37>/VOLTAGE Saturation' */ 60 } B_MOTOR_1_CONTROL_CONTROL_SYS_T; 61 62 /* Block states (auto storage) for system '<S33>/MOTOR_1_CONTROL' */ 63 typedef struct { 64 real_T Integrator_DSTATE; /* '<S43>/Integrator' */ 65 } DW_MOTOR_1_CONTROL_CONTROL_SY_T; 66 67 /* Block signals (auto storage) */ 68 typedef struct { 69 B_MOTOR_1_CONTROL_CONTROL_SYS_T MOTOR_4_CONTROL;/* '<S33>/MOTOR_4_CONTROL' */ 70 B_MOTOR_1_CONTROL_CONTROL_SYS_T MOTOR_3_CONTROL;/* '<S33>/MOTOR_3_CONTROL' */ 71 B_MOTOR_1_CONTROL_CONTROL_SYS_T MOTOR_2_CONTROL;/* '<S33>/MOTOR_2_CONTROL' */ 72 B_MOTOR_1_CONTROL_CONTROL_SYS_T MOTOR_1_CONTROL;/* '<S33>/MOTOR_1_CONTROL' */ 73 B_Z_CONT_CONTROL_SYS_T Z_CONT; /* '<S2>/Z_CONT' */ 74 B_YAW_CONT_CONTROL_SYS_T YAW_CONT; /* '<S2>/YAW_CONT' */ 75 B_PITCH_and_ROLL_CONT_CONTROL_T PITCH_and_ROLL_CONT;/* '<S2>/PITCH_and_ROLL_CONT' */ 76 } B_CONTROL_SYS_T; 77 78 /* Block states (auto storage) for system '<Root>' */ 79 typedef struct { 80 DW_MOTOR_1_CONTROL_CONTROL_SY_T MOTOR_4_CONTROL;/* '<S33>/MOTOR_4_CONTROL' */ 81 DW_MOTOR_1_CONTROL_CONTROL_SY_T MOTOR_3_CONTROL;/* '<S33>/MOTOR_3_CONTROL' */ 82 DW_MOTOR_1_CONTROL_CONTROL_SY_T MOTOR_2_CONTROL;/* '<S33>/MOTOR_2_CONTROL' */ 83 DW_MOTOR_1_CONTROL_CONTROL_SY_T MOTOR_1_CONTROL;/* '<S33>/MOTOR_1_CONTROL' */ 84 } DW_CONTROL_SYS_T; 85 86 /* Invariant block signals (auto storage) */ 87 typedef struct { 88 const real_T Gain; /* '<S2>/Gain' */ 89 } ConstB_CONTROL_SYS_T; 90 91 /* Real-time Model Data Structure */ 92 struct tag_RTM_CONTROL_SYS_T { 93 const char_T * volatile errorStatus; 94 B_CONTROL_SYS_T *blockIO; 95 DW_CONTROL_SYS_T *dwork; 96 }; 97 98 /* External data declarations for dependent source files */ 99 extern const THE_MEAS_BUS CONTROL_SYS_rtZTHE_MEAS_BUS;/* THE_MEAS_BUS ground */ 100 extern const ConstB_CONTROL_SYS_T CONTROL_SYS_ConstB;/* constant block i/o */ 101 102 /* Model entry point functions */ 103 extern void CONTROL_SYS_initialize(RT_MODEL_CONTROL_SYS_T *const CONTROL_SYS_M, 104 THE_MEAS_BUS *CONTROL_SYS_U_MEAS_BUS, real_T *CONTROL_SYS_U_Ze_cmd, real_T 105 CONTROL_SYS_U_XY_cmd[2], real_T *CONTROL_SYS_U_YAW_cmd, real_T 106 CONTROL_SYS_U_w_mot_UN[4], real_T CONTROL_SYS_Y_VOLTS[4], real_T 107 CONTROL_SYS_Y_FM_CMD_VEC[4]); 108 extern void CONTROL_SYS_step(RT_MODEL_CONTROL_SYS_T *const CONTROL_SYS_M, 109 THE_MEAS_BUS *CONTROL_SYS_U_MEAS_BUS, real_T CONTROL_SYS_U_Ze_cmd, real_T 110 CONTROL_SYS_U_XY_cmd[2], real_T CONTROL_SYS_U_YAW_cmd, real_T 111 CONTROL_SYS_U_w_mot_UN[4], real_T CONTROL_SYS_Y_VOLTS[4], real_T 112 CONTROL_SYS_Y_FM_CMD_VEC[4]); 113 extern void CONTROL_SYS_terminate(RT_MODEL_CONTROL_SYS_T *const CONTROL_SYS_M); 114 115 /*- 116 * These blocks were eliminated from the model due to optimizations: 117 * 118 * Block '<S5>/Gr_Qr' : Unused code path elimination 119 * Block '<S13>/P_and_R_CMDs' : Unused code path elimination 120 * Block '<S22>/Gain' : Unused code path elimination 121 * Block '<S23>/Gain' : Unused code path elimination 122 * Block '<S24>/Gain' : Unused code path elimination 123 * Block '<S3>/CMD F_and_M and wRPS' : Unused code path elimination 124 * Block '<S33>/VOLTS scope' : Unused code path elimination 125 * Block '<S33>/w CMD vs Actual' : Unused code path elimination 126 * Block '<S36>/Constant' : Unused code path elimination 127 * Block '<S36>/Gain1' : Unused code path elimination 128 * Block '<S36>/Product' : Unused code path elimination 129 * Block '<S5>/Reshape' : Reshape block reduction 130 * Block '<S5>/Reshape1' : Reshape block reduction 131 * Block '<S5>/Reshape2' : Reshape block reduction 132 */ 133 134 /*- 135 * The generated code includes comments that allow you to trace directly 136 * back to the appropriate location in the model. The basic format 137 * is <system>/block_name, where system is the system number (uniquely 138 * assigned by Simulink) and block_name is the name of the block. 139 * 140 * Note that this particular code originates from a subsystem build, 141 * and has its own system numbers different from the parent model. 142 * Refer to the system hierarchy for this subsystem below, and use the 143 * MATLAB hilite_system command to trace the generated code back 144 * to the parent model. For example, 145 * 146 * hilite_system('bh_6DOF_DISC_codegen/CONTROL_SYS') - opens subsystem bh_6DOF_DISC_codegen/CONTROL_SYS 147 * hilite_system('bh_6DOF_DISC_codegen/CONTROL_SYS/Kp') - opens and selects block Kp 148 * 149 * Here is the system hierarchy for this model 150 * 151 * '<Root>' : 'bh_6DOF_DISC_codegen' 152 * '<S1>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS' 153 * '<S2>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS' 154 * '<S3>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS' 155 * '<S4>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/FM_CMD_LIMITS' 156 * '<S5>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT' 157 * '<S6>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/YAW_CONT' 158 * '<S7>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/Z_CONT' 159 * '<S8>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/Apply Pitch and Roll Saturation Limits' 160 * '<S9>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_PITCH_CONTROL' 161 * '<S10>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_ROLL_CONTROL' 162 * '<S11>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/MATLAB Function' 163 * '<S12>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/phi' 164 * '<S13>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/plots' 165 * '<S14>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/psi' 166 * '<S15>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/theta' 167 * '<S16>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/Apply Pitch and Roll Saturation Limits/Degrees to Radians' 168 * '<S17>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/Apply Pitch and Roll Saturation Limits/Radians to Degrees' 169 * '<S18>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_PITCH_CONTROL/P_CONT' 170 * '<S19>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_PITCH_CONTROL/P_CONT_too' 171 * '<S20>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_ROLL_CONTROL/P_CONT' 172 * '<S21>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/FINAL_DES_ROLL_CONTROL/P_CONT_too' 173 * '<S22>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/plots/Radians to Degrees' 174 * '<S23>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/plots/Radians to Degrees1' 175 * '<S24>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/PITCH_and_ROLL_CONT/plots/Radians to Degrees2' 176 * '<S25>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/YAW_CONT/FINAL_DES_YAW_CONTROL_SYSTEM' 177 * '<S26>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/YAW_CONT/FINAL_DES_YAW_CONTROL_SYSTEM/P_CONT_too' 178 * '<S27>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/YAW_CONT/FINAL_DES_YAW_CONTROL_SYSTEM/P_Cont' 179 * '<S28>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/Z_CONT/FINAl_DES_ALTITUDE_CONTROL_SYSTEM' 180 * '<S29>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/Z_CONT/Ze_to_Altitude' 181 * '<S30>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/Z_CONT/FINAl_DES_ALTITUDE_CONTROL_SYSTEM/P_cont' 182 * '<S31>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS FM_CMDS/Z_CONT/FINAl_DES_ALTITUDE_CONTROL_SYSTEM/P_cont_too' 183 * '<S32>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/FM_to_w2' 184 * '<S33>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS' 185 * '<S34>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/W2_checker' 186 * '<S35>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/W2_checker1' 187 * '<S36>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/w_to_RPS' 188 * '<S37>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_1_CONTROL' 189 * '<S38>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_1_CONTROL4' 190 * '<S39>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_2_CONTROL' 191 * '<S40>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_3_CONTROL' 192 * '<S41>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_4_CONTROL' 193 * '<S42>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/w_MUX' 194 * '<S43>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_1_CONTROL/PI_CONT' 195 * '<S44>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_2_CONTROL/PI_CONT' 196 * '<S45>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_3_CONTROL/PI_CONT' 197 * '<S46>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/MOTOR_CONTROL_SYS/MOTOR_4_CONTROL/PI_CONT' 198 * '<S47>' : 'bh_6DOF_DISC_codegen/CONTROL_SYS/CONT_SYS MOTOR_CMDS/W2_checker/Compare To Constant' 199 */ 200 #endif /* RTW_HEADER_CONTROL_SYS_h_ */ 201 202 /* 203 * File trailer for generated code. 204 * 205 * [EOF] 206 */ 207 |