update gencode

This commit is contained in:
LyuWeiye
2022-12-15 23:16:28 +08:00
parent 6de66a099a
commit 1ed9f8dd11
9 changed files with 285 additions and 339 deletions
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -1202,18 +1202,11 @@ static void cr929_SIL_dflo_0(void);
static void cr929_SIL_dfri_max(void);
static void cr929_SIL_dh_max(void);
static void cr929_SIL_dh_min(void);
static void cr929_SIL_dr_max(void);
static void cr929_SIL_dr_min(void);
static void cr929_SIL_dspl1_0(void);
static void cr929_SIL_dspl1_02(void);
static void cr929_SIL_dspl1_03(void);
static void cr929_SIL_dspl1_04(void);
static void cr929_SIL_dspl2_0(void);
static void cr929_SIL_idel(void);
static void cr929_SIL_AutoRecovery(void);
static void cr929_SIL_Emergency(void);
static void cr929_SIL_enter_atomic_Emergency(void);
static void cr929_SIL_Emergency1(void);
static void cr929_SIL_Manual(void);
static void cr929_SIL_enter_atomic_Emergency1(void);
static void cr929_SIL_Standby(void);
static uint8_T cr929_SIL_update_f(uint8_T in);
@@ -5486,90 +5479,6 @@ static void cr929_SIL_dh_min(void)
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dr_max(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dr_min;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dr_c = -0.523560226F;
} else {
cr929_SIL_B.dr_c = 0.523560226F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dr_min(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dr_c = -0.523560226F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dspl1_0(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl1_02;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspl1_c = -0.872600377F;
} else {
cr929_SIL_B.dspl1_c = -0.523560226F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dspl1_02(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dspl1_c = -0.872600377F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dspl1_03(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dspr1_c = -0.872600377F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dspl1_04(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl1_03;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspr1_c = -0.872600377F;
} else {
cr929_SIL_B.dspl1_c = -0.523560226F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_dspl2_0(void)
{
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl2_01;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspl2_c = -0.872600377F;
} else {
cr929_SIL_B.dspl2_c = -0.523560226F;
}
}
/* Function for Chart: '<S843>/Chart' */
static void cr929_SIL_idel(void)
{
@@ -5692,6 +5601,32 @@ static void cr929_SIL_idel(void)
}
}
/* Function for Chart: '<S640>/standby_emergency' */
static void cr929_SIL_AutoRecovery(void)
{
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_THT_CTRL;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_ROLL_CTRL;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_DAMPING;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.phi_c_d = 0.0F;
/* Constant: '<S640>/Constant4' */
if (cr929_SIL_B.BusAssignment_h.msl < cr929_SIL_P.min_abs_alt) {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_Recovery;
cr929_SIL_DW.temporalCounter_i2_j = 0U;
cr929_SIL_DW.is_Recovery = cr929_SIL_IN_On;
cr929_SIL_DW.temporalCounter_i1_g = 0U;
cr929_SIL_B.recovery = true;
} else {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_hold1;
cr929_SIL_DW.temporalCounter_i1_g = 0U;
}
/* End of Constant: '<S640>/Constant4' */
}
/* Function for Chart: '<S640>/standby_emergency' */
static void cr929_SIL_Emergency(void)
{
@@ -5802,39 +5737,6 @@ static void cr929_SIL_Emergency1(void)
/* End of Constant: '<S640>/Constant4' */
}
/* Function for Chart: '<S640>/standby_emergency' */
static void cr929_SIL_Manual(void)
{
cr929_SIL_B.mode_c = ENUM_mode_MANUAL;
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_COMMAND;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_COMMAND;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_COMMAND;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.landed_state_out_j = ENUM_LANDED_STATE_IN_AIR;
cr929_SIL_B.phi_c_d = 0.0F;
cr929_SIL_B.recovery = false;
cr929_SIL_B.armed = true;
cr929_SIL_B.state_m = ENUM_SystemState_EMERGENCY;
if (cr929_SIL_B.Switch2_n || (cr929_SIL_B.BusAssignment.recovery_cmd >= 1)) {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_AutoRecovery;
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_THT_CTRL;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_ROLL_CTRL;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_DAMPING;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.throttle_c_out_m = -0.25F;
cr929_SIL_B.phi_c_d = 0.0F;
/* Constant: '<S450>/Constant Single6' */
cr929_SIL_B.tht_c_h = cr929_SIL_P.max_tht;
} else {
cr929_SIL_B.throttle_c_out_m = cr929_SIL_B.saturation_j;
}
}
/* Function for Chart: '<S640>/standby_emergency' */
static void cr929_SIL_enter_atomic_Emergency1(void)
{
@@ -13680,11 +13582,11 @@ void cr929_SIL_step(void)
real32_T rtb_Gain_nd_idx_0;
real32_T rtb_Merge_h_Cmd_dspri_c_idx_2;
real32_T rtb_Merge_i_dspri_c_idx_2;
boolean_T rtb_Merge_i_load_signal_idx_2;
boolean_T rtb_Merge_i_load_signal_idx_1;
real_T rtb_Merge_ko_idx_2;
real_T rtb_Merge_ko_idx_1;
real_T rtb_Merge_ko_idx_0;
boolean_T rtb_Merge_i_load_signal_idx_2;
boolean_T rtb_Merge_i_load_signal_idx_1;
real_T rtb_ImpAsg_InsertedFor_F_at_inport_0_idx_2;
real_T rtb_ImpAsg_InsertedFor_F_at_inport_0_idx_1;
real_T rtb_ImpAsg_InsertedFor_F_at_inport_0_idx_0;
@@ -14855,148 +14757,137 @@ void cr929_SIL_step(void)
/* Sum: '<S309>/Sum3' */
cr929_SIL_B.Sum3 = (cr929_SIL_B.Product5 - cr929_SIL_B.Product3_a1) +
cr929_SIL_B.Product6;
if (rtmIsMajorTimeStep(cr929_SIL_M)) {
/* ManualSwitch: '<Root>/Manual Switch1' incorporates:
* Constant: '<Root>/Constant4'
*/
cr929_SIL_B.ManualSwitch1 = 0.0;
/* Outputs for Enabled SubSystem: '<S10>/wind_model' incorporates:
* EnablePort: '<S1866>/Enable'
*/
if (rtmIsMajorTimeStep(cr929_SIL_M)) {
if (cr929_SIL_B.ManualSwitch1 > 0.0) {
if (!cr929_SIL_DW.wind_model_MODE) {
cr929_SIL_DW.wind_model_MODE = true;
}
} else {
if (cr929_SIL_DW.wind_model_MODE) {
/* Disable for Enabled SubSystem: '<S1880>/Hpgw' */
if (cr929_SIL_DW.Hpgw_MODE) {
/* Disable for Outport: '<S1891>/pgw' */
cr929_SIL_B.Sum_i3m[0] = 0.0;
cr929_SIL_B.Sum_i3m[1] = 0.0;
cr929_SIL_DW.Hpgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hpgw' */
/* Disable for Enabled SubSystem: '<S1881>/Hwgw(z)' */
if (cr929_SIL_DW.Hwgwz_MODE) {
/* Disable for Outport: '<S1896>/wgw' */
cr929_SIL_B.Sum_gr[0] = 0.0;
cr929_SIL_B.Sum_gr[1] = 0.0;
cr929_SIL_DW.Hwgwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hwgw(z)' */
/* Disable for Enabled SubSystem: '<S1880>/Hqgw' */
if (cr929_SIL_DW.Hqgw_MODE) {
/* Disable for Outport: '<S1892>/qgw' */
cr929_SIL_B.Sum1_i[0] = 0.0;
cr929_SIL_B.Sum1_i[1] = 0.0;
cr929_SIL_DW.Hqgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hqgw' */
/* Disable for Enabled SubSystem: '<S1881>/Hvgw(z)' */
if (cr929_SIL_DW.Hvgwz_MODE) {
/* Disable for Outport: '<S1895>/vgw' */
cr929_SIL_B.Sum_kl[0] = 0.0;
cr929_SIL_B.Sum_kl[1] = 0.0;
cr929_SIL_DW.Hvgwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hvgw(z)' */
/* Disable for Enabled SubSystem: '<S1880>/Hrgw' */
if (cr929_SIL_DW.Hrgw_MODE) {
/* Disable for Outport: '<S1893>/rgw' */
cr929_SIL_B.Sum1_cq[0] = 0.0;
cr929_SIL_B.Sum1_cq[1] = 0.0;
cr929_SIL_DW.Hrgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hrgw' */
/* Disable for If: '<S1885>/if Height < Max low altitude elseif Height > Min isotropic altitude ' */
cr929_SIL_DW.ifHeightMaxlowaltitudeelseifHeightMinisotropicaltitude_ActiveSu
= -1;
/* Disable for Enabled SubSystem: '<S1881>/Hugw(z)' */
if (cr929_SIL_DW.Hugwz_MODE) {
/* Disable for Outport: '<S1894>/ugw' */
cr929_SIL_B.Sum_fe[0] = 0.0;
cr929_SIL_B.Sum_fe[1] = 0.0;
cr929_SIL_DW.Hugwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hugw(z)' */
/* Disable for If: '<S1886>/if Height < Max low altitude elseif Height > Min isotropic altitude ' */
cr929_SIL_DW.ifHeightMaxlowaltitudeelseifHeightMinisotropicaltitude_Active_a
= -1;
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (x)' */
if (cr929_SIL_DW.Distanceintogustx.Distanceintogustx_MODE) {
cr929_SIL_Distanceintogustx_Disable
(&cr929_SIL_DW.Distanceintogustx);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (x)' */
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (y)' */
if (cr929_SIL_DW.Distanceintogusty.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogusty);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (y)' */
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (z)' */
if (cr929_SIL_DW.Distanceintogustz.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogustz);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (z)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (x)' */
if (cr929_SIL_DW.Distanceintogustx_d.Distanceintogustx_MODE) {
cr929_SIL_Distanceintogustx_Disable
(&cr929_SIL_DW.Distanceintogustx_d);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (x)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (y)' */
if (cr929_SIL_DW.Distanceintogusty_k.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogusty_k);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (y)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (z)' */
if (cr929_SIL_DW.Distanceintogustz_a.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogustz_a);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (z)' */
cr929_SIL_DW.wind_model_MODE = false;
}
}
}
/* End of Outputs for SubSystem: '<S10>/wind_model' */
}
/* Outputs for Enabled SubSystem: '<S10>/wind_model' incorporates:
* EnablePort: '<S1866>/Enable'
*/
if (rtmIsMajorTimeStep(cr929_SIL_M) && rtmIsMajorTimeStep(cr929_SIL_M)) {
/* Constant: '<Root>/Constant2' */
if (wind_able > 0.0) {
if (!cr929_SIL_DW.wind_model_MODE) {
cr929_SIL_DW.wind_model_MODE = true;
}
} else {
if (cr929_SIL_DW.wind_model_MODE) {
/* Disable for Enabled SubSystem: '<S1880>/Hpgw' */
if (cr929_SIL_DW.Hpgw_MODE) {
/* Disable for Outport: '<S1891>/pgw' */
cr929_SIL_B.Sum_i3m[0] = 0.0;
cr929_SIL_B.Sum_i3m[1] = 0.0;
cr929_SIL_DW.Hpgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hpgw' */
/* Disable for Enabled SubSystem: '<S1881>/Hwgw(z)' */
if (cr929_SIL_DW.Hwgwz_MODE) {
/* Disable for Outport: '<S1896>/wgw' */
cr929_SIL_B.Sum_gr[0] = 0.0;
cr929_SIL_B.Sum_gr[1] = 0.0;
cr929_SIL_DW.Hwgwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hwgw(z)' */
/* Disable for Enabled SubSystem: '<S1880>/Hqgw' */
if (cr929_SIL_DW.Hqgw_MODE) {
/* Disable for Outport: '<S1892>/qgw' */
cr929_SIL_B.Sum1_i[0] = 0.0;
cr929_SIL_B.Sum1_i[1] = 0.0;
cr929_SIL_DW.Hqgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hqgw' */
/* Disable for Enabled SubSystem: '<S1881>/Hvgw(z)' */
if (cr929_SIL_DW.Hvgwz_MODE) {
/* Disable for Outport: '<S1895>/vgw' */
cr929_SIL_B.Sum_kl[0] = 0.0;
cr929_SIL_B.Sum_kl[1] = 0.0;
cr929_SIL_DW.Hvgwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hvgw(z)' */
/* Disable for Enabled SubSystem: '<S1880>/Hrgw' */
if (cr929_SIL_DW.Hrgw_MODE) {
/* Disable for Outport: '<S1893>/rgw' */
cr929_SIL_B.Sum1_cq[0] = 0.0;
cr929_SIL_B.Sum1_cq[1] = 0.0;
cr929_SIL_DW.Hrgw_MODE = false;
}
/* End of Disable for SubSystem: '<S1880>/Hrgw' */
/* Disable for If: '<S1885>/if Height < Max low altitude elseif Height > Min isotropic altitude ' */
cr929_SIL_DW.ifHeightMaxlowaltitudeelseifHeightMinisotropicaltitude_ActiveSu
= -1;
/* Disable for Enabled SubSystem: '<S1881>/Hugw(z)' */
if (cr929_SIL_DW.Hugwz_MODE) {
/* Disable for Outport: '<S1894>/ugw' */
cr929_SIL_B.Sum_fe[0] = 0.0;
cr929_SIL_B.Sum_fe[1] = 0.0;
cr929_SIL_DW.Hugwz_MODE = false;
}
/* End of Disable for SubSystem: '<S1881>/Hugw(z)' */
/* Disable for If: '<S1886>/if Height < Max low altitude elseif Height > Min isotropic altitude ' */
cr929_SIL_DW.ifHeightMaxlowaltitudeelseifHeightMinisotropicaltitude_Active_a
= -1;
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (x)' */
if (cr929_SIL_DW.Distanceintogustx.Distanceintogustx_MODE) {
cr929_SIL_Distanceintogustx_Disable(&cr929_SIL_DW.Distanceintogustx);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (x)' */
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (y)' */
if (cr929_SIL_DW.Distanceintogusty.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable(&cr929_SIL_DW.Distanceintogusty);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (y)' */
/* Disable for Enabled SubSystem: '<S1867>/Distance into gust (z)' */
if (cr929_SIL_DW.Distanceintogustz.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable(&cr929_SIL_DW.Distanceintogustz);
}
/* End of Disable for SubSystem: '<S1867>/Distance into gust (z)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (x)' */
if (cr929_SIL_DW.Distanceintogustx_d.Distanceintogustx_MODE) {
cr929_SIL_Distanceintogustx_Disable
(&cr929_SIL_DW.Distanceintogustx_d);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (x)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (y)' */
if (cr929_SIL_DW.Distanceintogusty_k.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogusty_k);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (y)' */
/* Disable for Enabled SubSystem: '<S1868>/Distance into gust (z)' */
if (cr929_SIL_DW.Distanceintogustz_a.Distanceintogusty_MODE) {
cr929_SIL_Distanceintogusty_Disable
(&cr929_SIL_DW.Distanceintogustz_a);
}
/* End of Disable for SubSystem: '<S1868>/Distance into gust (z)' */
cr929_SIL_DW.wind_model_MODE = false;
}
}
/* End of Constant: '<Root>/Constant2' */
}
if (cr929_SIL_DW.wind_model_MODE) {
if (rtmIsMajorTimeStep(cr929_SIL_M)) {
/* Math: '<S1866>/Transpose' incorporates:
@@ -20484,7 +20375,11 @@ void cr929_SIL_step(void)
break;
case cr929_SIL_IN_dfri_0:
cr929_SIL_dflo_0();
if (cr929_SIL_DW.temporalCounter_i1_es >= 6532U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel2;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel2();
}
break;
case cr929_SIL_IN_dfri_max:
@@ -20500,31 +20395,73 @@ void cr929_SIL_step(void)
break;
case cr929_SIL_IN_dr_max:
cr929_SIL_dr_max();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dr_min;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dr_c = -0.523560226F;
} else {
cr929_SIL_B.dr_c = 0.523560226F;
}
break;
case cr929_SIL_IN_dr_min:
cr929_SIL_dr_min();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dr_c = -0.523560226F;
}
break;
case cr929_SIL_IN_dspl1_0:
cr929_SIL_dspl1_0();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl1_02;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspl1_c = -0.872600377F;
} else {
cr929_SIL_B.dspl1_c = -0.523560226F;
}
break;
case cr929_SIL_IN_dspl1_02:
cr929_SIL_dspl1_02();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dspl1_c = -0.872600377F;
}
break;
case cr929_SIL_IN_dspl1_03:
cr929_SIL_dspl1_03();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_idel;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_enter_atomic_idel();
} else {
cr929_SIL_B.dspr1_c = -0.872600377F;
}
break;
case cr929_SIL_IN_dspl1_04:
cr929_SIL_dspl1_04();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl1_03;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspr1_c = -0.872600377F;
} else {
cr929_SIL_B.dspl1_c = -0.523560226F;
}
break;
case cr929_SIL_IN_dspl2_0:
cr929_SIL_dspl2_0();
if (cr929_SIL_DW.temporalCounter_i1_es >= 980U) {
cr929_SIL_DW.is_c63_cr929_autopilot = cr929_SIL_IN_dspl2_01;
cr929_SIL_DW.temporalCounter_i1_es = 0U;
cr929_SIL_B.dspl2_c = -0.872600377F;
} else {
cr929_SIL_B.dspl2_c = -0.523560226F;
}
break;
case cr929_SIL_IN_dspl2_01:
@@ -21483,7 +21420,6 @@ void cr929_SIL_step(void)
/* Chart: '<S640>/standby_emergency' incorporates:
* Constant: '<S450>/Constant Single25'
* Constant: '<S450>/Constant Single6'
* Constant: '<S640>/Constant4'
* Constant: '<S640>/Constant7'
* Constant: '<S640>/Constant8'
* Constant: '<S640>/Constant9'
@@ -21519,23 +21455,7 @@ void cr929_SIL_step(void)
} else {
switch (cr929_SIL_DW.is_c69_cr929_autopilot) {
case cr929_SIL_IN_AutoRecovery:
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_THT_CTRL;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_ROLL_CTRL;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_DAMPING;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.phi_c_d = 0.0F;
if (cr929_SIL_B.BusAssignment_h.msl < cr929_SIL_P.min_abs_alt) {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_Recovery;
cr929_SIL_DW.temporalCounter_i2_j = 0U;
cr929_SIL_DW.is_Recovery = cr929_SIL_IN_On;
cr929_SIL_DW.temporalCounter_i1_g = 0U;
cr929_SIL_B.recovery = true;
} else {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_hold1;
cr929_SIL_DW.temporalCounter_i1_g = 0U;
}
cr929_SIL_AutoRecovery();
break;
case cr929_SIL_IN_Emergency:
@@ -21547,7 +21467,33 @@ void cr929_SIL_step(void)
break;
case cr929_SIL_IN_Manual:
cr929_SIL_Manual();
cr929_SIL_B.mode_c = ENUM_mode_MANUAL;
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_COMMAND;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_COMMAND;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_COMMAND;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.landed_state_out_j = ENUM_LANDED_STATE_IN_AIR;
cr929_SIL_B.phi_c_d = 0.0F;
cr929_SIL_B.recovery = false;
cr929_SIL_B.armed = true;
cr929_SIL_B.state_m = ENUM_SystemState_EMERGENCY;
if (cr929_SIL_B.Switch2_n || (cr929_SIL_B.BusAssignment.recovery_cmd
>= 1)) {
cr929_SIL_DW.is_c69_cr929_autopilot = cr929_SIL_IN_AutoRecovery;
cr929_SIL_B.AFCS_VERT_ng = ENUM_AFCS_VERT_OFF;
cr929_SIL_B.AFCS_LNAV = ENUM_AFCS_LAT_OFF;
cr929_SIL_B.CSAS_pitch_c = ENUM_CSAS_PITCH_THT_CTRL;
cr929_SIL_B.CSAS_roll_c = ENUM_CSAS_ROLL_ROLL_CTRL;
cr929_SIL_B.CSAS_yaw_f = ENUM_CSAS_YAW_DAMPING;
cr929_SIL_B.AT_j = ENUM_AT_COMMAND;
cr929_SIL_B.throttle_c_out_m = -0.25F;
cr929_SIL_B.phi_c_d = 0.0F;
cr929_SIL_B.tht_c_h = cr929_SIL_P.max_tht;
} else {
cr929_SIL_B.throttle_c_out_m = cr929_SIL_B.saturation_j;
}
break;
case cr929_SIL_IN_Recovery:
@@ -46014,22 +45960,21 @@ void cr929_SIL_step(void)
/* End of Outputs for SubSystem: '<S1588>/Enabled Subsystem' */
/* DataTypeConversion: '<S1556>/Data Type Conversion' */
rtb_DataTypeConversion_a = (real32_T)cr929_SIL_B.SignalCopy;
/* Saturate: '<S1556>/Saturation' */
if (rtb_DataTypeConversion_a > 89.9F) {
rtb_DataTypeConversion_a = 89.9F;
/* Saturate: '<S1556>/Saturation' incorporates:
* DataTypeConversion: '<S1556>/Data Type Conversion'
*/
if ((real32_T)cr929_SIL_B.SignalCopy > 89.9F) {
rtb_if_g = 89.9F;
} else if ((real32_T)cr929_SIL_B.SignalCopy < -89.9F) {
rtb_if_g = -89.9F;
} else {
if (rtb_DataTypeConversion_a < -89.9F) {
rtb_DataTypeConversion_a = -89.9F;
}
rtb_if_g = (real32_T)cr929_SIL_B.SignalCopy;
}
/* End of Saturate: '<S1556>/Saturation' */
/* Gain: '<S1560>/Gain1' */
cr929_SIL_B.Gain1_jf = 0.0174532924F * rtb_DataTypeConversion_a;
cr929_SIL_B.Gain1_jf = 0.0174532924F * rtb_if_g;
/* Chart: '<S1556>/check_gps_valid' */
if (cr929_SIL_DW.temporalCounter_i1_hj < 1023U) {
@@ -46143,17 +46088,16 @@ void cr929_SIL_step(void)
((cr929_SIL_B.OutportBuffer_InsertedFor_gps_vel_status_at_inport_0 & 63U)
== 0U));
/* Gain: '<S1556>/Gain' incorporates:
/* Product: '<S1556>/Product' incorporates:
* Constant: '<S1557>/Constant'
*/
rtb_DataTypeConversion_a = 3062.0F;
/* DataTypeConversion: '<S1556>/Data Type Conversion1' incorporates:
* Product: '<S1556>/Product'
* Gain: '<S1556>/Gain'
* UnitDelay: '<S1556>/Unit Delay'
*/
rtb_if_g = floorf(rtb_DataTypeConversion_a * (real32_T)
cr929_SIL_DW.UnitDelay_DSTATE_kg);
rtb_DataTypeConversion_a = 3062.0F * (real32_T)
cr929_SIL_DW.UnitDelay_DSTATE_kg;
/* DataTypeConversion: '<S1556>/Data Type Conversion1' */
rtb_if_g = floorf(rtb_DataTypeConversion_a);
if (rtIsNaNF(rtb_if_g) || rtIsInfF(rtb_if_g)) {
rtb_if_g = 0.0F;
} else {
@@ -49862,6 +49806,7 @@ void cr929_SIL_step(void)
/* BusAssignment: '<S1694>/Bus Assignment' incorporates:
* Constant: '<S1694>/Constant4'
* DataStoreWrite: '<S5>/Data Store Write'
* Gain: '<S1694>/gain'
*/
cr929_SIL_DW.sens = rtb_TmpHiddenBufferAtBusAssignmentInport1_m;
cr929_SIL_DW.sens.lat = rtb_Merge_ko_idx_0;
@@ -49871,7 +49816,7 @@ void cr929_SIL_step(void)
cr929_SIL_DW.sens.v_e = cr929_SIL_B.velocity_NED[1];
cr929_SIL_DW.sens.v_d = cr929_SIL_B.velocity_NED[2];
cr929_SIL_DW.sens.baro = cr929_SIL_B.Saturation;
cr929_SIL_DW.sens.asl_baro = cr929_SIL_B.alt_pres_a;
cr929_SIL_DW.sens.asl_baro = 0.9F * cr929_SIL_B.alt_pres_a;
cr929_SIL_DW.sens.qbar = cr929_SIL_B.qbar;
cr929_SIL_DW.sens.IAS = cr929_SIL_B.IAS;
cr929_SIL_DW.sens.p = cr929_SIL_B.Gain1_o2[0];
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -577,7 +577,6 @@ typedef struct {
real_T Product5; /* '<S309>/Product5' */
real_T Product6; /* '<S309>/Product6' */
real_T Sum3; /* '<S309>/Sum3' */
real_T ManualSwitch1; /* '<Root>/Manual Switch1' */
real_T LookupTableDynamic; /* '<S1711>/Lookup Table Dynamic' */
real_T LookupTableDynamic_k; /* '<S1709>/Lookup Table Dynamic' */
real_T LookupTableDynamic_m; /* '<S1712>/Lookup Table Dynamic' */
@@ -4576,6 +4575,7 @@ extern RT_MODEL_cr929_SIL_T *const cr929_SIL_M;
* Block '<S385>/Reshape (9) to [3x3] column-major' : Reshape block reduction
* Block '<S443>/Gain5' : Eliminated nontunable gain of 1
* Block '<Root>/Manual Switch' : Eliminated due to constant selection input
* Block '<Root>/Manual Switch1' : Eliminated due to constant selection input
* Block '<S446>/Data Type Conversion3' : Eliminate redundant data type conversion
* Block '<S601>/Data Type Conversion' : Eliminate redundant data type conversion
* Block '<S602>/Data Type Conversion' : Eliminate redundant data type conversion
@@ -4644,6 +4644,7 @@ extern RT_MODEL_cr929_SIL_T *const cr929_SIL_M;
* Block '<S1911>/Reshape1' : Reshape block reduction
* Block '<S1913>/Reshape' : Reshape block reduction
* Block '<Root>/Constant3' : Unused code path elimination
* Block '<Root>/Constant4' : Unused code path elimination
* Block '<S637>/Constant' : Unused code path elimination
* Block '<S637>/Constant1' : Unused code path elimination
* Block '<S643>/Constant' : Unused code path elimination
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -1002,10 +1002,10 @@ static rtwCAPI_ModelMappingStaticInfo mmiStatic = {
rtElementMap, rtSampleTimeMap, rtDimensionArray },
"float",
{ 1671386560U,
2954498450U,
2418456181U,
4221723537U },
{ 3686526386U,
612300788U,
1423871903U,
3733884905U },
(NULL), 0,
0
};
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -206,7 +206,7 @@ P_cr929_SIL_T cr929_SIL_P = {
/* Variable: wind_east
* Referenced by: '<S1870>/wind_East'
*/
{ -1.0, -5.0 },
{ -3.0, -6.0 },
/* Variable: wind_level
* Referenced by:
@@ -218,7 +218,7 @@ P_cr929_SIL_T cr929_SIL_P = {
/* Variable: wind_north
* Referenced by: '<S1870>/wind_North'
*/
{ -3.0, -15.0 },
{ 3.0, 15.0 },
/* Variable: CLa
* Referenced by: '<S1457>/Constant Single1'
@@ -3252,19 +3252,19 @@ const ConstP_cr929_SIL_T cr929_SIL_ConstP = {
5001U,
4.0F,
{ 439334730, 1201471060 }
{ 439353783, 1201344274 }
}, { 5001U,
4.0F,
{ 439344421, 1202049818 }
{ 439359731, 1202084775 }
}, { 5001U,
4.0F,
{ 438831665, 1202055906 }
{ 438769762, 1202088529 }
}, { 5001U,
4.0F,
{ 438834294, 1201496025 }
{ 438783497, 1201357090 }
}, { 0U,
0.0F,
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -16,10 +16,10 @@
#ifndef RTW_HEADER_cr929_SIL_private_h_
#define RTW_HEADER_cr929_SIL_private_h_
void save_mission(char typ);
void get_sbg_crc16(const unsigned char *u0,
unsigned short *y0,
unsigned short u_width);
void save_mission(char typ);
#include "rtwtypes.h"
#include "builtin_typeid_types.h"
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
@@ -3,9 +3,9 @@
*
* Code generated for Simulink model 'cr929_SIL'.
*
* Model version : 1.2408
* Model version : 1.2413
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Thu Dec 15 09:54:48 2022
* C/C++ source code generated on : Thu Dec 15 11:50:06 2022
*
* Target selection: ert_shrlib.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)