Matlab code for quadcopter

Dependents:   combination combination

Committer:
Glaxys_finest1
Date:
Mon Nov 25 10:51:06 2019 +0000
Revision:
0:25d32fc1c12e
hello1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Glaxys_finest1 0:25d32fc1c12e 1 //
Glaxys_finest1 0:25d32fc1c12e 2 // File: LAAP.cpp
Glaxys_finest1 0:25d32fc1c12e 3 //
Glaxys_finest1 0:25d32fc1c12e 4 // Code generated for Simulink model 'LAAP'.
Glaxys_finest1 0:25d32fc1c12e 5 //
Glaxys_finest1 0:25d32fc1c12e 6 // Model version : 1.2
Glaxys_finest1 0:25d32fc1c12e 7 // Simulink Coder version : 9.1 (R2019a) 23-Nov-2018
Glaxys_finest1 0:25d32fc1c12e 8 // C/C++ source code generated on : Mon Nov 18 17:57:49 2019
Glaxys_finest1 0:25d32fc1c12e 9 //
Glaxys_finest1 0:25d32fc1c12e 10 // Target selection: ert.tlc
Glaxys_finest1 0:25d32fc1c12e 11 // Embedded hardware selection: ARM Compatible->ARM Cortex
Glaxys_finest1 0:25d32fc1c12e 12 // Code generation objectives:
Glaxys_finest1 0:25d32fc1c12e 13 // 1. Execution efficiency
Glaxys_finest1 0:25d32fc1c12e 14 // 2. RAM efficiency
Glaxys_finest1 0:25d32fc1c12e 15 // Validation result: Not run
Glaxys_finest1 0:25d32fc1c12e 16 //
Glaxys_finest1 0:25d32fc1c12e 17 #include "LAAP.h"
Glaxys_finest1 0:25d32fc1c12e 18
Glaxys_finest1 0:25d32fc1c12e 19 // Model step function
Glaxys_finest1 0:25d32fc1c12e 20 void LAAPModelClass::step()
Glaxys_finest1 0:25d32fc1c12e 21 {
Glaxys_finest1 0:25d32fc1c12e 22 static const int8_T b[3] = { 0, 1, 0 };
Glaxys_finest1 0:25d32fc1c12e 23
Glaxys_finest1 0:25d32fc1c12e 24 static const real_T b_0[12] = { 0.0028, 0.003, 3.1623, 0.0012, 0.0012, 3.68,
Glaxys_finest1 0:25d32fc1c12e 25 1.6056, 1.6056, 1.0, 0.153, 0.153, 0.1 };
Glaxys_finest1 0:25d32fc1c12e 26
Glaxys_finest1 0:25d32fc1c12e 27 static const int8_T c[3] = { 0, 1, 0 };
Glaxys_finest1 0:25d32fc1c12e 28
Glaxys_finest1 0:25d32fc1c12e 29 static const real_T a[16] = { 0.25, 0.25, 0.25, 0.25, 0.0, 2.193, 0.0, -2.193,
Glaxys_finest1 0:25d32fc1c12e 30 -2.193, 0.0, 2.193, 0.0, 4.2591, -4.2591, 4.2591, -4.2591 };
Glaxys_finest1 0:25d32fc1c12e 31
Glaxys_finest1 0:25d32fc1c12e 32 int32_T r1;
Glaxys_finest1 0:25d32fc1c12e 33 int32_T i;
Glaxys_finest1 0:25d32fc1c12e 34 real_T Fdes_idx_2;
Glaxys_finest1 0:25d32fc1c12e 35 real_T Fdes_idx_1;
Glaxys_finest1 0:25d32fc1c12e 36 real_T Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 37 real_T rtb_TmpSignalConversionAtSFun_0;
Glaxys_finest1 0:25d32fc1c12e 38 real_T rtb_TmpSignalConversionAtSFun_1;
Glaxys_finest1 0:25d32fc1c12e 39 int32_T R_tmp;
Glaxys_finest1 0:25d32fc1c12e 40 int32_T b_I_tmp;
Glaxys_finest1 0:25d32fc1c12e 41 int32_T b_I_tmp_0;
Glaxys_finest1 0:25d32fc1c12e 42
Glaxys_finest1 0:25d32fc1c12e 43 // Outputs for Atomic SubSystem: '<Root>/Adaptive large angle controller'
Glaxys_finest1 0:25d32fc1c12e 44 // Delay: '<S1>/Delay1'
Glaxys_finest1 0:25d32fc1c12e 45 memcpy(&rtDW.Delay1[0], &rtDW.psy[0], 12U * sizeof(real_T));
Glaxys_finest1 0:25d32fc1c12e 46
Glaxys_finest1 0:25d32fc1c12e 47 // Outputs for Atomic SubSystem: '<S1>/quadcopter_dynamics_prediction'
Glaxys_finest1 0:25d32fc1c12e 48 // MATLAB Function: '<S3>/Euler equations of motion1 ' incorporates:
Glaxys_finest1 0:25d32fc1c12e 49 // Constant: '<S1>/mass '
Glaxys_finest1 0:25d32fc1c12e 50 // Delay: '<S1>/Delay'
Glaxys_finest1 0:25d32fc1c12e 51 // Delay: '<S3>/Delay'
Glaxys_finest1 0:25d32fc1c12e 52 // Delay: '<S3>/Delay1'
Glaxys_finest1 0:25d32fc1c12e 53
Glaxys_finest1 0:25d32fc1c12e 54 rtDW.b_I[0] = 0.01023564759;
Glaxys_finest1 0:25d32fc1c12e 55 rtDW.b_I[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 56 rtDW.b_I[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 57 rtDW.b_I[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 58 rtDW.b_I[4] = 0.01023564759;
Glaxys_finest1 0:25d32fc1c12e 59 rtDW.b_I[7] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 60 rtDW.b_I[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 61 rtDW.b_I[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 62 rtDW.b_I[8] = 0.02047129518;
Glaxys_finest1 0:25d32fc1c12e 63 rtDW.maxval = std::cos(rtDW.Delay1_DSTATE_l[2]);
Glaxys_finest1 0:25d32fc1c12e 64 rtDW.b_I_k[0] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 65 rtDW.Add1_k = std::sin(rtDW.Delay1_DSTATE_l[2]);
Glaxys_finest1 0:25d32fc1c12e 66 rtDW.b_I_k[3] = -rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 67 rtDW.b_I_k[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 68 rtDW.b_I_k[1] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 69 rtDW.b_I_k[4] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 70 rtDW.b_I_k[7] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 71 rtDW.b_I_k[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 72 rtDW.d[0] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 73 rtDW.b_I_k[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 74 rtDW.d[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 75 rtDW.b_I_k[8] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 76 rtDW.d[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 77 rtDW.d[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 78 Fdes_idx_0 = std::cos(rtDW.Delay1_DSTATE_l[0]);
Glaxys_finest1 0:25d32fc1c12e 79 rtDW.d[4] = Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 80 Fdes_idx_1 = std::sin(rtDW.Delay1_DSTATE_l[0]);
Glaxys_finest1 0:25d32fc1c12e 81 rtDW.d[7] = -Fdes_idx_1;
Glaxys_finest1 0:25d32fc1c12e 82 rtDW.d[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 83 rtDW.d[5] = Fdes_idx_1;
Glaxys_finest1 0:25d32fc1c12e 84 rtDW.d[8] = Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 85 rtDW.maxval = std::cos(rtDW.Delay1_DSTATE_l[1]);
Glaxys_finest1 0:25d32fc1c12e 86 rtDW.dv0[0] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 87 rtDW.dv0[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 88 rtDW.Add1_k = std::sin(rtDW.Delay1_DSTATE_l[1]);
Glaxys_finest1 0:25d32fc1c12e 89 rtDW.dv0[6] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 90 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 91 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 92 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 93 rtDW.R_c[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 94 rtDW.R_c[R_tmp] += rtDW.d[3 * i] * rtDW.b_I_k[r1];
Glaxys_finest1 0:25d32fc1c12e 95 rtDW.R_c[R_tmp] += rtDW.d[3 * i + 1] * rtDW.b_I_k[r1 + 3];
Glaxys_finest1 0:25d32fc1c12e 96 rtDW.R_c[R_tmp] += rtDW.d[3 * i + 2] * rtDW.b_I_k[r1 + 6];
Glaxys_finest1 0:25d32fc1c12e 97 }
Glaxys_finest1 0:25d32fc1c12e 98
Glaxys_finest1 0:25d32fc1c12e 99 rtDW.dv0[1 + 3 * r1] = b[r1];
Glaxys_finest1 0:25d32fc1c12e 100 }
Glaxys_finest1 0:25d32fc1c12e 101
Glaxys_finest1 0:25d32fc1c12e 102 rtDW.dv0[2] = -rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 103 rtDW.dv0[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 104 rtDW.dv0[8] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 105 rtDW.w_dot[0] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 106 rtDW.w_dot[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 107 rtDW.w_dot[2] = rtDW.Delay_DSTATE[0];
Glaxys_finest1 0:25d32fc1c12e 108 rtDW.dv2[0] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 109 rtDW.dv2[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 110 rtDW.dv2[2] = -7.3575;
Glaxys_finest1 0:25d32fc1c12e 111 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 112 rtDW.wb[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 113 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 114 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 115 rtDW.b_I_k[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 116 rtDW.b_I_k[R_tmp] += rtDW.dv0[3 * i] * rtDW.R_c[r1];
Glaxys_finest1 0:25d32fc1c12e 117 rtDW.b_I_k[R_tmp] += rtDW.dv0[3 * i + 1] * rtDW.R_c[r1 + 3];
Glaxys_finest1 0:25d32fc1c12e 118 rtDW.b_I_k[R_tmp] += rtDW.dv0[3 * i + 2] * rtDW.R_c[r1 + 6];
Glaxys_finest1 0:25d32fc1c12e 119 rtDW.wb[r1] += rtDW.b_I_k[R_tmp] * rtDW.w_dot[i];
Glaxys_finest1 0:25d32fc1c12e 120 }
Glaxys_finest1 0:25d32fc1c12e 121
Glaxys_finest1 0:25d32fc1c12e 122 rtDW.a_dotdot[r1] = (rtDW.dv2[r1] + rtDW.wb[r1]) * 1.3333333333333333;
Glaxys_finest1 0:25d32fc1c12e 123 }
Glaxys_finest1 0:25d32fc1c12e 124
Glaxys_finest1 0:25d32fc1c12e 125 rtDW.b_I_k[0] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 126 rtDW.b_I_k[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 127 rtDW.b_I_k[6] = -Fdes_idx_0 * rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 128 rtDW.b_I_k[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 129 rtDW.b_I_k[4] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 130 rtDW.b_I_k[7] = Fdes_idx_1;
Glaxys_finest1 0:25d32fc1c12e 131 rtDW.b_I_k[2] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 132 rtDW.b_I_k[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 133 rtDW.b_I_k[8] = Fdes_idx_0 * rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 134 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 135 rtDW.wb[r1] = rtDW.b_I_k[r1 + 6] * rtDW.Delay_DSTATE_h[2] + (rtDW.b_I_k[r1 +
Glaxys_finest1 0:25d32fc1c12e 136 3] * rtDW.Delay_DSTATE_h[1] + rtDW.b_I_k[r1] * rtDW.Delay_DSTATE_h[0]);
Glaxys_finest1 0:25d32fc1c12e 137 }
Glaxys_finest1 0:25d32fc1c12e 138
Glaxys_finest1 0:25d32fc1c12e 139 rtDW.b_I_k[0] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 140 rtDW.b_I_k[3] = -rtDW.wb[2];
Glaxys_finest1 0:25d32fc1c12e 141 rtDW.b_I_k[6] = rtDW.wb[1];
Glaxys_finest1 0:25d32fc1c12e 142 rtDW.b_I_k[1] = rtDW.wb[2];
Glaxys_finest1 0:25d32fc1c12e 143 rtDW.b_I_k[4] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 144 rtDW.b_I_k[7] = -rtDW.wb[0];
Glaxys_finest1 0:25d32fc1c12e 145 rtDW.b_I_k[2] = -rtDW.wb[1];
Glaxys_finest1 0:25d32fc1c12e 146 rtDW.b_I_k[5] = rtDW.wb[0];
Glaxys_finest1 0:25d32fc1c12e 147 rtDW.b_I_k[8] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 148 rtDW.w_dot[0] = rtDW.Delay_DSTATE[1];
Glaxys_finest1 0:25d32fc1c12e 149 rtDW.w_dot[1] = rtDW.Delay_DSTATE[2];
Glaxys_finest1 0:25d32fc1c12e 150 rtDW.w_dot[2] = rtDW.Delay_DSTATE[3];
Glaxys_finest1 0:25d32fc1c12e 151 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 152 rtDW.dv2[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 153 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 154 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 155 rtDW.R_c[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 156 rtDW.R_c[R_tmp] += rtDW.b_I[3 * i] * rtDW.b_I_k[r1];
Glaxys_finest1 0:25d32fc1c12e 157 rtDW.R_c[R_tmp] += rtDW.b_I[3 * i + 1] * rtDW.b_I_k[r1 + 3];
Glaxys_finest1 0:25d32fc1c12e 158 rtDW.R_c[R_tmp] += rtDW.b_I[3 * i + 2] * rtDW.b_I_k[r1 + 6];
Glaxys_finest1 0:25d32fc1c12e 159 rtDW.dv2[r1] += rtDW.R_c[R_tmp] * rtDW.wb[i];
Glaxys_finest1 0:25d32fc1c12e 160 }
Glaxys_finest1 0:25d32fc1c12e 161
Glaxys_finest1 0:25d32fc1c12e 162 rtDW.Iw_dot[r1] = rtDW.w_dot[r1] - rtDW.dv2[r1];
Glaxys_finest1 0:25d32fc1c12e 163 }
Glaxys_finest1 0:25d32fc1c12e 164
Glaxys_finest1 0:25d32fc1c12e 165 rtDW.w_dot[1] = rtDW.Iw_dot[1] - rtDW.Iw_dot[0] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 166 rtDW.w_dot[2] = (rtDW.Iw_dot[2] - rtDW.Iw_dot[0] * 0.0) - rtDW.w_dot[1] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 167 rtDW.w_dot[2] /= 0.02047129518;
Glaxys_finest1 0:25d32fc1c12e 168 rtDW.w_dot[0] = rtDW.Iw_dot[0] - rtDW.w_dot[2] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 169 rtDW.w_dot[1] -= rtDW.w_dot[2] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 170 rtDW.w_dot[1] /= 0.01023564759;
Glaxys_finest1 0:25d32fc1c12e 171 rtDW.w_dot[0] -= rtDW.w_dot[1] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 172 rtDW.w_dot[0] /= 0.01023564759;
Glaxys_finest1 0:25d32fc1c12e 173
Glaxys_finest1 0:25d32fc1c12e 174 // DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 175 for (r1 = 0; r1 < 6; r1++) {
Glaxys_finest1 0:25d32fc1c12e 176 if (rtDW.Integrator_PrevResetState != 0) {
Glaxys_finest1 0:25d32fc1c12e 177 rtDW.Integrator_DSTATE_ep[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 178 if (rtDW.Integrator_DSTATE_ep[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 179 rtDW.Integrator_DSTATE_ep[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 180 } else {
Glaxys_finest1 0:25d32fc1c12e 181 if (rtDW.Integrator_DSTATE_ep[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 182 rtDW.Integrator_DSTATE_ep[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 183 }
Glaxys_finest1 0:25d32fc1c12e 184 }
Glaxys_finest1 0:25d32fc1c12e 185 }
Glaxys_finest1 0:25d32fc1c12e 186
Glaxys_finest1 0:25d32fc1c12e 187 if (rtDW.Integrator_DSTATE_ep[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 188 rtDW.Integrator_DSTATE_ep[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 189 } else {
Glaxys_finest1 0:25d32fc1c12e 190 if (rtDW.Integrator_DSTATE_ep[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 191 rtDW.Integrator_DSTATE_ep[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 192 }
Glaxys_finest1 0:25d32fc1c12e 193 }
Glaxys_finest1 0:25d32fc1c12e 194
Glaxys_finest1 0:25d32fc1c12e 195 rtDW.Integrator[r1] = rtDW.Integrator_DSTATE_ep[r1];
Glaxys_finest1 0:25d32fc1c12e 196 }
Glaxys_finest1 0:25d32fc1c12e 197
Glaxys_finest1 0:25d32fc1c12e 198 // DiscreteIntegrator: '<S14>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 199 // Inport: '<Root>/phi'
Glaxys_finest1 0:25d32fc1c12e 200 // Inport: '<Root>/psi'
Glaxys_finest1 0:25d32fc1c12e 201 // Inport: '<Root>/theta'
Glaxys_finest1 0:25d32fc1c12e 202 // Inport: '<Root>/x'
Glaxys_finest1 0:25d32fc1c12e 203 // Inport: '<Root>/y'
Glaxys_finest1 0:25d32fc1c12e 204 // Inport: '<Root>/z'
Glaxys_finest1 0:25d32fc1c12e 205
Glaxys_finest1 0:25d32fc1c12e 206 if (rtDW.Integrator_IC_LOADING != 0) {
Glaxys_finest1 0:25d32fc1c12e 207 rtDW.Integrator_DSTATE_k[0] = rtU.x;
Glaxys_finest1 0:25d32fc1c12e 208 rtDW.Integrator_DSTATE_k[1] = rtU.y;
Glaxys_finest1 0:25d32fc1c12e 209 rtDW.Integrator_DSTATE_k[2] = rtU.z;
Glaxys_finest1 0:25d32fc1c12e 210 rtDW.Integrator_DSTATE_k[3] = rtU.phi;
Glaxys_finest1 0:25d32fc1c12e 211 rtDW.Integrator_DSTATE_k[4] = rtU.theta;
Glaxys_finest1 0:25d32fc1c12e 212 rtDW.Integrator_DSTATE_k[5] = rtU.psi;
Glaxys_finest1 0:25d32fc1c12e 213 for (r1 = 0; r1 < 6; r1++) {
Glaxys_finest1 0:25d32fc1c12e 214 if (rtDW.Integrator_DSTATE_k[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 215 rtDW.Integrator_DSTATE_k[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 216 } else {
Glaxys_finest1 0:25d32fc1c12e 217 if (rtDW.Integrator_DSTATE_k[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 218 rtDW.Integrator_DSTATE_k[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 219 }
Glaxys_finest1 0:25d32fc1c12e 220 }
Glaxys_finest1 0:25d32fc1c12e 221 }
Glaxys_finest1 0:25d32fc1c12e 222 }
Glaxys_finest1 0:25d32fc1c12e 223
Glaxys_finest1 0:25d32fc1c12e 224 if (rtDW.Integrator_PrevResetState_n != 0) {
Glaxys_finest1 0:25d32fc1c12e 225 rtDW.Integrator_DSTATE_k[0] = rtU.x;
Glaxys_finest1 0:25d32fc1c12e 226 rtDW.Integrator_DSTATE_k[1] = rtU.y;
Glaxys_finest1 0:25d32fc1c12e 227 rtDW.Integrator_DSTATE_k[2] = rtU.z;
Glaxys_finest1 0:25d32fc1c12e 228 rtDW.Integrator_DSTATE_k[3] = rtU.phi;
Glaxys_finest1 0:25d32fc1c12e 229 rtDW.Integrator_DSTATE_k[4] = rtU.theta;
Glaxys_finest1 0:25d32fc1c12e 230 rtDW.Integrator_DSTATE_k[5] = rtU.psi;
Glaxys_finest1 0:25d32fc1c12e 231 for (r1 = 0; r1 < 6; r1++) {
Glaxys_finest1 0:25d32fc1c12e 232 if (rtDW.Integrator_DSTATE_k[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 233 rtDW.Integrator_DSTATE_k[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 234 } else {
Glaxys_finest1 0:25d32fc1c12e 235 if (rtDW.Integrator_DSTATE_k[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 236 rtDW.Integrator_DSTATE_k[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 237 }
Glaxys_finest1 0:25d32fc1c12e 238 }
Glaxys_finest1 0:25d32fc1c12e 239 }
Glaxys_finest1 0:25d32fc1c12e 240 }
Glaxys_finest1 0:25d32fc1c12e 241
Glaxys_finest1 0:25d32fc1c12e 242 for (r1 = 0; r1 < 6; r1++) {
Glaxys_finest1 0:25d32fc1c12e 243 if (rtDW.Integrator_DSTATE_k[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 244 rtDW.Integrator_DSTATE_k[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 245 } else {
Glaxys_finest1 0:25d32fc1c12e 246 if (rtDW.Integrator_DSTATE_k[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 247 rtDW.Integrator_DSTATE_k[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 248 }
Glaxys_finest1 0:25d32fc1c12e 249 }
Glaxys_finest1 0:25d32fc1c12e 250
Glaxys_finest1 0:25d32fc1c12e 251 rtDW.Integrator_p[r1] = rtDW.Integrator_DSTATE_k[r1];
Glaxys_finest1 0:25d32fc1c12e 252 }
Glaxys_finest1 0:25d32fc1c12e 253
Glaxys_finest1 0:25d32fc1c12e 254 // Update for Delay: '<S3>/Delay' incorporates:
Glaxys_finest1 0:25d32fc1c12e 255 // DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 256
Glaxys_finest1 0:25d32fc1c12e 257 rtDW.Delay_DSTATE_h[0] = rtDW.Integrator_DSTATE_ep[3];
Glaxys_finest1 0:25d32fc1c12e 258
Glaxys_finest1 0:25d32fc1c12e 259 // Update for Delay: '<S3>/Delay1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 260 // DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 261
Glaxys_finest1 0:25d32fc1c12e 262 rtDW.Delay1_DSTATE_l[0] = rtDW.Integrator_DSTATE_k[3];
Glaxys_finest1 0:25d32fc1c12e 263
Glaxys_finest1 0:25d32fc1c12e 264 // Update for Delay: '<S3>/Delay' incorporates:
Glaxys_finest1 0:25d32fc1c12e 265 // DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 266
Glaxys_finest1 0:25d32fc1c12e 267 rtDW.Delay_DSTATE_h[1] = rtDW.Integrator_DSTATE_ep[4];
Glaxys_finest1 0:25d32fc1c12e 268
Glaxys_finest1 0:25d32fc1c12e 269 // Update for Delay: '<S3>/Delay1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 270 // DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 271
Glaxys_finest1 0:25d32fc1c12e 272 rtDW.Delay1_DSTATE_l[1] = rtDW.Integrator_DSTATE_k[4];
Glaxys_finest1 0:25d32fc1c12e 273
Glaxys_finest1 0:25d32fc1c12e 274 // Update for Delay: '<S3>/Delay' incorporates:
Glaxys_finest1 0:25d32fc1c12e 275 // DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 276
Glaxys_finest1 0:25d32fc1c12e 277 rtDW.Delay_DSTATE_h[2] = rtDW.Integrator_DSTATE_ep[5];
Glaxys_finest1 0:25d32fc1c12e 278
Glaxys_finest1 0:25d32fc1c12e 279 // Update for Delay: '<S3>/Delay1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 280 // DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 281
Glaxys_finest1 0:25d32fc1c12e 282 rtDW.Delay1_DSTATE_l[2] = rtDW.Integrator_DSTATE_k[5];
Glaxys_finest1 0:25d32fc1c12e 283
Glaxys_finest1 0:25d32fc1c12e 284 // Update for DiscreteIntegrator: '<S13>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 285 // MATLAB Function: '<S3>/Euler equations of motion1 '
Glaxys_finest1 0:25d32fc1c12e 286
Glaxys_finest1 0:25d32fc1c12e 287 rtDW.dv1[0] = 0.0001 * rtDW.a_dotdot[0];
Glaxys_finest1 0:25d32fc1c12e 288 rtDW.dv1[1] = 0.0001 * rtDW.a_dotdot[1];
Glaxys_finest1 0:25d32fc1c12e 289 rtDW.dv1[2] = 0.0001 * rtDW.a_dotdot[2];
Glaxys_finest1 0:25d32fc1c12e 290 rtDW.dv1[3] = 0.0001 * rtDW.w_dot[0];
Glaxys_finest1 0:25d32fc1c12e 291 rtDW.dv1[4] = 0.0001 * rtDW.w_dot[1];
Glaxys_finest1 0:25d32fc1c12e 292 rtDW.dv1[5] = 0.0001 * rtDW.w_dot[2];
Glaxys_finest1 0:25d32fc1c12e 293 rtDW.Integrator_PrevResetState = 0;
Glaxys_finest1 0:25d32fc1c12e 294
Glaxys_finest1 0:25d32fc1c12e 295 // Update for DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 296 rtDW.Integrator_IC_LOADING = 0U;
Glaxys_finest1 0:25d32fc1c12e 297 for (r1 = 0; r1 < 6; r1++) {
Glaxys_finest1 0:25d32fc1c12e 298 // Update for DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 299 rtDW.Integrator_DSTATE_ep[r1] += rtDW.dv1[r1];
Glaxys_finest1 0:25d32fc1c12e 300 if (rtDW.Integrator_DSTATE_ep[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 301 rtDW.Integrator_DSTATE_ep[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 302 } else {
Glaxys_finest1 0:25d32fc1c12e 303 if (rtDW.Integrator_DSTATE_ep[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 304 rtDW.Integrator_DSTATE_ep[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 305 }
Glaxys_finest1 0:25d32fc1c12e 306 }
Glaxys_finest1 0:25d32fc1c12e 307
Glaxys_finest1 0:25d32fc1c12e 308 // Update for DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 309 rtDW.Integrator_DSTATE_k[r1] += 0.0001 * rtDW.Integrator[r1];
Glaxys_finest1 0:25d32fc1c12e 310 if (rtDW.Integrator_DSTATE_k[r1] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 311 rtDW.Integrator_DSTATE_k[r1] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 312 } else {
Glaxys_finest1 0:25d32fc1c12e 313 if (rtDW.Integrator_DSTATE_k[r1] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 314 rtDW.Integrator_DSTATE_k[r1] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 315 }
Glaxys_finest1 0:25d32fc1c12e 316 }
Glaxys_finest1 0:25d32fc1c12e 317 }
Glaxys_finest1 0:25d32fc1c12e 318
Glaxys_finest1 0:25d32fc1c12e 319 // Update for DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 320 rtDW.Integrator_PrevResetState_n = 0;
Glaxys_finest1 0:25d32fc1c12e 321
Glaxys_finest1 0:25d32fc1c12e 322 // End of Outputs for SubSystem: '<S1>/quadcopter_dynamics_prediction'
Glaxys_finest1 0:25d32fc1c12e 323
Glaxys_finest1 0:25d32fc1c12e 324 // Outputs for Atomic SubSystem: '<S1>/largepaa'
Glaxys_finest1 0:25d32fc1c12e 325 // Outputs for Enabled SubSystem: '<S2>/large_controller' incorporates:
Glaxys_finest1 0:25d32fc1c12e 326 // EnablePort: '<S5>/Enable'
Glaxys_finest1 0:25d32fc1c12e 327
Glaxys_finest1 0:25d32fc1c12e 328 // MATLAB Function: '<S5>/MATLAB Function3' incorporates:
Glaxys_finest1 0:25d32fc1c12e 329 // Constant: '<S2>/mass 1'
Glaxys_finest1 0:25d32fc1c12e 330 // Delay: '<S2>/Delay'
Glaxys_finest1 0:25d32fc1c12e 331 // Inport: '<Root>/angles'
Glaxys_finest1 0:25d32fc1c12e 332 // Inport: '<Root>/r'
Glaxys_finest1 0:25d32fc1c12e 333 // Inport: '<Root>/rdot'
Glaxys_finest1 0:25d32fc1c12e 334 // Inport: '<Root>/wb'
Glaxys_finest1 0:25d32fc1c12e 335 // Inport: '<Root>/x'
Glaxys_finest1 0:25d32fc1c12e 336 // Inport: '<Root>/y'
Glaxys_finest1 0:25d32fc1c12e 337 // Inport: '<Root>/z'
Glaxys_finest1 0:25d32fc1c12e 338
Glaxys_finest1 0:25d32fc1c12e 339 rtDW.a_dotdot[0] = rtU.r[0] - rtU.x;
Glaxys_finest1 0:25d32fc1c12e 340 rtDW.a_dotdot[1] = rtU.r[1] - rtU.y;
Glaxys_finest1 0:25d32fc1c12e 341 rtDW.a_dotdot[2] = rtU.r[2] - rtU.z;
Glaxys_finest1 0:25d32fc1c12e 342 Fdes_idx_0 = -rtDW.Delay_DSTATE_hf[0] * rtDW.a_dotdot[0] -
Glaxys_finest1 0:25d32fc1c12e 343 rtDW.Delay_DSTATE_hf[3] * rtU.rdot[0];
Glaxys_finest1 0:25d32fc1c12e 344 rtDW.Iw_dot[0] = rtU.rdot[0];
Glaxys_finest1 0:25d32fc1c12e 345 rtDW.w_dot[0] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 346 Fdes_idx_1 = -rtDW.Delay_DSTATE_hf[1] * rtDW.a_dotdot[1] -
Glaxys_finest1 0:25d32fc1c12e 347 rtDW.Delay_DSTATE_hf[4] * rtU.rdot[1];
Glaxys_finest1 0:25d32fc1c12e 348 rtDW.Iw_dot[1] = rtU.rdot[1];
Glaxys_finest1 0:25d32fc1c12e 349 rtDW.w_dot[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 350 Fdes_idx_2 = ((-rtDW.Delay_DSTATE_hf[2] * rtDW.a_dotdot[2] -
Glaxys_finest1 0:25d32fc1c12e 351 rtDW.Delay_DSTATE_hf[5] * rtU.rdot[2]) - 7.3575) + 7.3575;
Glaxys_finest1 0:25d32fc1c12e 352 rtDW.Iw_dot[2] = rtU.rdot[2];
Glaxys_finest1 0:25d32fc1c12e 353 rtDW.w_dot[2] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 354 rtDW.maxval = std::sqrt((Fdes_idx_0 * Fdes_idx_0 + Fdes_idx_1 * Fdes_idx_1) +
Glaxys_finest1 0:25d32fc1c12e 355 Fdes_idx_2 * Fdes_idx_2);
Glaxys_finest1 0:25d32fc1c12e 356 if (rtDW.maxval == 0.0) {
Glaxys_finest1 0:25d32fc1c12e 357 rtDW.maxval = 1.0;
Glaxys_finest1 0:25d32fc1c12e 358 }
Glaxys_finest1 0:25d32fc1c12e 359
Glaxys_finest1 0:25d32fc1c12e 360 rtDW.maxval = 1.0 / rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 361 rtDW.Zbdes[0] = rtDW.maxval * Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 362 rtDW.Zbdes[1] = rtDW.maxval * Fdes_idx_1;
Glaxys_finest1 0:25d32fc1c12e 363 rtDW.Zbdes[2] = rtDW.maxval * Fdes_idx_2;
Glaxys_finest1 0:25d32fc1c12e 364 rtDW.crossZX[0] = rtDW.Zbdes[1] * 0.0 - rtDW.Zbdes[2] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 365 rtDW.crossZX[1] = rtDW.Zbdes[2] - rtDW.Zbdes[0] * 0.0;
Glaxys_finest1 0:25d32fc1c12e 366 rtDW.crossZX[2] = rtDW.Zbdes[0] * 0.0 - rtDW.Zbdes[1];
Glaxys_finest1 0:25d32fc1c12e 367 rtDW.maxval = std::sqrt((rtDW.crossZX[0] * rtDW.crossZX[0] + rtDW.crossZX[1] *
Glaxys_finest1 0:25d32fc1c12e 368 rtDW.crossZX[1]) + rtDW.crossZX[2] * rtDW.crossZX[2]);
Glaxys_finest1 0:25d32fc1c12e 369 if (rtDW.maxval == 0.0) {
Glaxys_finest1 0:25d32fc1c12e 370 rtDW.maxval = 1.0;
Glaxys_finest1 0:25d32fc1c12e 371 }
Glaxys_finest1 0:25d32fc1c12e 372
Glaxys_finest1 0:25d32fc1c12e 373 rtDW.maxval = 1.0 / rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 374 rtDW.Add1_k = rtDW.maxval * rtDW.crossZX[0];
Glaxys_finest1 0:25d32fc1c12e 375 rtDW.b_I[3] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 376 rtDW.b_I[6] = rtDW.Zbdes[0];
Glaxys_finest1 0:25d32fc1c12e 377 rtDW.crossZX[0] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 378 rtDW.Add1_k = rtDW.maxval * rtDW.crossZX[1];
Glaxys_finest1 0:25d32fc1c12e 379 rtDW.b_I[4] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 380 rtDW.b_I[7] = rtDW.Zbdes[1];
Glaxys_finest1 0:25d32fc1c12e 381 rtDW.crossZX[1] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 382 rtDW.Add1_k = rtDW.maxval * rtDW.crossZX[2];
Glaxys_finest1 0:25d32fc1c12e 383 rtDW.b_I[5] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 384 rtDW.b_I[8] = rtDW.Zbdes[2];
Glaxys_finest1 0:25d32fc1c12e 385 rtDW.b_I[0] = rtDW.crossZX[1] * rtDW.Zbdes[2] - rtDW.Add1_k * rtDW.Zbdes[1];
Glaxys_finest1 0:25d32fc1c12e 386 rtDW.b_I[1] = rtDW.Add1_k * rtDW.Zbdes[0] - rtDW.crossZX[0] * rtDW.Zbdes[2];
Glaxys_finest1 0:25d32fc1c12e 387 rtDW.b_I[2] = rtDW.crossZX[0] * rtDW.Zbdes[1] - rtDW.crossZX[1] * rtDW.Zbdes[0];
Glaxys_finest1 0:25d32fc1c12e 388 rtDW.maxval = std::cos(rtU.angles[2]);
Glaxys_finest1 0:25d32fc1c12e 389 rtDW.b_I_k[0] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 390 rtDW.Add1_k = std::sin(rtU.angles[2]);
Glaxys_finest1 0:25d32fc1c12e 391 rtDW.b_I_k[3] = -rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 392 rtDW.b_I_k[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 393 rtDW.b_I_k[1] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 394 rtDW.b_I_k[4] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 395 rtDW.b_I_k[7] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 396 rtDW.b_I_k[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 397 rtDW.d[0] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 398 rtDW.b_I_k[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 399 rtDW.d[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 400 rtDW.b_I_k[8] = 1.0;
Glaxys_finest1 0:25d32fc1c12e 401 rtDW.d[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 402 rtDW.d[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 403 rtDW.maxval = std::cos(rtU.angles[0]);
Glaxys_finest1 0:25d32fc1c12e 404 rtDW.d[4] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 405 rtDW.Add1_k = std::sin(rtU.angles[0]);
Glaxys_finest1 0:25d32fc1c12e 406 rtDW.d[7] = -rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 407 rtDW.d[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 408 rtDW.d[5] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 409 rtDW.d[8] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 410 rtDW.maxval = std::cos(rtU.angles[1]);
Glaxys_finest1 0:25d32fc1c12e 411 rtDW.dv0[0] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 412 rtDW.dv0[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 413 rtDW.Add1_k = std::sin(rtU.angles[1]);
Glaxys_finest1 0:25d32fc1c12e 414 rtDW.dv0[6] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 415 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 416 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 417 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 418 rtDW.R_c[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 419 rtDW.R_c[R_tmp] += rtDW.d[3 * i] * rtDW.b_I_k[r1];
Glaxys_finest1 0:25d32fc1c12e 420 rtDW.R_c[R_tmp] += rtDW.d[3 * i + 1] * rtDW.b_I_k[r1 + 3];
Glaxys_finest1 0:25d32fc1c12e 421 rtDW.R_c[R_tmp] += rtDW.d[3 * i + 2] * rtDW.b_I_k[r1 + 6];
Glaxys_finest1 0:25d32fc1c12e 422 }
Glaxys_finest1 0:25d32fc1c12e 423
Glaxys_finest1 0:25d32fc1c12e 424 rtDW.dv0[1 + 3 * r1] = c[r1];
Glaxys_finest1 0:25d32fc1c12e 425 }
Glaxys_finest1 0:25d32fc1c12e 426
Glaxys_finest1 0:25d32fc1c12e 427 rtDW.dv0[2] = -rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 428 rtDW.dv0[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 429 rtDW.dv0[8] = rtDW.maxval;
Glaxys_finest1 0:25d32fc1c12e 430 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 431 rtDW.Zbdes[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 432 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 433 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 434 rtDW.R[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 435 rtDW.R[R_tmp] += rtDW.dv0[3 * i] * rtDW.R_c[r1];
Glaxys_finest1 0:25d32fc1c12e 436 rtDW.R[R_tmp] += rtDW.dv0[3 * i + 1] * rtDW.R_c[r1 + 3];
Glaxys_finest1 0:25d32fc1c12e 437 rtDW.R[R_tmp] += rtDW.dv0[3 * i + 2] * rtDW.R_c[r1 + 6];
Glaxys_finest1 0:25d32fc1c12e 438 rtDW.Zbdes[r1] += rtDW.R[R_tmp] * rtDW.w_dot[i];
Glaxys_finest1 0:25d32fc1c12e 439 }
Glaxys_finest1 0:25d32fc1c12e 440 }
Glaxys_finest1 0:25d32fc1c12e 441
Glaxys_finest1 0:25d32fc1c12e 442 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 443 for (i = 0; i < 3; i++) {
Glaxys_finest1 0:25d32fc1c12e 444 R_tmp = r1 + 3 * i;
Glaxys_finest1 0:25d32fc1c12e 445 rtDW.b_I_k[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 446 rtDW.R_c[R_tmp] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 447 rtDW.b_I_k[R_tmp] += rtDW.b_I[3 * r1] * rtDW.R[3 * i];
Glaxys_finest1 0:25d32fc1c12e 448 rtDW.R_c[R_tmp] += rtDW.R[3 * r1] * rtDW.b_I[3 * i];
Glaxys_finest1 0:25d32fc1c12e 449 b_I_tmp = 3 * r1 + 1;
Glaxys_finest1 0:25d32fc1c12e 450 b_I_tmp_0 = 3 * i + 1;
Glaxys_finest1 0:25d32fc1c12e 451 rtDW.b_I_k[R_tmp] += rtDW.b_I[b_I_tmp] * rtDW.R[b_I_tmp_0];
Glaxys_finest1 0:25d32fc1c12e 452 rtDW.R_c[R_tmp] += rtDW.R[b_I_tmp] * rtDW.b_I[b_I_tmp_0];
Glaxys_finest1 0:25d32fc1c12e 453 b_I_tmp = 3 * r1 + 2;
Glaxys_finest1 0:25d32fc1c12e 454 b_I_tmp_0 = 3 * i + 2;
Glaxys_finest1 0:25d32fc1c12e 455 rtDW.b_I_k[R_tmp] += rtDW.b_I[b_I_tmp] * rtDW.R[b_I_tmp_0];
Glaxys_finest1 0:25d32fc1c12e 456 rtDW.R_c[R_tmp] += rtDW.R[b_I_tmp] * rtDW.b_I[b_I_tmp_0];
Glaxys_finest1 0:25d32fc1c12e 457 }
Glaxys_finest1 0:25d32fc1c12e 458 }
Glaxys_finest1 0:25d32fc1c12e 459
Glaxys_finest1 0:25d32fc1c12e 460 for (r1 = 0; r1 < 9; r1++) {
Glaxys_finest1 0:25d32fc1c12e 461 rtDW.b_I[r1] = (rtDW.b_I_k[r1] - rtDW.R_c[r1]) * 0.5;
Glaxys_finest1 0:25d32fc1c12e 462 }
Glaxys_finest1 0:25d32fc1c12e 463
Glaxys_finest1 0:25d32fc1c12e 464 rtDW.Xc[0] = rtDW.b_I[5];
Glaxys_finest1 0:25d32fc1c12e 465 rtDW.Xc[1] = rtDW.b_I[6];
Glaxys_finest1 0:25d32fc1c12e 466 rtDW.Xc[2] = rtDW.b_I[1];
Glaxys_finest1 0:25d32fc1c12e 467 rtDW.b_I_k[0] = -rtDW.Delay_DSTATE_hf[6];
Glaxys_finest1 0:25d32fc1c12e 468 rtDW.b_I_k[3] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 469 rtDW.b_I_k[6] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 470 rtDW.b_I_k[1] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 471 rtDW.b_I_k[4] = -rtDW.Delay_DSTATE_hf[7];
Glaxys_finest1 0:25d32fc1c12e 472 rtDW.b_I_k[7] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 473 rtDW.b_I_k[2] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 474 rtDW.b_I_k[5] = -0.0;
Glaxys_finest1 0:25d32fc1c12e 475 rtDW.b_I_k[8] = -rtDW.Delay_DSTATE_hf[8];
Glaxys_finest1 0:25d32fc1c12e 476 rtDW.R_c[0] = rtDW.Delay_DSTATE_hf[9];
Glaxys_finest1 0:25d32fc1c12e 477 rtDW.R_c[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 478 rtDW.R_c[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 479 rtDW.R_c[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 480 rtDW.R_c[4] = rtDW.Delay_DSTATE_hf[10];
Glaxys_finest1 0:25d32fc1c12e 481 rtDW.R_c[7] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 482 rtDW.R_c[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 483 rtDW.R_c[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 484 rtDW.R_c[8] = rtDW.Delay_DSTATE_hf[11];
Glaxys_finest1 0:25d32fc1c12e 485 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 486 rtDW.psy[r1] = rtDW.a_dotdot[r1];
Glaxys_finest1 0:25d32fc1c12e 487 rtDW.psy[r1 + 3] = rtDW.Iw_dot[r1];
Glaxys_finest1 0:25d32fc1c12e 488 rtDW.psy[r1 + 6] = rtDW.Xc[r1];
Glaxys_finest1 0:25d32fc1c12e 489 rtDW.psy[r1 + 9] = rtU.wb[r1];
Glaxys_finest1 0:25d32fc1c12e 490 rtDW.crossZX[r1] = rtU.wb[r1];
Glaxys_finest1 0:25d32fc1c12e 491 rtDW.w_dot[r1] = rtDW.b_I_k[r1 + 6] * rtDW.Xc[2] + (rtDW.b_I_k[r1 + 3] *
Glaxys_finest1 0:25d32fc1c12e 492 rtDW.Xc[1] + rtDW.b_I_k[r1] * rtDW.Xc[0]);
Glaxys_finest1 0:25d32fc1c12e 493 }
Glaxys_finest1 0:25d32fc1c12e 494
Glaxys_finest1 0:25d32fc1c12e 495 rtDW.A[0] = ((Fdes_idx_0 * rtDW.Zbdes[0] + Fdes_idx_1 * rtDW.Zbdes[1]) +
Glaxys_finest1 0:25d32fc1c12e 496 Fdes_idx_2 * rtDW.Zbdes[2]) + 7.3575;
Glaxys_finest1 0:25d32fc1c12e 497 for (r1 = 0; r1 < 3; r1++) {
Glaxys_finest1 0:25d32fc1c12e 498 rtDW.A[r1 + 1] = rtDW.w_dot[r1] - (rtDW.R_c[r1 + 6] * rtDW.crossZX[2] +
Glaxys_finest1 0:25d32fc1c12e 499 (rtDW.R_c[r1 + 3] * rtDW.crossZX[1] + rtDW.R_c[r1] * rtDW.crossZX[0]));
Glaxys_finest1 0:25d32fc1c12e 500 }
Glaxys_finest1 0:25d32fc1c12e 501
Glaxys_finest1 0:25d32fc1c12e 502 // End of MATLAB Function: '<S5>/MATLAB Function3'
Glaxys_finest1 0:25d32fc1c12e 503
Glaxys_finest1 0:25d32fc1c12e 504 // Saturate: '<S5>/Saturation'
Glaxys_finest1 0:25d32fc1c12e 505 if (rtDW.A[0] > 27.0) {
Glaxys_finest1 0:25d32fc1c12e 506 rtDW.maxval = 27.0;
Glaxys_finest1 0:25d32fc1c12e 507 } else if (rtDW.A[0] < 0.0) {
Glaxys_finest1 0:25d32fc1c12e 508 rtDW.maxval = 0.0;
Glaxys_finest1 0:25d32fc1c12e 509 } else {
Glaxys_finest1 0:25d32fc1c12e 510 rtDW.maxval = rtDW.A[0];
Glaxys_finest1 0:25d32fc1c12e 511 }
Glaxys_finest1 0:25d32fc1c12e 512
Glaxys_finest1 0:25d32fc1c12e 513 if (rtDW.A[1] > 1.6) {
Glaxys_finest1 0:25d32fc1c12e 514 Fdes_idx_0 = 1.6;
Glaxys_finest1 0:25d32fc1c12e 515 } else if (rtDW.A[1] < -1.6) {
Glaxys_finest1 0:25d32fc1c12e 516 Fdes_idx_0 = -1.6;
Glaxys_finest1 0:25d32fc1c12e 517 } else {
Glaxys_finest1 0:25d32fc1c12e 518 Fdes_idx_0 = rtDW.A[1];
Glaxys_finest1 0:25d32fc1c12e 519 }
Glaxys_finest1 0:25d32fc1c12e 520
Glaxys_finest1 0:25d32fc1c12e 521 if (rtDW.A[2] > 1.6) {
Glaxys_finest1 0:25d32fc1c12e 522 Fdes_idx_1 = 1.6;
Glaxys_finest1 0:25d32fc1c12e 523 } else if (rtDW.A[2] < -1.6) {
Glaxys_finest1 0:25d32fc1c12e 524 Fdes_idx_1 = -1.6;
Glaxys_finest1 0:25d32fc1c12e 525 } else {
Glaxys_finest1 0:25d32fc1c12e 526 Fdes_idx_1 = rtDW.A[2];
Glaxys_finest1 0:25d32fc1c12e 527 }
Glaxys_finest1 0:25d32fc1c12e 528
Glaxys_finest1 0:25d32fc1c12e 529 if (rtDW.A[3] > 0.6) {
Glaxys_finest1 0:25d32fc1c12e 530 Fdes_idx_2 = 0.6;
Glaxys_finest1 0:25d32fc1c12e 531 } else if (rtDW.A[3] < -0.6) {
Glaxys_finest1 0:25d32fc1c12e 532 Fdes_idx_2 = -0.6;
Glaxys_finest1 0:25d32fc1c12e 533 } else {
Glaxys_finest1 0:25d32fc1c12e 534 Fdes_idx_2 = rtDW.A[3];
Glaxys_finest1 0:25d32fc1c12e 535 }
Glaxys_finest1 0:25d32fc1c12e 536
Glaxys_finest1 0:25d32fc1c12e 537 // End of Saturate: '<S5>/Saturation'
Glaxys_finest1 0:25d32fc1c12e 538
Glaxys_finest1 0:25d32fc1c12e 539 // MATLAB Function: '<S5>/MATLAB Function1'
Glaxys_finest1 0:25d32fc1c12e 540 for (r1 = 0; r1 < 4; r1++) {
Glaxys_finest1 0:25d32fc1c12e 541 rtDW.Add1_k = a[r1 + 12] * Fdes_idx_2 + (a[r1 + 8] * Fdes_idx_1 + (a[r1 + 4]
Glaxys_finest1 0:25d32fc1c12e 542 * Fdes_idx_0 + a[r1] * rtDW.maxval));
Glaxys_finest1 0:25d32fc1c12e 543 rtDW.A[r1] = rtDW.Add1_k;
Glaxys_finest1 0:25d32fc1c12e 544 }
Glaxys_finest1 0:25d32fc1c12e 545
Glaxys_finest1 0:25d32fc1c12e 546 if (rtDW.A[0] < 0.0) {
Glaxys_finest1 0:25d32fc1c12e 547 rtDW.A[0] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 548 }
Glaxys_finest1 0:25d32fc1c12e 549
Glaxys_finest1 0:25d32fc1c12e 550 if (rtDW.A[1] < 0.0) {
Glaxys_finest1 0:25d32fc1c12e 551 rtDW.A[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 552 }
Glaxys_finest1 0:25d32fc1c12e 553
Glaxys_finest1 0:25d32fc1c12e 554 if (rtDW.A[2] < 0.0) {
Glaxys_finest1 0:25d32fc1c12e 555 rtDW.A[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 556 }
Glaxys_finest1 0:25d32fc1c12e 557
Glaxys_finest1 0:25d32fc1c12e 558 if (rtDW.A[3] < 0.0) {
Glaxys_finest1 0:25d32fc1c12e 559 rtDW.A[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 560 }
Glaxys_finest1 0:25d32fc1c12e 561
Glaxys_finest1 0:25d32fc1c12e 562 rtDW.duty[0] = (3485.3574033876184 * std::sqrt(rtDW.A[0]) * 0.1865 + 768.0) /
Glaxys_finest1 0:25d32fc1c12e 563 20000.0;
Glaxys_finest1 0:25d32fc1c12e 564 rtDW.duty[1] = (3485.3574033876184 * std::sqrt(rtDW.A[1]) * 0.1865 + 768.0) /
Glaxys_finest1 0:25d32fc1c12e 565 20000.0;
Glaxys_finest1 0:25d32fc1c12e 566 rtDW.duty[2] = (3485.3574033876184 * std::sqrt(rtDW.A[2]) * 0.1865 + 768.0) /
Glaxys_finest1 0:25d32fc1c12e 567 20000.0;
Glaxys_finest1 0:25d32fc1c12e 568 rtDW.duty[3] = (3485.3574033876184 * std::sqrt(rtDW.A[3]) * 0.1865 + 768.0) /
Glaxys_finest1 0:25d32fc1c12e 569 20000.0;
Glaxys_finest1 0:25d32fc1c12e 570
Glaxys_finest1 0:25d32fc1c12e 571 // End of MATLAB Function: '<S5>/MATLAB Function1'
Glaxys_finest1 0:25d32fc1c12e 572 // End of Outputs for SubSystem: '<S2>/large_controller'
Glaxys_finest1 0:25d32fc1c12e 573
Glaxys_finest1 0:25d32fc1c12e 574 // MATLAB Function: '<S6>/MATLAB Function3'
Glaxys_finest1 0:25d32fc1c12e 575 rtDW.F[0] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 576 rtDW.F[12] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 577 rtDW.F[24] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 578 rtDW.F[36] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 579 rtDW.F[48] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 580 rtDW.F[60] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 581 rtDW.F[72] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 582 rtDW.F[84] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 583 rtDW.F[96] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 584 rtDW.F[108] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 585 rtDW.F[120] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 586 rtDW.F[132] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 587 rtDW.F[1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 588 rtDW.F[13] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 589 rtDW.F[25] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 590 rtDW.F[37] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 591 rtDW.F[49] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 592 rtDW.F[61] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 593 rtDW.F[73] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 594 rtDW.F[85] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 595 rtDW.F[97] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 596 rtDW.F[109] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 597 rtDW.F[121] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 598 rtDW.F[133] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 599 rtDW.F[2] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 600 rtDW.F[14] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 601 rtDW.F[26] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 602 rtDW.F[38] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 603 rtDW.F[50] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 604 rtDW.F[62] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 605 rtDW.F[74] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 606 rtDW.F[86] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 607 rtDW.F[98] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 608 rtDW.F[110] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 609 rtDW.F[122] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 610 rtDW.F[134] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 611 rtDW.F[3] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 612 rtDW.F[15] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 613 rtDW.F[27] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 614 rtDW.F[39] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 615 rtDW.F[51] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 616 rtDW.F[63] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 617 rtDW.F[75] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 618 rtDW.F[87] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 619 rtDW.F[99] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 620 rtDW.F[111] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 621 rtDW.F[123] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 622 rtDW.F[135] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 623 rtDW.F[4] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 624 rtDW.F[16] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 625 rtDW.F[28] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 626 rtDW.F[40] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 627 rtDW.F[52] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 628 rtDW.F[64] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 629 rtDW.F[76] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 630 rtDW.F[88] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 631 rtDW.F[100] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 632 rtDW.F[112] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 633 rtDW.F[124] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 634 rtDW.F[136] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 635 rtDW.F[5] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 636 rtDW.F[17] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 637 rtDW.F[29] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 638 rtDW.F[41] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 639 rtDW.F[53] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 640 rtDW.F[65] = 0.001;
Glaxys_finest1 0:25d32fc1c12e 641 rtDW.F[77] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 642 rtDW.F[89] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 643 rtDW.F[101] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 644 rtDW.F[113] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 645 rtDW.F[125] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 646 rtDW.F[137] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 647 rtDW.F[6] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 648 rtDW.F[18] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 649 rtDW.F[30] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 650 rtDW.F[42] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 651 rtDW.F[54] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 652 rtDW.F[66] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 653 rtDW.F[78] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 654 rtDW.F[90] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 655 rtDW.F[102] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 656 rtDW.F[114] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 657 rtDW.F[126] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 658 rtDW.F[138] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 659 rtDW.F[7] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 660 rtDW.F[19] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 661 rtDW.F[31] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 662 rtDW.F[43] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 663 rtDW.F[55] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 664 rtDW.F[67] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 665 rtDW.F[79] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 666 rtDW.F[91] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 667 rtDW.F[103] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 668 rtDW.F[115] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 669 rtDW.F[127] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 670 rtDW.F[139] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 671 rtDW.F[8] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 672 rtDW.F[20] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 673 rtDW.F[32] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 674 rtDW.F[44] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 675 rtDW.F[56] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 676 rtDW.F[68] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 677 rtDW.F[80] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 678 rtDW.F[92] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 679 rtDW.F[104] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 680 rtDW.F[116] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 681 rtDW.F[128] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 682 rtDW.F[140] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 683 rtDW.F[9] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 684 rtDW.F[21] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 685 rtDW.F[33] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 686 rtDW.F[45] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 687 rtDW.F[57] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 688 rtDW.F[69] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 689 rtDW.F[81] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 690 rtDW.F[93] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 691 rtDW.F[105] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 692 rtDW.F[117] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 693 rtDW.F[129] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 694 rtDW.F[141] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 695 rtDW.F[10] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 696 rtDW.F[22] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 697 rtDW.F[34] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 698 rtDW.F[46] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 699 rtDW.F[58] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 700 rtDW.F[70] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 701 rtDW.F[82] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 702 rtDW.F[94] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 703 rtDW.F[106] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 704 rtDW.F[118] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 705 rtDW.F[130] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 706 rtDW.F[142] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 707 rtDW.F[11] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 708 rtDW.F[23] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 709 rtDW.F[35] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 710 rtDW.F[47] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 711 rtDW.F[59] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 712 rtDW.F[71] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 713 rtDW.F[83] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 714 rtDW.F[95] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 715 rtDW.F[107] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 716 rtDW.F[119] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 717 rtDW.F[131] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 718 rtDW.F[143] = 0.0001;
Glaxys_finest1 0:25d32fc1c12e 719 rtDW.maxval = 0.0;
Glaxys_finest1 0:25d32fc1c12e 720 for (r1 = 0; r1 < 12; r1++) {
Glaxys_finest1 0:25d32fc1c12e 721 rtDW.rtb_Delay1_m[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 722 for (i = 0; i < 12; i++) {
Glaxys_finest1 0:25d32fc1c12e 723 rtDW.rtb_Delay1_m[r1] += rtDW.F[12 * r1 + i] * rtDW.Delay1[i];
Glaxys_finest1 0:25d32fc1c12e 724 }
Glaxys_finest1 0:25d32fc1c12e 725
Glaxys_finest1 0:25d32fc1c12e 726 rtDW.maxval += rtDW.rtb_Delay1_m[r1] * rtDW.Delay1[r1];
Glaxys_finest1 0:25d32fc1c12e 727 }
Glaxys_finest1 0:25d32fc1c12e 728
Glaxys_finest1 0:25d32fc1c12e 729 // SignalConversion: '<S9>/TmpSignal ConversionAt SFunction Inport2' incorporates:
Glaxys_finest1 0:25d32fc1c12e 730 // Inport: '<Root>/angles'
Glaxys_finest1 0:25d32fc1c12e 731 // Inport: '<Root>/r'
Glaxys_finest1 0:25d32fc1c12e 732 // Inport: '<Root>/rdot'
Glaxys_finest1 0:25d32fc1c12e 733 // Inport: '<Root>/wb'
Glaxys_finest1 0:25d32fc1c12e 734 // MATLAB Function: '<S6>/MATLAB Function3'
Glaxys_finest1 0:25d32fc1c12e 735 // Sum: '<S6>/Add1'
Glaxys_finest1 0:25d32fc1c12e 736 // Sum: '<S6>/Add2'
Glaxys_finest1 0:25d32fc1c12e 737 // Sum: '<S6>/Add3'
Glaxys_finest1 0:25d32fc1c12e 738 // Sum: '<S6>/Add4'
Glaxys_finest1 0:25d32fc1c12e 739
Glaxys_finest1 0:25d32fc1c12e 740 rtDW.rtb_Delay1_m[0] = rtU.r[0] - rtDW.Integrator_p[0];
Glaxys_finest1 0:25d32fc1c12e 741 rtDW.rtb_Delay1_m[3] = rtU.rdot[0] - rtDW.Integrator[0];
Glaxys_finest1 0:25d32fc1c12e 742 rtDW.rtb_Delay1_m[6] = rtU.angles[0] - rtDW.Integrator_p[3];
Glaxys_finest1 0:25d32fc1c12e 743 rtDW.rtb_Delay1_m[9] = rtU.wb[0] - rtDW.wb[0];
Glaxys_finest1 0:25d32fc1c12e 744 rtDW.rtb_Delay1_m[1] = rtU.r[1] - rtDW.Integrator_p[1];
Glaxys_finest1 0:25d32fc1c12e 745 rtDW.rtb_Delay1_m[4] = rtU.rdot[1] - rtDW.Integrator[1];
Glaxys_finest1 0:25d32fc1c12e 746 rtDW.rtb_Delay1_m[7] = rtU.angles[1] - rtDW.Integrator_p[4];
Glaxys_finest1 0:25d32fc1c12e 747 rtDW.rtb_Delay1_m[10] = rtU.wb[1] - rtDW.wb[1];
Glaxys_finest1 0:25d32fc1c12e 748 rtDW.rtb_Delay1_m[2] = rtU.r[2] - rtDW.Integrator_p[2];
Glaxys_finest1 0:25d32fc1c12e 749 rtDW.rtb_Delay1_m[5] = rtU.rdot[2] - rtDW.Integrator[2];
Glaxys_finest1 0:25d32fc1c12e 750 rtDW.rtb_Delay1_m[8] = rtU.angles[2] - rtDW.Integrator_p[5];
Glaxys_finest1 0:25d32fc1c12e 751 rtDW.rtb_Delay1_m[11] = rtU.wb[2] - rtDW.wb[2];
Glaxys_finest1 0:25d32fc1c12e 752 for (r1 = 0; r1 < 12; r1++) {
Glaxys_finest1 0:25d32fc1c12e 753 // MATLAB Function: '<S6>/MATLAB Function3'
Glaxys_finest1 0:25d32fc1c12e 754 rtDW.F_c[r1] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 755 for (i = 0; i < 12; i++) {
Glaxys_finest1 0:25d32fc1c12e 756 rtDW.F_c[r1] += rtDW.F[12 * i + r1] * rtDW.Delay1[i];
Glaxys_finest1 0:25d32fc1c12e 757 }
Glaxys_finest1 0:25d32fc1c12e 758
Glaxys_finest1 0:25d32fc1c12e 759 // Update for Delay: '<S2>/Delay' incorporates:
Glaxys_finest1 0:25d32fc1c12e 760 // MATLAB Function: '<S6>/MATLAB Function3'
Glaxys_finest1 0:25d32fc1c12e 761 // SignalConversion: '<S9>/TmpSignal ConversionAt SFunction Inport2'
Glaxys_finest1 0:25d32fc1c12e 762
Glaxys_finest1 0:25d32fc1c12e 763 rtDW.Delay_DSTATE_hf[r1] = rtDW.F_c[r1] * rtDW.rtb_Delay1_m[r1] / (1.0 +
Glaxys_finest1 0:25d32fc1c12e 764 rtDW.maxval) + b_0[r1];
Glaxys_finest1 0:25d32fc1c12e 765 }
Glaxys_finest1 0:25d32fc1c12e 766
Glaxys_finest1 0:25d32fc1c12e 767 // End of Outputs for SubSystem: '<S1>/largepaa'
Glaxys_finest1 0:25d32fc1c12e 768
Glaxys_finest1 0:25d32fc1c12e 769 // Outputs for Atomic SubSystem: '<S1>/small_angle_control'
Glaxys_finest1 0:25d32fc1c12e 770 // Sum: '<S22>/Add1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 771 // Inport: '<Root>/x'
Glaxys_finest1 0:25d32fc1c12e 772
Glaxys_finest1 0:25d32fc1c12e 773 rtDW.maxval = rtU.x - rtDW.Integrator_p[0];
Glaxys_finest1 0:25d32fc1c12e 774
Glaxys_finest1 0:25d32fc1c12e 775 // Gain: '<S144>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 776 // DiscreteIntegrator: '<S136>/Filter'
Glaxys_finest1 0:25d32fc1c12e 777 // Gain: '<S135>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 778 // Sum: '<S136>/SumD'
Glaxys_finest1 0:25d32fc1c12e 779
Glaxys_finest1 0:25d32fc1c12e 780 Fdes_idx_0 = (1.68326013623818 * rtDW.maxval - rtDW.Filter_DSTATE) *
Glaxys_finest1 0:25d32fc1c12e 781 206.264558996617;
Glaxys_finest1 0:25d32fc1c12e 782
Glaxys_finest1 0:25d32fc1c12e 783 // Sum: '<S22>/Add2' incorporates:
Glaxys_finest1 0:25d32fc1c12e 784 // Inport: '<Root>/y'
Glaxys_finest1 0:25d32fc1c12e 785
Glaxys_finest1 0:25d32fc1c12e 786 Fdes_idx_1 = rtU.y - rtDW.Integrator_p[1];
Glaxys_finest1 0:25d32fc1c12e 787
Glaxys_finest1 0:25d32fc1c12e 788 // Gain: '<S276>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 789 // DiscreteIntegrator: '<S268>/Filter'
Glaxys_finest1 0:25d32fc1c12e 790 // Gain: '<S267>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 791 // Sum: '<S268>/SumD'
Glaxys_finest1 0:25d32fc1c12e 792
Glaxys_finest1 0:25d32fc1c12e 793 Fdes_idx_2 = (1.68326013623818 * Fdes_idx_1 - rtDW.Filter_DSTATE_k) *
Glaxys_finest1 0:25d32fc1c12e 794 206.264558996617;
Glaxys_finest1 0:25d32fc1c12e 795
Glaxys_finest1 0:25d32fc1c12e 796 // SignalConversion: '<S21>/TmpSignal ConversionAt SFunction Inport1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 797 // DiscreteIntegrator: '<S141>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 798 // DiscreteIntegrator: '<S273>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 799 // Gain: '<S146>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 800 // Gain: '<S278>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 801 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 802 // Sum: '<S150>/Sum'
Glaxys_finest1 0:25d32fc1c12e 803 // Sum: '<S282>/Sum'
Glaxys_finest1 0:25d32fc1c12e 804
Glaxys_finest1 0:25d32fc1c12e 805 rtb_TmpSignalConversionAtSFun_1 = (0.576051138105677 * rtDW.maxval +
Glaxys_finest1 0:25d32fc1c12e 806 rtDW.Integrator_DSTATE) + Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 807 rtb_TmpSignalConversionAtSFun_0 = (0.576051138105677 * Fdes_idx_1 +
Glaxys_finest1 0:25d32fc1c12e 808 rtDW.Integrator_DSTATE_a) + Fdes_idx_2;
Glaxys_finest1 0:25d32fc1c12e 809
Glaxys_finest1 0:25d32fc1c12e 810 // Sum: '<S23>/Add1' incorporates:
Glaxys_finest1 0:25d32fc1c12e 811 // Constant: '<S4>/Constant'
Glaxys_finest1 0:25d32fc1c12e 812 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 813
Glaxys_finest1 0:25d32fc1c12e 814 rtDW.Add1_k = (rtb_TmpSignalConversionAtSFun_1 * 0.0 -
Glaxys_finest1 0:25d32fc1c12e 815 rtb_TmpSignalConversionAtSFun_0) * 0.1019367991845056 -
Glaxys_finest1 0:25d32fc1c12e 816 rtDW.Integrator_p[3];
Glaxys_finest1 0:25d32fc1c12e 817
Glaxys_finest1 0:25d32fc1c12e 818 // Gain: '<S188>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 819 // DiscreteIntegrator: '<S180>/Filter'
Glaxys_finest1 0:25d32fc1c12e 820 // Gain: '<S179>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 821 // Sum: '<S180>/SumD'
Glaxys_finest1 0:25d32fc1c12e 822
Glaxys_finest1 0:25d32fc1c12e 823 rtDW.FilterCoefficient_a = (0.171115754916436 * rtDW.Add1_k -
Glaxys_finest1 0:25d32fc1c12e 824 rtDW.Filter_DSTATE_m) * 176.087006843524;
Glaxys_finest1 0:25d32fc1c12e 825
Glaxys_finest1 0:25d32fc1c12e 826 // Sum: '<S23>/Add2' incorporates:
Glaxys_finest1 0:25d32fc1c12e 827 // Constant: '<S4>/Constant'
Glaxys_finest1 0:25d32fc1c12e 828 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 829
Glaxys_finest1 0:25d32fc1c12e 830 rtb_TmpSignalConversionAtSFun_1 = (rtb_TmpSignalConversionAtSFun_0 * 0.0 +
Glaxys_finest1 0:25d32fc1c12e 831 rtb_TmpSignalConversionAtSFun_1) * 0.1019367991845056 - rtDW.Integrator_p[4];
Glaxys_finest1 0:25d32fc1c12e 832
Glaxys_finest1 0:25d32fc1c12e 833 // Gain: '<S56>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 834 // DiscreteIntegrator: '<S48>/Filter'
Glaxys_finest1 0:25d32fc1c12e 835 // Gain: '<S47>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 836 // Sum: '<S48>/SumD'
Glaxys_finest1 0:25d32fc1c12e 837
Glaxys_finest1 0:25d32fc1c12e 838 rtb_TmpSignalConversionAtSFun_0 = (0.171115754916436 *
Glaxys_finest1 0:25d32fc1c12e 839 rtb_TmpSignalConversionAtSFun_1 - rtDW.Filter_DSTATE_l) * 176.087006843524;
Glaxys_finest1 0:25d32fc1c12e 840
Glaxys_finest1 0:25d32fc1c12e 841 // Gain: '<S100>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 842 // Constant: '<S4>/Constant'
Glaxys_finest1 0:25d32fc1c12e 843 // DiscreteIntegrator: '<S92>/Filter'
Glaxys_finest1 0:25d32fc1c12e 844 // Gain: '<S91>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 845 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 846 // Sum: '<S23>/Add3'
Glaxys_finest1 0:25d32fc1c12e 847 // Sum: '<S92>/SumD'
Glaxys_finest1 0:25d32fc1c12e 848
Glaxys_finest1 0:25d32fc1c12e 849 rtDW.FilterCoefficient_k = ((0.0 - rtDW.Integrator_p[5]) * 0.0490884878345462
Glaxys_finest1 0:25d32fc1c12e 850 - rtDW.Filter_DSTATE_lo) * 270.43836739932;
Glaxys_finest1 0:25d32fc1c12e 851
Glaxys_finest1 0:25d32fc1c12e 852 // SignalConversion: '<S4>/ConcatBufferAtVector ConcatenateIn2' incorporates:
Glaxys_finest1 0:25d32fc1c12e 853 // Constant: '<S4>/Constant'
Glaxys_finest1 0:25d32fc1c12e 854 // Delay: '<S1>/Delay'
Glaxys_finest1 0:25d32fc1c12e 855 // DiscreteIntegrator: '<S185>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 856 // DiscreteIntegrator: '<S53>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 857 // DiscreteIntegrator: '<S97>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 858 // Gain: '<S102>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 859 // Gain: '<S190>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 860 // Gain: '<S58>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 861 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 862 // Sum: '<S106>/Sum'
Glaxys_finest1 0:25d32fc1c12e 863 // Sum: '<S194>/Sum'
Glaxys_finest1 0:25d32fc1c12e 864 // Sum: '<S23>/Add3'
Glaxys_finest1 0:25d32fc1c12e 865 // Sum: '<S62>/Sum'
Glaxys_finest1 0:25d32fc1c12e 866
Glaxys_finest1 0:25d32fc1c12e 867 rtDW.Delay_DSTATE[1] = (0.421511657975665 * rtDW.Add1_k +
Glaxys_finest1 0:25d32fc1c12e 868 rtDW.Integrator_DSTATE_m) + rtDW.FilterCoefficient_a;
Glaxys_finest1 0:25d32fc1c12e 869 rtDW.Delay_DSTATE[2] = (0.421511657975665 * rtb_TmpSignalConversionAtSFun_1 +
Glaxys_finest1 0:25d32fc1c12e 870 rtDW.Integrator_DSTATE_e) + rtb_TmpSignalConversionAtSFun_0;
Glaxys_finest1 0:25d32fc1c12e 871 rtDW.Delay_DSTATE[3] = ((0.0 - rtDW.Integrator_p[5]) * 0.00309186213155581 +
Glaxys_finest1 0:25d32fc1c12e 872 rtDW.Integrator_DSTATE_o) + rtDW.FilterCoefficient_k;
Glaxys_finest1 0:25d32fc1c12e 873
Glaxys_finest1 0:25d32fc1c12e 874 // Sum: '<S22>/Add3' incorporates:
Glaxys_finest1 0:25d32fc1c12e 875 // Inport: '<Root>/z'
Glaxys_finest1 0:25d32fc1c12e 876
Glaxys_finest1 0:25d32fc1c12e 877 rtDW.Add3_a = rtU.z - rtDW.Integrator_p[2];
Glaxys_finest1 0:25d32fc1c12e 878
Glaxys_finest1 0:25d32fc1c12e 879 // Gain: '<S232>/Filter Coefficient' incorporates:
Glaxys_finest1 0:25d32fc1c12e 880 // DiscreteIntegrator: '<S224>/Filter'
Glaxys_finest1 0:25d32fc1c12e 881 // Gain: '<S223>/Derivative Gain'
Glaxys_finest1 0:25d32fc1c12e 882 // Sum: '<S224>/SumD'
Glaxys_finest1 0:25d32fc1c12e 883
Glaxys_finest1 0:25d32fc1c12e 884 rtDW.FilterCoefficient_i = (1.46547031640698 * rtDW.Add3_a -
Glaxys_finest1 0:25d32fc1c12e 885 rtDW.Filter_DSTATE_n) * 19.9677854964375;
Glaxys_finest1 0:25d32fc1c12e 886
Glaxys_finest1 0:25d32fc1c12e 887 // Sum: '<S4>/Add' incorporates:
Glaxys_finest1 0:25d32fc1c12e 888 // Delay: '<S1>/Delay'
Glaxys_finest1 0:25d32fc1c12e 889 // DiscreteIntegrator: '<S229>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 890 // Gain: '<S234>/Proportional Gain'
Glaxys_finest1 0:25d32fc1c12e 891 // Sum: '<S238>/Sum'
Glaxys_finest1 0:25d32fc1c12e 892
Glaxys_finest1 0:25d32fc1c12e 893 rtDW.Delay_DSTATE[0] = ((0.547568478085603 * rtDW.Add3_a +
Glaxys_finest1 0:25d32fc1c12e 894 rtDW.Integrator_DSTATE_ao) + rtDW.FilterCoefficient_i) + 7.3575;
Glaxys_finest1 0:25d32fc1c12e 895
Glaxys_finest1 0:25d32fc1c12e 896 // Update for DiscreteIntegrator: '<S141>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 897 // Gain: '<S138>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 898
Glaxys_finest1 0:25d32fc1c12e 899 rtDW.Integrator_DSTATE += 0.0492289691165195 * rtDW.maxval * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 900
Glaxys_finest1 0:25d32fc1c12e 901 // Update for DiscreteIntegrator: '<S136>/Filter'
Glaxys_finest1 0:25d32fc1c12e 902 rtDW.Filter_DSTATE += 0.0001 * Fdes_idx_0;
Glaxys_finest1 0:25d32fc1c12e 903
Glaxys_finest1 0:25d32fc1c12e 904 // Update for DiscreteIntegrator: '<S273>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 905 // Gain: '<S270>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 906
Glaxys_finest1 0:25d32fc1c12e 907 rtDW.Integrator_DSTATE_a += 0.0492289691165195 * Fdes_idx_1 * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 908
Glaxys_finest1 0:25d32fc1c12e 909 // Update for DiscreteIntegrator: '<S268>/Filter'
Glaxys_finest1 0:25d32fc1c12e 910 rtDW.Filter_DSTATE_k += 0.0001 * Fdes_idx_2;
Glaxys_finest1 0:25d32fc1c12e 911
Glaxys_finest1 0:25d32fc1c12e 912 // Update for DiscreteIntegrator: '<S185>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 913 // Gain: '<S182>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 914
Glaxys_finest1 0:25d32fc1c12e 915 rtDW.Integrator_DSTATE_m += 0.230387898131499 * rtDW.Add1_k * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 916
Glaxys_finest1 0:25d32fc1c12e 917 // Update for DiscreteIntegrator: '<S180>/Filter'
Glaxys_finest1 0:25d32fc1c12e 918 rtDW.Filter_DSTATE_m += 0.0001 * rtDW.FilterCoefficient_a;
Glaxys_finest1 0:25d32fc1c12e 919
Glaxys_finest1 0:25d32fc1c12e 920 // Update for DiscreteIntegrator: '<S53>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 921 // Gain: '<S50>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 922
Glaxys_finest1 0:25d32fc1c12e 923 rtDW.Integrator_DSTATE_e += 0.230387898131499 *
Glaxys_finest1 0:25d32fc1c12e 924 rtb_TmpSignalConversionAtSFun_1 * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 925
Glaxys_finest1 0:25d32fc1c12e 926 // Update for DiscreteIntegrator: '<S48>/Filter'
Glaxys_finest1 0:25d32fc1c12e 927 rtDW.Filter_DSTATE_l += 0.0001 * rtb_TmpSignalConversionAtSFun_0;
Glaxys_finest1 0:25d32fc1c12e 928
Glaxys_finest1 0:25d32fc1c12e 929 // Update for DiscreteIntegrator: '<S97>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 930 // Constant: '<S4>/Constant'
Glaxys_finest1 0:25d32fc1c12e 931 // Gain: '<S94>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 932 // MATLAB Function: '<S4>/MATLAB Function4'
Glaxys_finest1 0:25d32fc1c12e 933 // Sum: '<S23>/Add3'
Glaxys_finest1 0:25d32fc1c12e 934
Glaxys_finest1 0:25d32fc1c12e 935 rtDW.Integrator_DSTATE_o += (0.0 - rtDW.Integrator_p[5]) * 4.32690066926921E-5
Glaxys_finest1 0:25d32fc1c12e 936 * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 937
Glaxys_finest1 0:25d32fc1c12e 938 // Update for DiscreteIntegrator: '<S92>/Filter'
Glaxys_finest1 0:25d32fc1c12e 939 rtDW.Filter_DSTATE_lo += 0.0001 * rtDW.FilterCoefficient_k;
Glaxys_finest1 0:25d32fc1c12e 940
Glaxys_finest1 0:25d32fc1c12e 941 // Update for DiscreteIntegrator: '<S229>/Integrator' incorporates:
Glaxys_finest1 0:25d32fc1c12e 942 // Gain: '<S226>/Integral Gain'
Glaxys_finest1 0:25d32fc1c12e 943
Glaxys_finest1 0:25d32fc1c12e 944 rtDW.Integrator_DSTATE_ao += 0.0506661578399485 * rtDW.Add3_a * 0.0001;
Glaxys_finest1 0:25d32fc1c12e 945
Glaxys_finest1 0:25d32fc1c12e 946 // Update for DiscreteIntegrator: '<S224>/Filter'
Glaxys_finest1 0:25d32fc1c12e 947 rtDW.Filter_DSTATE_n += 0.0001 * rtDW.FilterCoefficient_i;
Glaxys_finest1 0:25d32fc1c12e 948
Glaxys_finest1 0:25d32fc1c12e 949 // End of Outputs for SubSystem: '<S1>/small_angle_control'
Glaxys_finest1 0:25d32fc1c12e 950 // End of Outputs for SubSystem: '<Root>/Adaptive large angle controller'
Glaxys_finest1 0:25d32fc1c12e 951
Glaxys_finest1 0:25d32fc1c12e 952 // Outport: '<Root>/u1 '
Glaxys_finest1 0:25d32fc1c12e 953 rtY.u1 = rtDW.duty[0];
Glaxys_finest1 0:25d32fc1c12e 954
Glaxys_finest1 0:25d32fc1c12e 955 // Outport: '<Root>/u2 '
Glaxys_finest1 0:25d32fc1c12e 956 rtY.u2 = rtDW.duty[1];
Glaxys_finest1 0:25d32fc1c12e 957
Glaxys_finest1 0:25d32fc1c12e 958 // Outport: '<Root>/u3'
Glaxys_finest1 0:25d32fc1c12e 959 rtY.u3 = rtDW.duty[2];
Glaxys_finest1 0:25d32fc1c12e 960
Glaxys_finest1 0:25d32fc1c12e 961 // Outport: '<Root>/u4'
Glaxys_finest1 0:25d32fc1c12e 962 rtY.u4 = rtDW.duty[3];
Glaxys_finest1 0:25d32fc1c12e 963 }
Glaxys_finest1 0:25d32fc1c12e 964
Glaxys_finest1 0:25d32fc1c12e 965 // Model initialize function
Glaxys_finest1 0:25d32fc1c12e 966 void LAAPModelClass::initialize()
Glaxys_finest1 0:25d32fc1c12e 967 {
Glaxys_finest1 0:25d32fc1c12e 968 {
Glaxys_finest1 0:25d32fc1c12e 969 int32_T i;
Glaxys_finest1 0:25d32fc1c12e 970
Glaxys_finest1 0:25d32fc1c12e 971 // SystemInitialize for Atomic SubSystem: '<Root>/Adaptive large angle controller'
Glaxys_finest1 0:25d32fc1c12e 972 // SystemInitialize for Atomic SubSystem: '<S1>/quadcopter_dynamics_prediction'
Glaxys_finest1 0:25d32fc1c12e 973 // InitializeConditions for DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 974 for (i = 0; i < 6; i++) {
Glaxys_finest1 0:25d32fc1c12e 975 rtDW.Integrator_DSTATE_ep[i] = 0.0;
Glaxys_finest1 0:25d32fc1c12e 976 if (rtDW.Integrator_DSTATE_ep[i] >= 10.0) {
Glaxys_finest1 0:25d32fc1c12e 977 rtDW.Integrator_DSTATE_ep[i] = 10.0;
Glaxys_finest1 0:25d32fc1c12e 978 } else {
Glaxys_finest1 0:25d32fc1c12e 979 if (rtDW.Integrator_DSTATE_ep[i] <= -10.0) {
Glaxys_finest1 0:25d32fc1c12e 980 rtDW.Integrator_DSTATE_ep[i] = -10.0;
Glaxys_finest1 0:25d32fc1c12e 981 }
Glaxys_finest1 0:25d32fc1c12e 982 }
Glaxys_finest1 0:25d32fc1c12e 983 }
Glaxys_finest1 0:25d32fc1c12e 984
Glaxys_finest1 0:25d32fc1c12e 985 // End of InitializeConditions for DiscreteIntegrator: '<S13>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 986
Glaxys_finest1 0:25d32fc1c12e 987 // InitializeConditions for DiscreteIntegrator: '<S14>/Integrator'
Glaxys_finest1 0:25d32fc1c12e 988 rtDW.Integrator_IC_LOADING = 1U;
Glaxys_finest1 0:25d32fc1c12e 989
Glaxys_finest1 0:25d32fc1c12e 990 // End of SystemInitialize for SubSystem: '<S1>/quadcopter_dynamics_prediction'
Glaxys_finest1 0:25d32fc1c12e 991 // End of SystemInitialize for SubSystem: '<Root>/Adaptive large angle controller'
Glaxys_finest1 0:25d32fc1c12e 992 }
Glaxys_finest1 0:25d32fc1c12e 993 }
Glaxys_finest1 0:25d32fc1c12e 994
Glaxys_finest1 0:25d32fc1c12e 995 // Constructor
Glaxys_finest1 0:25d32fc1c12e 996 LAAPModelClass::LAAPModelClass()
Glaxys_finest1 0:25d32fc1c12e 997 {
Glaxys_finest1 0:25d32fc1c12e 998 // Currently there is no constructor body generated.
Glaxys_finest1 0:25d32fc1c12e 999 }
Glaxys_finest1 0:25d32fc1c12e 1000
Glaxys_finest1 0:25d32fc1c12e 1001 // Destructor
Glaxys_finest1 0:25d32fc1c12e 1002 LAAPModelClass::~LAAPModelClass()
Glaxys_finest1 0:25d32fc1c12e 1003 {
Glaxys_finest1 0:25d32fc1c12e 1004 // Currently there is no destructor body generated.
Glaxys_finest1 0:25d32fc1c12e 1005 }
Glaxys_finest1 0:25d32fc1c12e 1006
Glaxys_finest1 0:25d32fc1c12e 1007 // Root-level input access methods
Glaxys_finest1 0:25d32fc1c12e 1008
Glaxys_finest1 0:25d32fc1c12e 1009 // Root inport: '<Root>/rdot' set method
Glaxys_finest1 0:25d32fc1c12e 1010 void LAAPModelClass::setrdot(real_T localArgInput[3])
Glaxys_finest1 0:25d32fc1c12e 1011 {
Glaxys_finest1 0:25d32fc1c12e 1012 rtU.rdot[0] = localArgInput[0];
Glaxys_finest1 0:25d32fc1c12e 1013 rtU.rdot[1] = localArgInput[1];
Glaxys_finest1 0:25d32fc1c12e 1014 rtU.rdot[2] = localArgInput[2];
Glaxys_finest1 0:25d32fc1c12e 1015 }
Glaxys_finest1 0:25d32fc1c12e 1016
Glaxys_finest1 0:25d32fc1c12e 1017 // Root inport: '<Root>/r' set method
Glaxys_finest1 0:25d32fc1c12e 1018 void LAAPModelClass::setr(real_T localArgInput[3])
Glaxys_finest1 0:25d32fc1c12e 1019 {
Glaxys_finest1 0:25d32fc1c12e 1020 rtU.r[0] = localArgInput[0];
Glaxys_finest1 0:25d32fc1c12e 1021 rtU.r[1] = localArgInput[1];
Glaxys_finest1 0:25d32fc1c12e 1022 rtU.r[2] = localArgInput[2];
Glaxys_finest1 0:25d32fc1c12e 1023 }
Glaxys_finest1 0:25d32fc1c12e 1024
Glaxys_finest1 0:25d32fc1c12e 1025 // Root inport: '<Root>/wb' set method
Glaxys_finest1 0:25d32fc1c12e 1026 void LAAPModelClass::setwb(real_T localArgInput[3])
Glaxys_finest1 0:25d32fc1c12e 1027 {
Glaxys_finest1 0:25d32fc1c12e 1028 rtU.wb[0] = localArgInput[0];
Glaxys_finest1 0:25d32fc1c12e 1029 rtU.wb[1] = localArgInput[1];
Glaxys_finest1 0:25d32fc1c12e 1030 rtU.wb[2] = localArgInput[2];
Glaxys_finest1 0:25d32fc1c12e 1031 }
Glaxys_finest1 0:25d32fc1c12e 1032
Glaxys_finest1 0:25d32fc1c12e 1033 // Root inport: '<Root>/angles' set method
Glaxys_finest1 0:25d32fc1c12e 1034 void LAAPModelClass::setangles(real_T localArgInput[3])
Glaxys_finest1 0:25d32fc1c12e 1035 {
Glaxys_finest1 0:25d32fc1c12e 1036 rtU.angles[0] = localArgInput[0];
Glaxys_finest1 0:25d32fc1c12e 1037 rtU.angles[1] = localArgInput[1];
Glaxys_finest1 0:25d32fc1c12e 1038 rtU.angles[2] = localArgInput[2];
Glaxys_finest1 0:25d32fc1c12e 1039 }
Glaxys_finest1 0:25d32fc1c12e 1040
Glaxys_finest1 0:25d32fc1c12e 1041 // Root inport: '<Root>/x' set method
Glaxys_finest1 0:25d32fc1c12e 1042 void LAAPModelClass::setx(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1043 {
Glaxys_finest1 0:25d32fc1c12e 1044 rtU.x = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1045 }
Glaxys_finest1 0:25d32fc1c12e 1046
Glaxys_finest1 0:25d32fc1c12e 1047 // Root inport: '<Root>/y' set method
Glaxys_finest1 0:25d32fc1c12e 1048 void LAAPModelClass::sety(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1049 {
Glaxys_finest1 0:25d32fc1c12e 1050 rtU.y = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1051 }
Glaxys_finest1 0:25d32fc1c12e 1052
Glaxys_finest1 0:25d32fc1c12e 1053 // Root inport: '<Root>/z' set method
Glaxys_finest1 0:25d32fc1c12e 1054 void LAAPModelClass::setz(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1055 {
Glaxys_finest1 0:25d32fc1c12e 1056 rtU.z = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1057 }
Glaxys_finest1 0:25d32fc1c12e 1058
Glaxys_finest1 0:25d32fc1c12e 1059 // Root inport: '<Root>/phi' set method
Glaxys_finest1 0:25d32fc1c12e 1060 void LAAPModelClass::setphi(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1061 {
Glaxys_finest1 0:25d32fc1c12e 1062 rtU.phi = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1063 }
Glaxys_finest1 0:25d32fc1c12e 1064
Glaxys_finest1 0:25d32fc1c12e 1065 // Root inport: '<Root>/theta' set method
Glaxys_finest1 0:25d32fc1c12e 1066 void LAAPModelClass::settheta(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1067 {
Glaxys_finest1 0:25d32fc1c12e 1068 rtU.theta = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1069 }
Glaxys_finest1 0:25d32fc1c12e 1070
Glaxys_finest1 0:25d32fc1c12e 1071 // Root inport: '<Root>/psi' set method
Glaxys_finest1 0:25d32fc1c12e 1072 void LAAPModelClass::setpsi(real_T localArgInput)
Glaxys_finest1 0:25d32fc1c12e 1073 {
Glaxys_finest1 0:25d32fc1c12e 1074 rtU.psi = localArgInput;
Glaxys_finest1 0:25d32fc1c12e 1075 }
Glaxys_finest1 0:25d32fc1c12e 1076
Glaxys_finest1 0:25d32fc1c12e 1077 // Root-level output access methods
Glaxys_finest1 0:25d32fc1c12e 1078
Glaxys_finest1 0:25d32fc1c12e 1079 // Root outport: '<Root>/u1 ' get method
Glaxys_finest1 0:25d32fc1c12e 1080 real_T LAAPModelClass::getu1_() const
Glaxys_finest1 0:25d32fc1c12e 1081 {
Glaxys_finest1 0:25d32fc1c12e 1082 return rtY.u1;
Glaxys_finest1 0:25d32fc1c12e 1083 }
Glaxys_finest1 0:25d32fc1c12e 1084
Glaxys_finest1 0:25d32fc1c12e 1085 // Root outport: '<Root>/u2 ' get method
Glaxys_finest1 0:25d32fc1c12e 1086 real_T LAAPModelClass::getu2_() const
Glaxys_finest1 0:25d32fc1c12e 1087 {
Glaxys_finest1 0:25d32fc1c12e 1088 return rtY.u2;
Glaxys_finest1 0:25d32fc1c12e 1089 }
Glaxys_finest1 0:25d32fc1c12e 1090
Glaxys_finest1 0:25d32fc1c12e 1091 // Root outport: '<Root>/u3' get method
Glaxys_finest1 0:25d32fc1c12e 1092 real_T LAAPModelClass::getu3() const
Glaxys_finest1 0:25d32fc1c12e 1093 {
Glaxys_finest1 0:25d32fc1c12e 1094 return rtY.u3;
Glaxys_finest1 0:25d32fc1c12e 1095 }
Glaxys_finest1 0:25d32fc1c12e 1096
Glaxys_finest1 0:25d32fc1c12e 1097 // Root outport: '<Root>/u4' get method
Glaxys_finest1 0:25d32fc1c12e 1098 real_T LAAPModelClass::getu4() const
Glaxys_finest1 0:25d32fc1c12e 1099 {
Glaxys_finest1 0:25d32fc1c12e 1100 return rtY.u4;
Glaxys_finest1 0:25d32fc1c12e 1101 }
Glaxys_finest1 0:25d32fc1c12e 1102
Glaxys_finest1 0:25d32fc1c12e 1103 // Real-Time Model get method
Glaxys_finest1 0:25d32fc1c12e 1104 RT_MODEL * LAAPModelClass::getRTM()
Glaxys_finest1 0:25d32fc1c12e 1105 {
Glaxys_finest1 0:25d32fc1c12e 1106 return (&rtM);
Glaxys_finest1 0:25d32fc1c12e 1107 }
Glaxys_finest1 0:25d32fc1c12e 1108
Glaxys_finest1 0:25d32fc1c12e 1109 //
Glaxys_finest1 0:25d32fc1c12e 1110 // File trailer for generated code.
Glaxys_finest1 0:25d32fc1c12e 1111 //
Glaxys_finest1 0:25d32fc1c12e 1112 // [EOF]
Glaxys_finest1 0:25d32fc1c12e 1113 //