diff --git a/fbw-a380x/src/wasm/fbw_a380/build.sh b/fbw-a380x/src/wasm/fbw_a380/build.sh index faa69dc31b6..d2d55ca41dc 100755 --- a/fbw-a380x/src/wasm/fbw_a380/build.sh +++ b/fbw-a380x/src/wasm/fbw_a380/build.sh @@ -126,11 +126,9 @@ clang++ \ "${DIR}/src/model/FacComputer_data.cpp" \ "${DIR}/src/model/FacComputer.cpp" \ "${DIR}/src/model/look1_binlxpw.cpp" \ - "${DIR}/src/model/look2_binlcpw.cpp" \ "${DIR}/src/model/look2_binlxpw.cpp" \ "${DIR}/src/model/look2_pbinlxpw.cpp" \ - "${DIR}/src/model/mod_mvZvttxs.cpp" \ - "${DIR}/src/model/mod_2RcCQkwc.cpp" \ + "${DIR}/src/model/mod_OlzklkXq.cpp" \ "${DIR}/src/model/MultiWordIor.cpp" \ "${DIR}/src/model/rt_modd.cpp" \ "${DIR}/src/model/rt_remd.cpp" \ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.cpp b/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.cpp index ec5d68ce173..ee0e9614101 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.cpp @@ -1858,7 +1858,7 @@ bool FlyByWireInterface::updateFac(double sampleTime, int facIndex) { idFacCenterOfGravity[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].center_of_gravity_pos_percent)); idFacSideslipTarget[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].sideslip_target_deg)); idFacSlatAngle[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].fac_slat_angle_deg)); - idFacFlapAngle[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].fac_flap_angle)); + idFacFlapAngle[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].fac_flap_angle_deg)); idFacDiscreteWord2[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].discrete_word_2)); idFacRudderTravelLimitCommand[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].rudder_travel_limit_command_deg)); idFacDeltaRYawDamperVoted[facIndex]->set(Arinc429Utils::toSimVar(facsBusOutputs[facIndex].delta_r_yaw_damper_deg)); @@ -2121,8 +2121,10 @@ bool FlyByWireInterface::updateAutopilotStateMachine(double sampleTime) { autopilotStateMachineInput.in.data.cruise_altitude = idFmgcCruiseAltitude->get(); autopilotStateMachineInput.in.data.throttle_lever_1_pos = thrustLeverAngle_1->get(); autopilotStateMachineInput.in.data.throttle_lever_2_pos = thrustLeverAngle_2->get(); - autopilotStateMachineInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autopilotStateMachineInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; + autopilotStateMachineInput.in.data.gear_strut_compression_1 = + std::max(simData.contact_point_compression_1 * 0.5 + 0.5, simData.contact_point_compression_3 * 0.5 + 0.5); + autopilotStateMachineInput.in.data.gear_strut_compression_2 = + std::max(simData.contact_point_compression_2 * 0.5 + 0.5, simData.contact_point_compression_4 * 0.5 + 0.5); autopilotStateMachineInput.in.data.zeta_pos = simData.zeta_pos; autopilotStateMachineInput.in.data.flaps_handle_index = flapsHandleIndexFlapConf->get(); autopilotStateMachineInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; @@ -2471,8 +2473,10 @@ bool FlyByWireInterface::updateAutopilotLaws(double sampleTime) { autopilotLawsInput.in.data.acceleration_altitude_go_around_engine_out = fmAccelerationAltitudeGoAroundEngineOut->valueOr(0); autopilotLawsInput.in.data.throttle_lever_1_pos = thrustLeverAngle_1->get(); autopilotLawsInput.in.data.throttle_lever_2_pos = thrustLeverAngle_2->get(); - autopilotLawsInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autopilotLawsInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; + autopilotLawsInput.in.data.gear_strut_compression_1 = + std::max(simData.contact_point_compression_1 * 0.5 + 0.5, simData.contact_point_compression_3 * 0.5 + 0.5); + autopilotLawsInput.in.data.gear_strut_compression_2 = + std::max(simData.contact_point_compression_2 * 0.5 + 0.5, simData.contact_point_compression_4 * 0.5 + 0.5); autopilotLawsInput.in.data.zeta_pos = simData.zeta_pos; autopilotLawsInput.in.data.flaps_handle_index = flapsHandleIndexFlapConf->get(); autopilotLawsInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; @@ -2686,8 +2690,10 @@ bool FlyByWireInterface::updateAutothrust(double sampleTime) { autoThrustInput.in.data.bx_m_s2 = simData.bx_m_s2; autoThrustInput.in.data.by_m_s2 = simData.by_m_s2; autoThrustInput.in.data.bz_m_s2 = simData.bz_m_s2; - autoThrustInput.in.data.gear_strut_compression_1 = simData.gear_animation_pos_1; - autoThrustInput.in.data.gear_strut_compression_2 = simData.gear_animation_pos_2; + autoThrustInput.in.data.gear_strut_compression_1 = + std::max(simData.contact_point_compression_1 * 0.5 + 0.5, simData.contact_point_compression_3 * 0.5 + 0.5); + autoThrustInput.in.data.gear_strut_compression_2 = + std::max(simData.contact_point_compression_2 * 0.5 + 0.5, simData.contact_point_compression_4 * 0.5 + 0.5); autoThrustInput.in.data.flap_handle_index = flapsHandleIndexFlapConf->get(); autoThrustInput.in.data.is_engine_operative_1 = simData.engine_combustion_1; autoThrustInput.in.data.is_engine_operative_2 = simData.engine_combustion_2; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/fac/Fac.cpp b/fbw-a380x/src/wasm/fbw_a380/src/fac/Fac.cpp index 314ebd136bf..79ea93f2395 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/fac/Fac.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/fac/Fac.cpp @@ -99,7 +99,7 @@ base_fac_bus Fac::getBusOutputs() { output.center_of_gravity_pos_percent.SSM = Arinc429SignStatus::FailureWarning; output.sideslip_target_deg.SSM = Arinc429SignStatus::FailureWarning; output.fac_slat_angle_deg.SSM = Arinc429SignStatus::FailureWarning; - output.fac_flap_angle.SSM = Arinc429SignStatus::FailureWarning; + output.fac_flap_angle_deg.SSM = Arinc429SignStatus::FailureWarning; output.rudder_travel_limit_command_deg.SSM = Arinc429SignStatus::FailureWarning; output.delta_r_yaw_damper_deg.SSM = Arinc429SignStatus::FailureWarning; output.estimated_sideslip_deg.SSM = Arinc429SignStatus::FailureWarning; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectData.h b/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectData.h index 80e08e7965f..12ff29439c2 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectData.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectData.h @@ -140,6 +140,11 @@ struct SimData { double wheelRpmRightBlg; double wheelRpmLeftWlg; double wheelRpmRightWlg; + double contact_point_compression_0; + double contact_point_compression_1; + double contact_point_compression_2; + double contact_point_compression_3; + double contact_point_compression_4; }; struct SimInput { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp b/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp index 002cdbc0c3e..2919cbdc6d6 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp @@ -272,6 +272,11 @@ bool SimConnectInterface::prepareSimDataSimConnectDataDefinitions() { result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "WHEEL RPM:2", "RPM"); result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "WHEEL RPM:3", "RPM"); result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "WHEEL RPM:4", "RPM"); + result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "CONTACT POINT COMPRESSION", "PERCENT"); + result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "CONTACT POINT COMPRESSION:1", "PERCENT"); + result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "CONTACT POINT COMPRESSION:2", "PERCENT"); + result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "CONTACT POINT COMPRESSION:3", "PERCENT"); + result &= addDataDefinition(hSimConnect, 0, SIMCONNECT_DATATYPE_FLOAT64, "CONTACT POINT COMPRESSION:4", "PERCENT"); return result; } diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw.h index b86cf7b66bb..b9bac5c1794 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380LateralDirectLaw_h_ -#define RTW_HEADER_A380LateralDirectLaw_h_ +#ifndef A380LateralDirectLaw_h_ +#define A380LateralDirectLaw_h_ #include "rtwtypes.h" #include "A380LateralDirectLaw_types.h" #include diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_private.h index 889e505e7a5..5e70d792a5b 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380LateralDirectLaw_private_h_ -#define RTW_HEADER_A380LateralDirectLaw_private_h_ +#ifndef A380LateralDirectLaw_private_h_ +#define A380LateralDirectLaw_private_h_ #include "rtwtypes.h" #include "A380LateralDirectLaw_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_types.h index f3712cd03ca..23fdc5419b6 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw_types.h @@ -1,4 +1,4 @@ -#ifndef RTW_HEADER_A380LateralDirectLaw_types_h_ -#define RTW_HEADER_A380LateralDirectLaw_types_h_ +#ifndef A380LateralDirectLaw_types_h_ +#define A380LateralDirectLaw_types_h_ #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp index 8d09a51cc70..3bdfb8c0772 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp @@ -351,8 +351,8 @@ void A380LateralNormalLaw::reset(void) A380LateralNormalLaw_RateLimiter_Reset(&A380LateralNormalLaw_DWork.sf_RateLimiter_k); A380LateralNormalLaw_DWork.pY_not_empty = false; A380LateralNormalLaw_DWork.pU_not_empty = false; - A380LateralNormalLaw_DWork.pY_not_empty_o = false; - A380LateralNormalLaw_DWork.pY_not_empty_l = false; + A380LateralNormalLaw_DWork.pY_not_empty_g = false; + A380LateralNormalLaw_DWork.pY_not_empty_m = false; A380LateralNormalLaw_RateLimiter_Reset(&A380LateralNormalLaw_DWork.sf_RateLimiter_go); A380LateralNormalLaw_RateLimiter_Reset(&A380LateralNormalLaw_DWork.sf_RateLimiter_g); A380LateralNormalLaw_TransportDelay_Reset(&A380LateralNormalLaw_DWork.sf_TransportDelay_p); @@ -370,17 +370,10 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ *rty_Out_xi_midboard_deg, real_T *rty_Out_xi_outboard_deg, real_T *rty_Out_xi_spoiler_deg, real_T *rty_Out_zeta_upper_deg, real_T *rty_Out_zeta_lower_deg) { - static const real_T c_0[5]{ 0.3, 0.3, 0.4, 0.8, 0.8 }; - - static const int16_T b_0[5]{ -1, 0, 120, 320, 400 }; - - static const int16_T b[4]{ 0, 120, 150, 380 }; - - static const int8_T c[4]{ -15, -15, -15, -2 }; - real_T L_xi; real_T Vias; real_T Vtas; + real_T denom; real_T k_phi; real_T omega_0; real_T r; @@ -388,9 +381,8 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ real_T rtb_Gain1_h; real_T rtb_Gain_b; real_T rtb_Limiterxi; - real_T rtb_Product1_pm; real_T rtb_Y; - real_T rtb_Y_j5; + real_T rtb_Y_j; real_T rtb_beDot; real_T v_cas_ms; int32_T high_i; @@ -400,6 +392,14 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ int16_T r_tmp; boolean_T rtb_NOT_h_tmp; boolean_T rtb_OR1; + static const int16_T b[4]{ 0, 120, 150, 380 }; + + static const int8_T c[4]{ -15, -15, -15, -2 }; + + static const int16_T b_0[5]{ -1, 0, 120, 320, 400 }; + + static const real_T c_0[5]{ 0.3, 0.3, 0.4, 0.8, 0.8 }; + rtb_NOT_h_tmp = !*rtu_In_on_ground; if (static_cast(rtb_NOT_h_tmp) > A380LateralNormalLaw_rtP.Saturation_UpperSat) { omega_0 = A380LateralNormalLaw_rtP.Saturation_UpperSat; @@ -411,7 +411,7 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_RateLimiter(omega_0, A380LateralNormalLaw_rtP.RateLimiterVariableTs_up, A380LateralNormalLaw_rtP.RateLimiterVariableTs_lo, rtu_In_time_dt, - A380LateralNormalLaw_rtP.RateLimiterVariableTs_InitialCondition, &rtb_Y_j5, + A380LateralNormalLaw_rtP.RateLimiterVariableTs_InitialCondition, &rtb_Y_j, &A380LateralNormalLaw_DWork.sf_RateLimiter); rtb_Gain_b = A380LateralNormalLaw_rtP.Gain_Gain_c * *rtu_In_delta_xi_pos; rtb_Gain1_h = A380LateralNormalLaw_rtP.Gain1_Gain * *rtu_In_delta_zeta_pos; @@ -453,7 +453,7 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition, &Vias, &A380LateralNormalLaw_DWork.sf_RateLimiter_k); rtb_beDot = *rtu_In_r_deg_s; - rtb_Product1_pm = *rtu_In_beta_deg; + denom = *rtu_In_beta_deg; rtb_Y = *rtu_In_V_ias_kn; Vtas = *rtu_In_V_tas_kn; rtb_Limiterxi = A380LateralNormalLaw_rtP.Gain1_Gain_o * *rtu_In_delta_xi_pos; @@ -525,9 +525,9 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ } A380LateralNormalLaw_DWork.Delay_DSTATE = std::fmin(rtb_Divide, std::fmax(rtb_Limiterxi, - A380LateralNormalLaw_DWork.Delay_DSTATE * rtb_Y_j5)) * - A380LateralNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain * *rtu_In_time_dt; - rtb_OR1 = ((rtb_Y_j5 == 0.0) || (*rtu_In_tracking_mode_on) || (*rtu_In_any_ap_engaged)); + A380LateralNormalLaw_DWork.Delay_DSTATE * rtb_Y_j)) * A380LateralNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain + * *rtu_In_time_dt; + rtb_OR1 = ((rtb_Y_j == 0.0) || (*rtu_In_tracking_mode_on) || (*rtu_In_any_ap_engaged)); rtb_Divide = *rtu_In_Phi_deg - A380LateralNormalLaw_DWork.Delay_DSTATE; A380LateralNormalLaw_DWork.icLoad = (rtb_OR1 || A380LateralNormalLaw_DWork.icLoad); if (A380LateralNormalLaw_DWork.icLoad) { @@ -557,11 +557,11 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ Vtas = std::fmax(1.0, Vtas * 0.5144); rtb_Limiterxi = rtb_Y * 0.5144; if (rtb_Y >= 60.0) { - rtb_beDot = ((rtb_Limiterxi * rtb_Limiterxi * 0.6125 * 122.0 / (70000.0 * Vtas) * 0.814 * rtb_Product1_pm * - 3.1415926535897931 / 180.0 - rtb_beDot * 3.1415926535897931 / 180.0) + rtb_Divide * 3.1415926535897931 - / 180.0 * (9.81 / Vtas)) * 180.0 / 3.1415926535897931; + rtb_beDot = ((rtb_Limiterxi * rtb_Limiterxi * 0.6125 * 122.0 / (70000.0 * Vtas) * 0.814 * denom * 3.1415926535897931 + / 180.0 - rtb_beDot * 3.1415926535897931 / 180.0) + rtb_Divide * 3.1415926535897931 / 180.0 * (9.81 / + Vtas)) * 180.0 / 3.1415926535897931; } else { - rtb_Product1_pm = 0.0; + denom = 0.0; rtb_beDot = 0.0; } @@ -575,7 +575,7 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ rtb_Limiterxi = look1_binlxpw(*rtu_In_V_ias_kn, A380LateralNormalLaw_rtP.ScheduledGain1_BreakpointsForDimension1, A380LateralNormalLaw_rtP.ScheduledGain1_Table, 4U); - rtb_Limiterxi = (A380LateralNormalLaw_DWork.Delay_DSTATE - rtb_Product1_pm) * rtb_Limiterxi - rtb_beDot; + rtb_Limiterxi = (A380LateralNormalLaw_DWork.Delay_DSTATE - denom) * rtb_Limiterxi - rtb_beDot; if ((!A380LateralNormalLaw_DWork.pY_not_empty) || (!A380LateralNormalLaw_DWork.pU_not_empty)) { A380LateralNormalLaw_DWork.pU = rtb_Limiterxi; A380LateralNormalLaw_DWork.pU_not_empty = true; @@ -583,10 +583,10 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_DWork.pY_not_empty = true; } - rtb_Product1_pm = *rtu_In_time_dt * A380LateralNormalLaw_rtP.LagFilter_C1; - rtb_beDot = rtb_Product1_pm / (rtb_Product1_pm + 2.0); - A380LateralNormalLaw_DWork.pY = (2.0 - rtb_Product1_pm) / (rtb_Product1_pm + 2.0) * A380LateralNormalLaw_DWork.pY + - (rtb_Limiterxi * rtb_beDot + A380LateralNormalLaw_DWork.pU * rtb_beDot); + denom = *rtu_In_time_dt * A380LateralNormalLaw_rtP.LagFilter_C1; + rtb_beDot = denom / (denom + 2.0); + A380LateralNormalLaw_DWork.pY = (2.0 - denom) / (denom + 2.0) * A380LateralNormalLaw_DWork.pY + (rtb_Limiterxi * + rtb_beDot + A380LateralNormalLaw_DWork.pU * rtb_beDot); A380LateralNormalLaw_DWork.pU = rtb_Limiterxi; rtb_Limiterxi = look1_binlxpw(*rtu_In_V_ias_kn, A380LateralNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1, A380LateralNormalLaw_rtP.ScheduledGain_Table, 8U); @@ -598,9 +598,9 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_DWork.Delay_DSTATE = A380LateralNormalLaw_rtP.Saturation_LowerSat_l; } - if (!A380LateralNormalLaw_DWork.pY_not_empty_o) { + if (!A380LateralNormalLaw_DWork.pY_not_empty_g) { A380LateralNormalLaw_DWork.pY_f = A380LateralNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition; - A380LateralNormalLaw_DWork.pY_not_empty_o = true; + A380LateralNormalLaw_DWork.pY_not_empty_g = true; } A380LateralNormalLaw_DWork.pY_f += std::fmax(std::fmin(static_cast(*rtu_In_on_ground) - @@ -614,8 +614,7 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_f; } - rtb_Product1_pm = (A380LateralNormalLaw_rtP.Constant_Value_o - rtb_Limiterxi) * - A380LateralNormalLaw_DWork.Delay_DSTATE; + denom = (A380LateralNormalLaw_rtP.Constant_Value_o - rtb_Limiterxi) * A380LateralNormalLaw_DWork.Delay_DSTATE; rtb_beDot = *rtu_In_ap_beta_c_deg * rtb_Limiterxi; rtb_Limiterxi = A380LateralNormalLaw_rtP.Gain1_Gain_l * *rtu_In_Theta_deg; A380LateralNormalLaw_DWork.Delay_DSTATE = *rtu_In_V_tas_kn; @@ -638,20 +637,20 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_DWork.Delay_DSTATE = A380LateralNormalLaw_rtP.Saturation1_LowerSat; } - if (!A380LateralNormalLaw_DWork.pY_not_empty_l) { - A380LateralNormalLaw_DWork.pY_h = A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_m; - A380LateralNormalLaw_DWork.pY_not_empty_l = true; + if (!A380LateralNormalLaw_DWork.pY_not_empty_m) { + A380LateralNormalLaw_DWork.pY_f5 = A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_m; + A380LateralNormalLaw_DWork.pY_not_empty_m = true; } - A380LateralNormalLaw_DWork.pY_h += std::fmax(std::fmin(static_cast(rtb_NOT_h_tmp) - - A380LateralNormalLaw_DWork.pY_h, std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs1_up_j) * *rtu_In_time_dt), + A380LateralNormalLaw_DWork.pY_f5 += std::fmax(std::fmin(static_cast(rtb_NOT_h_tmp) - + A380LateralNormalLaw_DWork.pY_f5, std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs1_up_j) * *rtu_In_time_dt), -std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs1_lo_n) * *rtu_In_time_dt); - if (A380LateralNormalLaw_DWork.pY_h > A380LateralNormalLaw_rtP.Saturation_UpperSat_n) { + if (A380LateralNormalLaw_DWork.pY_f5 > A380LateralNormalLaw_rtP.Saturation_UpperSat_n) { rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_UpperSat_n; - } else if (A380LateralNormalLaw_DWork.pY_h < A380LateralNormalLaw_rtP.Saturation_LowerSat_b) { + } else if (A380LateralNormalLaw_DWork.pY_f5 < A380LateralNormalLaw_rtP.Saturation_LowerSat_b) { rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_LowerSat_b; } else { - rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_h; + rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_f5; } Vtas = A380LateralNormalLaw_DWork.Delay_DSTATE * rtb_Limiterxi; @@ -665,12 +664,12 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_DWork.Delay_DSTATE = A380LateralNormalLaw_rtP.Saturation2_LowerSat; } - A380LateralNormalLaw_RateLimiter(A380LateralNormalLaw_rtP.Gain6_Gain_j * ((rtb_beDot + rtb_Product1_pm) + (Vtas + + A380LateralNormalLaw_RateLimiter(A380LateralNormalLaw_rtP.Gain6_Gain_j * ((rtb_beDot + denom) + (Vtas + (A380LateralNormalLaw_rtP.Constant_Value_k - rtb_Limiterxi) * A380LateralNormalLaw_DWork.Delay_DSTATE)), A380LateralNormalLaw_rtP.RateLimiterVariableTs4_up, A380LateralNormalLaw_rtP.RateLimiterVariableTs4_lo, rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs4_InitialCondition, &rtb_Y, &A380LateralNormalLaw_DWork.sf_RateLimiter_go); - A380LateralNormalLaw_DWork.Delay_DSTATE = rtb_Y_j5 + static_cast(*rtu_In_any_ap_engaged); + A380LateralNormalLaw_DWork.Delay_DSTATE = rtb_Y_j + static_cast(*rtu_In_any_ap_engaged); if (A380LateralNormalLaw_DWork.Delay_DSTATE > A380LateralNormalLaw_rtP.Saturation1_UpperSat_e) { A380LateralNormalLaw_DWork.Delay_DSTATE = A380LateralNormalLaw_rtP.Saturation1_UpperSat_e; } else if (A380LateralNormalLaw_DWork.Delay_DSTATE < A380LateralNormalLaw_rtP.Saturation1_LowerSat_l) { @@ -687,12 +686,12 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_RateLimiter(rtb_Y * rtb_Limiterxi + (A380LateralNormalLaw_rtP.Constant_Value_g - rtb_Limiterxi) * rtb_Gain1_h, A380LateralNormalLaw_rtP.RateLimiterVariableTs3_up, A380LateralNormalLaw_rtP.RateLimiterVariableTs3_lo, - rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs3_InitialCondition, &rtb_Y_j5, + rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs3_InitialCondition, &rtb_Y_j, &A380LateralNormalLaw_DWork.sf_RateLimiter_g); if (static_cast(rtb_NOT_h_tmp) > A380LateralNormalLaw_rtP.Switch1_Threshold) { - rtb_Limiterxi = A380LateralNormalLaw_rtP.Gain3_Gain * rtb_Y_j5; + rtb_Limiterxi = A380LateralNormalLaw_rtP.Gain3_Gain * rtb_Y_j; } else { - rtb_Limiterxi = rtb_Y_j5; + rtb_Limiterxi = rtb_Y_j; } if (rtb_Limiterxi > A380LateralNormalLaw_rtP.Saturation6_UpperSat) { @@ -704,7 +703,7 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ } rtb_OR1 = !rtb_NOT_h_tmp; - A380LateralNormalLaw_TransportDelay(rtb_Y_j5, rtu_In_time_dt, rtb_OR1, &rtb_Limiterxi, + A380LateralNormalLaw_TransportDelay(rtb_Y_j, rtu_In_time_dt, rtb_OR1, &rtb_Limiterxi, &A380LateralNormalLaw_DWork.sf_TransportDelay_p); if (rtb_Limiterxi > A380LateralNormalLaw_rtP.Saturation5_UpperSat) { *rty_Out_zeta_upper_deg = A380LateralNormalLaw_rtP.Saturation5_UpperSat; @@ -721,12 +720,12 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ } rtb_Gain1_h = A380LateralNormalLaw_rtP.Gain1_Gain_h * *rtu_In_Phi_deg; - rtb_Y_j5 = A380LateralNormalLaw_rtP.Gain1_Gain_d * *rtu_In_pk_deg_s; + rtb_Y_j = A380LateralNormalLaw_rtP.Gain1_Gain_d * *rtu_In_pk_deg_s; rtb_Limiterxi = look1_binlxpw(*rtu_In_time_dt, A380LateralNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1_b, A380LateralNormalLaw_rtP.ScheduledGain_Table_h, 4U); A380LateralNormalLaw_DWork.Delay1_DSTATE = ((-(Vias / v_cas_ms * 845.0 * 1592.01 * -0.5 / 8.5E+7 + 1.414 * omega_0) / - L_xi * rtb_Y_j5 + k_phi * rtb_Gain1_h) + A380LateralNormalLaw_rtP.Gain1_Gain_j * rtb_Divide * -k_phi) * - rtb_Limiterxi * A380LateralNormalLaw_rtP.Gain_Gain_cw; + L_xi * rtb_Y_j + k_phi * rtb_Gain1_h) + A380LateralNormalLaw_rtP.Gain1_Gain_j * rtb_Divide * -k_phi) * rtb_Limiterxi + * A380LateralNormalLaw_rtP.Gain_Gain_cw; if (A380LateralNormalLaw_DWork.Delay1_DSTATE > A380LateralNormalLaw_rtP.Limiterxi_UpperSat) { omega_0 = A380LateralNormalLaw_rtP.Limiterxi_UpperSat; } else if (A380LateralNormalLaw_DWork.Delay1_DSTATE < A380LateralNormalLaw_rtP.Limiterxi_LowerSat) { @@ -737,9 +736,9 @@ void A380LateralNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_ A380LateralNormalLaw_RateLimiter(A380LateralNormalLaw_rtP.Gain5_Gain * omega_0, A380LateralNormalLaw_rtP.RateLimiterVariableTs2_up_g, A380LateralNormalLaw_rtP.RateLimiterVariableTs2_lo_o, - rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition_c, &rtb_Y_j5, + rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition_c, &rtb_Y_j, &A380LateralNormalLaw_DWork.sf_RateLimiter_l); - A380LateralNormalLaw_RateLimiter(rtb_Y_j5 * A380LateralNormalLaw_DWork.Delay_DSTATE + + A380LateralNormalLaw_RateLimiter(rtb_Y_j * A380LateralNormalLaw_DWork.Delay_DSTATE + (A380LateralNormalLaw_rtP.Constant_Value_j - A380LateralNormalLaw_DWork.Delay_DSTATE) * rtb_Gain_b, A380LateralNormalLaw_rtP.RateLimiterVariableTs1_up_d, A380LateralNormalLaw_rtP.RateLimiterVariableTs1_lo_k, rtu_In_time_dt, A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_e, &rtb_Gain1_h, diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.h index 0eadff9408d..941d54f326c 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380LateralNormalLaw_h_ -#define RTW_HEADER_A380LateralNormalLaw_h_ +#ifndef A380LateralNormalLaw_h_ +#define A380LateralNormalLaw_h_ #include "rtwtypes.h" #include "A380LateralNormalLaw_types.h" #include @@ -25,12 +25,12 @@ class A380LateralNormalLaw final real_T pY; real_T pU; real_T pY_f; - real_T pY_h; + real_T pY_f5; boolean_T icLoad; boolean_T pY_not_empty; boolean_T pU_not_empty; - boolean_T pY_not_empty_o; - boolean_T pY_not_empty_l; + boolean_T pY_not_empty_g; + boolean_T pY_not_empty_m; rtDW_TransportDelay_A380LateralNormalLaw_T sf_TransportDelay_p; rtDW_TransportDelay_A380LateralNormalLaw_T sf_TransportDelay; rtDW_RateLimiter_A380LateralNormalLaw_T sf_RateLimiter_go; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_data.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_data.cpp deleted file mode 100644 index d23630491f7..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_data.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "A380LateralNormalLaw.h" - -const A380LateralNormalLaw::rtC_A380LateralNormalLaw_T A380LateralNormalLaw_ConstB{ - 0.0 -}; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_private.h index 3fca62532fb..1fa266012f0 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380LateralNormalLaw_private_h_ -#define RTW_HEADER_A380LateralNormalLaw_private_h_ +#ifndef A380LateralNormalLaw_private_h_ +#define A380LateralNormalLaw_private_h_ #include "rtwtypes.h" #include "A380LateralNormalLaw_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_types.h index 4202f8b1443..e19c8c6ff4e 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw_types.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380LateralNormalLaw_types_h_ -#define RTW_HEADER_A380LateralNormalLaw_types_h_ +#ifndef A380LateralNormalLaw_types_h_ +#define A380LateralNormalLaw_types_h_ #include "rtwtypes.h" #ifndef DEFINED_TYPEDEF_FOR_base_time_ #define DEFINED_TYPEDEF_FOR_base_time_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.cpp index 951bed16d79..7199baf80bc 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.cpp @@ -427,10 +427,10 @@ void A380PitchAlternateLaw::reset(void) A380PitchAlternateLaw_DWork.icLoad = true; A380PitchAlternateLaw_DWork.is_active_c9_A380PitchAlternateLaw = 0U; A380PitchAlternateLaw_DWork.is_c9_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_NO_ACTIVE_CHILD; - A380PitchAlternateLaw_DWork.is_active_c1_A380PitchAlternateLaw = 0U; - A380PitchAlternateLaw_DWork.is_c1_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_NO_ACTIVE_CHILD; rtb_nz_limit_up_g = 0.0; rtb_nz_limit_lo_g = 0.0; + A380PitchAlternateLaw_DWork.is_active_c1_A380PitchAlternateLaw = 0U; + A380PitchAlternateLaw_DWork.is_c1_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_NO_ACTIVE_CHILD; A380PitchAlternateLaw_RateLimiter_Reset(&A380PitchAlternateLaw_DWork.sf_RateLimiter); A380PitchAlternateLaw_LagFilter_Reset(&A380PitchAlternateLaw_DWork.sf_LagFilter_g3); A380PitchAlternateLaw_WashoutFilter_Reset(&A380PitchAlternateLaw_DWork.sf_WashoutFilter_c); @@ -480,7 +480,7 @@ void A380PitchAlternateLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu real_T y_0; int32_T tmp; boolean_T rtb_eta_trim_deg_should_freeze; - if (A380PitchAlternateLaw_DWork.is_active_c9_A380PitchAlternateLaw == 0U) { + if (A380PitchAlternateLaw_DWork.is_active_c9_A380PitchAlternateLaw == 0) { A380PitchAlternateLaw_DWork.is_active_c9_A380PitchAlternateLaw = 1U; A380PitchAlternateLaw_DWork.is_c9_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_running; rtb_eta_trim_deg_should_freeze = false; @@ -518,7 +518,7 @@ void A380PitchAlternateLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu } rtb_Gain5 = A380PitchAlternateLaw_rtP.Gain5_Gain * rtb_Switch_c; - if (A380PitchAlternateLaw_DWork.is_active_c1_A380PitchAlternateLaw == 0U) { + if (A380PitchAlternateLaw_DWork.is_active_c1_A380PitchAlternateLaw == 0) { A380PitchAlternateLaw_DWork.is_active_c1_A380PitchAlternateLaw = 1U; A380PitchAlternateLaw_DWork.is_c1_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_ground; rtb_eta_trim_deg_rate_limit_up_deg_s = 0.25; @@ -834,7 +834,7 @@ void A380PitchAlternateLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu &A380PitchAlternateLaw_DWork.sf_RateLimiter_b); *rty_Out_eta_trim_limit_up = A380PitchAlternateLaw_rtP.Constant2_Value; *rty_Out_eta_trim_limit_lo = A380PitchAlternateLaw_rtP.Constant3_Value_j; - if (A380PitchAlternateLaw_DWork.is_active_c8_A380PitchAlternateLaw == 0U) { + if (A380PitchAlternateLaw_DWork.is_active_c8_A380PitchAlternateLaw == 0) { A380PitchAlternateLaw_DWork.is_active_c8_A380PitchAlternateLaw = 1U; A380PitchAlternateLaw_DWork.is_c8_A380PitchAlternateLaw = A380PitchAlternateLaw_IN_manual; } else { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.h index c1147517649..fdb995a6463 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchAlternateLaw_h_ -#define RTW_HEADER_A380PitchAlternateLaw_h_ +#ifndef A380PitchAlternateLaw_h_ +#define A380PitchAlternateLaw_h_ #include "rtwtypes.h" #include "A380PitchAlternateLaw_types.h" #include diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_private.h index 497e6e11e70..45ec5bcacec 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchAlternateLaw_private_h_ -#define RTW_HEADER_A380PitchAlternateLaw_private_h_ +#ifndef A380PitchAlternateLaw_private_h_ +#define A380PitchAlternateLaw_private_h_ #include "rtwtypes.h" #include "A380PitchAlternateLaw_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_types.h index 9d0096d5c46..f35a5183530 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw_types.h @@ -1,4 +1,4 @@ -#ifndef RTW_HEADER_A380PitchAlternateLaw_types_h_ -#define RTW_HEADER_A380PitchAlternateLaw_types_h_ +#ifndef A380PitchAlternateLaw_types_h_ +#define A380PitchAlternateLaw_types_h_ #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw.h index bf144a4b6d1..1a75ac3c233 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchDirectLaw_h_ -#define RTW_HEADER_A380PitchDirectLaw_h_ +#ifndef A380PitchDirectLaw_h_ +#define A380PitchDirectLaw_h_ #include "rtwtypes.h" #include "A380PitchDirectLaw_types.h" #include diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_private.h index 6451f074b49..5544a11b0f3 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchDirectLaw_private_h_ -#define RTW_HEADER_A380PitchDirectLaw_private_h_ +#ifndef A380PitchDirectLaw_private_h_ +#define A380PitchDirectLaw_private_h_ #include "rtwtypes.h" #include "A380PitchDirectLaw_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_types.h index 3e5e067ab6c..25c89a3ff46 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw_types.h @@ -1,4 +1,4 @@ -#ifndef RTW_HEADER_A380PitchDirectLaw_types_h_ -#define RTW_HEADER_A380PitchDirectLaw_types_h_ +#ifndef A380PitchDirectLaw_types_h_ +#define A380PitchDirectLaw_types_h_ #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp index dc6ae12d42b..bca66b4b83d 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp @@ -18,7 +18,7 @@ const uint8_T A380PitchNormalLaw_IN_running{ 2U }; const uint8_T A380PitchNormalLaw_IN_FlightToGroundTransition{ 2U }; -const uint8_T A380PitchNormalLaw_IN_Flight_p{ 1U }; +const uint8_T A380PitchNormalLaw_IN_Flight_b{ 1U }; const uint8_T A380PitchNormalLaw_IN_GroundToFlightTransition{ 4U }; @@ -1001,21 +1001,21 @@ void A380PitchNormalLaw::reset(void) A380PitchNormalLaw_DWork.Delay_DSTATE_ej = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_InitialCondition_b; A380PitchNormalLaw_DWork.Delay_DSTATE_e4 = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_InitialCondition_p; A380PitchNormalLaw_DWork.icLoad_p = true; - A380PitchNormalLaw_DWork.is_active_c3_A380PitchNormalLaw = 0U; - A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; A380PitchNormalLaw_B.in_flight = 0.0; A380PitchNormalLaw_DWork.on_ground_time = 0.0; A380PitchNormalLaw_DWork.in_flight_time = 0.0; + A380PitchNormalLaw_DWork.is_active_c3_A380PitchNormalLaw = 0U; + A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; A380PitchNormalLaw_DWork.is_active_c8_A380PitchNormalLaw = 0U; A380PitchNormalLaw_DWork.is_c8_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; A380PitchNormalLaw_DWork.is_active_c2_A380PitchNormalLaw = 0U; A380PitchNormalLaw_DWork.is_c2_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; A380PitchNormalLaw_DWork.is_active_c9_A380PitchNormalLaw = 0U; A380PitchNormalLaw_DWork.is_c9_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; - A380PitchNormalLaw_DWork.is_active_c7_A380PitchNormalLaw = 0U; - A380PitchNormalLaw_DWork.is_c7_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; rtb_nz_limit_up_g = 0.0; rtb_nz_limit_lo_g = 0.0; + A380PitchNormalLaw_DWork.is_active_c7_A380PitchNormalLaw = 0U; + A380PitchNormalLaw_DWork.is_c7_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; A380PitchNormalLaw_RateLimiter_Reset(&A380PitchNormalLaw_DWork.sf_RateLimiter); A380PitchNormalLaw_DWork.is_active_c6_A380PitchNormalLaw = 0U; A380PitchNormalLaw_DWork.is_c6_A380PitchNormalLaw = A380PitchNormalLaw_IN_NO_ACTIVE_CHILD; @@ -1097,12 +1097,12 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In real_T rtb_Saturation_ix; real_T rtb_Sum1_n; real_T rtb_Sum_ma; - real_T rtb_Y_d; - real_T rtb_Y_ej; + real_T rtb_Y_b; + real_T rtb_Y_g; + real_T rtb_Y_h; real_T rtb_Y_i; - real_T rtb_Y_je; - real_T rtb_Y_mt; - real_T rtb_Y_n; + real_T rtb_Y_j; + real_T rtb_Y_ld; real_T rtb_Y_p; real_T rtb_alpha_err_gain; real_T rtb_eta_trim_deg_rate_limit_lo_deg_s; @@ -1116,13 +1116,13 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In int32_T rtb_in_flare; boolean_T rtb_AND; boolean_T rtb_NOT; - if (A380PitchNormalLaw_DWork.is_active_c3_A380PitchNormalLaw == 0U) { + if (A380PitchNormalLaw_DWork.is_active_c3_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c3_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_Ground; A380PitchNormalLaw_B.in_flight = 0.0; } else { switch (A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw) { - case A380PitchNormalLaw_IN_Flight_p: + case A380PitchNormalLaw_IN_Flight_b: if ((*rtu_In_on_ground) && (*rtu_In_Theta_deg < 0.5)) { A380PitchNormalLaw_DWork.on_ground_time = *rtu_In_time_simulation_time; A380PitchNormalLaw_DWork.in_flight_time = 0.0; @@ -1138,7 +1138,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_B.in_flight = 0.0; } else if ((!*rtu_In_on_ground) || (*rtu_In_Theta_deg >= 0.5)) { A380PitchNormalLaw_DWork.on_ground_time = 0.0; - A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_Flight_p; + A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_Flight_b; A380PitchNormalLaw_B.in_flight = 1.0; } break; @@ -1155,7 +1155,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In default: if (*rtu_In_time_simulation_time - A380PitchNormalLaw_DWork.in_flight_time >= 5.0) { - A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_Flight_p; + A380PitchNormalLaw_DWork.is_c3_A380PitchNormalLaw = A380PitchNormalLaw_IN_Flight_b; A380PitchNormalLaw_B.in_flight = 1.0; } else if (*rtu_In_on_ground) { A380PitchNormalLaw_DWork.in_flight_time = 0.0; @@ -1166,7 +1166,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In } } - if (A380PitchNormalLaw_DWork.is_active_c8_A380PitchNormalLaw == 0U) { + if (A380PitchNormalLaw_DWork.is_active_c8_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c8_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c8_A380PitchNormalLaw = A380PitchNormalLaw_IN_manual; } else { @@ -1205,7 +1205,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_ManualSwitch = A380PitchNormalLaw_rtP.Constant_Value; } - if (A380PitchNormalLaw_DWork.is_active_c2_A380PitchNormalLaw == 0U) { + if (A380PitchNormalLaw_DWork.is_active_c2_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c2_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c2_A380PitchNormalLaw = A380PitchNormalLaw_IN_Ground; rtb_in_flare = 0; @@ -1245,7 +1245,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_NOT = !*rtu_In_any_ap_engaged; rtb_AND = ((rtb_in_flare != 0) && rtb_NOT); - if (A380PitchNormalLaw_DWork.is_active_c9_A380PitchNormalLaw == 0U) { + if (A380PitchNormalLaw_DWork.is_active_c9_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c9_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c9_A380PitchNormalLaw = A380PitchNormalLaw_IN_running; rtb_NOT = false; @@ -1264,7 +1264,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In } rtb_Gain = A380PitchNormalLaw_rtP.Gain_Gain * *rtu_In_delta_eta_pos; - if (A380PitchNormalLaw_DWork.is_active_c7_A380PitchNormalLaw == 0U) { + if (A380PitchNormalLaw_DWork.is_active_c7_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c7_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c7_A380PitchNormalLaw = A380PitchNormalLaw_IN_ground; rtb_eta_trim_deg_rate_limit_up_deg_s = 0.25; @@ -1348,20 +1348,20 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_RateLimiter(rtb_Sum_ma, A380PitchNormalLaw_rtP.RateLimiterVariableTs_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs_lo, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition, &rtb_Y_ej, &A380PitchNormalLaw_DWork.sf_RateLimiter); - if (A380PitchNormalLaw_DWork.is_active_c6_A380PitchNormalLaw == 0U) { + A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition, &rtb_Y_b, &A380PitchNormalLaw_DWork.sf_RateLimiter); + if (A380PitchNormalLaw_DWork.is_active_c6_A380PitchNormalLaw == 0) { A380PitchNormalLaw_DWork.is_active_c6_A380PitchNormalLaw = 1U; A380PitchNormalLaw_DWork.is_c6_A380PitchNormalLaw = A380PitchNormalLaw_IN_OFF; rtb_in_flare = 0; } else if (A380PitchNormalLaw_DWork.is_c6_A380PitchNormalLaw == A380PitchNormalLaw_IN_OFF) { - if ((rtb_Y_ej < 1.0) && (*rtu_In_V_tas_kn > 70.0) && ((*rtu_In_thrust_lever_1_pos >= 35.0) || + if ((rtb_Y_b < 1.0) && (*rtu_In_V_tas_kn > 70.0) && ((*rtu_In_thrust_lever_1_pos >= 35.0) || (*rtu_In_thrust_lever_2_pos >= 35.0))) { A380PitchNormalLaw_DWork.is_c6_A380PitchNormalLaw = A380PitchNormalLaw_IN_ON; rtb_in_flare = 1; } else { rtb_in_flare = 0; } - } else if ((rtb_Y_ej == 1.0) || (*rtu_In_H_radio_ft > 400.0) || ((*rtu_In_V_tas_kn < 70.0) && + } else if ((rtb_Y_b == 1.0) || (*rtu_In_H_radio_ft > 400.0) || ((*rtu_In_V_tas_kn < 70.0) && ((*rtu_In_thrust_lever_1_pos < 35.0) || (*rtu_In_thrust_lever_2_pos < 35.0)))) { A380PitchNormalLaw_DWork.is_c6_A380PitchNormalLaw = A380PitchNormalLaw_IN_OFF; rtb_in_flare = 0; @@ -1379,32 +1379,30 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_RateLimiter(rtb_Sum_ma, A380PitchNormalLaw_rtP.RateLimiterVariableTs1_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs1_lo, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition, &rtb_Y_mt, - &A380PitchNormalLaw_DWork.sf_RateLimiter_p); + A380PitchNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition, &rtb_Y_h, &A380PitchNormalLaw_DWork.sf_RateLimiter_p); A380PitchNormalLaw_RateLimiter(rtb_nz_limit_up_g, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_lo, rtu_In_time_dt, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition, &rtb_Sum_ma, &A380PitchNormalLaw_DWork.sf_RateLimiter_c); A380PitchNormalLaw_RateLimiter(rtb_nz_limit_lo_g, A380PitchNormalLaw_rtP.RateLimiterVariableTs3_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs3_lo, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs3_InitialCondition, &rtb_Y_je, - &A380PitchNormalLaw_DWork.sf_RateLimiter_n); + A380PitchNormalLaw_rtP.RateLimiterVariableTs3_InitialCondition, &rtb_Y_p, &A380PitchNormalLaw_DWork.sf_RateLimiter_n); A380PitchNormalLaw_RateLimiter(static_cast(rtb_AND), A380PitchNormalLaw_rtP.RateLimiterVariableTs4_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs4_lo, rtu_In_time_dt, A380PitchNormalLaw_rtP.RateLimiterVariableTs4_InitialCondition, &rtb_ManualSwitch, &A380PitchNormalLaw_DWork.sf_RateLimiter_l); - A380PitchNormalLaw_eta_trim_limit_lofreeze(rtu_In_eta_trim_deg, rtu_In_high_aoa_prot_active, &rtb_Y_n, + A380PitchNormalLaw_eta_trim_limit_lofreeze(rtu_In_eta_trim_deg, rtu_In_high_aoa_prot_active, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_eta_trim_limit_lofreeze); if (*rtu_In_high_aoa_prot_active) { - *rty_Out_eta_trim_limit_lo = rtb_Y_n; + *rty_Out_eta_trim_limit_lo = rtb_Y_j; } else { *rty_Out_eta_trim_limit_lo = A380PitchNormalLaw_rtP.Constant3_Value; } - A380PitchNormalLaw_eta_trim_limit_lofreeze(rtu_In_eta_trim_deg, rtu_In_high_speed_prot_active, &rtb_Y_n, + A380PitchNormalLaw_eta_trim_limit_lofreeze(rtu_In_eta_trim_deg, rtu_In_high_speed_prot_active, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_eta_trim_limit_upfreeze); if (*rtu_In_high_speed_prot_active) { - *rty_Out_eta_trim_limit_up = rtb_Y_n; + *rty_Out_eta_trim_limit_up = rtb_Y_j; } else { *rty_Out_eta_trim_limit_up = A380PitchNormalLaw_rtP.Constant2_Value; } @@ -1421,18 +1419,18 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_RateLimiter(static_cast(rtb_in_flare) - std::fmin(5.0, std::fmax(0.0, 5.0 - (rtb_Gain1 - (rtb_Gain_px + 5.0)) * 0.25)), A380PitchNormalLaw_rtP.RateLimiterVariableTs6_up, A380PitchNormalLaw_rtP.RateLimiterVariableTs6_lo, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs6_InitialCondition, &rtb_Y_n, &A380PitchNormalLaw_DWork.sf_RateLimiter_o); + A380PitchNormalLaw_rtP.RateLimiterVariableTs6_InitialCondition, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_RateLimiter_o); rtb_Loaddemand2 = A380PitchNormalLaw_rtP.Gain1_Gain * *rtu_In_Theta_deg; rtb_Gain1 = A380PitchNormalLaw_rtP.Gain1_Gain_c * *rtu_In_Theta_deg; rtb_Cos = std::cos(rtb_Gain1); rtb_Gain1 = A380PitchNormalLaw_rtP.Gain1_Gain_l * *rtu_In_Phi_deg; - rtb_Y_d = rtb_Cos / std::cos(rtb_Gain1); - rtb_Y_p = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.uDLookupTable_bp01Data, + rtb_Y_ld = rtb_Cos / std::cos(rtb_Gain1); + rtb_Y_g = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.uDLookupTable_bp01Data, A380PitchNormalLaw_rtP.uDLookupTable_tableData, 6U); rtb_v_target = *rtu_In_V_tas_kn; rtb_Gain1 = A380PitchNormalLaw_rtP.Gain1_Gain_e * *rtu_In_qk_deg_s; - rtb_Gain_av = *rtu_In_nz_g - rtb_Y_d; - rtb_Gain1_e = A380PitchNormalLaw_rtP.Gain2_Gain * rtb_Y_n - rtb_Loaddemand2; + rtb_Gain_av = *rtu_In_nz_g - rtb_Y_ld; + rtb_Gain1_e = A380PitchNormalLaw_rtP.Gain2_Gain * rtb_Y_j - rtb_Loaddemand2; if (rtb_v_target > A380PitchNormalLaw_rtP.Saturation3_UpperSat) { rtb_v_target = A380PitchNormalLaw_rtP.Saturation3_UpperSat; } else if (rtb_v_target < A380PitchNormalLaw_rtP.Saturation3_LowerSat) { @@ -1446,42 +1444,42 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In } rtb_Y_i = (A380PitchNormalLaw_rtP.Gain_Gain_c * A380PitchNormalLaw_rtP.Vm_currentms_Value * rtb_Gain1 + rtb_Gain_av) - - (rtb_Y_p / (A380PitchNormalLaw_rtP.Gain5_Gain * rtb_v_target) + A380PitchNormalLaw_rtP.Bias_Bias) * ((rtb_Y_d + + (rtb_Y_g / (A380PitchNormalLaw_rtP.Gain5_Gain * rtb_v_target) + A380PitchNormalLaw_rtP.Bias_Bias) * ((rtb_Y_ld + look1_binlxpw(rtb_Gain1_e, A380PitchNormalLaw_rtP.Loaddemand1_bp01Data, A380PitchNormalLaw_rtP.Loaddemand1_tableData, - 2U)) - rtb_Y_d); - rtb_Y_p = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data, A380PitchNormalLaw_rtP.PLUT_tableData, + 2U)) - rtb_Y_ld); + rtb_Y_g = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data, A380PitchNormalLaw_rtP.PLUT_tableData, 1U); - rtb_Product1_dm = rtb_Y_i * rtb_Y_p; + rtb_Product1_dm = rtb_Y_i * rtb_Y_g; rtb_Gain1 = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs1_Gain * *rtu_In_qk_deg_s; rtb_Divide = (rtb_Gain1 - A380PitchNormalLaw_DWork.Delay_DSTATE) / *rtu_In_time_dt; - rtb_Y_p = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data, A380PitchNormalLaw_rtP.DLUT_tableData, + rtb_Y_g = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data, A380PitchNormalLaw_rtP.DLUT_tableData, 1U); - rtb_Gain_px = rtb_Y_i * rtb_Y_p * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain; + rtb_Gain_px = rtb_Y_i * rtb_Y_g * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain; rtb_Divide_o = (rtb_Gain_px - A380PitchNormalLaw_DWork.Delay_DSTATE_n) / *rtu_In_time_dt; rtb_Gain_ot = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs2_Gain * *rtu_In_V_tas_kn; rtb_Divide_an = (rtb_Gain_ot - A380PitchNormalLaw_DWork.Delay_DSTATE_c) / *rtu_In_time_dt; - A380PitchNormalLaw_LagFilter(rtb_Divide_an, A380PitchNormalLaw_rtP.LagFilter_C1, rtu_In_time_dt, &rtb_Y_n, + A380PitchNormalLaw_LagFilter(rtb_Divide_an, A380PitchNormalLaw_rtP.LagFilter_C1, rtu_In_time_dt, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_LagFilter_k); - if (rtb_Y_n > A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat) { + if (rtb_Y_j > A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat) { rtb_Divide_bq = A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat; - } else if (rtb_Y_n < A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat) { + } else if (rtb_Y_j < A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat) { rtb_Divide_bq = A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat; } else { - rtb_Divide_bq = rtb_Y_n; + rtb_Divide_bq = rtb_Y_j; } rtb_Gain5_gq = std::fmin(*rtu_In_spoilers_left_pos, *rtu_In_spoilers_right_pos); - A380PitchNormalLaw_WashoutFilter(rtb_Gain5_gq, A380PitchNormalLaw_rtP.WashoutFilter_C1, rtu_In_time_dt, &rtb_Y_n, + A380PitchNormalLaw_WashoutFilter(rtb_Gain5_gq, A380PitchNormalLaw_rtP.WashoutFilter_C1, rtu_In_time_dt, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_WashoutFilter_k); - rtb_Y_p = look1_binlxpw(*rtu_In_H_radio_ft, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1, + rtb_Y_g = look1_binlxpw(*rtu_In_H_radio_ft, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1, A380PitchNormalLaw_rtP.ScheduledGain_Table, 3U); - if (rtb_Y_n > A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat) { - rtb_Y_n = A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat; - } else if (rtb_Y_n < A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat) { - rtb_Y_n = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat; + if (rtb_Y_j > A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat) { + rtb_Y_j = A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat; + } else if (rtb_Y_j < A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat) { + rtb_Y_j = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat; } - rtb_Product_kz = rtb_Y_n * rtb_Y_p; + rtb_Product_kz = rtb_Y_j * rtb_Y_g; rtb_Divide_an = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs1_Gain_i * *rtu_In_qk_deg_s; rtb_Divide_cq = (rtb_Divide_an - A380PitchNormalLaw_DWork.Delay_DSTATE_l) / *rtu_In_time_dt; rtb_Gain1_ft = A380PitchNormalLaw_rtP.Gain1_Gain_o * *rtu_In_qk_deg_s; @@ -1496,37 +1494,37 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Y_i = (A380PitchNormalLaw_rtP.Gain_Gain_a * A380PitchNormalLaw_rtP.Vm_currentms_Value_e * rtb_Gain1_ft + rtb_Gain_av) - (rtb_Y_i / (A380PitchNormalLaw_rtP.Gain5_Gain_d * rtb_v_target) + - A380PitchNormalLaw_rtP.Bias_Bias_a) * (rtb_Sum_ma - rtb_Y_d); - rtb_Y_p = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data_b, + A380PitchNormalLaw_rtP.Bias_Bias_a) * (rtb_Sum_ma - rtb_Y_ld); + rtb_Y_g = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data_b, A380PitchNormalLaw_rtP.PLUT_tableData_b, 1U); - rtb_Product1_ck = rtb_Y_i * rtb_Y_p; - rtb_Y_p = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data_h, + rtb_Product1_ck = rtb_Y_i * rtb_Y_g; + rtb_Y_g = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data_h, A380PitchNormalLaw_rtP.DLUT_tableData_p, 1U); - rtb_Gain1_ft = rtb_Y_i * rtb_Y_p * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_j; + rtb_Gain1_ft = rtb_Y_i * rtb_Y_g * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_j; rtb_Divide_l = (rtb_Gain1_ft - A380PitchNormalLaw_DWork.Delay_DSTATE_k) / *rtu_In_time_dt; rtb_Gain_bs = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs2_Gain_e * *rtu_In_V_tas_kn; rtb_Sum_ma = (rtb_Gain_bs - A380PitchNormalLaw_DWork.Delay_DSTATE_d) / *rtu_In_time_dt; - A380PitchNormalLaw_LagFilter(rtb_Sum_ma, A380PitchNormalLaw_rtP.LagFilter_C1_p, rtu_In_time_dt, &rtb_Y_n, + A380PitchNormalLaw_LagFilter(rtb_Sum_ma, A380PitchNormalLaw_rtP.LagFilter_C1_p, rtu_In_time_dt, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_LagFilter_g3); - if (rtb_Y_n > A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat_j) { + if (rtb_Y_j > A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat_j) { rtb_Gain_f = A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat_j; - } else if (rtb_Y_n < A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat_e) { + } else if (rtb_Y_j < A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat_e) { rtb_Gain_f = A380PitchNormalLaw_rtP.SaturationV_dot_LowerSat_e; } else { - rtb_Gain_f = rtb_Y_n; + rtb_Gain_f = rtb_Y_j; } - A380PitchNormalLaw_WashoutFilter(rtb_Gain5_gq, A380PitchNormalLaw_rtP.WashoutFilter_C1_n, rtu_In_time_dt, &rtb_Y_n, + A380PitchNormalLaw_WashoutFilter(rtb_Gain5_gq, A380PitchNormalLaw_rtP.WashoutFilter_C1_n, rtu_In_time_dt, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_WashoutFilter_c); - rtb_Y_p = look1_binlxpw(*rtu_In_H_radio_ft, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1_n, + rtb_Y_g = look1_binlxpw(*rtu_In_H_radio_ft, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1_n, A380PitchNormalLaw_rtP.ScheduledGain_Table_b, 3U); - if (rtb_Y_n > A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat_g) { - rtb_Y_n = A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat_g; - } else if (rtb_Y_n < A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_j) { - rtb_Y_n = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_j; + if (rtb_Y_j > A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat_g) { + rtb_Y_j = A380PitchNormalLaw_rtP.SaturationSpoilers_UpperSat_g; + } else if (rtb_Y_j < A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_j) { + rtb_Y_j = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_j; } - rtb_Product_n3 = rtb_Y_n * rtb_Y_p; + rtb_Product_n3 = rtb_Y_j * rtb_Y_g; A380PitchNormalLaw_RateLimiter_h(rtu_In_delta_eta_pos, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_up_m, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_lo_k, rtu_In_time_dt, A380PitchNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition_f, &rtb_Sum_ma, @@ -1539,10 +1537,11 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_DWork.pY_not_empty = true; } - rtb_Sum_ma = *rtu_In_time_dt * A380PitchNormalLaw_rtP.LagFilter1_C1; - ca = rtb_Sum_ma / (rtb_Sum_ma + 2.0); - A380PitchNormalLaw_DWork.pY = (2.0 - rtb_Sum_ma) / (rtb_Sum_ma + 2.0) * A380PitchNormalLaw_DWork.pY + - (*rtu_In_alpha_deg * ca + A380PitchNormalLaw_DWork.pU * ca); + rtb_Y_j = *rtu_In_time_dt * A380PitchNormalLaw_rtP.LagFilter1_C1; + rtb_Sum_ma = rtb_Y_j + 2.0; + ca = rtb_Y_j / (rtb_Y_j + 2.0); + A380PitchNormalLaw_DWork.pY = (2.0 - rtb_Y_j) / (rtb_Y_j + 2.0) * A380PitchNormalLaw_DWork.pY + (*rtu_In_alpha_deg * + ca + A380PitchNormalLaw_DWork.pU * ca); A380PitchNormalLaw_DWork.pU = *rtu_In_alpha_deg; ca = A380PitchNormalLaw_DWork.pY - *rtu_In_alpha_prot; rtb_y = std::fmax(std::fmax(0.0, *rtu_In_Theta_deg - 22.5), std::fmax(0.0, (std::abs(*rtu_In_Phi_deg) - 3.0) / 6.0)); @@ -1551,10 +1550,10 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Y_i = (rtb_y_c - ca) - rtb_Sum_ma; rtb_y_c = A380PitchNormalLaw_rtP.Subsystem1_Gain * rtb_Y_i; ca = (rtb_y_c - A380PitchNormalLaw_DWork.Delay_DSTATE_f) / *rtu_In_time_dt; - rtb_Y_p = *rtu_In_time_dt * A380PitchNormalLaw_rtP.Subsystem1_C1; - rtb_Saturation_ix = rtb_Y_p + A380PitchNormalLaw_rtP.Constant_Value_f; - A380PitchNormalLaw_DWork.Delay1_DSTATE = 1.0 / rtb_Saturation_ix * (A380PitchNormalLaw_rtP.Constant_Value_f - rtb_Y_p) - * A380PitchNormalLaw_DWork.Delay1_DSTATE + (ca + A380PitchNormalLaw_DWork.Delay_DSTATE_g) * (rtb_Y_p / + rtb_Y_g = *rtu_In_time_dt * A380PitchNormalLaw_rtP.Subsystem1_C1; + rtb_Saturation_ix = rtb_Y_g + A380PitchNormalLaw_rtP.Constant_Value_f; + A380PitchNormalLaw_DWork.Delay1_DSTATE = 1.0 / rtb_Saturation_ix * (A380PitchNormalLaw_rtP.Constant_Value_f - rtb_Y_g) + * A380PitchNormalLaw_DWork.Delay1_DSTATE + (ca + A380PitchNormalLaw_DWork.Delay_DSTATE_g) * (rtb_Y_g / rtb_Saturation_ix); rtb_alpha_err_gain = A380PitchNormalLaw_rtP.alpha_err_gain_Gain * rtb_Y_i; rtb_y = A380PitchNormalLaw_rtP.Subsystem3_Gain * *rtu_In_V_ias_kn; @@ -1566,11 +1565,11 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_DWork.Delay_DSTATE_ca) * (rtb_Saturation_ix / rtb_Y_i); rtb_qk_gain = A380PitchNormalLaw_rtP.qk_gain_Gain * *rtu_In_qk_deg_s; rtb_qk_dot_gain = A380PitchNormalLaw_rtP.qk_dot_gain_Gain * *rtu_In_qk_dot_deg_s2; - rtb_Y_p = *rtu_In_high_aoa_prot_active; + rtb_Y_g = *rtu_In_high_aoa_prot_active; rtb_Sum_ma = A380PitchNormalLaw_rtP.RateLimiterVariableTs5_up * *rtu_In_time_dt; - rtb_Y_p = std::fmin(rtb_Y_p - A380PitchNormalLaw_DWork.Delay_DSTATE_e, rtb_Sum_ma); + rtb_Y_g = std::fmin(rtb_Y_g - A380PitchNormalLaw_DWork.Delay_DSTATE_e, rtb_Sum_ma); rtb_Sum_ma = *rtu_In_time_dt * A380PitchNormalLaw_rtP.RateLimiterVariableTs5_lo; - A380PitchNormalLaw_DWork.Delay_DSTATE_e += std::fmax(rtb_Y_p, rtb_Sum_ma); + A380PitchNormalLaw_DWork.Delay_DSTATE_e += std::fmax(rtb_Y_g, rtb_Sum_ma); if (A380PitchNormalLaw_DWork.Delay_DSTATE_e > A380PitchNormalLaw_rtP.Saturation_UpperSat_e) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_UpperSat_e; } else if (A380PitchNormalLaw_DWork.Delay_DSTATE_e < A380PitchNormalLaw_rtP.Saturation_LowerSat_h) { @@ -1605,13 +1604,13 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Bias_o = rtb_Sum_ma / (A380PitchNormalLaw_rtP.Gain5_Gain_e * rtb_v_target) + A380PitchNormalLaw_rtP.Bias_Bias_f; A380PitchNormalLaw_RateLimiter_h(rtu_In_ap_theta_c_deg, A380PitchNormalLaw_rtP.RateLimiterVariableTs1_up_d, A380PitchNormalLaw_rtP.RateLimiterVariableTs1_lo_g, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_l, &rtb_Y_p, + A380PitchNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_l, &rtb_Y_g, &A380PitchNormalLaw_DWork.sf_RateLimiter_d); rtb_uDLookupTable = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1_h, A380PitchNormalLaw_rtP.ScheduledGain_Table_j, 6U); A380PitchNormalLaw_RateLimiter_h(rtu_In_delta_eta_pos, A380PitchNormalLaw_rtP.RateLimiterVariableTs_up_n, A380PitchNormalLaw_rtP.RateLimiterVariableTs_lo_c, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition_o, &rtb_Y_n, + A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition_o, &rtb_Y_j, &A380PitchNormalLaw_DWork.sf_RateLimiter_c2); rtb_Saturation_ix = *rtu_In_delta_eta_pos - A380PitchNormalLaw_DWork.Delay_DSTATE_b; rtb_Y_i = A380PitchNormalLaw_rtP.RateLimiterVariableTs3_up_i * *rtu_In_time_dt; @@ -1640,17 +1639,17 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Y_i = *rtu_In_time_dt * A380PitchNormalLaw_rtP.RateLimiterVariableTs4_lo_o; A380PitchNormalLaw_DWork.Delay_DSTATE_mz += std::fmax(rtb_Saturation_ix, rtb_Y_i); if (*rtu_In_any_ap_engaged) { - rtb_Sum_ma = rtb_Y_p - *rtu_In_Theta_deg; + rtb_Sum_ma = rtb_Y_g - *rtu_In_Theta_deg; rtb_Sum_ma *= rtb_uDLookupTable; } else { - rtb_Y_n = look1_binlxpw(rtb_Y_n, A380PitchNormalLaw_rtP.Loaddemand_bp01Data, + rtb_Y_j = look1_binlxpw(rtb_Y_j, A380PitchNormalLaw_rtP.Loaddemand_bp01Data, A380PitchNormalLaw_rtP.Loaddemand_tableData, 2U); if (A380PitchNormalLaw_DWork.Delay_DSTATE_mz > A380PitchNormalLaw_rtP.Saturation_UpperSat) { - rtb_Y_p = A380PitchNormalLaw_rtP.Saturation_UpperSat; + rtb_Y_g = A380PitchNormalLaw_rtP.Saturation_UpperSat; } else if (A380PitchNormalLaw_DWork.Delay_DSTATE_mz < A380PitchNormalLaw_rtP.Saturation_LowerSat) { - rtb_Y_p = A380PitchNormalLaw_rtP.Saturation_LowerSat; + rtb_Y_g = A380PitchNormalLaw_rtP.Saturation_LowerSat; } else { - rtb_Y_p = A380PitchNormalLaw_DWork.Delay_DSTATE_mz; + rtb_Y_g = A380PitchNormalLaw_DWork.Delay_DSTATE_mz; } if (rtb_in_flare > A380PitchNormalLaw_rtP.Switch2_Threshold) { @@ -1661,12 +1660,12 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_rtP.Gain6_Gain * rtb_v_target) + A380PitchNormalLaw_rtP.v_dot_gain_HSP_Gain * A380PitchNormalLaw_DWork.Delay1_DSTATE_n) + rtb_Y_i) + rtb_Sum_ma) * A380PitchNormalLaw_rtP.HSP_gain_Gain; - if (rtb_Y_n > A380PitchNormalLaw_rtP.Saturation8_UpperSat) { + if (rtb_Y_j > A380PitchNormalLaw_rtP.Saturation8_UpperSat) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation8_UpperSat; - } else if (rtb_Y_n < A380PitchNormalLaw_rtP.Saturation8_LowerSat) { + } else if (rtb_Y_j < A380PitchNormalLaw_rtP.Saturation8_LowerSat) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation8_LowerSat; } else { - rtb_Sum_ma = rtb_Y_n; + rtb_Sum_ma = rtb_Y_j; } if (rtb_v_target > A380PitchNormalLaw_rtP.Saturation4_UpperSat) { @@ -1680,7 +1679,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = A380PitchNormalLaw_rtP.Constant1_Value_g; } - rtb_Sum_ma = (A380PitchNormalLaw_rtP.Constant_Value_m - rtb_Y_p) * rtb_Y_n + rtb_Sum_ma * rtb_Y_p; + rtb_Sum_ma = (A380PitchNormalLaw_rtP.Constant_Value_m - rtb_Y_g) * rtb_Y_j + rtb_Sum_ma * rtb_Y_g; } rtb_v_target = *rtu_In_Phi_deg; @@ -1692,17 +1691,17 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = (A380PitchNormalLaw_rtP.Gain_Gain_b * A380PitchNormalLaw_rtP.Vm_currentms_Value_h * rtb_Gain1_e + rtb_Gain_av) - ((rtb_Cos / std::cos(A380PitchNormalLaw_rtP.Gain1_Gain_lm * rtb_v_target) + rtb_Sum_ma) - - rtb_Y_d) * rtb_Bias_o; + rtb_Y_ld) * rtb_Bias_o; rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data_f, A380PitchNormalLaw_rtP.PLUT_tableData_k, 1U); - rtb_Y_p = rtb_Sum_ma * rtb_Saturation_ix; + rtb_Y_g = rtb_Sum_ma * rtb_Saturation_ix; rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data_m, A380PitchNormalLaw_rtP.DLUT_tableData_a, 1U); rtb_Cos = rtb_Sum_ma * rtb_Saturation_ix * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_b; rtb_v_target = (rtb_Cos - A380PitchNormalLaw_DWork.Delay_DSTATE_jh) / *rtu_In_time_dt; - rtb_Y_n = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs2_Gain_c * *rtu_In_V_tas_kn; + rtb_Y_j = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs2_Gain_c * *rtu_In_V_tas_kn; rtb_Sum_ma = A380PitchNormalLaw_DWork.Delay_DSTATE_dy; - rtb_Y_i = (rtb_Y_n - A380PitchNormalLaw_DWork.Delay_DSTATE_dy) / *rtu_In_time_dt; + rtb_Y_i = (rtb_Y_j - A380PitchNormalLaw_DWork.Delay_DSTATE_dy) / *rtu_In_time_dt; A380PitchNormalLaw_LagFilter(rtb_Y_i, A380PitchNormalLaw_rtP.LagFilter_C1_pt, rtu_In_time_dt, &rtb_Sum_ma, &A380PitchNormalLaw_DWork.sf_LagFilter_i); if (rtb_Sum_ma > A380PitchNormalLaw_rtP.SaturationV_dot_UpperSat_b) { @@ -1722,10 +1721,10 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_jl; } - rtb_v_target = (((A380PitchNormalLaw_rtP.Gain3_Gain_c * rtb_Divide_ho + rtb_Y_p) + rtb_v_target) + rtb_Y_i) + + rtb_v_target = (((A380PitchNormalLaw_rtP.Gain3_Gain_c * rtb_Divide_ho + rtb_Y_g) + rtb_v_target) + rtb_Y_i) + rtb_Sum_ma * rtb_Saturation_ix; - rtb_Y_p = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs1_Gain_c * *rtu_In_qk_deg_s; - rtb_Y_i = (rtb_Y_p - A380PitchNormalLaw_DWork.Delay_DSTATE_e5) / *rtu_In_time_dt; + rtb_Y_g = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs1_Gain_c * *rtu_In_qk_deg_s; + rtb_Y_i = (rtb_Y_g - A380PitchNormalLaw_DWork.Delay_DSTATE_e5) / *rtu_In_time_dt; rtb_Divide_ho = A380PitchNormalLaw_rtP.Gain1_Gain_b * *rtu_In_qk_deg_s; rtb_Sum_ma = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.uDLookupTable_bp01Data_a, A380PitchNormalLaw_rtP.uDLookupTable_tableData_p, 6U); @@ -1738,14 +1737,14 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = (A380PitchNormalLaw_rtP.Gain_Gain_p * A380PitchNormalLaw_rtP.Vm_currentms_Value_p * rtb_Divide_ho + rtb_Gain_av) - (rtb_Sum_ma / (A380PitchNormalLaw_rtP.Gain5_Gain_n * rtb_Gain1_e) + - A380PitchNormalLaw_rtP.Bias_Bias_ai) * (rtb_Y_je - rtb_Y_d); + A380PitchNormalLaw_rtP.Bias_Bias_ai) * (rtb_Y_p - rtb_Y_ld); rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data_a, A380PitchNormalLaw_rtP.PLUT_tableData_o, 1U); rtb_Bias_o = rtb_Sum_ma * rtb_Saturation_ix; rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data_k, A380PitchNormalLaw_rtP.DLUT_tableData_e, 1U); - rtb_Y_je = rtb_Sum_ma * rtb_Saturation_ix * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_p; - rtb_uDLookupTable = (rtb_Y_je - A380PitchNormalLaw_DWork.Delay_DSTATE_gz) / *rtu_In_time_dt; + rtb_Y_p = rtb_Sum_ma * rtb_Saturation_ix * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_p; + rtb_uDLookupTable = (rtb_Y_p - A380PitchNormalLaw_DWork.Delay_DSTATE_gz) / *rtu_In_time_dt; rtb_Divide_ho = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs2_Gain_a * *rtu_In_V_tas_kn; rtb_Sum_ma = A380PitchNormalLaw_DWork.Delay_DSTATE_lf; rtb_Saturation_ix = (rtb_Divide_ho - A380PitchNormalLaw_DWork.Delay_DSTATE_lf) / *rtu_In_time_dt; @@ -1813,11 +1812,11 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = (A380PitchNormalLaw_rtP.Gain_Gain_jq * A380PitchNormalLaw_rtP.Vm_currentms_Value_b * rtb_Divide_l + rtb_Gain_av) - (rtb_Sum_ma / (A380PitchNormalLaw_rtP.Gain5_Gain_m * rtb_v_target) + - A380PitchNormalLaw_rtP.Bias_Bias_m) * ((rtb_Y_d + look1_binlxpw(rtb_Gain1_e, - A380PitchNormalLaw_rtP.Loaddemand2_bp01Data, A380PitchNormalLaw_rtP.Loaddemand2_tableData, 2U)) - rtb_Y_d); + A380PitchNormalLaw_rtP.Bias_Bias_m) * ((rtb_Y_ld + look1_binlxpw(rtb_Gain1_e, + A380PitchNormalLaw_rtP.Loaddemand2_bp01Data, A380PitchNormalLaw_rtP.Loaddemand2_tableData, 2U)) - rtb_Y_ld); rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.PLUT_bp01Data_e, A380PitchNormalLaw_rtP.PLUT_tableData_g, 1U); - rtb_Y_d = rtb_Sum_ma * rtb_Saturation_ix; + rtb_Y_ld = rtb_Sum_ma * rtb_Saturation_ix; rtb_Saturation_ix = look1_binlxpw(*rtu_In_V_tas_kn, A380PitchNormalLaw_rtP.DLUT_bp01Data_hw, A380PitchNormalLaw_rtP.DLUT_tableData_l, 1U); rtb_Loaddemand2 = rtb_Sum_ma * rtb_Saturation_ix * A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_c; @@ -1846,7 +1845,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = A380PitchNormalLaw_rtP.SaturationSpoilers_LowerSat_d; } - rtb_Gain1_e = (((A380PitchNormalLaw_rtP.Gain3_Gain_n * rtb_Product1_ck + rtb_Y_d) + rtb_Divide_l) + rtb_Gain_f) + + rtb_Gain1_e = (((A380PitchNormalLaw_rtP.Gain3_Gain_n * rtb_Product1_ck + rtb_Y_ld) + rtb_Divide_l) + rtb_Gain_f) + rtb_Sum_ma * rtb_Saturation_ix; if (rtb_v_target > A380PitchNormalLaw_rtP.Saturation_UpperSat_h) { rtb_v_target = A380PitchNormalLaw_rtP.Saturation_UpperSat_h; @@ -1863,16 +1862,16 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_VoterAttitudeProtection(rtb_v_target, rtb_Y_i, rtb_Gain1_e, &rtb_Saturation_ix); rtb_Sum_ma = look1_binlxpw(*rtu_In_V_ias_kn, A380PitchNormalLaw_rtP.ScheduledGain1_BreakpointsForDimension1, A380PitchNormalLaw_rtP.ScheduledGain1_Table, 4U); - rtb_Y_d = rtb_Saturation_ix * rtb_Sum_ma; + rtb_Y_ld = rtb_Saturation_ix * rtb_Sum_ma; rtb_Sum_ma = look1_binlxpw(*rtu_In_time_dt, A380PitchNormalLaw_rtP.ScheduledGain_BreakpointsForDimension1_d, A380PitchNormalLaw_rtP.ScheduledGain_Table_hh, 4U); - rtb_Sum_ma = rtb_Y_d * rtb_Sum_ma * A380PitchNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain * *rtu_In_time_dt; - rtb_Y_d = *rtu_In_eta_deg - rtb_Sum_ma; - rtb_AND = ((rtb_Y_ej == 0.0) || (rtb_ManualSwitch == A380PitchNormalLaw_rtP.CompareToConstant_const) || + rtb_Sum_ma = rtb_Y_ld * rtb_Sum_ma * A380PitchNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain * *rtu_In_time_dt; + rtb_Y_ld = *rtu_In_eta_deg - rtb_Sum_ma; + rtb_AND = ((rtb_Y_b == 0.0) || (rtb_ManualSwitch == A380PitchNormalLaw_rtP.CompareToConstant_const) || (*rtu_In_tracking_mode_on)); A380PitchNormalLaw_DWork.icLoad = (rtb_AND || A380PitchNormalLaw_DWork.icLoad); if (A380PitchNormalLaw_DWork.icLoad) { - A380PitchNormalLaw_DWork.Delay_DSTATE_o = rtb_Y_d; + A380PitchNormalLaw_DWork.Delay_DSTATE_o = rtb_Y_ld; } A380PitchNormalLaw_DWork.Delay_DSTATE_o += rtb_Sum_ma; @@ -1898,36 +1897,36 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In *rty_Out_eta_trim_dot_deg_s = rtb_Sum_ma; } - if (rtb_Y_ej > A380PitchNormalLaw_rtP.Saturation_UpperSat_l) { + if (rtb_Y_b > A380PitchNormalLaw_rtP.Saturation_UpperSat_l) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_UpperSat_l; - } else if (rtb_Y_ej < A380PitchNormalLaw_rtP.Saturation_LowerSat_kp) { + } else if (rtb_Y_b < A380PitchNormalLaw_rtP.Saturation_LowerSat_kp) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_LowerSat_kp; } else { - rtb_Sum_ma = rtb_Y_ej; + rtb_Sum_ma = rtb_Y_b; } rtb_Product1_dm = A380PitchNormalLaw_DWork.Delay_DSTATE_o * rtb_Sum_ma; rtb_Divide = A380PitchNormalLaw_rtP.Constant_Value_o1 - rtb_Sum_ma; A380PitchNormalLaw_RateLimiter_h(rtu_In_delta_eta_pos, A380PitchNormalLaw_rtP.RateLimiterVariableTs_up_na, A380PitchNormalLaw_rtP.RateLimiterVariableTs_lo_i, rtu_In_time_dt, - A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition_m, &rtb_Y_d, + A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition_m, &rtb_Y_ld, &A380PitchNormalLaw_DWork.sf_RateLimiter_ct); rtb_Sum_ma = look2_binlxpw(*rtu_In_Theta_deg, *rtu_In_H_radio_ft, A380PitchNormalLaw_rtP.uDLookupTable_bp01Data_l, A380PitchNormalLaw_rtP.uDLookupTable_bp02Data, A380PitchNormalLaw_rtP.uDLookupTable_tableData_e5, A380PitchNormalLaw_rtP.uDLookupTable_maxIndex, 5U); rtb_Saturation_ix = *rtu_In_tailstrike_protection_on; - if (rtb_Y_d > A380PitchNormalLaw_rtP.Saturation3_UpperSat_l) { + if (rtb_Y_ld > A380PitchNormalLaw_rtP.Saturation3_UpperSat_l) { rtb_Y_i = A380PitchNormalLaw_rtP.Saturation3_UpperSat_l; - } else if (rtb_Y_d < A380PitchNormalLaw_rtP.Saturation3_LowerSat_h) { + } else if (rtb_Y_ld < A380PitchNormalLaw_rtP.Saturation3_LowerSat_h) { rtb_Y_i = A380PitchNormalLaw_rtP.Saturation3_LowerSat_h; } else { - rtb_Y_i = rtb_Y_d; + rtb_Y_i = rtb_Y_ld; } - rtb_Sum_ma = look1_binlxpw(rtb_Saturation_ix * rtb_Sum_ma * rtb_Y_i + rtb_Y_d, + rtb_Sum_ma = look1_binlxpw(rtb_Saturation_ix * rtb_Sum_ma * rtb_Y_i + rtb_Y_ld, A380PitchNormalLaw_rtP.PitchRateDemand_bp01Data, A380PitchNormalLaw_rtP.PitchRateDemand_tableData, 2U); rtb_eta_trim_deg_rate_limit_up_deg_s = A380PitchNormalLaw_rtP.DiscreteDerivativeVariableTs_Gain_j3 * rtb_Sum_ma; - rtb_Y_d = (rtb_eta_trim_deg_rate_limit_up_deg_s - A380PitchNormalLaw_DWork.Delay_DSTATE_ej) / *rtu_In_time_dt; + rtb_Y_ld = (rtb_eta_trim_deg_rate_limit_up_deg_s - A380PitchNormalLaw_DWork.Delay_DSTATE_ej) / *rtu_In_time_dt; rtb_Saturation_ix = *rtu_In_qk_deg_s - rtb_Sum_ma; rtb_Divide_o = A380PitchNormalLaw_rtP.Gain_Gain_pt * rtb_Saturation_ix; rtb_eta_trim_deg_rate_limit_lo_deg_s = A380PitchNormalLaw_rtP.Gain1_Gain_d * rtb_Saturation_ix * @@ -1939,15 +1938,16 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_LagFilter(rtb_Gain5_gq, A380PitchNormalLaw_rtP.LagFilter_C1_k, rtu_In_time_dt, &rtb_Saturation_ix, &A380PitchNormalLaw_DWork.sf_LagFilter_f); rtb_Gain5_gq = A380PitchNormalLaw_rtP.Gain6_Gain_g * *rtu_In_qk_dot_deg_s2; - rtb_Y_d = (((rtb_Divide_o + rtb_Divide_bq) * A380PitchNormalLaw_rtP.Gain1_Gain_a + A380PitchNormalLaw_rtP.Gain3_Gain_e - * rtb_Y_d) + (rtb_Saturation_ix - rtb_Sum_ma) * A380PitchNormalLaw_rtP.Gain4_Gain) + rtb_Gain5_gq; + rtb_Y_ld = (((rtb_Divide_o + rtb_Divide_bq) * A380PitchNormalLaw_rtP.Gain1_Gain_a + + A380PitchNormalLaw_rtP.Gain3_Gain_e * rtb_Y_ld) + (rtb_Saturation_ix - rtb_Sum_ma) * + A380PitchNormalLaw_rtP.Gain4_Gain) + rtb_Gain5_gq; rtb_Sum_ma = look1_binlxpw(*rtu_In_V_ias_kn, A380PitchNormalLaw_rtP.ScheduledGain1_BreakpointsForDimension1_h, A380PitchNormalLaw_rtP.ScheduledGain1_Table_c, 4U); - rtb_Sum_ma = (A380PitchNormalLaw_rtP.Constant2_Value_k - rtb_Y_ej) * (rtb_Y_d * rtb_Sum_ma) * + rtb_Sum_ma = (A380PitchNormalLaw_rtP.Constant2_Value_k - rtb_Y_b) * (rtb_Y_ld * rtb_Sum_ma) * A380PitchNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain_j * *rtu_In_time_dt; rtb_NOT = (*rtu_In_delta_eta_pos <= A380PitchNormalLaw_rtP.Constant_Value_o); rtb_NOT = (rtb_NOT && (*rtu_In_on_ground)); - rtb_NOT = (rtb_NOT || (rtb_Y_mt == 0.0) || (*rtu_In_tracking_mode_on)); + rtb_NOT = (rtb_NOT || (rtb_Y_h == 0.0) || (*rtu_In_tracking_mode_on)); A380PitchNormalLaw_DWork.icLoad_p = (rtb_NOT || A380PitchNormalLaw_DWork.icLoad_p); if (A380PitchNormalLaw_DWork.icLoad_p) { A380PitchNormalLaw_DWork.Delay_DSTATE_cl = A380PitchNormalLaw_rtP.Constant_Value_jk - rtb_Sum_ma; @@ -1973,16 +1973,16 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In rtb_Sum_ma = A380PitchNormalLaw_rtP.Constant1_Value_h; } - rtb_Y_ej = A380PitchNormalLaw_DWork.Delay_DSTATE_cl + rtb_Sum_ma; - if (rtb_Y_mt > A380PitchNormalLaw_rtP.Saturation_UpperSat_m) { + rtb_Y_b = A380PitchNormalLaw_DWork.Delay_DSTATE_cl + rtb_Sum_ma; + if (rtb_Y_h > A380PitchNormalLaw_rtP.Saturation_UpperSat_m) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_UpperSat_m; - } else if (rtb_Y_mt < A380PitchNormalLaw_rtP.Saturation_LowerSat_b) { + } else if (rtb_Y_h < A380PitchNormalLaw_rtP.Saturation_LowerSat_b) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_LowerSat_b; } else { - rtb_Sum_ma = rtb_Y_mt; + rtb_Sum_ma = rtb_Y_h; } - rtb_Gain = (A380PitchNormalLaw_rtP.Constant_Value_h - rtb_Sum_ma) * rtb_Gain + rtb_Y_ej * rtb_Sum_ma; + rtb_Gain = (A380PitchNormalLaw_rtP.Constant_Value_h - rtb_Sum_ma) * rtb_Gain + rtb_Y_b * rtb_Sum_ma; if (rtb_ManualSwitch > A380PitchNormalLaw_rtP.Saturation_UpperSat_p) { rtb_Sum_ma = A380PitchNormalLaw_rtP.Saturation_UpperSat_p; } else if (rtb_ManualSwitch < A380PitchNormalLaw_rtP.Saturation_LowerSat_hs) { @@ -1996,8 +1996,8 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_rtP.RateLimiterVariableTs_InitialCondition_c, &rtb_Y_i, &A380PitchNormalLaw_DWork.sf_RateLimiter_h); rtb_ManualSwitch = A380PitchNormalLaw_rtP.Gain1_Gain_h * *rtu_In_qk_deg_s; - rtb_Y_mt = *rtu_In_nz_g + A380PitchNormalLaw_rtP.Bias_Bias_d; - rtb_v_target = A380PitchNormalLaw_rtP.Gain2_Gain_n * rtb_Y_mt + rtb_ManualSwitch; + rtb_Y_h = *rtu_In_nz_g + A380PitchNormalLaw_rtP.Bias_Bias_d; + rtb_v_target = A380PitchNormalLaw_rtP.Gain2_Gain_n * rtb_Y_h + rtb_ManualSwitch; if (rtb_v_target > A380PitchNormalLaw_rtP.Saturation_UpperSat_g) { rtb_v_target = A380PitchNormalLaw_rtP.Saturation_UpperSat_g; } else if (rtb_v_target < A380PitchNormalLaw_rtP.Saturation_LowerSat_kf) { @@ -2031,9 +2031,9 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_DWork.Delay_DSTATE_m = rtb_Gain_ll; A380PitchNormalLaw_DWork.Delay_DSTATE_k2 = rtb_Divide_k; A380PitchNormalLaw_DWork.Delay_DSTATE_jh = rtb_Cos; - A380PitchNormalLaw_DWork.Delay_DSTATE_dy = rtb_Y_n; - A380PitchNormalLaw_DWork.Delay_DSTATE_e5 = rtb_Y_p; - A380PitchNormalLaw_DWork.Delay_DSTATE_gz = rtb_Y_je; + A380PitchNormalLaw_DWork.Delay_DSTATE_dy = rtb_Y_j; + A380PitchNormalLaw_DWork.Delay_DSTATE_e5 = rtb_Y_g; + A380PitchNormalLaw_DWork.Delay_DSTATE_gz = rtb_Y_p; A380PitchNormalLaw_DWork.Delay_DSTATE_lf = rtb_Divide_ho; A380PitchNormalLaw_DWork.Delay_DSTATE_h = rtb_Divide_cq; A380PitchNormalLaw_DWork.Delay_DSTATE_ds = rtb_Loaddemand2; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h index e1bf1a901cf..1e01e0475b3 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchNormalLaw_h_ -#define RTW_HEADER_A380PitchNormalLaw_h_ +#ifndef A380PitchNormalLaw_h_ +#define A380PitchNormalLaw_h_ #include "rtwtypes.h" #include "A380PitchNormalLaw_types.h" #include diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_private.h index fb183d4f948..146ccd0f03e 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchNormalLaw_private_h_ -#define RTW_HEADER_A380PitchNormalLaw_private_h_ +#ifndef A380PitchNormalLaw_private_h_ +#define A380PitchNormalLaw_private_h_ #include "rtwtypes.h" #include "A380PitchNormalLaw_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_types.h index dceda494b09..4a7c8d2243b 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw_types.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PitchNormalLaw_types_h_ -#define RTW_HEADER_A380PitchNormalLaw_types_h_ +#ifndef A380PitchNormalLaw_types_h_ +#define A380PitchNormalLaw_types_h_ #include "rtwtypes.h" #ifndef DEFINED_TYPEDEF_FOR_base_pitch_data_computed_ #define DEFINED_TYPEDEF_FOR_base_pitch_data_computed_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.cpp index eb12328d113..1a3049bb29d 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.cpp @@ -431,7 +431,7 @@ void A380PrimComputer::step() real_T rtb_Switch9_f; real_T rtb_Switch_h; real_T rtb_Y; - real_T rtb_Y_i; + real_T rtb_Y_l; real_T rtb_elevator1Command; real_T rtb_elevator2Command; real_T rtb_elevator3Command; @@ -542,10 +542,10 @@ void A380PrimComputer::step() real32_T rtb_r; real32_T rtb_raComputationValue; real32_T rtb_theta_dot; - uint32_T rtb_y_fj; - uint32_T rtb_y_fn; - uint32_T rtb_y_k0; - uint32_T rtb_y_m; + uint32_T rtb_y_b4; + uint32_T rtb_y_fd; + uint32_T rtb_y_n; + uint32_T rtb_y_ob; boolean_T rtb_VectorConcatenate[19]; boolean_T rtb_VectorConcatenate_c[19]; boolean_T b_x[6]; @@ -557,7 +557,6 @@ void A380PrimComputer::step() boolean_T rightAileron2Avail; boolean_T rightSpoilerElectricModeAvail; boolean_T rightSpoilerHydraulicModeAvail; - boolean_T rtb_AND1; boolean_T rtb_AND10; boolean_T rtb_AND10_b; boolean_T rtb_AND11; @@ -571,6 +570,7 @@ void A380PrimComputer::step() boolean_T rtb_AND18_c; boolean_T rtb_AND19; boolean_T rtb_AND1_l; + boolean_T rtb_AND2; boolean_T rtb_AND20; boolean_T rtb_AND2_ac; boolean_T rtb_AND2_i; @@ -600,6 +600,7 @@ void A380PrimComputer::step() boolean_T rtb_OR6; boolean_T rtb_OR7; boolean_T rtb_OR_b; + boolean_T rtb_aileronAntidroopActive; boolean_T rtb_doubleAdrFault; boolean_T rtb_doubleIrFault; boolean_T rtb_doubleIrFault_tmp; @@ -613,12 +614,12 @@ void A380PrimComputer::step() boolean_T rtb_thsEngaged; boolean_T rtb_tripleAdrFault; boolean_T rtb_tripleIrFault; + boolean_T rtb_y_bb; boolean_T rtb_y_c; - boolean_T rtb_y_cv; - boolean_T rtb_y_dvi; - boolean_T rtb_y_h3; - boolean_T rtb_y_k; - boolean_T rtb_y_mj; + boolean_T rtb_y_gc; + boolean_T rtb_y_ge; + boolean_T rtb_y_jk; + boolean_T rtb_y_ow; boolean_T rudder1ElectricModeAvail; boolean_T rudder1HydraulicModeAvail; boolean_T rudder1HydraulicModeHasPriority; @@ -627,7 +628,7 @@ void A380PrimComputer::step() boolean_T thsAvail; a380_lateral_efcs_law rtb_activeLateralLaw; a380_pitch_efcs_law rtb_law; - a380_pitch_efcs_law rtb_law_c; + a380_pitch_efcs_law rtb_law_k; a380_pitch_efcs_law rtb_pitchLawCapability; if (A380PrimComputer_U.in.sim_data.computer_running) { if (!A380PrimComputer_DWork.Runtime_MODE) { @@ -663,7 +664,7 @@ void A380PrimComputer::step() A380PrimComputer_MATLABFunction_ge_Reset(&A380PrimComputer_DWork.sf_MATLABFunction_j2); A380PrimComputer_MATLABFunction_ge_Reset(&A380PrimComputer_DWork.sf_MATLABFunction_g24); A380PrimComputer_RateLimiter_e_Reset(&A380PrimComputer_DWork.sf_RateLimiter_ne); - A380PrimComputer_DWork.eventTime_not_empty_e = false; + A380PrimComputer_DWork.eventTime_not_empty_m = false; A380PrimComputer_RateLimiter_e_Reset(&A380PrimComputer_DWork.sf_RateLimiter_mr); A380PrimComputer_DWork.resetEventTime_not_empty = false; A380PrimComputer_DWork.sProtActive = false; @@ -741,9 +742,9 @@ void A380PrimComputer::step() (A380PrimComputer_U.in.bus_inputs.adr_3_bus.aoa_corrected_deg.SSM == static_cast (SignStatusMatrix::FailureWarning)) || A380PrimComputer_P.Constant1_Value_b || A380PrimComputer_P.Constant1_Value_b); - rtb_AND1 = (rtb_OR1 && rtb_OR3); - rtb_doubleAdrFault = (rtb_AND1 || (rtb_OR1 && rtb_OR4) || (rtb_OR3 && rtb_OR4)); - rtb_tripleAdrFault = (rtb_AND1 && rtb_OR4); + rtb_AND2 = (rtb_OR1 && rtb_OR3); + rtb_doubleAdrFault = (rtb_AND2 || (rtb_OR1 && rtb_OR4) || (rtb_OR3 && rtb_OR4)); + rtb_tripleAdrFault = (rtb_AND2 && rtb_OR4); rtb_OR = ((A380PrimComputer_U.in.bus_inputs.ir_1_bus.pitch_angle_deg.SSM != static_cast(SignStatusMatrix:: NormalOperation)) || (A380PrimComputer_U.in.bus_inputs.ir_1_bus.roll_angle_deg.SSM != static_cast(SignStatusMatrix::NormalOperation)) || @@ -832,7 +833,7 @@ void A380PrimComputer::step() rtb_V_tas = A380PrimComputer_U.in.bus_inputs.adr_2_bus.airspeed_true_kn.Data; rtb_mach = A380PrimComputer_U.in.bus_inputs.adr_2_bus.mach.Data; rtb_alpha = A380PrimComputer_U.in.bus_inputs.adr_2_bus.aoa_corrected_deg.Data; - } else if (rtb_AND1 && rtb_AND2_i) { + } else if (rtb_AND2 && rtb_AND2_i) { rtb_V_ias = A380PrimComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.Data; rtb_V_tas = A380PrimComputer_U.in.bus_inputs.adr_3_bus.airspeed_true_kn.Data; rtb_mach = A380PrimComputer_U.in.bus_inputs.adr_3_bus.mach.Data; @@ -962,49 +963,49 @@ void A380PrimComputer::step() rtb_left_inboard_aileron_deg = rtb_phi_dot; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel_bit, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel_bit, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_NOT_k); - rtb_AND1 = ((rtb_y_k0 != 0U) && rtb_NOT_k); + rtb_OR4 = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel1_bit, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel1_bit, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, - &rtb_y_h3); - rtb_OR = ((rtb_y_k0 != 0U) && rtb_y_h3); + &rtb_y_ow); + rtb_AND2 = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_c((std::abs(A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.Data - A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.Data) > A380PrimComputer_P.CompareToConstant_const_ll), A380PrimComputer_U.in.time.dt, A380PrimComputer_P.ConfirmNode_isRisingEdge, - A380PrimComputer_P.ConfirmNode_timeDelay, &rtb_y_cv, &A380PrimComputer_DWork.sf_MATLABFunction_jz); - rtb_OR4 = (rtb_tripleAdrFault || (rtb_doubleAdrFault && A380PrimComputer_P.Constant1_Value_b)); + A380PrimComputer_P.ConfirmNode_timeDelay, &rtb_y_jk, &A380PrimComputer_DWork.sf_MATLABFunction_jz); + rtb_rudder2HydraulicModeEngaged = (rtb_tripleAdrFault || (rtb_doubleAdrFault && A380PrimComputer_P.Constant1_Value_b)); A380PrimComputer_MATLABFunction_c(((A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.Data > 50.0F) && (A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: - NormalOperation)) && (rtb_V_ias > 200.0F) && rtb_OR4), A380PrimComputer_U.in.time.dt, - A380PrimComputer_P.ConfirmNode2_isRisingEdge, A380PrimComputer_P.ConfirmNode2_timeDelay, &rtb_y_h3, + NormalOperation)) && (rtb_V_ias > 200.0F) && rtb_rudder2HydraulicModeEngaged), A380PrimComputer_U.in.time.dt, + A380PrimComputer_P.ConfirmNode2_isRisingEdge, A380PrimComputer_P.ConfirmNode2_timeDelay, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_lf); A380PrimComputer_MATLABFunction_c(((A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.Data > 50.0F) && (A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: - NormalOperation)) && (rtb_V_ias > 200.0F) && rtb_OR4), A380PrimComputer_U.in.time.dt, + NormalOperation)) && (rtb_V_ias > 200.0F) && rtb_rudder2HydraulicModeEngaged), A380PrimComputer_U.in.time.dt, A380PrimComputer_P.ConfirmNode1_isRisingEdge, A380PrimComputer_P.ConfirmNode1_timeDelay, &rtb_NOT_k, &A380PrimComputer_DWork.sf_MATLABFunction_jl); - A380PrimComputer_DWork.ra1CoherenceRejected = (rtb_y_h3 || A380PrimComputer_DWork.ra1CoherenceRejected); + A380PrimComputer_DWork.ra1CoherenceRejected = (rtb_y_ow || A380PrimComputer_DWork.ra1CoherenceRejected); A380PrimComputer_DWork.ra2CoherenceRejected = (rtb_NOT_k || A380PrimComputer_DWork.ra2CoherenceRejected); - rtb_OR6 = ((A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: - FailureWarning)) || A380PrimComputer_DWork.ra1CoherenceRejected); - rtb_OR7 = ((A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: + rtb_OR = ((A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: + FailureWarning)) || A380PrimComputer_DWork.ra1CoherenceRejected); + rtb_OR6 = ((A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.SSM == static_cast(SignStatusMatrix:: FailureWarning)) || A380PrimComputer_DWork.ra2CoherenceRejected); if (!A380PrimComputer_DWork.configFullEventTime_not_empty) { A380PrimComputer_DWork.configFullEventTime = A380PrimComputer_U.in.time.simulation_time; A380PrimComputer_DWork.configFullEventTime_not_empty = true; } - if ((!rtb_AND1) && (!rtb_OR)) { + if ((!rtb_OR4) && (!rtb_AND2)) { A380PrimComputer_DWork.configFullEventTime = A380PrimComputer_U.in.time.simulation_time; } - rtb_AND2_i = !rtb_OR7; - rtb_DataTypeConversion_m2 = !rtb_OR6; + rtb_AND2_i = !rtb_OR6; + rtb_DataTypeConversion_m2 = !rtb_OR; if (rtb_DataTypeConversion_m2 && rtb_AND2_i) { - if (rtb_y_cv) { + if (rtb_y_jk) { if (A380PrimComputer_U.in.time.simulation_time > A380PrimComputer_DWork.configFullEventTime + 10.0) { rtb_raComputationValue = std::fmin(A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.Data, A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.Data); @@ -1015,10 +1016,10 @@ void A380PrimComputer::step() rtb_raComputationValue = (A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.Data + A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.Data) / 2.0F; } - } else if ((rtb_OR6 && rtb_AND2_i) || (rtb_DataTypeConversion_m2 && rtb_OR7)) { - if ((rtb_V_ias > 180.0F) && rtb_OR4) { + } else if ((rtb_OR && rtb_AND2_i) || (rtb_DataTypeConversion_m2 && rtb_OR6)) { + if ((rtb_V_ias > 180.0F) && rtb_rudder2HydraulicModeEngaged) { rtb_raComputationValue = 250.0F; - } else if (rtb_OR7) { + } else if (rtb_OR6) { rtb_raComputationValue = A380PrimComputer_U.in.bus_inputs.ra_1_bus.radio_height_ft.Data; } else { rtb_raComputationValue = A380PrimComputer_U.in.bus_inputs.ra_2_bus.radio_height_ft.Data; @@ -1027,34 +1028,34 @@ void A380PrimComputer::step() rtb_raComputationValue = 250.0F; } - rtb_OR4 = (rtb_OR6 && rtb_OR7); - rtb_AND1 = ((rtb_raComputationValue < A380PrimComputer_P.CompareToConstant_const) && (!rtb_OR4)); + rtb_OR4 = (rtb_OR && rtb_OR6); + rtb_AND2 = ((rtb_raComputationValue < A380PrimComputer_P.CompareToConstant_const) && (!rtb_OR4)); rtb_OR = (A380PrimComputer_U.in.sim_data.slew_on || A380PrimComputer_U.in.sim_data.pause_on || A380PrimComputer_U.in.sim_data.tracking_mode_on_override); A380PrimComputer_MATLABFunction_n(A380PrimComputer_U.in.analog_inputs.yellow_hyd_pressure_psi, - A380PrimComputer_P.HysteresisNode2_highTrigger, A380PrimComputer_P.HysteresisNode2_lowTrigger, &rtb_y_h3, + A380PrimComputer_P.HysteresisNode2_highTrigger, A380PrimComputer_P.HysteresisNode2_lowTrigger, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_nj); - A380PrimComputer_MATLABFunction_c(((!A380PrimComputer_U.in.discrete_inputs.yellow_low_pressure) && rtb_y_h3), + A380PrimComputer_MATLABFunction_c(((!A380PrimComputer_U.in.discrete_inputs.yellow_low_pressure) && rtb_y_ow), A380PrimComputer_U.in.time.dt, A380PrimComputer_P.ConfirmNode_isRisingEdge_l, A380PrimComputer_P.ConfirmNode_timeDelay_i, &rtb_NOT_k, &A380PrimComputer_DWork.sf_MATLABFunction_cx); A380PrimComputer_MATLABFunction_n(A380PrimComputer_U.in.analog_inputs.green_hyd_pressure_psi, - A380PrimComputer_P.HysteresisNode3_highTrigger, A380PrimComputer_P.HysteresisNode3_lowTrigger, &rtb_y_h3, + A380PrimComputer_P.HysteresisNode3_highTrigger, A380PrimComputer_P.HysteresisNode3_lowTrigger, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_e1); - A380PrimComputer_MATLABFunction_c(((!A380PrimComputer_U.in.discrete_inputs.green_low_pressure) && rtb_y_h3), + A380PrimComputer_MATLABFunction_c(((!A380PrimComputer_U.in.discrete_inputs.green_low_pressure) && rtb_y_ow), A380PrimComputer_U.in.time.dt, A380PrimComputer_P.ConfirmNode2_isRisingEdge_i, - A380PrimComputer_P.ConfirmNode2_timeDelay_h, &rtb_y_h3, &A380PrimComputer_DWork.sf_MATLABFunction_kq); - rtb_rudder2HydraulicModeEngaged = !rtb_y_h3; + A380PrimComputer_P.ConfirmNode2_timeDelay_h, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_kq); + rtb_rudder2HydraulicModeEngaged = !rtb_y_ow; rtb_rudder1HydraulicModeEngaged = !rtb_NOT_k; rtb_OR6 = !A380PrimComputer_P.Constant_Value_aq; - rtb_OR6 = (rtb_AND1 && ((rtb_y_h3 || rtb_NOT_k || (!A380PrimComputer_U.in.discrete_inputs.rat_contactor_closed) || ( + rtb_OR6 = (rtb_AND2 && ((rtb_y_ow || rtb_NOT_k || (!A380PrimComputer_U.in.discrete_inputs.rat_contactor_closed) || ( !A380PrimComputer_U.in.discrete_inputs.rat_deployed)) && ((rtb_rudder2HydraulicModeEngaged || rtb_OR6) && (rtb_rudder1HydraulicModeEngaged || rtb_OR6)))); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { - rtb_OR7 = rtb_y_h3; - rtb_doubleIrFault_tmp = rtb_y_h3; + rtb_OR7 = rtb_y_ow; + rtb_doubleIrFault_tmp = rtb_y_ow; } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_OR7 = rtb_y_h3; - rtb_doubleIrFault_tmp = rtb_y_h3; + rtb_OR7 = rtb_y_ow; + rtb_doubleIrFault_tmp = rtb_y_ow; } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { rtb_OR7 = rtb_NOT_k; rtb_doubleIrFault_tmp = rtb_NOT_k; @@ -1069,10 +1070,10 @@ void A380PrimComputer::step() rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word; } - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel2_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_c); - rtb_OR1 = ((rtb_y_k0 != 0U) && rtb_y_c); - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel1_bit_b, &rtb_y_k0); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel2_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_bb); + rtb_OR1 = ((rtb_y_b4 != 0U) && rtb_y_bb); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel1_bit_b, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_OR3 = true; rightAileron2Avail = true; @@ -1090,17 +1091,17 @@ void A380PrimComputer::step() rudder2ElectricModeHasPriority = !rtb_OR6; rtb_rightAileron2Engaged = (A380PrimComputer_U.in.discrete_inputs.is_unit_3 || rudder2ElectricModeHasPriority); rtb_OR1 = (rtb_OR3 && ((!rtb_OR1) && rtb_rightAileron2Engaged)); - rtb_rightAileron2Engaged = (rightAileron2Avail && (((!rtb_y_c) || (rtb_y_k0 == 0U)) && rtb_rightAileron2Engaged)); + rtb_rightAileron2Engaged = (rightAileron2Avail && (((!rtb_y_bb) || (rtb_y_b4 == 0U)) && rtb_rightAileron2Engaged)); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { - leftSpoilerHydraulicModeAvail = rtb_y_h3; + leftSpoilerHydraulicModeAvail = rtb_y_ow; leftSpoilerElectricModeAvail = true; - rightSpoilerHydraulicModeAvail = rtb_y_h3; + rightSpoilerHydraulicModeAvail = rtb_y_ow; rightSpoilerElectricModeAvail = true; - rtb_leftSpoilerHydraulicModeEngaged = rtb_y_h3; + rtb_leftSpoilerHydraulicModeEngaged = rtb_y_ow; rtb_leftSpoilerElectricModeEngaged = (rtb_rudder2HydraulicModeEngaged && rudder2ElectricModeHasPriority); - rtb_rightSpoilerHydraulicModeEngaged = rtb_y_h3; + rtb_rightSpoilerHydraulicModeEngaged = rtb_y_ow; rtb_rightSpoilerElectricModeEngaged = rtb_leftSpoilerElectricModeEngaged; - elevator1Avail = rtb_y_h3; + elevator1Avail = rtb_y_ow; } else { if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { leftSpoilerHydraulicModeAvail = rtb_NOT_k; @@ -1108,9 +1109,9 @@ void A380PrimComputer::step() rightSpoilerHydraulicModeAvail = rtb_NOT_k; rightSpoilerElectricModeAvail = true; } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - leftSpoilerHydraulicModeAvail = rtb_y_h3; + leftSpoilerHydraulicModeAvail = rtb_y_ow; leftSpoilerElectricModeAvail = true; - rightSpoilerHydraulicModeAvail = rtb_y_h3; + rightSpoilerHydraulicModeAvail = rtb_y_ow; rightSpoilerElectricModeAvail = true; } else { leftSpoilerHydraulicModeAvail = false; @@ -1134,7 +1135,7 @@ void A380PrimComputer::step() if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { elevator1Avail = rtb_NOT_k; } else { - elevator1Avail = (A380PrimComputer_U.in.discrete_inputs.is_unit_3 && rtb_y_h3); + elevator1Avail = (A380PrimComputer_U.in.discrete_inputs.is_unit_3 && rtb_y_ow); } } @@ -1144,9 +1145,9 @@ void A380PrimComputer::step() rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word; } - A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_c); - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel1_bit_n, &rtb_y_k0); - rtb_AND_e = (rtb_y_c && (rtb_y_k0 != 0U)); + A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_bb); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel1_bit_n, &rtb_y_b4); + rtb_AND_e = (rtb_y_bb && (rtb_y_b4 != 0U)); elevator2Avail = (A380PrimComputer_U.in.discrete_inputs.is_unit_1 || (A380PrimComputer_U.in.discrete_inputs.is_unit_2 || (A380PrimComputer_U.in.discrete_inputs.is_unit_3 && rtb_NOT_k))); @@ -1159,57 +1160,57 @@ void A380PrimComputer::step() } rtb_AND_e = (elevator2Avail && rtb_AND2_i); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, &rtb_y_mj); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, &rtb_y_gc); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel3_bit, &rtb_y_m); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, &rtb_y_c); + A380PrimComputer_P.BitfromLabel3_bit, &rtb_y_ob); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, &rtb_y_bb); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel2_bit_l, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel2_bit_l, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_y_mj = (rtb_y_mj && (rtb_y_m != 0U)); + rtb_y_gc = (rtb_y_gc && (rtb_y_ob != 0U)); } else { - rtb_y_mj = (rtb_y_c && (rtb_y_k0 != 0U)); + rtb_y_gc = (rtb_y_bb && (rtb_y_b4 != 0U)); } - rtb_y_c = (A380PrimComputer_U.in.discrete_inputs.is_unit_1 || A380PrimComputer_U.in.discrete_inputs.is_unit_2); + rtb_y_bb = (A380PrimComputer_U.in.discrete_inputs.is_unit_1 || A380PrimComputer_U.in.discrete_inputs.is_unit_2); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND2_i = ((!rtb_y_mj) && rudder2ElectricModeHasPriority); + rtb_AND2_i = ((!rtb_y_gc) && rudder2ElectricModeHasPriority); } else { - rtb_AND2_i = (A380PrimComputer_U.in.discrete_inputs.is_unit_2 && ((!rtb_y_mj) && rudder2ElectricModeHasPriority)); + rtb_AND2_i = (A380PrimComputer_U.in.discrete_inputs.is_unit_2 && ((!rtb_y_gc) && rudder2ElectricModeHasPriority)); } - rtb_y_mj = (rtb_y_c && rtb_AND2_i); + rtb_y_gc = (rtb_y_bb && rtb_AND2_i); rtb_BusAssignment_j_logic_is_yellow_hydraulic_power_avail = rtb_NOT_k; A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, &rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel1_bit_bv, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel1_bit_bv, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { thsAvail = rtb_BusAssignment_j_logic_is_yellow_hydraulic_power_avail; - rtb_AND2_i = ((!rtb_NOT_k) || (rtb_y_k0 == 0U)); + rtb_AND2_i = ((!rtb_NOT_k) || (rtb_y_b4 == 0U)); } else { - rtb_thsEngaged = !A380PrimComputer_U.in.discrete_inputs.is_unit_2; - thsAvail = (rtb_thsEngaged && (A380PrimComputer_U.in.discrete_inputs.is_unit_3 && rtb_y_h3)); - rtb_AND2_i = (rtb_thsEngaged && A380PrimComputer_U.in.discrete_inputs.is_unit_3); + rtb_NOT_k = !A380PrimComputer_U.in.discrete_inputs.is_unit_2; + thsAvail = (rtb_NOT_k && (A380PrimComputer_U.in.discrete_inputs.is_unit_3 && rtb_y_ow)); + rtb_AND2_i = (rtb_NOT_k && A380PrimComputer_U.in.discrete_inputs.is_unit_3); } rtb_thsEngaged = (thsAvail && rtb_AND2_i); - rtb_BusAssignment_hi_logic_is_green_hydraulic_power_avail = rtb_y_h3; + rtb_BusAssignment_hi_logic_is_green_hydraulic_power_avail = rtb_y_ow; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel1_bit_k, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel1_bit_k, &rtb_y_b4); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel2_bit_e, &rtb_y_m); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, &rtb_y_cv); + A380PrimComputer_P.BitfromLabel2_bit_e, &rtb_y_ob); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, &rtb_y_jk); if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_i = (rtb_y_k0 != 0U); + rtb_AND2_i = (rtb_y_b4 != 0U); } else { - rtb_AND2_i = (rtb_y_m != 0U); + rtb_AND2_i = (rtb_y_ob != 0U); } - rtb_AND_n = (rtb_AND2_i && rtb_y_cv); + rtb_AND_n = (rtb_AND2_i && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel3_bit_c, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel3_bit_c, &rtb_y_b4); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel4_bit, &rtb_y_m); + A380PrimComputer_P.BitfromLabel4_bit, &rtb_y_ob); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word; } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { @@ -1218,22 +1219,22 @@ void A380PrimComputer::step() rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word; } - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel6_bit, &rtb_y_fn); - A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_h3); - rtb_AND6_o = ((rtb_y_fn != 0U) && rtb_y_h3); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel6_bit, &rtb_y_fd); + A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_y_ow); + rtb_AND6_o = ((rtb_y_fd != 0U) && rtb_y_ow); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.sec_2_bus.rudder_status_word; } else { rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word; } - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel9_bit, &rtb_y_fn); - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel10_bit, &rtb_y_fj); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel9_bit, &rtb_y_fd); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel10_bit, &rtb_y_n); A380PrimComputer_MATLABFunction(rtb_Switch_ir_0, &rtb_NOT_k); if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_i = (rtb_y_fn != 0U); + rtb_AND2_i = (rtb_y_fd != 0U); } else { - rtb_AND2_i = (rtb_y_fj != 0U); + rtb_AND2_i = (rtb_y_n != 0U); } rtb_AND3 = (rtb_AND2_i && rtb_NOT_k); @@ -1258,12 +1259,12 @@ void A380PrimComputer::step() if (A380PrimComputer_U.in.discrete_inputs.is_unit_2 || A380PrimComputer_U.in.discrete_inputs.is_unit_3) { rudder1HydraulicModeHasPriority = !rtb_AND_n; if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_i = (rtb_y_k0 != 0U); + rtb_AND2_i = (rtb_y_b4 != 0U); } else { - rtb_AND2_i = (rtb_y_m != 0U); + rtb_AND2_i = (rtb_y_ob != 0U); } - rtb_AND_n = (rudder1HydraulicModeHasPriority && ((!rtb_y_cv) || (!rtb_AND2_i)) && (!rudder1HydraulicModeAvail) && + rtb_AND_n = (rudder1HydraulicModeHasPriority && ((!rtb_y_jk) || (!rtb_AND2_i)) && (!rudder1HydraulicModeAvail) && (!rtb_AND6_o) && (!rtb_AND3) && rudder2ElectricModeHasPriority); } else { rudder1HydraulicModeHasPriority = false; @@ -1274,22 +1275,22 @@ void A380PrimComputer::step() rtb_rudder1HydraulicModeEngaged = (rudder1HydraulicModeAvail && rudder1HydraulicModeHasPriority); rtb_AND_n = (rudder1ElectricModeAvail && rtb_AND_n); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel5_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, &rtb_y_cv); - rtb_AND3 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel5_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, &rtb_y_jk); + rtb_AND3 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel7_bit, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel7_bit, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, &rtb_NOT_k); - rtb_AND4_f = ((rtb_y_k0 != 0U) && rtb_NOT_k); + rtb_AND4_f = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel8_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, &rtb_y_h3); + A380PrimComputer_P.BitfromLabel8_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, &rtb_y_ow); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_AND6_o = rtb_BusAssignment_hi_logic_is_green_hydraulic_power_avail; rudder1HydraulicModeHasPriority = true; rudder2HydraulicModeHasPriority = true; - rudder2ElectricModeHasPriority = ((!rtb_AND3) && rtb_rudder2HydraulicModeEngaged && (!rtb_AND4_f) && ((rtb_y_k0 == - 0U) || (!rtb_y_h3)) && rudder2ElectricModeHasPriority); + rudder2ElectricModeHasPriority = ((!rtb_AND3) && rtb_rudder2HydraulicModeEngaged && (!rtb_AND4_f) && ((rtb_y_b4 == + 0U) || (!rtb_y_ow)) && rudder2ElectricModeHasPriority); } else { rtb_AND6_o = false; rudder1HydraulicModeHasPriority = false; @@ -1300,58 +1301,58 @@ void A380PrimComputer::step() rtb_rudder2HydraulicModeEngaged = (rtb_AND6_o && rudder2HydraulicModeHasPriority); rudder2ElectricModeHasPriority = (rudder1HydraulicModeHasPriority && rudder2ElectricModeHasPriority); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel_bit_i, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel_bit_i, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.aileron_status_word, &rtb_DataTypeConversion_m2); - rtb_AND3 = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + rtb_AND3 = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel1_bit_c, &rtb_y_k0); - rudder2HydraulicModeHasPriority = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel1_bit_c, &rtb_y_b4); + rudder2HydraulicModeHasPriority = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel2_bit_p, &rtb_y_k0); - rtb_AND2_ac = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel2_bit_p, &rtb_y_b4); + rtb_AND2_ac = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel3_bit_n, &rtb_y_k0); - rtb_AND1_l = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel3_bit_n, &rtb_y_b4); + rtb_AND1_l = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel4_bit_j, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, &rtb_y_cv); - rtb_AND4_d = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel4_bit_j, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, &rtb_y_jk); + rtb_AND4_d = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel5_bit_i, &rtb_y_k0); - rtb_AND4_f = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel5_bit_i, &rtb_y_b4); + rtb_AND4_f = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel6_bit_j, &rtb_y_k0); - rtb_AND7 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel6_bit_j, &rtb_y_b4); + rtb_AND7 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel7_bit_n, &rtb_y_k0); - rtb_AND8 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel7_bit_n, &rtb_y_b4); + rtb_AND8 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel8_bit_n, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel8_bit_n, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.aileron_status_word, &rtb_NOT_k); - rtb_AND13 = ((rtb_y_k0 != 0U) && rtb_NOT_k); + rtb_AND13 = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel9_bit_b, &rtb_y_k0); - rtb_AND11 = ((rtb_y_k0 != 0U) && rtb_NOT_k); + A380PrimComputer_P.BitfromLabel9_bit_b, &rtb_y_b4); + rtb_AND11 = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel10_bit_h, &rtb_y_k0); - rtb_AND10 = ((rtb_y_k0 != 0U) && rtb_NOT_k); + A380PrimComputer_P.BitfromLabel10_bit_h, &rtb_y_b4); + rtb_AND10 = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel11_bit, &rtb_y_k0); - rtb_AND9 = ((rtb_y_k0 != 0U) && rtb_NOT_k); + A380PrimComputer_P.BitfromLabel11_bit, &rtb_y_b4); + rtb_AND9 = ((rtb_y_b4 != 0U) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel14_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.aileron_status_word, &rtb_y_h3); - rtb_AND15 = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel14_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.aileron_status_word, &rtb_y_ow); + rtb_AND15 = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel15_bit, &rtb_y_k0); - rtb_AND16 = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel15_bit, &rtb_y_b4); + rtb_AND16 = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel16_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.aileron_status_word, &rtb_y_cv); - rtb_AND17 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel16_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.aileron_status_word, &rtb_y_jk); + rtb_AND17 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.aileron_status_word, - A380PrimComputer_P.BitfromLabel17_bit, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel17_bit, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_AND2_i = (rtb_OR7 || rtb_AND2_ac); rtb_AND9_o = (rtb_doubleIrFault_tmp || rtb_AND1_l); @@ -1376,135 +1377,128 @@ void A380PrimComputer::step() } else { rtb_rightOutboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_2_position_deg.Data; } - } else { - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_AND2_i = (rtb_OR1 || rtb_AND3); - rtb_AND9_o = (rtb_rightAileron2Engaged || rudder2HydraulicModeHasPriority); - rtb_AND2_ac = (rtb_AND2_ac || rtb_AND4_d); - rtb_AND1_l = (rtb_AND1_l || rtb_AND4_f); - rtb_AND3 = (rtb_OR7 || rtb_AND7); - rudder2HydraulicModeHasPriority = (rtb_doubleIrFault_tmp || rtb_AND8); - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_i = (rtb_AND3 || rtb_AND7); - rtb_AND9_o = (rudder2HydraulicModeHasPriority || rtb_AND8); - rtb_AND2_ac = (rtb_OR7 || rtb_AND2_ac); - rtb_AND1_l = (rtb_doubleIrFault_tmp || rtb_AND1_l); - rtb_AND3 = (rtb_AND4_d || rtb_OR1); - rudder2HydraulicModeHasPriority = (rtb_AND4_f || rtb_rightAileron2Engaged); + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { + rtb_AND2_i = (rtb_OR1 || rtb_AND3); + rtb_AND9_o = (rtb_rightAileron2Engaged || rudder2HydraulicModeHasPriority); + rtb_AND2_ac = (rtb_AND2_ac || rtb_AND4_d); + rtb_AND1_l = (rtb_AND1_l || rtb_AND4_f); + rtb_AND3 = (rtb_OR7 || rtb_AND7); + rudder2HydraulicModeHasPriority = (rtb_doubleIrFault_tmp || rtb_AND8); + rtb_leftInboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_2_pos_deg; + rtb_rightInboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_2_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_leftMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_1_position_deg.Data; } else { - rtb_AND2_i = false; - rtb_AND9_o = false; - rtb_AND2_ac = false; - rtb_AND1_l = false; - rtb_AND3 = false; - rudder2HydraulicModeHasPriority = false; + rtb_leftMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_2_position_deg.Data; } - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_leftInboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_2_pos_deg; - rtb_rightInboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_2_pos_deg; - if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_leftMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_1_position_deg.Data; - } else { - rtb_leftMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_2_position_deg.Data; - } - - if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_rightMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_1_position_deg.Data; - } else { - rtb_rightMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_2_position_deg.Data; - } - - rtb_leftOutboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_1_pos_deg; - rtb_rightOutboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_1_pos_deg; - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_leftInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_1_position_deg.Data; - } else { - rtb_leftInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_2_position_deg.Data; - } + if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_rightMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_1_position_deg.Data; + } else { + rtb_rightMidboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_2_position_deg.Data; + } - if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_rightInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_1_position_deg.Data; - } else { - rtb_rightInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_2_position_deg.Data; - } + rtb_leftOutboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_1_pos_deg; + rtb_rightOutboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_1_pos_deg; + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { + rtb_AND2_i = (rtb_AND3 || rtb_AND7); + rtb_AND9_o = (rudder2HydraulicModeHasPriority || rtb_AND8); + rtb_AND2_ac = (rtb_OR7 || rtb_AND2_ac); + rtb_AND1_l = (rtb_doubleIrFault_tmp || rtb_AND1_l); + rtb_AND3 = (rtb_AND4_d || rtb_OR1); + rudder2HydraulicModeHasPriority = (rtb_AND4_f || rtb_rightAileron2Engaged); + if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_leftInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_aileron_1_position_deg.Data; + } else { + rtb_leftInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_aileron_2_position_deg.Data; + } - rtb_leftMidboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_1_pos_deg; - rtb_rightMidboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_1_pos_deg; - rtb_leftOutboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_2_pos_deg; - rtb_rightOutboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_2_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_rightInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.right_aileron_1_position_deg.Data; } else { - rtb_leftInboardAilPos = 0.0; - rtb_rightInboardAilPos = 0.0; - rtb_leftMidboardAilPos = 0.0; - rtb_rightMidboardAilPos = 0.0; - rtb_leftOutboardAilPos = 0.0; - rtb_rightOutboardAilPos = 0.0; + rtb_rightInboardAilPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_aileron_2_position_deg.Data; } + + rtb_leftMidboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_1_pos_deg; + rtb_rightMidboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_1_pos_deg; + rtb_leftOutboardAilPos = A380PrimComputer_U.in.analog_inputs.left_aileron_2_pos_deg; + rtb_rightOutboardAilPos = A380PrimComputer_U.in.analog_inputs.right_aileron_2_pos_deg; + } else { + rtb_AND2_i = false; + rtb_AND9_o = false; + rtb_AND2_ac = false; + rtb_AND1_l = false; + rtb_AND3 = false; + rudder2HydraulicModeHasPriority = false; + rtb_leftInboardAilPos = 0.0; + rtb_rightInboardAilPos = 0.0; + rtb_leftMidboardAilPos = 0.0; + rtb_rightMidboardAilPos = 0.0; + rtb_leftOutboardAilPos = 0.0; + rtb_rightOutboardAilPos = 0.0; } rtb_AND4_f = (rtb_AND2_i || (rtb_AND13 || rtb_AND15)); rtb_AND11 = (rtb_AND9_o || (rtb_AND11 || rtb_AND16)); rtb_AND10 = (rtb_AND2_ac || (rtb_AND10 || rtb_AND17)); - rtb_AND9 = (rtb_AND1_l || (rtb_AND9 || ((rtb_y_k0 != 0U) && rtb_y_cv))); + rtb_AND9 = (rtb_AND1_l || (rtb_AND9 || ((rtb_y_b4 != 0U) && rtb_y_jk))); rtb_rightAileron2Command = rtb_alpha; rtb_elevator1Command = rtb_phi; rtb_right_midboard_aileron_deg = rtb_r; rtb_elevator2Command = rtb_n_z; rtb_elevator3Command = rtb_theta_dot; rtb_rudder1Command = rtb_raComputationValue; - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, &rtb_y_h3); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, &rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel1_bit_g, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_g, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel2_bit_pc, &rtb_y_k0); - rtb_AND13 = (rtb_y_h3 && (rtb_DataTypeConversion_m2 || (rtb_y_k0 != 0U))); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, &rtb_y_h3); + A380PrimComputer_P.BitfromLabel2_bit_pc, &rtb_y_b4); + rtb_AND13 = (rtb_y_ow && (rtb_DataTypeConversion_m2 || (rtb_y_b4 != 0U))); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, &rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel1_bit_i, &rtb_y_k0); - rtb_y_dvi = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_i, &rtb_y_b4); + rtb_y_c = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel2_bit_n, &rtb_y_k0); - rtb_AND17 = (rtb_y_h3 && (rtb_y_dvi || (rtb_y_k0 != 0U))); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.spoiler_status_word, &rtb_y_h3); + A380PrimComputer_P.BitfromLabel2_bit_n, &rtb_y_b4); + rtb_AND17 = (rtb_y_ow && (rtb_y_c || (rtb_y_b4 != 0U))); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.spoiler_status_word, &rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel1_bit_nd, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_nd, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel2_bit_d, &rtb_y_k0); - rtb_AND4_d = (rtb_y_h3 && (rtb_DataTypeConversion_m2 || (rtb_y_k0 != 0U))); + A380PrimComputer_P.BitfromLabel2_bit_d, &rtb_y_b4); + rtb_AND4_d = (rtb_y_ow && (rtb_DataTypeConversion_m2 || (rtb_y_b4 != 0U))); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel8_bit_l, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel8_bit_l, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel9_bit_g, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel9_bit_g, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.spoiler_status_word, &rtb_NOT_k); - rtb_AND15 = ((rtb_DataTypeConversion_m2 || (rtb_y_k0 != 0U)) && rtb_NOT_k); + rtb_AND15 = ((rtb_DataTypeConversion_m2 || (rtb_y_b4 != 0U)) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel10_bit_j, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel10_bit_j, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel11_bit_j, &rtb_y_k0); - rtb_AND16 = ((rtb_y_cv || (rtb_y_k0 != 0U)) && rtb_NOT_k); + A380PrimComputer_P.BitfromLabel11_bit_j, &rtb_y_b4); + rtb_AND16 = ((rtb_y_jk || (rtb_y_b4 != 0U)) && rtb_NOT_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel14_bit_p, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel14_bit_p, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel15_bit_i, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, &rtb_y_h3); - rtb_AND8 = ((rtb_y_cv || (rtb_y_k0 != 0U)) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel15_bit_i, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, &rtb_y_ow); + rtb_AND8 = ((rtb_y_jk || (rtb_y_b4 != 0U)) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel12_bit, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel12_bit, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel13_bit, &rtb_y_k0); - rtb_AND9_o = ((rtb_y_cv || (rtb_y_k0 != 0U)) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel13_bit, &rtb_y_b4); + rtb_AND9_o = ((rtb_y_jk || (rtb_y_b4 != 0U)) && rtb_y_ow); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_AND7 = (rtb_AND8 || rtb_AND9_o); rtb_AND8 = (rtb_AND15 || rtb_AND16); @@ -1526,19 +1520,19 @@ void A380PrimComputer::step() rtb_AND15 = false; } - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, &rtb_y_h3); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, &rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel1_bit_l, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_l, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel2_bit_f, &rtb_y_k0); - rtb_AND16 = (rtb_y_h3 && (rtb_y_cv || (rtb_y_k0 != 0U))); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, &rtb_y_h3); + A380PrimComputer_P.BitfromLabel2_bit_f, &rtb_y_b4); + rtb_AND16 = (rtb_y_ow && (rtb_y_jk || (rtb_y_b4 != 0U))); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, &rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel1_bit_p, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_p, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.spoiler_status_word, - A380PrimComputer_P.BitfromLabel2_bit_b, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel2_bit_b, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_leftSplr4Pos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.left_spoiler_position_deg.Data; rtb_rightSplr4Pos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.right_spoiler_position_deg.Data; @@ -1569,72 +1563,72 @@ void A380PrimComputer::step() rtb_rightSplr6Pos = 0.0; } - rtb_AND9_o = (rtb_y_h3 && (rtb_DataTypeConversion_m2 || (rtb_y_k0 != 0U))); + rtb_AND9_o = (rtb_y_ow && (rtb_DataTypeConversion_m2 || (rtb_y_b4 != 0U))); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel16_bit_b, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, &rtb_y_cv); - rtb_AND2_ac = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel16_bit_b, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, &rtb_y_jk); + rtb_AND2_ac = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel17_bit_i, &rtb_y_k0); - rtb_AND15_l = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel17_bit_i, &rtb_y_b4); + rtb_AND15_l = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel18_bit, &rtb_y_k0); - rtb_AND1_l = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel18_bit, &rtb_y_b4); + rtb_AND1_l = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel19_bit, &rtb_y_k0); - rtb_AND12 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel19_bit, &rtb_y_b4); + rtb_AND12 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel20_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, &rtb_y_h3); - rtb_AND16_n = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel20_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, &rtb_y_ow); + rtb_AND16_n = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel21_bit, &rtb_y_k0); - rtb_AND18_c = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel21_bit, &rtb_y_b4); + rtb_AND18_c = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel22_bit, &rtb_y_k0); - rtb_AND19 = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel22_bit, &rtb_y_b4); + rtb_AND19 = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel23_bit, &rtb_y_k0); - rtb_AND20 = ((rtb_y_k0 != 0U) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel23_bit, &rtb_y_b4); + rtb_AND20 = ((rtb_y_b4 != 0U) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel1_bit_lr, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel1_bit_lr, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.elevator_status_word, &rtb_DataTypeConversion_m2); - rtb_AND5_e = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + rtb_AND5_e = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel2_bit_g, &rtb_y_k0); - rtb_AND3_h = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel2_bit_g, &rtb_y_b4); + rtb_AND3_h = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel3_bit_k, &rtb_y_k0); - rtb_AND2_i = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel3_bit_k, &rtb_y_b4); + rtb_AND2_i = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel4_bit_n, &rtb_y_k0); - rtb_y_h3 = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel4_bit_n, &rtb_y_b4); + rtb_NOT_k = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel5_bit_e, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel5_bit_e, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.elevator_status_word, &rtb_DataTypeConversion_m2); - rtb_AND4_fg3 = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + rtb_AND4_fg3 = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel6_bit_b, &rtb_y_k0); - rtb_NOT_k = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel6_bit_b, &rtb_y_b4); + rtb_y_ow = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel7_bit_p, &rtb_y_k0); - rtb_AND7_d = ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel7_bit_p, &rtb_y_b4); + rtb_AND7_d = ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel8_bit_d, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.elevator_status_word, &rtb_y_cv); - rtb_DataTypeConversion_m2 = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel8_bit_d, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.elevator_status_word, &rtb_y_jk); + rtb_DataTypeConversion_m2 = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel9_bit_e, &rtb_y_k0); - rtb_AND10_b = ((rtb_y_k0 != 0U) && rtb_y_cv); + A380PrimComputer_P.BitfromLabel9_bit_e, &rtb_y_b4); + rtb_AND10_b = ((rtb_y_b4 != 0U) && rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.elevator_status_word, - A380PrimComputer_P.BitfromLabel11_bit_n, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel11_bit_n, &rtb_y_b4); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { leftInboardElevEngaged = (rtb_AND_e || rtb_AND16_n); rtb_AND19 = (rtb_AND18_c || rtb_AND1_l); rtb_AND15_l = (elevator1Avail || rtb_AND15_l); - rtb_AND16_n = (rtb_AND2_ac || rtb_y_mj); + rtb_AND16_n = (rtb_AND2_ac || rtb_y_gc); rtb_AND12 = (rtb_thsEngaged || rtb_AND20); rtb_leftInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_2_pos_deg; if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_2_position_deg.SSM == static_cast @@ -1647,172 +1641,158 @@ void A380PrimComputer::step() rtb_leftOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_1_pos_deg; rtb_rightOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_3_pos_deg; rtb_thsPos = A380PrimComputer_U.in.analog_inputs.ths_pos_deg; - } else { - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - leftInboardElevEngaged = (rtb_AND16_n || rtb_AND15_l); - rtb_AND19 = (rtb_y_mj || rtb_AND18_c); - rtb_AND15_l = (rtb_AND_e || rtb_AND2_ac); - rtb_AND16_n = (elevator1Avail || rtb_AND1_l); - rtb_AND12 = (rtb_AND12 || rtb_AND20); - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - leftInboardElevEngaged = (elevator1Avail || rtb_AND15_l); - rtb_AND19 = (rtb_AND_e || rtb_AND19); - rtb_AND15_l = (rtb_AND2_ac || rtb_AND18_c); - rtb_AND16_n = (rtb_AND16_n || rtb_AND1_l); - rtb_AND12 = (rtb_thsEngaged || rtb_AND12); + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { + leftInboardElevEngaged = (rtb_AND16_n || rtb_AND15_l); + rtb_AND19 = (rtb_y_gc || rtb_AND18_c); + rtb_AND15_l = (rtb_AND_e || rtb_AND2_ac); + rtb_AND16_n = (elevator1Avail || rtb_AND1_l); + rtb_AND12 = (rtb_AND12 || rtb_AND20); + if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_leftInboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.Data; } else { - leftInboardElevEngaged = false; - rtb_AND19 = false; - rtb_AND15_l = false; - rtb_AND16_n = false; - rtb_AND12 = false; + rtb_leftInboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_2_position_deg.Data; } - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_leftInboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.Data; - } else { - rtb_leftInboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_2_position_deg.Data; - } - - rtb_rightInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_3_pos_deg; - rtb_leftOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_2_pos_deg; - rtb_rightOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_1_pos_deg; - if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.ths_position_deg.SSM == static_cast(SignStatusMatrix:: - NormalOperation)) { - rtb_thsPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.ths_position_deg.Data; - } else { - rtb_thsPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.ths_position_deg.Data; - } - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_leftInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_1_pos_deg; - rtb_rightInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_2_pos_deg; - if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_leftOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_1_position_deg.Data; - } else { - rtb_leftOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_2_position_deg.Data; - } - - if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_rightOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.Data; - } else { - rtb_rightOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_3_position_deg.Data; - } + rtb_rightInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_3_pos_deg; + rtb_leftOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_2_pos_deg; + rtb_rightOutboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_1_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.ths_position_deg.SSM == static_cast(SignStatusMatrix:: + NormalOperation)) { + rtb_thsPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.ths_position_deg.Data; + } else { + rtb_thsPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.ths_position_deg.Data; + } + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { + leftInboardElevEngaged = (elevator1Avail || rtb_AND15_l); + rtb_AND19 = (rtb_AND_e || rtb_AND19); + rtb_AND15_l = (rtb_AND2_ac || rtb_AND18_c); + rtb_AND16_n = (rtb_AND16_n || rtb_AND1_l); + rtb_AND12 = (rtb_thsEngaged || rtb_AND12); + rtb_leftInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_1_pos_deg; + rtb_rightInboardElevPos = A380PrimComputer_U.in.analog_inputs.elevator_2_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_leftOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_1_position_deg.Data; + } else { + rtb_leftOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_2_position_deg.Data; + } - rtb_thsPos = A380PrimComputer_U.in.analog_inputs.ths_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_rightOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.elevator_1_position_deg.Data; } else { - rtb_leftInboardElevPos = 0.0; - rtb_rightInboardElevPos = 0.0; - rtb_leftOutboardElevPos = 0.0; - rtb_rightOutboardElevPos = 0.0; - rtb_thsPos = 0.0; + rtb_rightOutboardElevPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.elevator_3_position_deg.Data; } + + rtb_thsPos = A380PrimComputer_U.in.analog_inputs.ths_pos_deg; + } else { + leftInboardElevEngaged = false; + rtb_AND19 = false; + rtb_AND15_l = false; + rtb_AND16_n = false; + rtb_AND12 = false; + rtb_leftInboardElevPos = 0.0; + rtb_rightInboardElevPos = 0.0; + rtb_leftOutboardElevPos = 0.0; + rtb_rightOutboardElevPos = 0.0; + rtb_thsPos = 0.0; } rtb_AND2_ac = (leftInboardElevEngaged || (rtb_DataTypeConversion_m2 || rtb_AND3_h)); rtb_AND1_l = (rtb_AND19 || (rtb_AND10_b || rtb_AND7_d)); - rtb_AND5_e = (rtb_AND15_l || (rtb_AND5_e || rtb_NOT_k)); + rtb_AND5_e = (rtb_AND15_l || (rtb_AND5_e || rtb_y_ow)); rtb_AND4_fg3 = (rtb_AND16_n || (rtb_AND4_fg3 || rtb_AND2_i)); - rtb_AND12 = (rtb_AND12 || (((rtb_y_k0 != 0U) && rtb_y_cv) || rtb_y_h3)); + rtb_AND12 = (rtb_AND12 || (((rtb_y_b4 != 0U) && rtb_y_jk) || rtb_NOT_k)); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel38_bit, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel38_bit, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel39_bit, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel39_bit, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, &rtb_DataTypeConversion_m2); - rtb_AND3_h = ((rtb_NOT_k || (rtb_y_k0 != 0U)) && rtb_DataTypeConversion_m2); + rtb_AND3_h = ((rtb_NOT_k || (rtb_y_b4 != 0U)) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel32_bit, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel32_bit, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel33_bit, &rtb_y_k0); - rtb_AND15_l = ((rtb_NOT_k || (rtb_y_k0 != 0U)) && rtb_DataTypeConversion_m2); + A380PrimComputer_P.BitfromLabel33_bit, &rtb_y_b4); + rtb_AND15_l = ((rtb_NOT_k || (rtb_y_b4 != 0U)) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel36_bit, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel36_bit, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel37_bit, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, &rtb_y_h3); - rtb_AND20 = ((rtb_NOT_k || (rtb_y_k0 != 0U)) && rtb_y_h3); + A380PrimComputer_P.BitfromLabel37_bit, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_status_word, &rtb_y_ow); + rtb_AND20 = ((rtb_NOT_k || (rtb_y_b4 != 0U)) && rtb_y_ow); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel3_bit_m, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel3_bit_m, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel4_bit_b, &rtb_y_k0); - rtb_y_h3 = (rtb_NOT_k || (rtb_y_k0 != 0U)); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, &rtb_y_dvi); + A380PrimComputer_P.BitfromLabel4_bit_b, &rtb_y_b4); + rtb_y_ow = (rtb_NOT_k || (rtb_y_b4 != 0U)); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, &rtb_y_c); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel1_bit_pt, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_pt, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_1_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel2_bit_h, &rtb_y_k0); - rtb_y_cv = (rtb_NOT_k || (rtb_y_k0 != 0U)); + A380PrimComputer_P.BitfromLabel2_bit_h, &rtb_y_b4); + rtb_y_jk = (rtb_NOT_k || (rtb_y_b4 != 0U)); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel5_bit_d, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel5_bit_d, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel6_bit_p, &rtb_y_k0); - rtb_AND16_n = (rtb_NOT_k || (rtb_y_k0 != 0U)); + A380PrimComputer_P.BitfromLabel6_bit_p, &rtb_y_b4); + rtb_AND16_n = (rtb_NOT_k || (rtb_y_b4 != 0U)); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_2_bus.rudder_status_word, &rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel7_bit_g, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel7_bit_g, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, - A380PrimComputer_P.BitfromLabel8_bit_i, &rtb_y_k0); - rtb_AND2_i = (rtb_NOT_k || (rtb_y_k0 != 0U)); + A380PrimComputer_P.BitfromLabel8_bit_i, &rtb_y_b4); + rtb_AND2_i = (rtb_NOT_k || (rtb_y_b4 != 0U)); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sec_3_bus.rudder_status_word, &rtb_NOT_k); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { rtb_AND3_h = (rtb_rudder1HydraulicModeEngaged || rtb_AND_n || rtb_AND3_h); rtb_AND15_l = (rtb_rudder2HydraulicModeEngaged || rudder2ElectricModeHasPriority || rtb_AND20); rtb_upperRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_1_pos_deg; rtb_lowerRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_2_pos_deg; - } else { - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_AND3_h = (rtb_rudder1HydraulicModeEngaged || rtb_AND_n || rtb_AND3_h); - rtb_AND15_l = (rtb_AND15_l || rtb_AND20); - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND3_h = (rtb_AND3_h || rtb_AND20); - rtb_AND15_l = (rtb_rudder1HydraulicModeEngaged || rtb_AND_n || rtb_AND15_l); + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { + rtb_AND3_h = (rtb_rudder1HydraulicModeEngaged || rtb_AND_n || rtb_AND3_h); + rtb_AND15_l = (rtb_AND15_l || rtb_AND20); + rtb_upperRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_1_pos_deg; + if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_2_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_lowerRudderPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_2_position_deg.Data; } else { - rtb_AND3_h = false; - rtb_AND15_l = false; + rtb_lowerRudderPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_1_position_deg.Data; } - - if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - rtb_upperRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_1_pos_deg; - if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_2_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_lowerRudderPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_2_position_deg.Data; - } else { - rtb_lowerRudderPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_1_position_deg.Data; - } - } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { - if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_1_position_deg.SSM == static_cast - (SignStatusMatrix::NormalOperation)) { - rtb_upperRudderPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_1_position_deg.Data; - } else { - rtb_upperRudderPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_1_position_deg.Data; - } - - rtb_lowerRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_1_pos_deg; + } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_3) { + rtb_AND3_h = (rtb_AND3_h || rtb_AND20); + rtb_AND15_l = (rtb_rudder1HydraulicModeEngaged || rtb_AND_n || rtb_AND15_l); + if (A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_1_position_deg.SSM == static_cast + (SignStatusMatrix::NormalOperation)) { + rtb_upperRudderPos = A380PrimComputer_U.in.bus_inputs.prim_x_bus.rudder_1_position_deg.Data; } else { - rtb_upperRudderPos = 0.0; - rtb_lowerRudderPos = 0.0; + rtb_upperRudderPos = A380PrimComputer_U.in.bus_inputs.prim_y_bus.rudder_1_position_deg.Data; } + + rtb_lowerRudderPos = A380PrimComputer_U.in.analog_inputs.rudder_1_pos_deg; + } else { + rtb_AND3_h = false; + rtb_AND15_l = false; + rtb_upperRudderPos = 0.0; + rtb_lowerRudderPos = 0.0; } - rtb_AND3_h = (rtb_AND3_h || (rtb_y_h3 && rtb_y_dvi) || (rtb_AND16_n && rtb_DataTypeConversion_m2)); - rtb_AND15_l = (rtb_AND15_l || (rtb_y_cv && rtb_y_dvi) || (rtb_AND2_i && rtb_NOT_k)); + rtb_AND3_h = (rtb_AND3_h || (rtb_y_ow && rtb_y_c) || (rtb_AND16_n && rtb_DataTypeConversion_m2)); + rtb_AND15_l = (rtb_AND15_l || (rtb_y_jk && rtb_y_c) || (rtb_AND2_i && rtb_NOT_k)); A380PrimComputer_MATLABFunction_c(A380PrimComputer_U.in.sim_data.slew_on, A380PrimComputer_U.in.time.dt, - A380PrimComputer_P.ConfirmNode_isRisingEdge_o, A380PrimComputer_P.ConfirmNode_timeDelay_d, &rtb_y_h3, + A380PrimComputer_P.ConfirmNode_isRisingEdge_o, A380PrimComputer_P.ConfirmNode_timeDelay_d, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_nb); - rtb_AND19 = !rtb_AND1; - rtb_AND16_n = ((!rtb_y_h3) && rtb_AND19 && (((!rtb_tripleAdrFault) && ((rtb_mach > 0.96) || (rtb_Y < -10.0) || + rtb_AND19 = !rtb_AND2; + rtb_AND16_n = ((!rtb_y_ow) && rtb_AND19 && (((!rtb_tripleAdrFault) && ((rtb_mach > 0.96) || (rtb_Y < -10.0) || (rtb_Y > 37.5) || (rtb_V_ias > 420.0F) || (rtb_V_ias < 70.0F))) || ((!rtb_tripleIrFault) && ((!rtb_doubleIrFault) || (!A380PrimComputer_P.Constant_Value_ad)) && ((std::abs(static_cast(rtb_phi)) > 120.0) || ((rtb_alpha > 50.0F) || (rtb_alpha < -30.0F)))))); @@ -1842,41 +1822,41 @@ void A380PrimComputer::step() } A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel_bit_o, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel_bit_o, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel1_bit_e, &rtb_y_k0); - rtb_AND2_i = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_e, &rtb_y_b4); + rtb_AND2_i = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel2_bit_hr, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel2_bit_hr, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel6_bit_k, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_h3); - A380PrimComputer_MATLABFunction_ek(rtb_y_cv, rtb_AND2_i, rtb_NOT_k, rtb_y_h3, &rtb_law_c); + A380PrimComputer_P.BitfromLabel6_bit_k, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_ow); + A380PrimComputer_MATLABFunction_ek(rtb_y_jk, rtb_AND2_i, rtb_NOT_k, rtb_y_ow, &rtb_law_k); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel3_bit_l, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel3_bit_l, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel4_bit_bl, &rtb_y_k0); - rtb_AND2_i = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel4_bit_bl, &rtb_y_b4); + rtb_AND2_i = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel5_bit_p, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel5_bit_p, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel7_bit_h, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, &rtb_y_h3); - A380PrimComputer_MATLABFunction_ek(rtb_y_cv, rtb_AND2_i, rtb_NOT_k, rtb_y_h3, &rtb_law); + A380PrimComputer_P.BitfromLabel7_bit_h, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_y_bus.fctl_law_status_word, &rtb_y_ow); + A380PrimComputer_MATLABFunction_ek(rtb_y_jk, rtb_AND2_i, rtb_NOT_k, rtb_y_ow, &rtb_law); if (A380PrimComputer_U.in.discrete_inputs.is_unit_1) { nz = static_cast(rtb_pitchLawCapability); - b_nz = static_cast(rtb_law_c); + b_nz = static_cast(rtb_law_k); prim3LawCap = static_cast(rtb_law); } else if (A380PrimComputer_U.in.discrete_inputs.is_unit_2) { - nz = static_cast(rtb_law_c); + nz = static_cast(rtb_law_k); b_nz = static_cast(rtb_pitchLawCapability); prim3LawCap = static_cast(rtb_law); } else { - nz = static_cast(rtb_law_c); + nz = static_cast(rtb_law_k); b_nz = static_cast(rtb_law); prim3LawCap = static_cast(rtb_pitchLawCapability); } @@ -1901,21 +1881,21 @@ void A380PrimComputer::step() rtb_AND2_i = !rtb_AND20; if (rtb_AND2_i) { - rtb_law_c = a380_pitch_efcs_law::None; + rtb_law_k = a380_pitch_efcs_law::None; rtb_activeLateralLaw = a380_lateral_efcs_law::None; } else { - rtb_law_c = rtb_pitchLawCapability; + rtb_law_k = rtb_pitchLawCapability; rtb_activeLateralLaw = a380_lateral_efcs_law::NormalLaw; } A380PrimComputer_MATLABFunction_f(A380PrimComputer_U.in.discrete_inputs.capt_priority_takeover_pressed, A380PrimComputer_P.PulseNode_isRisingEdge, &rtb_NOT_k, &A380PrimComputer_DWork.sf_MATLABFunction_g4); A380PrimComputer_MATLABFunction_f(A380PrimComputer_U.in.discrete_inputs.fo_priority_takeover_pressed, - A380PrimComputer_P.PulseNode1_isRisingEdge, &rtb_y_h3, &A380PrimComputer_DWork.sf_MATLABFunction_nu); + A380PrimComputer_P.PulseNode1_isRisingEdge, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_nu); if (rtb_NOT_k) { A380PrimComputer_DWork.pRightStickDisabled = true; A380PrimComputer_DWork.pLeftStickDisabled = false; - } else if (rtb_y_h3) { + } else if (rtb_y_ow) { A380PrimComputer_DWork.pLeftStickDisabled = true; A380PrimComputer_DWork.pRightStickDisabled = false; } @@ -1980,36 +1960,36 @@ void A380PrimComputer::step() } A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel_bit_h, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel_bit_h, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel1_bit_gs, &rtb_y_k0); - rtb_y_h3 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_gs, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel2_bit_nu, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel2_bit_nu, &rtb_y_b4); + rtb_y_ow = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel3_bit_g, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel3_bit_g, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel4_bit_e, &rtb_y_k0); - rtb_AND18_c = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel4_bit_e, &rtb_y_b4); + rtb_AND18_c = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel5_bit_a, &rtb_y_k0); - A380PrimComputer_MATLABFunction_o(rtb_y_cv, rtb_y_h3, rtb_NOT_k, rtb_DataTypeConversion_m2, rtb_AND18_c, (rtb_y_k0 + A380PrimComputer_P.BitfromLabel5_bit_a, &rtb_y_b4); + A380PrimComputer_MATLABFunction_o(rtb_y_jk, rtb_NOT_k, rtb_y_ow, rtb_DataTypeConversion_m2, rtb_AND18_c, (rtb_y_b4 != 0U), &rtb_handleIndex); A380PrimComputer_RateLimiter_n(look2_binlxpw(static_cast(rtb_mach), rtb_handleIndex, A380PrimComputer_P.alphamax_bp01Data, A380PrimComputer_P.alphamax_bp02Data, A380PrimComputer_P.alphamax_tableData, A380PrimComputer_P.alphamax_maxIndex, 4U), A380PrimComputer_P.RateLimiterGenericVariableTs_up, A380PrimComputer_P.RateLimiterGenericVariableTs_lo, A380PrimComputer_U.in.time.dt, A380PrimComputer_P.reset_Value, &rtb_Switch_h, &A380PrimComputer_DWork.sf_RateLimiter_ne); - if (!A380PrimComputer_DWork.eventTime_not_empty_e) { - A380PrimComputer_DWork.eventTime_d = A380PrimComputer_U.in.time.simulation_time; - A380PrimComputer_DWork.eventTime_not_empty_e = true; + if (!A380PrimComputer_DWork.eventTime_not_empty_m) { + A380PrimComputer_DWork.eventTime_f = A380PrimComputer_U.in.time.simulation_time; + A380PrimComputer_DWork.eventTime_not_empty_m = true; } - if (rtb_AND1 || (A380PrimComputer_DWork.eventTime_d == 0.0)) { - A380PrimComputer_DWork.eventTime_d = A380PrimComputer_U.in.time.simulation_time; + if (rtb_AND2 || (A380PrimComputer_DWork.eventTime_f == 0.0)) { + A380PrimComputer_DWork.eventTime_f = A380PrimComputer_U.in.time.simulation_time; } A380PrimComputer_RateLimiter_n(look2_binlxpw(static_cast(rtb_mach), rtb_handleIndex, @@ -2018,7 +1998,7 @@ void A380PrimComputer::step() A380PrimComputer_P.RateLimiterGenericVariableTs1_up, A380PrimComputer_P.RateLimiterGenericVariableTs1_lo, A380PrimComputer_U.in.time.dt, A380PrimComputer_P.reset_Value_j, &rtb_Switch4_d, &A380PrimComputer_DWork.sf_RateLimiter_mr); - if (A380PrimComputer_U.in.time.simulation_time - A380PrimComputer_DWork.eventTime_d <= + if (A380PrimComputer_U.in.time.simulation_time - A380PrimComputer_DWork.eventTime_f <= A380PrimComputer_P.CompareToConstant_const_l) { rtb_handleIndex = rtb_Switch_h; } else { @@ -2032,8 +2012,8 @@ void A380PrimComputer::step() A380PrimComputer_GetIASforMach4(static_cast(rtb_mach), A380PrimComputer_P.Constant8_Value_h, static_cast(rtb_V_ias), &rtb_Switch4_d); rtb_BusAssignment_d_logic_alpha_prot_deg = rtb_handleIndex; - rtb_y_k = false; - rtb_y_cv = ((rtb_law_c == a380_pitch_efcs_law::NormalLaw) || (rtb_activeLateralLaw == a380_lateral_efcs_law:: + rtb_y_ge = false; + rtb_y_jk = ((rtb_law_k == a380_pitch_efcs_law::NormalLaw) || (rtb_activeLateralLaw == a380_lateral_efcs_law:: NormalLaw)); if (!A380PrimComputer_DWork.resetEventTime_not_empty) { A380PrimComputer_DWork.resetEventTime = A380PrimComputer_U.in.time.simulation_time; @@ -2044,12 +2024,12 @@ void A380PrimComputer::step() A380PrimComputer_DWork.resetEventTime = A380PrimComputer_U.in.time.simulation_time; } - A380PrimComputer_DWork.sProtActive = ((rtb_AND19 && rtb_y_cv && (rtb_Y > rtb_handleIndex) && + A380PrimComputer_DWork.sProtActive = ((rtb_AND19 && rtb_y_jk && (rtb_Y > rtb_handleIndex) && (A380PrimComputer_U.in.time.monotonic_time > 10.0)) || A380PrimComputer_DWork.sProtActive); A380PrimComputer_DWork.sProtActive = ((A380PrimComputer_U.in.time.simulation_time - A380PrimComputer_DWork.resetEventTime <= 0.5) && (u0 >= -0.5) && ((rtb_raComputationValue >= 200.0F) || (u0 >= 0.5) - || (rtb_Y >= rtb_handleIndex - 2.0)) && rtb_AND19 && rtb_y_cv && A380PrimComputer_DWork.sProtActive); - if (A380PrimComputer_DWork.is_active_c28_A380PrimComputer == 0U) { + || (rtb_Y >= rtb_handleIndex - 2.0)) && rtb_AND19 && rtb_y_jk && A380PrimComputer_DWork.sProtActive); + if (A380PrimComputer_DWork.is_active_c28_A380PrimComputer == 0) { A380PrimComputer_DWork.is_active_c28_A380PrimComputer = 1U; A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Landed; nz = 0; @@ -2059,7 +2039,7 @@ void A380PrimComputer::step() if (rtb_raComputationValue < 100.0F) { A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Landing100ft; nz = 1; - } else if (rtb_AND1) { + } else if (rtb_AND2) { A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Landed; nz = 0; } else { @@ -2080,7 +2060,7 @@ void A380PrimComputer::step() if (rtb_raComputationValue > 100.0F) { A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Flying; nz = 0; - } else if (rtb_AND1) { + } else if (rtb_AND2) { A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Landed; nz = 0; } else { @@ -2089,7 +2069,7 @@ void A380PrimComputer::step() break; default: - if (rtb_AND1) { + if (rtb_AND2) { A380PrimComputer_DWork.is_c28_A380PrimComputer = A380PrimComputer_IN_Landed; nz = 0; } else if (rtb_raComputationValue > 100.0F) { @@ -2109,13 +2089,13 @@ void A380PrimComputer::step() if ((rtb_V_ias <= std::fmin(365.0, (look1_binlxpw(rtb_alpha - std::cos(A380PrimComputer_P.Gain1_Gain * rtb_phi) * rtb_Y, A380PrimComputer_P.uDLookupTable_bp01Data_m, A380PrimComputer_P.uDLookupTable_tableData_n, 3U) + 0.01) - * (static_cast(rtb_V_ias) / rtb_mach))) || ((rtb_law_c != a380_pitch_efcs_law::NormalLaw) && + * (static_cast(rtb_V_ias) / rtb_mach))) || ((rtb_law_k != a380_pitch_efcs_law::NormalLaw) && (rtb_activeLateralLaw != a380_lateral_efcs_law::NormalLaw)) || (A380PrimComputer_DWork.eventTime == 0.0)) { A380PrimComputer_DWork.eventTime = A380PrimComputer_U.in.time.simulation_time; } A380PrimComputer_Y.out.logic.protection_ap_disconnect = ((rtb_AND19 && (((nz != 0) && (rtb_Y > rtb_Switch_h)) || - (rtb_Y > rtb_handleIndex + 0.25)) && rtb_y_cv) || (A380PrimComputer_U.in.time.simulation_time - + (rtb_Y > rtb_handleIndex + 0.25)) && rtb_y_jk) || (A380PrimComputer_U.in.time.simulation_time - A380PrimComputer_DWork.eventTime > 3.0) || A380PrimComputer_DWork.sProtActive); rtb_DataTypeConversion_m2 = (A380PrimComputer_U.in.analog_inputs.thr_lever_3_pos >= A380PrimComputer_P.CompareToConstant1_const); @@ -2126,26 +2106,26 @@ void A380PrimComputer::step() A380PrimComputer_P.CompareToConstant2_const))); A380PrimComputer_MATLABFunction_c((A380PrimComputer_U.in.analog_inputs.speed_brake_lever_pos < A380PrimComputer_P.CompareToConstant_const_n), A380PrimComputer_U.in.time.dt, - A380PrimComputer_P.ConfirmNode_isRisingEdge_c, A380PrimComputer_P.ConfirmNode_timeDelay_g, &rtb_y_h3, + A380PrimComputer_P.ConfirmNode_isRisingEdge_c, A380PrimComputer_P.ConfirmNode_timeDelay_g, &rtb_y_ow, &A380PrimComputer_DWork.sf_MATLABFunction_al4); A380PrimComputer_DWork.Memory_PreviousInput = A380PrimComputer_P.Logic_table[(((static_cast(rtb_NOT_k) << - 1) + rtb_y_h3) << 1) + A380PrimComputer_DWork.Memory_PreviousInput]; - rtb_y_h3 = (rtb_NOT_k || A380PrimComputer_DWork.Memory_PreviousInput); - A380PrimComputer_MATLABFunction_f(rtb_AND1, A380PrimComputer_P.PulseNode7_isRisingEdge, &rtb_DataTypeConversion_m2, + 1) + rtb_y_ow) << 1) + A380PrimComputer_DWork.Memory_PreviousInput]; + rtb_y_ow = (rtb_NOT_k || A380PrimComputer_DWork.Memory_PreviousInput); + A380PrimComputer_MATLABFunction_f(rtb_AND2, A380PrimComputer_P.PulseNode7_isRisingEdge, &rtb_DataTypeConversion_m2, &A380PrimComputer_DWork.sf_MATLABFunction_ny); - A380PrimComputer_MATLABFunction_f(rtb_AND1, A380PrimComputer_P.PulseNode6_isRisingEdge, &rtb_y_cv, + A380PrimComputer_MATLABFunction_f(rtb_AND2, A380PrimComputer_P.PulseNode6_isRisingEdge, &rtb_y_jk, &A380PrimComputer_DWork.sf_MATLABFunction_gc); A380PrimComputer_DWork.Memory_PreviousInput_a = A380PrimComputer_P.Logic_table_h[(((static_cast (rtb_DataTypeConversion_m2 || (((A380PrimComputer_U.in.analog_inputs.left_body_wheel_speed < A380PrimComputer_P.CompareToConstant13_const) || (A380PrimComputer_U.in.analog_inputs.left_wing_wheel_speed < A380PrimComputer_P.CompareToConstant9_const)) && ((A380PrimComputer_U.in.analog_inputs.right_body_wheel_speed < A380PrimComputer_P.CompareToConstant10_const) || (A380PrimComputer_U.in.analog_inputs.right_wing_wheel_speed < - A380PrimComputer_P.CompareToConstant14_const)))) << 1) + rtb_y_cv) << 1) + + A380PrimComputer_P.CompareToConstant14_const)))) << 1) + rtb_y_jk) << 1) + A380PrimComputer_DWork.Memory_PreviousInput_a]; rtb_NOT_k = (A380PrimComputer_U.in.analog_inputs.speed_brake_lever_pos < A380PrimComputer_P.CompareToConstant_const_m); - rtb_y_dvi = (A380PrimComputer_U.in.analog_inputs.thr_lever_4_pos <= A380PrimComputer_P.CompareToConstant18_const); - rtb_y_cv = ((((A380PrimComputer_U.in.analog_inputs.speed_brake_lever_pos > + rtb_y_c = (A380PrimComputer_U.in.analog_inputs.thr_lever_4_pos <= A380PrimComputer_P.CompareToConstant18_const); + rtb_y_jk = ((((A380PrimComputer_U.in.analog_inputs.speed_brake_lever_pos > A380PrimComputer_P.CompareToConstant26_const) || rtb_NOT_k) && ((A380PrimComputer_U.in.analog_inputs.thr_lever_1_pos < A380PrimComputer_P.CompareToConstant11_const) && (A380PrimComputer_U.in.analog_inputs.thr_lever_2_pos < A380PrimComputer_P.CompareToConstant27_const) && @@ -2156,93 +2136,95 @@ void A380PrimComputer::step() (static_cast(((static_cast(A380PrimComputer_U.in.analog_inputs.thr_lever_1_pos <= A380PrimComputer_P.CompareToConstant29_const) + (A380PrimComputer_U.in.analog_inputs.thr_lever_2_pos <= A380PrimComputer_P.CompareToConstant16_const)) + (A380PrimComputer_U.in.analog_inputs.thr_lever_3_pos <= - A380PrimComputer_P.CompareToConstant17_const)) + rtb_y_dvi) >= A380PrimComputer_P.CompareToConstant19_const))); - A380PrimComputer_MATLABFunction_f(false, A380PrimComputer_P.PulseNode5_isRisingEdge, &rtb_y_dvi, + A380PrimComputer_P.CompareToConstant17_const)) + rtb_y_c) >= A380PrimComputer_P.CompareToConstant19_const))); + A380PrimComputer_MATLABFunction_f(false, A380PrimComputer_P.PulseNode5_isRisingEdge, &rtb_y_c, &A380PrimComputer_DWork.sf_MATLABFunction_m1); rtb_DataTypeConversion_m2 = (((A380PrimComputer_U.in.analog_inputs.left_body_wheel_speed >= A380PrimComputer_P.CompareToConstant7_const) || (A380PrimComputer_U.in.analog_inputs.left_wing_wheel_speed >= A380PrimComputer_P.CompareToConstant8_const)) && ((A380PrimComputer_U.in.analog_inputs.right_body_wheel_speed >= A380PrimComputer_P.CompareToConstant3_const_n) || (A380PrimComputer_U.in.analog_inputs.right_wing_wheel_speed >= A380PrimComputer_P.CompareToConstant4_const_k)) && A380PrimComputer_DWork.Memory_PreviousInput_a); - A380PrimComputer_DWork.Delay1_DSTATE_b = (rtb_y_cv && (rtb_y_dvi || rtb_DataTypeConversion_m2 || + A380PrimComputer_DWork.Delay1_DSTATE_b = (rtb_y_jk && (rtb_y_c || rtb_DataTypeConversion_m2 || A380PrimComputer_DWork.Delay1_DSTATE_b)); A380PrimComputer_MATLABFunction_f(false, A380PrimComputer_P.PulseNode4_isRisingEdge, &rtb_DataTypeConversion_m2, &A380PrimComputer_DWork.sf_MATLABFunction_ff); - A380PrimComputer_DWork.Delay2_DSTATE = (rtb_y_cv && (rtb_DataTypeConversion_m2 || + A380PrimComputer_DWork.Delay2_DSTATE = (rtb_y_jk && (rtb_DataTypeConversion_m2 || A380PrimComputer_DWork.Delay2_DSTATE)); A380PrimComputer_DWork.Delay3_DSTATE = (rtb_NOT_k && ((A380PrimComputer_U.in.analog_inputs.thr_lever_1_pos <= A380PrimComputer_P.CompareToConstant1_const_a) && (A380PrimComputer_U.in.analog_inputs.thr_lever_2_pos <= - A380PrimComputer_P.CompareToConstant2_const_k)) && (rtb_y_dvi || A380PrimComputer_DWork.Delay3_DSTATE)); + A380PrimComputer_P.CompareToConstant2_const_k)) && (rtb_y_c || A380PrimComputer_DWork.Delay3_DSTATE)); rtb_AND18_c = ((!A380PrimComputer_DWork.Delay1_DSTATE_b) && (A380PrimComputer_DWork.Delay2_DSTATE || A380PrimComputer_DWork.Delay3_DSTATE)); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel_bit_l, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel_bit_l, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_DataTypeConversion_m2); - rtb_y_cv = ((rtb_y_k0 == 0U) && rtb_DataTypeConversion_m2); + rtb_y_jk = ((rtb_y_b4 == 0U) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel1_bit_cm, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_cm, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, &rtb_DataTypeConversion_m2); - leftInboardElevEngaged = (rtb_AND1 && (rtb_y_cv || ((rtb_y_k0 == 0U) && rtb_DataTypeConversion_m2))); + leftInboardElevEngaged = (rtb_AND2 && (rtb_y_jk || ((rtb_y_b4 == 0U) && rtb_DataTypeConversion_m2))); A380PrimComputer_Y.out.logic.ground_spoilers_armed = rtb_NOT_k; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel_bit_e, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 == 0U); + A380PrimComputer_P.BitfromLabel_bit_e, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 == 0U); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - &rtb_y_cv); + &rtb_y_jk); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel1_bit_d, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_d, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, &rtb_NOT_k); - rtb_OR_b = ((rtb_DataTypeConversion_m2 && rtb_y_cv) || ((rtb_y_k0 == 0U) && rtb_NOT_k)); - A380PrimComputer_MATLABFunction_f(rtb_AND1, A380PrimComputer_P.PulseNode1_isRisingEdge_n, &rtb_y_dvi, + rtb_OR_b = ((rtb_DataTypeConversion_m2 && rtb_y_jk) || ((rtb_y_b4 == 0U) && rtb_NOT_k)); + rtb_aileronAntidroopActive = ((!A380PrimComputer_U.in.temporary_ap_input.ap_engaged) && + A380PrimComputer_DWork.Delay1_DSTATE_b); + A380PrimComputer_MATLABFunction_f(rtb_AND2, A380PrimComputer_P.PulseNode1_isRisingEdge_n, &rtb_y_c, &A380PrimComputer_DWork.sf_MATLABFunction_ky); - A380PrimComputer_MATLABFunction_f(rtb_AND1, A380PrimComputer_P.PulseNode2_isRisingEdge, &rtb_y_cv, + A380PrimComputer_MATLABFunction_f(rtb_AND2, A380PrimComputer_P.PulseNode2_isRisingEdge, &rtb_y_jk, &A380PrimComputer_DWork.sf_MATLABFunction_dmh); - A380PrimComputer_DWork.Memory_PreviousInput_d = A380PrimComputer_P.Logic_table_j[(((static_cast(rtb_y_dvi) - << 1) + (rtb_y_cv || A380PrimComputer_DWork.Delay_DSTATE_e)) << 1) + A380PrimComputer_DWork.Memory_PreviousInput_d]; + A380PrimComputer_DWork.Memory_PreviousInput_d = A380PrimComputer_P.Logic_table_j[(((static_cast(rtb_y_c) << + 1) + (rtb_y_jk || A380PrimComputer_DWork.Delay_DSTATE_e)) << 1) + A380PrimComputer_DWork.Memory_PreviousInput_d]; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel2_bit_pt, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel2_bit_pt, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_DataTypeConversion_m2); - if ((rtb_y_k0 != 0U) && rtb_DataTypeConversion_m2) { + if ((rtb_y_b4 != 0U) && rtb_DataTypeConversion_m2) { rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.prim_x_bus.discrete_status_word_1; } else { rtb_Switch_ir_0 = &A380PrimComputer_U.in.bus_inputs.prim_y_bus.discrete_status_word_1; } - A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel3_bit_gv, &rtb_y_k0); + A380PrimComputer_MATLABFunction_e(rtb_Switch_ir_0, A380PrimComputer_P.BitfromLabel3_bit_gv, &rtb_y_b4); if (rtb_AND20) { - rtb_y_cv = (rtb_AND19 && (rtb_law_c != A380PrimComputer_P.EnumeratedConstant_Value_l)); + rtb_y_jk = (rtb_AND19 && (rtb_law_k != A380PrimComputer_P.EnumeratedConstant_Value_l)); } else { - rtb_y_cv = ((rtb_y_k0 != 0U) && (rtb_Switch_ir_0->SSM == static_cast(SignStatusMatrix::NormalOperation))); + rtb_y_jk = ((rtb_y_b4 != 0U) && (rtb_Switch_ir_0->SSM == static_cast(SignStatusMatrix::NormalOperation))); } rtb_DataTypeConversion_m2 = A380PrimComputer_DWork.Memory_PreviousInput_j; - A380PrimComputer_DWork.Delay_DSTATE_e = A380PrimComputer_P.Logic_table_n[(((rtb_y_cv || (std::abs(rtb_thsPos) <= + A380PrimComputer_DWork.Delay_DSTATE_e = A380PrimComputer_P.Logic_table_n[(((rtb_y_jk || (std::abs(rtb_thsPos) <= A380PrimComputer_P.CompareToConstant1_const_p) || A380PrimComputer_U.in.discrete_inputs.pitch_trim_up_pressed || A380PrimComputer_U.in.discrete_inputs.pitch_trim_down_pressed) + (static_cast((rtb_V_ias <= A380PrimComputer_P.CompareToConstant_const_c) && A380PrimComputer_DWork.Memory_PreviousInput_d) << 1)) << 1) + A380PrimComputer_DWork.Memory_PreviousInput_j]; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel4_bit_p, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel4_bit_p, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel_bit_g, &rtb_y_k0); + A380PrimComputer_P.BitfromLabel_bit_g, &rtb_y_b4); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_DataTypeConversion_m2); - rtb_AND19 = (((!rtb_NOT_k) || (rtb_y_k0 == 0U)) && rtb_DataTypeConversion_m2); + rtb_AND19 = (((!rtb_NOT_k) || (rtb_y_b4 == 0U)) && rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_DataTypeConversion_m2); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel6_bit_l, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel6_bit_l, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380PrimComputer_P.BitfromLabel5_bit_as, &rtb_y_k0); - if (rtb_AND19 || (rtb_DataTypeConversion_m2 && ((!rtb_NOT_k) || (rtb_y_k0 == 0U)))) { + A380PrimComputer_P.BitfromLabel5_bit_as, &rtb_y_b4); + if (rtb_AND19 || (rtb_DataTypeConversion_m2 && ((!rtb_NOT_k) || (rtb_y_b4 == 0U)))) { abs_rate_c = 0.25; } else { abs_rate_c = 0.15; @@ -2266,13 +2248,13 @@ void A380PrimComputer::step() rtb_BusAssignment_nw_logic_alpha_max_deg = rtb_Switch_h; rtb_BusAssignment_nw_logic_high_speed_prot_hi_thresh_kn = std::fmin(A380PrimComputer_P.Constant7_Value_g, rtb_Switch4_d); - rtb_AND19 = rtb_y_cv; - rtb_y_cv = (rtb_OR || (static_cast(rtb_activeLateralLaw) != A380PrimComputer_P.CompareToConstant_const_m4)); + rtb_AND19 = rtb_y_jk; + rtb_y_jk = (rtb_OR || (static_cast(rtb_activeLateralLaw) != A380PrimComputer_P.CompareToConstant_const_m4)); LawMDLOBJ2.step(&A380PrimComputer_U.in.time.dt, &rtb_rightAileron2Command, &rtb_elevator1Command, &rtb_right_midboard_aileron_deg, &rtb_left_inboard_aileron_deg, &A380PrimComputer_P.Constant_Value_a, &rtb_eta_deg_dv, &rtb_eta_trim_dot_deg_s_n, &u0_0, - &A380PrimComputer_U.in.analog_inputs.rudder_pedal_pos, &rtb_AND1, &rtb_y_cv, - &A380PrimComputer_DWork.sProtActive, &rtb_y_k, + &A380PrimComputer_U.in.analog_inputs.rudder_pedal_pos, &rtb_AND2, &rtb_y_jk, + &A380PrimComputer_DWork.sProtActive, &rtb_y_ge, &A380PrimComputer_U.in.temporary_ap_input.roll_command, &A380PrimComputer_U.in.temporary_ap_input.yaw_command, &A380PrimComputer_U.in.temporary_ap_input.ap_engaged, &rtb_xi_inboard_deg, &rtb_xi_midboard_deg, @@ -2306,7 +2288,7 @@ void A380PrimComputer::step() A380PrimComputer_P.RateLimiterVariableTs2_up, A380PrimComputer_P.RateLimiterVariableTs2_lo, A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs2_InitialCondition, &rtb_Switch4_d, &A380PrimComputer_DWork.sf_RateLimiter); - if (A380PrimComputer_DWork.Delay1_DSTATE_b) { + if (rtb_aileronAntidroopActive) { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = A380PrimComputer_P.Constant4_Value_a; } else { @@ -2316,9 +2298,9 @@ void A380PrimComputer::step() A380PrimComputer_RateLimiter(rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg, A380PrimComputer_P.RateLimiterVariableTs3_up, A380PrimComputer_P.RateLimiterVariableTs3_lo, - A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs3_InitialCondition, &rtb_Y_i, + A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs3_InitialCondition, &rtb_Y_l, &A380PrimComputer_DWork.sf_RateLimiter_b); - rtb_right_outboard_aileron_deg = rtb_Switch4_d + rtb_Y_i; + rtb_right_outboard_aileron_deg = rtb_Switch4_d + rtb_Y_l; rtb_right_spoiler_2_deg = A380PrimComputer_P.Gain_Gain_m * rtb_handleIndex + rtb_right_outboard_aileron_deg; if (rtb_right_spoiler_2_deg > A380PrimComputer_P.Saturation2_UpperSat) { rtb_right_spoiler_2_deg = A380PrimComputer_P.Saturation2_UpperSat; @@ -2330,9 +2312,9 @@ void A380PrimComputer::step() A380PrimComputer_P.RateLimiterGenericVariableTs_lo_k, A380PrimComputer_U.in.time.dt, rtb_leftInboardAilPos, ((!rtb_AND4_f) || rtb_AND2_i), &rtb_Switch4_d, &A380PrimComputer_DWork.sf_RateLimiter_a); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel_bit_la, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_cv); - if ((rtb_y_k0 != 0U) && rtb_y_cv) { + A380PrimComputer_P.BitfromLabel_bit_la, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_jk); + if ((rtb_y_b4 != 0U) && rtb_y_jk) { rtb_Switch_left_inboard_aileron_command_deg_Data = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_inboard_aileron_command_deg.Data; rtb_Switch_right_inboard_aileron_command_deg_Data = @@ -2559,22 +2541,22 @@ void A380PrimComputer::step() A380PrimComputer_RateLimiter(rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg, A380PrimComputer_P.RateLimiterVariableTs4_up, A380PrimComputer_P.RateLimiterVariableTs4_lo, - A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs4_InitialCondition, &rtb_Y_i, + A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs4_InitialCondition, &rtb_Y_l, &A380PrimComputer_DWork.sf_RateLimiter_c); if (A380PrimComputer_DWork.Delay1_DSTATE_b) { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = A380PrimComputer_P.Constant_Value; } else { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } A380PrimComputer_RateLimiter(rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg, A380PrimComputer_P.RateLimiterVariableTs6_up, A380PrimComputer_P.RateLimiterVariableTs6_lo, - A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs6_InitialCondition, &rtb_Y_i, + A380PrimComputer_U.in.time.dt, A380PrimComputer_P.RateLimiterVariableTs6_InitialCondition, &rtb_Y_l, &A380PrimComputer_DWork.sf_RateLimiter_g); - rtb_right_spoiler_2_deg = A380PrimComputer_P.Gain5_Gain * rtb_Y_i; + rtb_right_spoiler_2_deg = A380PrimComputer_P.Gain5_Gain * rtb_Y_l; rtb_NOT_k = (A380PrimComputer_DWork.Delay1_DSTATE_b || rtb_AND18_c); - if (rtb_y_h3) { + if (rtb_y_ow) { rtb_Switch4_d = A380PrimComputer_P.Constant8_Value_d; } else { rtb_Switch4_d = look1_binlxpw(A380PrimComputer_U.in.analog_inputs.speed_brake_lever_pos, @@ -2688,7 +2670,7 @@ void A380PrimComputer::step() A380PrimComputer_Spoiler345Computation(rtb_xi_spoiler_deg_b, rtb_Switch4_d + rtb_Switch1_k, &rtb_Switch4_d, &rtb_Switch_h); if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2707,7 +2689,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch_h; } @@ -2725,7 +2707,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2743,7 +2725,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch_h; } @@ -2760,7 +2742,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2778,7 +2760,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_Switch_h = rtb_Y_i; + rtb_Switch_h = rtb_Y_l; } A380PrimComputer_RateLimiter_a(rtb_Switch_h, A380PrimComputer_P.RateLimiterGenericVariableTs19_up, @@ -2793,7 +2775,7 @@ void A380PrimComputer::step() A380PrimComputer_Spoiler345Computation(rtb_xi_spoiler_deg_b, rtb_Switch10_n + rtb_Switch1_k, &rtb_Switch4_d, &rtb_Switch_h); if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2811,7 +2793,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch_h; } @@ -2828,7 +2810,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2848,7 +2830,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch_h; } @@ -2867,7 +2849,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_i; + rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Y_l; } else { rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg = rtb_Switch4_d; } @@ -2887,7 +2869,7 @@ void A380PrimComputer::step() } if (rtb_NOT_k) { - rtb_Switch_h = rtb_Y_i; + rtb_Switch_h = rtb_Y_l; } A380PrimComputer_RateLimiter_a(rtb_Switch_h, A380PrimComputer_P.RateLimiterGenericVariableTs21_up, @@ -2895,9 +2877,9 @@ void A380PrimComputer::step() (A380PrimComputer_U.in.bus_inputs.sec_3_bus.right_spoiler_2_position_deg.Data), rtb_DataTypeConversion_m2, &rtb_Switch4_d, &A380PrimComputer_DWork.sf_RateLimiter_nl); if (rtb_AND20) { - rtb_Y_i = rtb_Switch4_d; + rtb_Y_l = rtb_Switch4_d; } else { - rtb_Y_i = rtb_Switch_right_spoiler_8_command_deg_Data; + rtb_Y_l = rtb_Switch_right_spoiler_8_command_deg_Data; } switch (static_cast(rtb_activeLateralLaw)) { @@ -2954,34 +2936,34 @@ void A380PrimComputer::step() rtb_rightOutboardElevPos; rtb_Switch10_n = rtb_Switch4_d * A380PrimComputer_P.Gain_Gain_a; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel_bit_p, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel_bit_p, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel1_bit_h, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_h, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel2_bit_fv, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel2_bit_fv, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel3_bit_cv, &rtb_y_k0); - rtb_y_dvi = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel3_bit_cv, &rtb_y_b4); + rtb_y_c = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel4_bit_n4, &rtb_y_k0); - rtb_DataTypeConversion_h = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel4_bit_n4, &rtb_y_b4); + rtb_DataTypeConversion_h = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel5_bit_py, &rtb_y_k0); - A380PrimComputer_MATLABFunction_o(rtb_y_cv, rtb_NOT_k, rtb_DataTypeConversion_m2, rtb_y_dvi, - rtb_DataTypeConversion_h, (rtb_y_k0 != 0U), &rtb_Switch1_k); - rtb_y_cv = (rtb_OR || ((static_cast(rtb_law_c) != A380PrimComputer_P.CompareToConstant_const_f) && ( - static_cast(rtb_law_c) != A380PrimComputer_P.CompareToConstant2_const_f))); + A380PrimComputer_P.BitfromLabel5_bit_py, &rtb_y_b4); + A380PrimComputer_MATLABFunction_o(rtb_y_jk, rtb_NOT_k, rtb_DataTypeConversion_m2, rtb_y_c, rtb_DataTypeConversion_h, + (rtb_y_b4 != 0U), &rtb_Switch1_k); + rtb_y_jk = (rtb_OR || ((static_cast(rtb_law_k) != A380PrimComputer_P.CompareToConstant_const_f) && ( + static_cast(rtb_law_k) != A380PrimComputer_P.CompareToConstant2_const_f))); LawMDLOBJ5.step(&A380PrimComputer_U.in.time.dt, &A380PrimComputer_U.in.time.simulation_time, &rtb_elevator2Command, &rtb_rightAileron2Command, &rtb_elevator1Command, &rtb_elevator3Command, &rtb_Switch_h, &rtb_Switch10_n, &A380PrimComputer_U.in.analog_inputs.ths_pos_deg, &rtb_Y, &rtb_eta_deg_dv, &rtb_eta_trim_dot_deg_s_n, &rtb_rudder1Command, &rtb_Switch1_k, (const_cast (&A380PrimComputer_RGND)), (const_cast(&A380PrimComputer_RGND)), &A380PrimComputer_P.Constant_Value_g, &A380PrimComputer_P.Constant_Value_g, &A380PrimComputer_U.in.sim_data.tailstrike_protection_on, ( - const_cast(&A380PrimComputer_RGND)), &u0, &rtb_AND1, &rtb_y_cv, &A380PrimComputer_DWork.sProtActive, - &rtb_y_k, &rtb_BusAssignment_d_logic_alpha_prot_deg, &rtb_BusAssignment_nw_logic_alpha_max_deg, + const_cast(&A380PrimComputer_RGND)), &u0, &rtb_AND2, &rtb_y_jk, &A380PrimComputer_DWork.sProtActive, + &rtb_y_ge, &rtb_BusAssignment_d_logic_alpha_prot_deg, &rtb_BusAssignment_nw_logic_alpha_max_deg, &rtb_BusAssignment_nw_logic_high_speed_prot_hi_thresh_kn, &rtb_BusAssignment_nw_logic_high_speed_prot_lo_thresh_kn, &A380PrimComputer_U.in.temporary_ap_input.pitch_command, @@ -2989,37 +2971,37 @@ void A380PrimComputer::step() &rtb_eta_trim_limit_lo, &rtb_eta_trim_limit_up); rtb_Switch4_d *= A380PrimComputer_P.Gain_Gain_g; A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel_bit_n, &rtb_y_k0); - rtb_y_cv = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel_bit_n, &rtb_y_b4); + rtb_y_jk = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel1_bit_h1, &rtb_y_k0); - rtb_NOT_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel1_bit_h1, &rtb_y_b4); + rtb_NOT_k = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel2_bit_gn, &rtb_y_k0); - rtb_DataTypeConversion_m2 = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel2_bit_gn, &rtb_y_b4); + rtb_DataTypeConversion_m2 = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel3_bit_b, &rtb_y_k0); - rtb_y_k = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel3_bit_b, &rtb_y_b4); + rtb_y_ge = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel4_bit_i, &rtb_y_k0); - rtb_y_dvi = (rtb_y_k0 != 0U); + A380PrimComputer_P.BitfromLabel4_bit_i, &rtb_y_b4); + rtb_y_c = (rtb_y_b4 != 0U); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_system_status_word, - A380PrimComputer_P.BitfromLabel5_bit_l, &rtb_y_k0); - A380PrimComputer_MATLABFunction_o(rtb_y_cv, rtb_NOT_k, rtb_DataTypeConversion_m2, rtb_y_k, rtb_y_dvi, (rtb_y_k0 != - 0U), &rtb_Switch_h); - rtb_y_cv = (rtb_OR || ((static_cast(rtb_law_c) != A380PrimComputer_P.CompareToConstant3_const_o) && ( - static_cast(rtb_law_c) != A380PrimComputer_P.CompareToConstant4_const_o) && (static_cast(rtb_law_c) + A380PrimComputer_P.BitfromLabel5_bit_l, &rtb_y_b4); + A380PrimComputer_MATLABFunction_o(rtb_y_jk, rtb_NOT_k, rtb_DataTypeConversion_m2, rtb_y_ge, rtb_y_c, (rtb_y_b4 != 0U), + &rtb_Switch_h); + rtb_y_jk = (rtb_OR || ((static_cast(rtb_law_k) != A380PrimComputer_P.CompareToConstant3_const_o) && ( + static_cast(rtb_law_k) != A380PrimComputer_P.CompareToConstant4_const_o) && (static_cast(rtb_law_k) != A380PrimComputer_P.CompareToConstant5_const_b))); - rtb_NOT_k = (rtb_law_c != A380PrimComputer_P.EnumeratedConstant_Value_b); + rtb_NOT_k = (rtb_law_k != A380PrimComputer_P.EnumeratedConstant_Value_b); LawMDLOBJ3.step(&A380PrimComputer_U.in.time.dt, &rtb_elevator2Command, &rtb_rightAileron2Command, &rtb_elevator1Command, &rtb_elevator3Command, &rtb_Switch4_d, &A380PrimComputer_U.in.analog_inputs.ths_pos_deg, &rtb_eta_deg_dv, &rtb_eta_trim_limit_lo_d, &rtb_eta_trim_dot_deg_s_n, &rtb_Switch_h, (const_cast(&A380PrimComputer_RGND)), ( - const_cast(&A380PrimComputer_RGND)), &u0, &rtb_y_cv, &rtb_NOT_k, &rtb_eta_deg_o, + const_cast(&A380PrimComputer_RGND)), &u0, &rtb_y_jk, &rtb_NOT_k, &rtb_eta_deg_o, &rtb_eta_trim_dot_deg_s_a, &rtb_eta_trim_limit_lo_h, &rtb_eta_trim_limit_up_d); LawMDLOBJ4.step(&A380PrimComputer_U.in.time.dt, &u0, &rtb_eta_deg_dv, &rtb_eta_trim_dot_deg_s_n, &rtb_eta_trim_limit_lo_d, &rtb_eta_trim_limit_up_m); - switch (static_cast(rtb_law_c)) { + switch (static_cast(rtb_law_k)) { case 0: case 1: rtb_eta_deg_dv = rtb_eta_deg; @@ -3043,9 +3025,9 @@ void A380PrimComputer::step() A380PrimComputer_P.RateLimiterGenericVariableTs_lo_f, A380PrimComputer_U.in.time.dt, rtb_leftInboardElevPos, ((!rtb_AND2_ac) || rtb_AND2_i), &rtb_Switch4_d, &A380PrimComputer_DWork.sf_RateLimiter_cr); A380PrimComputer_MATLABFunction_e(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, - A380PrimComputer_P.BitfromLabel_bit_of, &rtb_y_k0); - A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_cv); - if ((rtb_y_k0 != 0U) && rtb_y_cv) { + A380PrimComputer_P.BitfromLabel_bit_of, &rtb_y_b4); + A380PrimComputer_MATLABFunction(&A380PrimComputer_U.in.bus_inputs.prim_x_bus.fctl_law_status_word, &rtb_y_jk); + if ((rtb_y_b4 != 0U) && rtb_y_jk) { rtb_Switch_left_inboard_aileron_command_deg_Data = A380PrimComputer_U.in.bus_inputs.prim_x_bus.left_inboard_elevator_command_deg.Data; rtb_Switch_right_inboard_aileron_command_deg_Data = @@ -3094,7 +3076,7 @@ void A380PrimComputer::step() rtb_Switch10_n = rtb_Switch_right_midboard_aileron_command_deg_Data; } - switch (static_cast(rtb_law_c)) { + switch (static_cast(rtb_law_k)) { case 0: case 1: rtb_eta_trim_limit_up_m = rtb_eta_trim_limit_up; @@ -3115,7 +3097,7 @@ void A380PrimComputer::step() } if (rtb_AND19) { - switch (static_cast(rtb_law_c)) { + switch (static_cast(rtb_law_k)) { case 0: case 1: rtb_eta_trim_dot_deg_s_n = rtb_eta_trim_dot_deg_s; @@ -3152,7 +3134,7 @@ void A380PrimComputer::step() if (A380PrimComputer_DWork.Delay_DSTATE_c > rtb_eta_trim_limit_up_m) { A380PrimComputer_DWork.Delay_DSTATE_c = rtb_eta_trim_limit_up_m; } else { - switch (static_cast(rtb_law_c)) { + switch (static_cast(rtb_law_k)) { case 0: case 1: rtb_eta_trim_limit_lo_d = rtb_eta_trim_limit_lo; @@ -3275,7 +3257,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.bus_outputs.left_spoiler_8_command_deg.Data = static_cast (rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg); rtb_left_spoiler_8_command_deg_SSM = static_cast(A380PrimComputer_P.EnumeratedConstant1_Value); - A380PrimComputer_Y.out.bus_outputs.right_spoiler_8_command_deg.Data = static_cast(rtb_Y_i); + A380PrimComputer_Y.out.bus_outputs.right_spoiler_8_command_deg.Data = static_cast(rtb_Y_l); rtb_right_spoiler_8_command_deg_SSM = static_cast(A380PrimComputer_P.EnumeratedConstant1_Value); A380PrimComputer_Y.out.bus_outputs.left_inboard_elevator_command_deg.Data = static_cast(rtb_Switch4_d); rtb_left_inboard_elevator_command_deg_SSM = static_cast(A380PrimComputer_P.EnumeratedConstant1_Value); @@ -3402,8 +3384,8 @@ void A380PrimComputer::step() rtb_VectorConcatenate[3] = elevator2Avail; rtb_VectorConcatenate[4] = rtb_AND_e; rtb_VectorConcatenate[5] = A380PrimComputer_P.Constant18_Value; - rtb_VectorConcatenate[6] = rtb_y_c; - rtb_VectorConcatenate[7] = rtb_y_mj; + rtb_VectorConcatenate[6] = rtb_y_bb; + rtb_VectorConcatenate[7] = rtb_y_gc; rtb_VectorConcatenate[8] = A380PrimComputer_P.Constant18_Value; rtb_VectorConcatenate[9] = thsAvail; rtb_VectorConcatenate[10] = rtb_thsEngaged; @@ -3444,7 +3426,7 @@ void A380PrimComputer::step() &rtb_VectorConcatenate_c[2]); A380PrimComputer_MATLABFunction2(a380_lateral_efcs_law::NormalLaw, &rtb_VectorConcatenate_c[3], &rtb_VectorConcatenate_c[4]); - A380PrimComputer_MATLABFunction_ei(rtb_law_c, &rtb_VectorConcatenate_c[5], &rtb_VectorConcatenate_c[6], + A380PrimComputer_MATLABFunction_ei(rtb_law_k, &rtb_VectorConcatenate_c[5], &rtb_VectorConcatenate_c[6], &rtb_VectorConcatenate_c[7]); A380PrimComputer_MATLABFunction2(rtb_activeLateralLaw, &rtb_VectorConcatenate_c[8], &rtb_VectorConcatenate_c[9]); rtb_VectorConcatenate_c[10] = rtb_AND20; @@ -3504,7 +3486,7 @@ void A380PrimComputer::step() rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_right_spoiler_7_deg; A380PrimComputer_Y.out.laws.lateral_law_outputs.left_spoiler_8_deg = rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_left_spoiler_8_deg; - A380PrimComputer_Y.out.laws.lateral_law_outputs.right_spoiler_8_deg = rtb_Y_i; + A380PrimComputer_Y.out.laws.lateral_law_outputs.right_spoiler_8_deg = rtb_Y_l; A380PrimComputer_Y.out.laws.lateral_law_outputs.upper_rudder_deg = rtb_BusConversion_InsertedFor_BusAssignment_at_inport_1_BusCreator1_upper_rudder_deg; A380PrimComputer_Y.out.laws.lateral_law_outputs.lower_rudder_deg = @@ -3514,7 +3496,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.laws.pitch_law_outputs.left_outboard_elevator_deg = rtb_Switch1_k; A380PrimComputer_Y.out.laws.pitch_law_outputs.right_outboard_elevator_deg = rtb_Switch10_n; A380PrimComputer_Y.out.laws.pitch_law_outputs.ths_deg = rtb_eta_trim_limit_up_m; - A380PrimComputer_Y.out.logic.on_ground = rtb_AND1; + A380PrimComputer_Y.out.logic.on_ground = rtb_AND2; A380PrimComputer_Y.out.logic.tracking_mode_on = rtb_OR; A380PrimComputer_Y.out.logic.surface_statuses.left_inboard_aileron_engaged = rtb_AND4_f; A380PrimComputer_Y.out.logic.surface_statuses.right_inboard_aileron_engaged = rtb_AND11; @@ -3579,15 +3561,15 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.logic.lateral_law_capability = a380_lateral_efcs_law::NormalLaw; A380PrimComputer_Y.out.logic.active_lateral_law = rtb_activeLateralLaw; A380PrimComputer_Y.out.logic.pitch_law_capability = rtb_pitchLawCapability; - A380PrimComputer_Y.out.logic.active_pitch_law = rtb_law_c; + A380PrimComputer_Y.out.logic.active_pitch_law = rtb_law_k; A380PrimComputer_Y.out.logic.abnormal_condition_law_active = rtb_AND16_n; A380PrimComputer_Y.out.logic.is_master_prim = rtb_AND20; A380PrimComputer_Y.out.logic.elevator_1_avail = elevator1Avail; A380PrimComputer_Y.out.logic.elevator_1_engaged = elevator1Avail; A380PrimComputer_Y.out.logic.elevator_2_avail = elevator2Avail; A380PrimComputer_Y.out.logic.elevator_2_engaged = rtb_AND_e; - A380PrimComputer_Y.out.logic.elevator_3_avail = rtb_y_c; - A380PrimComputer_Y.out.logic.elevator_3_engaged = rtb_y_mj; + A380PrimComputer_Y.out.logic.elevator_3_avail = rtb_y_bb; + A380PrimComputer_Y.out.logic.elevator_3_engaged = rtb_y_gc; A380PrimComputer_Y.out.logic.ths_avail = thsAvail; A380PrimComputer_Y.out.logic.ths_engaged = rtb_thsEngaged; A380PrimComputer_Y.out.logic.left_aileron_1_avail = rtb_OR7; @@ -3615,7 +3597,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.logic.rudder_2_hydraulic_mode_engaged = rtb_rudder2HydraulicModeEngaged; A380PrimComputer_Y.out.logic.rudder_2_electric_mode_engaged = rudder2ElectricModeHasPriority; A380PrimComputer_Y.out.logic.aileron_droop_active = rtb_OR_b; - A380PrimComputer_Y.out.logic.aileron_antidroop_active = A380PrimComputer_DWork.Delay1_DSTATE_b; + A380PrimComputer_Y.out.logic.aileron_antidroop_active = rtb_aileronAntidroopActive; A380PrimComputer_Y.out.logic.ths_automatic_mode_active = rtb_AND19; A380PrimComputer_Y.out.logic.ths_manual_mode_c_deg_s = abs_rate_c; A380PrimComputer_Y.out.logic.is_yellow_hydraulic_power_avail = @@ -3629,7 +3611,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.logic.right_sidestick_priority_locked = rtb_AND10_b; A380PrimComputer_Y.out.logic.total_sidestick_pitch_command = u0; A380PrimComputer_Y.out.logic.total_sidestick_roll_command = u0_0; - A380PrimComputer_Y.out.logic.speed_brake_inhibited = rtb_y_h3; + A380PrimComputer_Y.out.logic.speed_brake_inhibited = rtb_y_ow; A380PrimComputer_Y.out.logic.ground_spoilers_out = A380PrimComputer_DWork.Delay1_DSTATE_b; A380PrimComputer_Y.out.logic.phased_lift_dumping_active = rtb_AND18_c; A380PrimComputer_Y.out.logic.spoiler_lift_active = leftInboardElevEngaged; @@ -3664,7 +3646,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.logic.dual_ra_failure = rtb_OR4; A380PrimComputer_Y.out.discrete_outputs.elevator_1_active_mode = elevator1Avail; A380PrimComputer_Y.out.discrete_outputs.elevator_2_active_mode = rtb_AND_e; - A380PrimComputer_Y.out.discrete_outputs.elevator_3_active_mode = rtb_y_mj; + A380PrimComputer_Y.out.discrete_outputs.elevator_3_active_mode = rtb_y_gc; A380PrimComputer_Y.out.discrete_outputs.ths_active_mode = rtb_thsEngaged; A380PrimComputer_Y.out.discrete_outputs.left_aileron_1_active_mode = rtb_OR7; A380PrimComputer_Y.out.discrete_outputs.left_aileron_2_active_mode = rtb_OR1; @@ -3692,7 +3674,7 @@ void A380PrimComputer::step() A380PrimComputer_Y.out.analog_outputs.elevator_2_pos_order_deg = A380PrimComputer_P.Constant1_Value_n; } - if (rtb_y_mj) { + if (rtb_y_gc) { A380PrimComputer_Y.out.analog_outputs.elevator_3_pos_order_deg = rtb_elevator3Command; } else { A380PrimComputer_Y.out.analog_outputs.elevator_3_pos_order_deg = A380PrimComputer_P.Constant2_Value_k; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.h index 0c7142aff78..495523c2bca 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PrimComputer_h_ -#define RTW_HEADER_A380PrimComputer_h_ +#ifndef A380PrimComputer_h_ +#define A380PrimComputer_h_ #include "rtwtypes.h" #include "A380PrimComputer_types.h" #include "A380LateralNormalLaw.h" @@ -63,7 +63,7 @@ class A380PrimComputer final real_T configFullEventTime; real_T eventTime; real_T resetEventTime; - real_T eventTime_d; + real_T eventTime_f; boolean_T Delay_DSTATE_cc; boolean_T Delay1_DSTATE; boolean_T Delay1_DSTATE_b; @@ -85,7 +85,7 @@ class A380PrimComputer final boolean_T eventTime_not_empty; boolean_T resetEventTime_not_empty; boolean_T sProtActive; - boolean_T eventTime_not_empty_e; + boolean_T eventTime_not_empty_m; boolean_T abnormalConditionWasActive; boolean_T Runtime_MODE; rtDW_MATLABFunction_A380PrimComputer_o_T sf_MATLABFunction_dmh; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_private.h index c167311fcbf..dd007f88e30 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PrimComputer_private_h_ -#define RTW_HEADER_A380PrimComputer_private_h_ +#ifndef A380PrimComputer_private_h_ +#define A380PrimComputer_private_h_ #include "rtwtypes.h" #include "A380PrimComputer_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_types.h index dcb57d54960..b0f21653368 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PrimComputer_types.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380PrimComputer_types_h_ -#define RTW_HEADER_A380PrimComputer_types_h_ +#ifndef A380PrimComputer_types_h_ +#define A380PrimComputer_types_h_ #include "rtwtypes.h" #ifndef DEFINED_TYPEDEF_FOR_a380_pitch_efcs_law_ #define DEFINED_TYPEDEF_FOR_a380_pitch_efcs_law_ @@ -30,33 +30,6 @@ enum class SignStatusMatrix #endif -#ifndef DEFINED_TYPEDEF_FOR_base_prim_temporary_ap_input_ -#define DEFINED_TYPEDEF_FOR_base_prim_temporary_ap_input_ - -struct base_prim_temporary_ap_input -{ - boolean_T ap_engaged; - real_T roll_command; - real_T pitch_command; - real_T yaw_command; -}; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_base_prim_pitch_surface_positions_ -#define DEFINED_TYPEDEF_FOR_base_prim_pitch_surface_positions_ - -struct base_prim_pitch_surface_positions -{ - real_T left_inboard_elevator_deg; - real_T right_inboard_elevator_deg; - real_T left_outboard_elevator_deg; - real_T right_outboard_elevator_deg; - real_T ths_deg; -}; - -#endif - #ifndef DEFINED_TYPEDEF_FOR_base_prim_discrete_inputs_ #define DEFINED_TYPEDEF_FOR_base_prim_discrete_inputs_ @@ -86,6 +59,33 @@ struct base_prim_discrete_inputs #endif +#ifndef DEFINED_TYPEDEF_FOR_base_prim_pitch_surface_positions_ +#define DEFINED_TYPEDEF_FOR_base_prim_pitch_surface_positions_ + +struct base_prim_pitch_surface_positions +{ + real_T left_inboard_elevator_deg; + real_T right_inboard_elevator_deg; + real_T left_outboard_elevator_deg; + real_T right_outboard_elevator_deg; + real_T ths_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_prim_temporary_ap_input_ +#define DEFINED_TYPEDEF_FOR_base_prim_temporary_ap_input_ + +struct base_prim_temporary_ap_input +{ + boolean_T ap_engaged; + real_T roll_command; + real_T pitch_command; + real_T yaw_command; +}; + +#endif + #ifndef DEFINED_TYPEDEF_FOR_base_time_ #define DEFINED_TYPEDEF_FOR_base_time_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.cpp index 0b15a9bb792..f77170ba9a3 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.cpp @@ -145,8 +145,8 @@ void A380SecComputer::step() real_T rtb_zeta_lower_deg; base_arinc_429 rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_gp; base_arinc_429 rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi; - real_T abs_rate_c; real_T ca; + real_T denom; real_T rtb_Switch1_k; real_T rtb_Switch8_o; real_T rtb_eta_deg; @@ -157,7 +157,7 @@ void A380SecComputer::step() real32_T rtb_V_tas; real32_T rtb_alpha; real32_T rtb_leftAileron1Command; - real32_T rtb_mach_a; + real32_T rtb_mach_f; real32_T rtb_n_x; real32_T rtb_n_y; real32_T rtb_n_z; @@ -169,10 +169,10 @@ void A380SecComputer::step() real32_T rtb_theta; real32_T rtb_theta_dot; uint32_T rtb_SSM_ov; - uint32_T rtb_y_ar; uint32_T rtb_y_e; - uint32_T rtb_y_k; - uint32_T rtb_y_p; + uint32_T rtb_y_ex; + uint32_T rtb_y_js; + uint32_T rtb_y_na; int8_T rtb_DataTypeConversion_i; boolean_T rtb_VectorConcatenate[19]; boolean_T rtb_VectorConcatenate_a[19]; @@ -193,10 +193,9 @@ void A380SecComputer::step() boolean_T rightSpoilerHydraulicModeAvail_0; boolean_T rtb_AND; boolean_T rtb_AND1; - boolean_T rtb_AND1_hw; - boolean_T rtb_AND1_p; - boolean_T rtb_AND2_a; - boolean_T rtb_AND2_c; + boolean_T rtb_AND1_cb; + boolean_T rtb_AND2_i; + boolean_T rtb_AND2_j; boolean_T rtb_AND3_dt; boolean_T rtb_AND4_ab; boolean_T rtb_AND4_e; @@ -204,13 +203,13 @@ void A380SecComputer::step() boolean_T rtb_AND5_e; boolean_T rtb_AND6; boolean_T rtb_AND6_e; - boolean_T rtb_AND7; boolean_T rtb_AND7_g; boolean_T rtb_AND7_j; boolean_T rtb_AND8; boolean_T rtb_AND9_e; - boolean_T rtb_AND_aa; - boolean_T rtb_AND_l; + boolean_T rtb_AND_b; + boolean_T rtb_AND_b3; + boolean_T rtb_AND_fj; boolean_T rtb_Compare_l; boolean_T rtb_OR; boolean_T rtb_OR1; @@ -218,11 +217,12 @@ void A380SecComputer::step() boolean_T rtb_OR6; boolean_T rtb_logic_c_is_green_hydraulic_power_avail; boolean_T rtb_logic_c_is_yellow_hydraulic_power_avail; - boolean_T rtb_y_c; - boolean_T rtb_y_nx; + boolean_T rtb_y_ej; + boolean_T rtb_y_im; boolean_T rudder1ElectricModeAvail; - boolean_T rudder1ElectricModeHasPriority; boolean_T rudder1HydraulicModeAvail; + boolean_T rudder1HydraulicModeHasPriority_tmp; + boolean_T rudder2ElectricModeAvail; boolean_T rudder2ElectricModeHasPriority; boolean_T rudderTrimAvail; boolean_T thsAvail; @@ -306,31 +306,31 @@ void A380SecComputer::step() (SignStatusMatrix::NormalOperation)) || (A380SecComputer_U.in.bus_inputs.ir_2_bus.roll_att_rate_deg_s.SSM != static_cast (SignStatusMatrix::NormalOperation)) || A380SecComputer_P.Constant_Value_ad); - rtb_AND2_c = !rtb_OR1; + rtb_AND9_e = !rtb_OR1; rtb_logic_c_is_yellow_hydraulic_power_avail = !rtb_OR3; - if (rtb_AND2_c && rtb_logic_c_is_yellow_hydraulic_power_avail) { + if (rtb_AND9_e && rtb_logic_c_is_yellow_hydraulic_power_avail) { rtb_V_ias = (A380SecComputer_U.in.bus_inputs.adr_1_bus.airspeed_computed_kn.Data + A380SecComputer_U.in.bus_inputs.adr_2_bus.airspeed_computed_kn.Data) / 2.0F; rtb_V_tas = (A380SecComputer_U.in.bus_inputs.adr_1_bus.airspeed_true_kn.Data + A380SecComputer_U.in.bus_inputs.adr_2_bus.airspeed_true_kn.Data) / 2.0F; - rtb_mach_a = (A380SecComputer_U.in.bus_inputs.adr_1_bus.mach.Data + + rtb_mach_f = (A380SecComputer_U.in.bus_inputs.adr_1_bus.mach.Data + A380SecComputer_U.in.bus_inputs.adr_2_bus.mach.Data) / 2.0F; rtb_alpha = (A380SecComputer_U.in.bus_inputs.adr_1_bus.aoa_corrected_deg.Data + A380SecComputer_U.in.bus_inputs.adr_2_bus.aoa_corrected_deg.Data) / 2.0F; - } else if (rtb_AND2_c && rtb_OR3) { + } else if (rtb_AND9_e && rtb_OR3) { rtb_V_ias = A380SecComputer_U.in.bus_inputs.adr_1_bus.airspeed_computed_kn.Data; rtb_V_tas = A380SecComputer_U.in.bus_inputs.adr_1_bus.airspeed_true_kn.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.adr_1_bus.mach.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.adr_1_bus.mach.Data; rtb_alpha = A380SecComputer_U.in.bus_inputs.adr_1_bus.aoa_corrected_deg.Data; } else if (rtb_OR1 && rtb_logic_c_is_yellow_hydraulic_power_avail) { rtb_V_ias = A380SecComputer_U.in.bus_inputs.adr_2_bus.airspeed_computed_kn.Data; rtb_V_tas = A380SecComputer_U.in.bus_inputs.adr_2_bus.airspeed_true_kn.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.adr_2_bus.mach.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.adr_2_bus.mach.Data; rtb_alpha = A380SecComputer_U.in.bus_inputs.adr_2_bus.aoa_corrected_deg.Data; } else { rtb_V_ias = 0.0F; rtb_V_tas = 0.0F; - rtb_mach_a = 0.0F; + rtb_mach_f = 0.0F; rtb_alpha = 0.0F; } @@ -341,14 +341,14 @@ void A380SecComputer::step() A380SecComputer_DWork.pY_not_empty = true; } - abs_rate_c = A380SecComputer_U.in.time.dt * A380SecComputer_P.LagFilter_C1; - ca = abs_rate_c / (abs_rate_c + 2.0); - A380SecComputer_DWork.pY = (2.0 - abs_rate_c) / (abs_rate_c + 2.0) * A380SecComputer_DWork.pY + (rtb_alpha * ca + + denom = A380SecComputer_U.in.time.dt * A380SecComputer_P.LagFilter_C1; + ca = denom / (denom + 2.0); + A380SecComputer_DWork.pY = (2.0 - denom) / (denom + 2.0) * A380SecComputer_DWork.pY + (rtb_alpha * ca + A380SecComputer_DWork.pU * ca); A380SecComputer_DWork.pU = rtb_alpha; - rtb_AND2_c = !rtb_OR; + rtb_AND9_e = !rtb_OR; rtb_logic_c_is_yellow_hydraulic_power_avail = !rtb_OR6; - if (rtb_AND2_c && rtb_logic_c_is_yellow_hydraulic_power_avail) { + if (rtb_AND9_e && rtb_logic_c_is_yellow_hydraulic_power_avail) { rtb_theta = (A380SecComputer_U.in.bus_inputs.ir_1_bus.pitch_angle_deg.Data + A380SecComputer_U.in.bus_inputs.ir_2_bus.pitch_angle_deg.Data) / 2.0F; rtb_phi = (A380SecComputer_U.in.bus_inputs.ir_1_bus.roll_angle_deg.Data + @@ -367,7 +367,7 @@ void A380SecComputer::step() A380SecComputer_U.in.bus_inputs.ir_2_bus.pitch_att_rate_deg_s.Data) / 2.0F; rtb_phi_dot = (A380SecComputer_U.in.bus_inputs.ir_1_bus.roll_att_rate_deg_s.Data + A380SecComputer_U.in.bus_inputs.ir_2_bus.roll_att_rate_deg_s.Data) / 2.0F; - } else if (rtb_AND2_c && rtb_OR6) { + } else if (rtb_AND9_e && rtb_OR6) { rtb_theta = A380SecComputer_U.in.bus_inputs.ir_1_bus.pitch_angle_deg.Data; rtb_phi = A380SecComputer_U.in.bus_inputs.ir_1_bus.roll_angle_deg.Data; rtb_q = A380SecComputer_U.in.bus_inputs.ir_1_bus.body_pitch_rate_deg_s.Data; @@ -408,50 +408,50 @@ void A380SecComputer::step() &A380SecComputer_DWork.sf_MATLABFunction_bd); rtb_Compare_l = false; A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_1_bus.fctl_law_status_word, - A380SecComputer_P.BitfromLabel6_bit, &rtb_y_ar); + A380SecComputer_P.BitfromLabel6_bit, &rtb_y_na); A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_1_bus.fctl_law_status_word, &rtb_Compare_l); - rtb_AND = ((rtb_y_ar != 0U) && rtb_Compare_l); + rtb_AND = ((rtb_y_na != 0U) && rtb_Compare_l); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_2_bus.fctl_law_status_word, - A380SecComputer_P.BitfromLabel7_bit, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_2_bus.fctl_law_status_word, &rtb_y_c); - rtb_AND1 = ((rtb_y_ar != 0U) && rtb_y_c); + A380SecComputer_P.BitfromLabel7_bit, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_2_bus.fctl_law_status_word, &rtb_y_ej); + rtb_AND1 = ((rtb_y_na != 0U) && rtb_y_ej); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_3_bus.fctl_law_status_word, - A380SecComputer_P.BitfromLabel1_bit, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_3_bus.fctl_law_status_word, &rtb_y_nx); + A380SecComputer_P.BitfromLabel1_bit, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_3_bus.fctl_law_status_word, &rtb_y_im); if (rtb_AND) { rtb_DataTypeConversion_i = 1; } else if (rtb_AND1) { rtb_DataTypeConversion_i = 2; - } else if ((rtb_y_ar != 0U) && rtb_y_nx) { + } else if ((rtb_y_na != 0U) && rtb_y_im) { rtb_DataTypeConversion_i = 3; } else { rtb_DataTypeConversion_i = 0; } if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_1_bus.aileron_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_1_bus.aileron_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_1_bus.aileron_status_word.Data; } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_2_bus.aileron_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_2_bus.aileron_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_2_bus.aileron_status_word.Data; } else { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_3_bus.aileron_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_3_bus.aileron_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_3_bus.aileron_status_word.Data; } - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel1_bit_g, &rtb_y_p); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel1_bit_g, &rtb_y_ex); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); - rtb_AND = ((rtb_y_p != 0U) && rtb_y_c); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); + rtb_AND_fj = ((rtb_y_ex != 0U) && rtb_y_ej); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel2_bit, &rtb_y_p); - rtb_AND1_p = (rtb_y_c && (rtb_y_p != 0U)); + A380SecComputer_P.BitfromLabel2_bit, &rtb_y_ex); + rtb_AND = (rtb_y_ej && (rtb_y_ex != 0U)); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.aileron_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.aileron_status_word.Data; @@ -463,15 +463,15 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel3_bit, &rtb_y_p); + A380SecComputer_P.BitfromLabel3_bit, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_nx); - rtb_AND1 = ((rtb_y_p != 0U) && rtb_y_nx); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_im); + rtb_AND2_j = ((rtb_y_ex != 0U) && rtb_y_im); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel4_bit, &rtb_y_p); + A380SecComputer_P.BitfromLabel4_bit, &rtb_y_ex); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { leftAileron1Avail = rtb_logic_c_is_green_hydraulic_power_avail; rightAileron1Avail = rtb_logic_c_is_green_hydraulic_power_avail; @@ -486,22 +486,22 @@ void A380SecComputer::step() rightAileron1Avail = false; } - A380SecComputer_B.logic.right_aileron_1_engaged = (rightAileron1Avail && ((!rtb_AND1_p) && ((!rtb_y_nx) || (rtb_y_p == + A380SecComputer_B.logic.right_aileron_1_engaged = (rightAileron1Avail && ((!rtb_AND) && ((!rtb_y_im) || (rtb_y_ex == 0U)))); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel5_bit, &rtb_y_p); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel5_bit, &rtb_y_ex); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_Compare_l); - rtb_AND4_e = ((rtb_y_p != 0U) && rtb_Compare_l); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_AND4_e = ((rtb_y_ex != 0U) && rtb_Compare_l); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel6_bit_d, &rtb_y_p); - rtb_AND1_p = (rtb_Compare_l && (rtb_y_p != 0U)); + A380SecComputer_P.BitfromLabel6_bit_d, &rtb_y_ex); + rtb_AND = (rtb_Compare_l && (rtb_y_ex != 0U)); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_3_bus.aileron_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_3_bus.aileron_status_word.Data; @@ -513,16 +513,16 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel7_bit_j, &rtb_y_p); + A380SecComputer_P.BitfromLabel7_bit_j, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); - rtb_AND6 = ((rtb_y_p != 0U) && rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); + rtb_AND6 = ((rtb_y_ex != 0U) && rtb_y_ej); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel8_bit, &rtb_y_p); - rtb_AND7 = (rtb_y_c && (rtb_y_p != 0U)); + A380SecComputer_P.BitfromLabel8_bit, &rtb_y_ex); + rtb_AND1 = (rtb_y_ej && (rtb_y_ex != 0U)); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.sec_y_bus.aileron_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.sec_y_bus.aileron_status_word.Data; @@ -534,15 +534,15 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel9_bit, &rtb_y_p); + A380SecComputer_P.BitfromLabel9_bit, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_nx); - rtb_AND8 = ((rtb_y_p != 0U) && rtb_y_nx); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_im); + rtb_AND8 = ((rtb_y_ex != 0U) && rtb_y_im); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel10_bit, &rtb_y_p); + A380SecComputer_P.BitfromLabel10_bit, &rtb_y_ex); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { leftAileron2Avail = true; rightAileron2Avail = true; @@ -552,68 +552,62 @@ void A380SecComputer::step() rightSpoilerHydraulicModeAvail_0 = false; rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.Data; + } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { + leftAileron2Avail = true; + rightAileron2Avail = true; + leftSpoilerHydraulicModeAvail = rtb_logic_c_is_green_hydraulic_power_avail; + rightSpoilerHydraulicModeAvail = rtb_logic_c_is_green_hydraulic_power_avail; + leftSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_yellow_hydraulic_power_avail; + rightSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_yellow_hydraulic_power_avail; + rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; + rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.Data; } else { - if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - leftAileron2Avail = true; - rightAileron2Avail = true; + leftAileron2Avail = false; + rightAileron2Avail = false; + if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { + leftSpoilerHydraulicModeAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; + rightSpoilerHydraulicModeAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; + leftSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_green_hydraulic_power_avail; + rightSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_green_hydraulic_power_avail; } else { - leftAileron2Avail = false; - rightAileron2Avail = false; + leftSpoilerHydraulicModeAvail = false; + rightSpoilerHydraulicModeAvail = false; + leftSpoilerHydraulicModeAvail_0 = false; + rightSpoilerHydraulicModeAvail_0 = false; } - if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - leftSpoilerHydraulicModeAvail = rtb_logic_c_is_green_hydraulic_power_avail; - rightSpoilerHydraulicModeAvail = rtb_logic_c_is_green_hydraulic_power_avail; - leftSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_yellow_hydraulic_power_avail; - rightSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_yellow_hydraulic_power_avail; - rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; - rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.Data; - } else { - if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - leftSpoilerHydraulicModeAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; - rightSpoilerHydraulicModeAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; - leftSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_green_hydraulic_power_avail; - rightSpoilerHydraulicModeAvail_0 = rtb_logic_c_is_green_hydraulic_power_avail; - } else { - leftSpoilerHydraulicModeAvail = false; - rightSpoilerHydraulicModeAvail = false; - leftSpoilerHydraulicModeAvail_0 = false; - rightSpoilerHydraulicModeAvail_0 = false; - } - - rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.SSM; - rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.Data; - } + rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.SSM; + rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.Data; } - A380SecComputer_B.logic.right_aileron_2_engaged = (rightAileron2Avail && ((!rtb_AND1_p) && (!rtb_AND7) && - ((!rtb_y_nx) || (rtb_y_p == 0U)))); + A380SecComputer_B.logic.right_aileron_2_engaged = (rightAileron2Avail && ((!rtb_AND) && (!rtb_AND1) && ((!rtb_y_im) || + (rtb_y_ex == 0U)))); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel1_bit_j, &rtb_y_p); + A380SecComputer_P.BitfromLabel1_bit_j, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.Data; } else { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.Data; } - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel2_bit_i, &rtb_y_k); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel2_bit_i, &rtb_y_e); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel3_bit_i, &rtb_y_e); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel3_bit_i, &rtb_y_js); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_nx); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { elevator1Avail = rtb_logic_c_is_green_hydraulic_power_avail; } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { @@ -623,88 +617,88 @@ void A380SecComputer::step() } if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_AND2_c = (rtb_y_k != 0U); + rtb_AND9_e = (rtb_y_e != 0U); } else { - rtb_AND2_c = (rtb_y_e != 0U); + rtb_AND9_e = (rtb_y_js != 0U); } - A380SecComputer_B.logic.elevator_1_engaged = (elevator1Avail && (((rtb_y_p == 0U) || (!rtb_y_c)) && ((!rtb_AND2_c) || - (!rtb_y_nx)))); + A380SecComputer_B.logic.elevator_1_engaged = (elevator1Avail && (((rtb_y_ex == 0U) || (!rtb_y_ej)) && ((!rtb_AND9_e) + || (!rtb_y_im)))); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel4_bit_e, &rtb_y_p); + A380SecComputer_P.BitfromLabel4_bit_e, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_Compare_l); - rtb_AND2_a = ((rtb_y_p != 0U) && rtb_Compare_l); + rtb_AND2_i = ((rtb_y_ex != 0U) && rtb_Compare_l); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.Data; } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.Data; } else { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.Data; } - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel6_bit_l, &rtb_y_p); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel6_bit_l, &rtb_y_ex); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel7_bit_b, &rtb_y_k); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel7_bit_b, &rtb_y_e); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_y_p != 0U); + rtb_AND9_e = (rtb_y_ex != 0U); } else { - rtb_AND2_c = (rtb_y_k != 0U); + rtb_AND9_e = (rtb_y_e != 0U); } - rtb_AND4_m = (rtb_AND2_c && rtb_y_c); + rtb_AND4_m = (rtb_AND9_e && rtb_y_ej); if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.sec_x_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.sec_x_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.sec_x_bus.elevator_status_word.Data; } else { - rtb_y_ar = A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word.SSM; + rtb_y_na = A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word.SSM; rtb_alpha = A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word.Data; } - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel8_bit_d, &rtb_y_p); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel8_bit_d, &rtb_y_ex); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel9_bit_g, &rtb_y_k); - rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_ar; + A380SecComputer_P.BitfromLabel9_bit_g, &rtb_y_e); + rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_y_na; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_alpha; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_nx); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_y_p != 0U); + rtb_AND9_e = (rtb_y_ex != 0U); } else { - rtb_AND2_c = (rtb_y_k != 0U); + rtb_AND9_e = (rtb_y_e != 0U); } - rtb_AND5_e = (rtb_AND2_c && rtb_y_nx); + rtb_AND5_e = (rtb_AND9_e && rtb_y_im); elevator2Avail = (A380SecComputer_U.in.discrete_inputs.is_unit_1 || (A380SecComputer_U.in.discrete_inputs.is_unit_2 || (A380SecComputer_U.in.discrete_inputs.is_unit_3 && rtb_logic_c_is_yellow_hydraulic_power_avail))); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel5_bit_e, &rtb_y_ar); + A380SecComputer_P.BitfromLabel5_bit_e, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_Compare_l); - rtb_AND3_dt = ((rtb_y_ar != 0U) && rtb_Compare_l); + rtb_AND3_dt = ((rtb_y_na != 0U) && rtb_Compare_l); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.elevator_status_word.Data; @@ -716,43 +710,43 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel10_bit_g, &rtb_y_p); + A380SecComputer_P.BitfromLabel10_bit_g, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel11_bit, &rtb_y_ar); + A380SecComputer_P.BitfromLabel11_bit, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND2_c = (rtb_y_p != 0U); + rtb_AND9_e = (rtb_y_ex != 0U); rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.sec_x_bus.elevator_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.sec_x_bus.elevator_status_word.Data; } else { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word.Data; } - rtb_AND6_e = (rtb_AND2_c && rtb_y_c); + rtb_AND6_e = (rtb_AND9_e && rtb_y_ej); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel12_bit, &rtb_y_ar); + A380SecComputer_P.BitfromLabel12_bit, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel13_bit, &rtb_y_p); + A380SecComputer_P.BitfromLabel13_bit, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_nx); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); } else { - rtb_AND2_c = (rtb_y_p != 0U); + rtb_AND9_e = (rtb_y_ex != 0U); } - rtb_AND7_j = (rtb_AND2_c && rtb_y_nx); + rtb_AND7_j = (rtb_AND9_e && rtb_y_im); elevator3Avail = (A380SecComputer_U.in.discrete_inputs.is_unit_1 || A380SecComputer_U.in.discrete_inputs.is_unit_2); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_1_bus.elevator_status_word.SSM; @@ -765,12 +759,12 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel1_bit_f, &rtb_y_ar); + A380SecComputer_P.BitfromLabel1_bit_f, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_Compare_l); - rtb_AND1_p = ((rtb_y_ar != 0U) && rtb_Compare_l); + rtb_AND = ((rtb_y_na != 0U) && rtb_Compare_l); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_3_bus.elevator_status_word.Data; @@ -782,24 +776,24 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel2_bit_a, &rtb_y_ar); + A380SecComputer_P.BitfromLabel2_bit_a, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); - rtb_AND7 = ((rtb_y_ar != 0U) && rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); + rtb_AND1 = ((rtb_y_na != 0U) && rtb_y_ej); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word, - A380SecComputer_P.BitfromLabel3_bit_j, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word, &rtb_y_nx); + A380SecComputer_P.BitfromLabel3_bit_j, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_y_bus.elevator_status_word, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { thsAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; - rtb_AND2_c = ((!rtb_AND1_p) && (!rtb_AND7) && ((rtb_y_ar == 0U) || (!rtb_y_nx))); + rtb_AND9_e = ((!rtb_AND) && (!rtb_AND1) && ((rtb_y_na == 0U) || (!rtb_y_im))); rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_1_bus.rudder_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_1_bus.rudder_status_word.Data; } else { - rtb_y_nx = !A380SecComputer_U.in.discrete_inputs.is_unit_2; - thsAvail = (rtb_y_nx && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && + rtb_y_im = !A380SecComputer_U.in.discrete_inputs.is_unit_2; + thsAvail = (rtb_y_im && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && rtb_logic_c_is_green_hydraulic_power_avail)); - rtb_AND2_c = (rtb_y_nx && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((!rtb_AND1_p) && (!rtb_AND7)))); + rtb_AND9_e = (rtb_y_im && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((!rtb_AND) && (!rtb_AND1)))); if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.rudder_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.rudder_status_word.Data; @@ -809,21 +803,21 @@ void A380SecComputer::step() } } - A380SecComputer_B.logic.ths_engaged = (thsAvail && rtb_AND2_c); + A380SecComputer_B.logic.ths_engaged = (thsAvail && rtb_AND9_e); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel1_bit_o, &rtb_y_ar); + A380SecComputer_P.BitfromLabel1_bit_o, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_Compare_l); - rtb_AND_aa = ((rtb_y_ar != 0U) && rtb_Compare_l); + rtb_AND_b3 = ((rtb_y_na != 0U) && rtb_Compare_l); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel2_bit_p, &rtb_y_p); - rtb_AND1_p = (rtb_Compare_l && (rtb_y_p != 0U)); + A380SecComputer_P.BitfromLabel2_bit_p, &rtb_y_ex); + rtb_AND = (rtb_Compare_l && (rtb_y_ex != 0U)); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_2_bus.rudder_status_word.SSM; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.rudder_status_word.Data; @@ -835,60 +829,60 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel10_bit_i, &rtb_y_ar); + A380SecComputer_P.BitfromLabel10_bit_i, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel8_bit_m, &rtb_y_p); + A380SecComputer_P.BitfromLabel8_bit_m, &rtb_y_ex); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; - A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_c); + A380SecComputer_MATLABFunction(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, &rtb_y_ej); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); } else { - rtb_AND2_c = (rtb_y_p != 0U); + rtb_AND9_e = (rtb_y_ex != 0U); } - rtb_AND7_g = (rtb_AND2_c && rtb_y_c); + rtb_AND7_g = (rtb_AND9_e && rtb_y_ej); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, - A380SecComputer_P.BitfromLabel11_bit_l, &rtb_y_ar); + A380SecComputer_P.BitfromLabel11_bit_l, &rtb_y_na); rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.SSM = rtb_SSM_ov; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi.Data = rtb_Data_ch; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_mi, A380SecComputer_P.BitfromLabel12_bit_b, &rtb_SSM_ov); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); } else { - rtb_AND2_c = (rtb_SSM_ov != 0U); + rtb_AND9_e = (rtb_SSM_ov != 0U); } - rtb_AND7 = (rtb_y_c && rtb_AND2_c); + rtb_AND1 = (rtb_y_ej && rtb_AND9_e); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, A380SecComputer_P.BitfromLabel9_bit_o, &rtb_SSM_ov); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel15_bit, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, &rtb_y_nx); + A380SecComputer_P.BitfromLabel15_bit, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_SSM_ov != 0U); + rtb_AND9_e = (rtb_SSM_ov != 0U); } else { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); } - rtb_AND9_e = (rtb_AND2_c && rtb_y_nx); + rtb_AND9_e = (rtb_AND9_e && rtb_y_im); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, A380SecComputer_P.BitfromLabel13_bit_o, &rtb_SSM_ov); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel14_bit, &rtb_y_ar); + A380SecComputer_P.BitfromLabel14_bit, &rtb_y_na); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rudder1HydraulicModeAvail = rtb_logic_c_is_yellow_hydraulic_power_avail; rudder1ElectricModeAvail = true; - rudder1ElectricModeHasPriority = !rtb_AND_aa; + rtb_y_ej = !rtb_AND_b3; rtb_AND7_g = !rtb_AND7_g; - rtb_AND_aa = (rudder1ElectricModeHasPriority && rtb_AND7_g); - rudder1ElectricModeHasPriority = (rudder1ElectricModeHasPriority && (!rtb_AND1_p) && rtb_AND7_g && (!rtb_AND7) && - (!rtb_AND9_e) && (!rtb_logic_c_is_yellow_hydraulic_power_avail)); + rtb_AND_b3 = (rtb_y_ej && rtb_AND7_g); + rtb_AND7_g = (rtb_y_ej && (!rtb_AND) && rtb_AND7_g && (!rtb_AND1) && (!rtb_AND9_e) && + (!rtb_logic_c_is_yellow_hydraulic_power_avail)); } else { if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { rudder1HydraulicModeAvail = rtb_logic_c_is_green_hydraulic_power_avail; @@ -902,64 +896,64 @@ void A380SecComputer::step() } if (A380SecComputer_U.in.discrete_inputs.is_unit_2 || A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rudder1ElectricModeHasPriority = !rtb_AND_aa; + rtb_y_ej = !rtb_AND_b3; rtb_AND7_g = !rtb_AND7_g; - rtb_AND9_e = !rtb_AND9_e; - rtb_AND_aa = (rudder1ElectricModeHasPriority && rtb_AND7_g && rtb_AND9_e); + rudder1HydraulicModeHasPriority_tmp = !rtb_AND9_e; + rtb_AND_b3 = (rtb_y_ej && rtb_AND7_g && rudder1HydraulicModeHasPriority_tmp); if (A380SecComputer_U.in.discrete_inputs.is_unit_3) { - rtb_AND2_c = (rtb_SSM_ov != 0U); + rtb_AND9_e = (rtb_SSM_ov != 0U); } else { - rtb_AND2_c = (rtb_y_ar != 0U); + rtb_AND9_e = (rtb_y_na != 0U); } - rudder1ElectricModeHasPriority = (rudder1ElectricModeHasPriority && (!rtb_AND1_p) && rtb_AND7_g && (!rtb_AND7) && - rtb_AND9_e && ((!rtb_y_nx) || (!rtb_AND2_c)) && (!rudder1HydraulicModeAvail)); + rtb_AND7_g = (rtb_y_ej && (!rtb_AND) && rtb_AND7_g && (!rtb_AND1) && rudder1HydraulicModeHasPriority_tmp && + ((!rtb_y_im) || (!rtb_AND9_e)) && (!rudder1HydraulicModeAvail)); } else { - rtb_AND_aa = false; - rudder1ElectricModeHasPriority = false; + rtb_AND_b3 = false; + rtb_AND7_g = false; } } A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_1_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel3_bit_o, &rtb_y_ar); + A380SecComputer_P.BitfromLabel3_bit_o, &rtb_y_na); A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_1_bus.rudder_status_word, &rtb_Compare_l); - rtb_AND2_c = ((rtb_y_ar != 0U) && rtb_Compare_l); + rtb_AND9_e = ((rtb_y_na != 0U) && rtb_Compare_l); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_1_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel4_bit_a, &rtb_y_ar); - rtb_AND1_p = (rtb_Compare_l && (rtb_y_ar != 0U)); + A380SecComputer_P.BitfromLabel4_bit_a, &rtb_y_na); + rtb_AND = (rtb_Compare_l && (rtb_y_na != 0U)); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_3_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel5_bit_c, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_3_bus.rudder_status_word, &rtb_y_c); - rtb_AND4_ab = ((rtb_y_ar != 0U) && rtb_y_c); + A380SecComputer_P.BitfromLabel5_bit_c, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.prim_3_bus.rudder_status_word, &rtb_y_ej); + rtb_AND4_ab = ((rtb_y_na != 0U) && rtb_y_ej); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.prim_3_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel6_bit_h, &rtb_y_ar); - rtb_AND7 = (rtb_y_c && (rtb_y_ar != 0U)); + A380SecComputer_P.BitfromLabel6_bit_h, &rtb_y_na); + rtb_AND1 = (rtb_y_ej && (rtb_y_na != 0U)); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_y_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel7_bit_i, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_y_bus.rudder_status_word, &rtb_y_nx); + A380SecComputer_P.BitfromLabel7_bit_i, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_y_bus.rudder_status_word, &rtb_y_im); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND7_g = rtb_logic_c_is_green_hydraulic_power_avail; - rtb_AND9_e = true; - rtb_AND2_c = !rtb_AND2_c; - rtb_y_c = !rtb_AND4_ab; - rtb_AND4_ab = (rtb_AND2_c && rtb_y_c); - rudder2ElectricModeHasPriority = (rtb_AND2_c && (!rtb_AND1_p) && rtb_y_c && (!rtb_AND7) && ((rtb_y_ar == 0U) || - (!rtb_y_nx)) && (!rtb_logic_c_is_green_hydraulic_power_avail)); - } else { - rtb_AND7_g = false; - rtb_AND9_e = false; + rudder1HydraulicModeHasPriority_tmp = rtb_logic_c_is_green_hydraulic_power_avail; + rudder2ElectricModeAvail = true; + rtb_AND9_e = !rtb_AND9_e; + rtb_y_ej = !rtb_AND4_ab; + rtb_AND4_ab = (rtb_AND9_e && rtb_y_ej); + rudder2ElectricModeHasPriority = (rtb_AND9_e && (!rtb_AND) && rtb_y_ej && (!rtb_AND1) && ((rtb_y_na == 0U) || + (!rtb_y_im)) && (!rtb_logic_c_is_green_hydraulic_power_avail)); + } else { + rudder1HydraulicModeHasPriority_tmp = false; + rudder2ElectricModeAvail = false; rtb_AND4_ab = false; rudder2ElectricModeHasPriority = false; } A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, - A380SecComputer_P.BitfromLabel9_bit_m, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, &rtb_y_nx); - rtb_AND1_p = !A380SecComputer_U.in.discrete_inputs.is_unit_2; - rudderTrimAvail = (A380SecComputer_U.in.discrete_inputs.is_unit_1 || (rtb_AND1_p && + A380SecComputer_P.BitfromLabel9_bit_m, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sec_x_bus.rudder_status_word, &rtb_y_im); + rtb_AND = !A380SecComputer_U.in.discrete_inputs.is_unit_2; + rudderTrimAvail = (A380SecComputer_U.in.discrete_inputs.is_unit_1 || (rtb_AND && A380SecComputer_U.in.discrete_inputs.is_unit_3)); A380SecComputer_B.logic.rudder_trim_engaged = (rudderTrimAvail && (A380SecComputer_U.in.discrete_inputs.is_unit_1 || - (rtb_AND1_p && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((rtb_y_ar == 0U) || (!rtb_y_nx)))))); + (rtb_AND && (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((rtb_y_na == 0U) || (!rtb_y_im)))))); if (rtb_DataTypeConversion_i == 0) { A380SecComputer_B.logic.active_pitch_law = a380_pitch_efcs_law::DirectLaw; A380SecComputer_B.logic.active_lateral_law = a380_lateral_efcs_law::DirectLaw; @@ -969,13 +963,13 @@ void A380SecComputer::step() } A380SecComputer_MATLABFunction_g(A380SecComputer_U.in.discrete_inputs.capt_priority_takeover_pressed, - A380SecComputer_P.PulseNode_isRisingEdge, &rtb_y_c, &A380SecComputer_DWork.sf_MATLABFunction_g4); + A380SecComputer_P.PulseNode_isRisingEdge, &rtb_y_ej, &A380SecComputer_DWork.sf_MATLABFunction_g4); A380SecComputer_MATLABFunction_g(A380SecComputer_U.in.discrete_inputs.fo_priority_takeover_pressed, - A380SecComputer_P.PulseNode1_isRisingEdge, &rtb_y_nx, &A380SecComputer_DWork.sf_MATLABFunction_nu); - if (rtb_y_c) { + A380SecComputer_P.PulseNode1_isRisingEdge, &rtb_y_im, &A380SecComputer_DWork.sf_MATLABFunction_nu); + if (rtb_y_ej) { A380SecComputer_DWork.pRightStickDisabled = true; A380SecComputer_DWork.pLeftStickDisabled = false; - } else if (rtb_y_nx) { + } else if (rtb_y_im) { A380SecComputer_DWork.pLeftStickDisabled = true; A380SecComputer_DWork.pRightStickDisabled = false; } @@ -992,25 +986,25 @@ void A380SecComputer::step() A380SecComputer_MATLABFunction_m((A380SecComputer_DWork.pLeftStickDisabled && (A380SecComputer_U.in.discrete_inputs.fo_priority_takeover_pressed || A380SecComputer_DWork.Delay_DSTATE_c)), A380SecComputer_U.in.time.dt, A380SecComputer_P.ConfirmNode1_isRisingEdge, - A380SecComputer_P.ConfirmNode1_timeDelay, &rtb_AND1_p, &A380SecComputer_DWork.sf_MATLABFunction_j2); + A380SecComputer_P.ConfirmNode1_timeDelay, &rtb_AND, &A380SecComputer_DWork.sf_MATLABFunction_j2); A380SecComputer_MATLABFunction_m((A380SecComputer_DWork.pRightStickDisabled && (A380SecComputer_U.in.discrete_inputs.capt_priority_takeover_pressed || A380SecComputer_DWork.Delay1_DSTATE)), A380SecComputer_U.in.time.dt, A380SecComputer_P.ConfirmNode_isRisingEdge_j, - A380SecComputer_P.ConfirmNode_timeDelay_a, &rtb_AND7, &A380SecComputer_DWork.sf_MATLABFunction_g2); + A380SecComputer_P.ConfirmNode_timeDelay_a, &rtb_AND1, &A380SecComputer_DWork.sf_MATLABFunction_g2); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, - A380SecComputer_P.BitfromLabel_bit, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_y_c); - rtb_AND_l = ((rtb_y_ar == 0U) && rtb_y_c); + A380SecComputer_P.BitfromLabel_bit, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_y_ej); + rtb_AND_b = ((rtb_y_na == 0U) && rtb_y_ej); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, - A380SecComputer_P.BitfromLabel1_bit_d, &rtb_y_ar); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, &rtb_y_nx); - rtb_AND1_hw = ((rtb_y_ar == 0U) && rtb_y_nx); - A380SecComputer_MATLABFunction_g(false, A380SecComputer_P.PulseNode1_isRisingEdge_m, &rtb_y_c, + A380SecComputer_P.BitfromLabel1_bit_d, &rtb_y_na); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_2_bus.slat_flap_actual_position_word, &rtb_y_im); + rtb_AND1_cb = ((rtb_y_na == 0U) && rtb_y_im); + A380SecComputer_MATLABFunction_g(false, A380SecComputer_P.PulseNode1_isRisingEdge_m, &rtb_y_ej, &A380SecComputer_DWork.sf_MATLABFunction_ek); A380SecComputer_MATLABFunction_g(false, A380SecComputer_P.PulseNode2_isRisingEdge, &rtb_Compare_l, &A380SecComputer_DWork.sf_MATLABFunction_mf); - A380SecComputer_DWork.Memory_PreviousInput = A380SecComputer_P.Logic_table[(((static_cast(rtb_y_c) << 1) + - (rtb_Compare_l || A380SecComputer_DWork.Delay_DSTATE_d)) << 1) + A380SecComputer_DWork.Memory_PreviousInput]; + A380SecComputer_DWork.Memory_PreviousInput = A380SecComputer_P.Logic_table[(((static_cast(rtb_y_ej) << 1) + + (rtb_Compare_l || A380SecComputer_DWork.Delay_DSTATE_d)) << 1) + A380SecComputer_DWork.Memory_PreviousInput]; if (rtb_DataTypeConversion_i == A380SecComputer_P.CompareToConstant3_const) { rtb_SSM_ov = A380SecComputer_U.in.bus_inputs.prim_1_bus.discrete_status_word_1.SSM; rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_gp.Data = @@ -1027,11 +1021,11 @@ void A380SecComputer::step() rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_gp.SSM = rtb_SSM_ov; A380SecComputer_MATLABFunction_c(&rtb_BusConversion_InsertedFor_MATLABFunction_at_inport_0_BusCreator1_gp, - A380SecComputer_P.BitfromLabel3_bit_id, &rtb_y_ar); + A380SecComputer_P.BitfromLabel3_bit_id, &rtb_y_na); if (rtb_DataTypeConversion_i == A380SecComputer_P.CompareToConstant5_const) { rtb_Compare_l = (rtb_DataTypeConversion_i != A380SecComputer_P.CompareToConstant2_const); } else { - rtb_Compare_l = ((rtb_y_ar != 0U) && (rtb_SSM_ov == static_cast(SignStatusMatrix::NormalOperation))); + rtb_Compare_l = ((rtb_y_na != 0U) && (rtb_SSM_ov == static_cast(SignStatusMatrix::NormalOperation))); } A380SecComputer_DWork.Delay_DSTATE_d = A380SecComputer_P.Logic_table_i[(((rtb_Compare_l || (std::abs @@ -1042,22 +1036,22 @@ void A380SecComputer::step() A380SecComputer_DWork.Memory_PreviousInput_n]; A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, A380SecComputer_P.BitfromLabel4_bit_m, &rtb_SSM_ov); - rtb_y_c = (rtb_SSM_ov != 0U); + rtb_y_ej = (rtb_SSM_ov != 0U); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, A380SecComputer_P.BitfromLabel_bit_k, &rtb_SSM_ov); - A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_y_nx); - rtb_y_nx = (((!rtb_y_c) || (rtb_SSM_ov == 0U)) && rtb_y_nx); + A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &rtb_y_im); + rtb_y_im = (((!rtb_y_ej) || (rtb_SSM_ov == 0U)) && rtb_y_im); A380SecComputer_MATLABFunction(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, &A380SecComputer_DWork.Memory_PreviousInput_n); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, A380SecComputer_P.BitfromLabel6_bit_a, &rtb_SSM_ov); - rtb_y_c = (rtb_SSM_ov != 0U); + rtb_y_ej = (rtb_SSM_ov != 0U); A380SecComputer_MATLABFunction_c(&A380SecComputer_U.in.bus_inputs.sfcc_1_bus.slat_flap_actual_position_word, A380SecComputer_P.BitfromLabel5_bit_j, &rtb_SSM_ov); - if (rtb_y_nx || (A380SecComputer_DWork.Memory_PreviousInput_n && ((!rtb_y_c) || (rtb_SSM_ov == 0U)))) { - abs_rate_c = 0.25; + if (rtb_y_im || (A380SecComputer_DWork.Memory_PreviousInput_n && ((!rtb_y_ej) || (rtb_SSM_ov == 0U)))) { + denom = 0.25; } else { - abs_rate_c = 0.15; + denom = 0.15; } if (A380SecComputer_DWork.Delay_DSTATE_d) { @@ -1070,9 +1064,9 @@ void A380SecComputer::step() A380SecComputer_B.logic.ths_manual_mode_c_deg_s = rtb_eta_deg; } } else if (A380SecComputer_U.in.discrete_inputs.pitch_trim_down_pressed) { - A380SecComputer_B.logic.ths_manual_mode_c_deg_s = abs_rate_c; + A380SecComputer_B.logic.ths_manual_mode_c_deg_s = denom; } else if (A380SecComputer_U.in.discrete_inputs.pitch_trim_up_pressed) { - A380SecComputer_B.logic.ths_manual_mode_c_deg_s = -abs_rate_c; + A380SecComputer_B.logic.ths_manual_mode_c_deg_s = -denom; } else { A380SecComputer_B.logic.ths_manual_mode_c_deg_s = 0.0; } @@ -1084,57 +1078,57 @@ void A380SecComputer::step() A380SecComputer_B.logic.elevator_1_avail = elevator1Avail; A380SecComputer_B.logic.elevator_2_avail = elevator2Avail; if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND2_c = ((!rtb_AND2_a) && (!rtb_AND4_m) && (!rtb_AND5_e)); + rtb_AND9_e = ((!rtb_AND2_i) && (!rtb_AND4_m) && (!rtb_AND5_e)); } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_AND2_c = ((!rtb_AND2_a) && (!rtb_AND4_m) && (!rtb_AND5_e)); + rtb_AND9_e = ((!rtb_AND2_i) && (!rtb_AND4_m) && (!rtb_AND5_e)); } else { - rtb_AND2_c = (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((!rtb_AND2_a) && (!rtb_AND4_m))); + rtb_AND9_e = (A380SecComputer_U.in.discrete_inputs.is_unit_3 && ((!rtb_AND2_i) && (!rtb_AND4_m))); } - A380SecComputer_B.logic.elevator_2_engaged = (elevator2Avail && rtb_AND2_c); + A380SecComputer_B.logic.elevator_2_engaged = (elevator2Avail && rtb_AND9_e); A380SecComputer_B.logic.elevator_3_avail = elevator3Avail; if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_AND2_c = ((!rtb_AND3_dt) && (!rtb_AND6_e) && (!rtb_AND7_j)); + rtb_AND9_e = ((!rtb_AND3_dt) && (!rtb_AND6_e) && (!rtb_AND7_j)); } else { - rtb_AND2_c = (A380SecComputer_U.in.discrete_inputs.is_unit_2 && ((!rtb_AND3_dt) && (!rtb_AND6_e) && (!rtb_AND7_j))); + rtb_AND9_e = (A380SecComputer_U.in.discrete_inputs.is_unit_2 && ((!rtb_AND3_dt) && (!rtb_AND6_e) && (!rtb_AND7_j))); } - A380SecComputer_B.logic.elevator_3_engaged = (elevator3Avail && rtb_AND2_c); + A380SecComputer_B.logic.elevator_3_engaged = (elevator3Avail && rtb_AND9_e); A380SecComputer_B.logic.ths_avail = thsAvail; A380SecComputer_B.logic.left_aileron_1_avail = leftAileron1Avail; - A380SecComputer_B.logic.left_aileron_1_engaged = (leftAileron1Avail && ((!rtb_AND) && (!rtb_AND1))); + A380SecComputer_B.logic.left_aileron_1_engaged = (leftAileron1Avail && ((!rtb_AND_fj) && (!rtb_AND2_j))); A380SecComputer_B.logic.left_aileron_2_avail = leftAileron2Avail; A380SecComputer_B.logic.left_aileron_2_engaged = (leftAileron2Avail && ((!rtb_AND4_e) && (!rtb_AND6) && (!rtb_AND8))); A380SecComputer_B.logic.right_aileron_1_avail = rightAileron1Avail; A380SecComputer_B.logic.right_aileron_2_avail = rightAileron2Avail; A380SecComputer_B.logic.left_spoiler_1_hydraulic_mode_avail = leftSpoilerHydraulicModeAvail; - rtb_y_nx = (leftSpoilerHydraulicModeAvail && rightSpoilerHydraulicModeAvail); - A380SecComputer_B.logic.left_spoiler_1_hydraulic_mode_engaged = rtb_y_nx; + rtb_y_im = (leftSpoilerHydraulicModeAvail && rightSpoilerHydraulicModeAvail); + A380SecComputer_B.logic.left_spoiler_1_hydraulic_mode_engaged = rtb_y_im; A380SecComputer_B.logic.right_spoiler_1_hydraulic_mode_avail = rightSpoilerHydraulicModeAvail; - A380SecComputer_B.logic.right_spoiler_1_hydraulic_mode_engaged = rtb_y_nx; + A380SecComputer_B.logic.right_spoiler_1_hydraulic_mode_engaged = rtb_y_im; A380SecComputer_B.logic.left_spoiler_2_hydraulic_mode_avail = leftSpoilerHydraulicModeAvail_0; - rtb_y_nx = (leftSpoilerHydraulicModeAvail_0 && rightSpoilerHydraulicModeAvail_0); - A380SecComputer_B.logic.left_spoiler_2_hydraulic_mode_engaged = rtb_y_nx; + rtb_y_im = (leftSpoilerHydraulicModeAvail_0 && rightSpoilerHydraulicModeAvail_0); + A380SecComputer_B.logic.left_spoiler_2_hydraulic_mode_engaged = rtb_y_im; A380SecComputer_B.logic.right_spoiler_2_hydraulic_mode_avail = rightSpoilerHydraulicModeAvail_0; - A380SecComputer_B.logic.right_spoiler_2_hydraulic_mode_engaged = rtb_y_nx; + A380SecComputer_B.logic.right_spoiler_2_hydraulic_mode_engaged = rtb_y_im; A380SecComputer_B.logic.rudder_1_hydraulic_mode_avail = rudder1HydraulicModeAvail; A380SecComputer_B.logic.rudder_1_electric_mode_avail = rudder1ElectricModeAvail; - A380SecComputer_B.logic.rudder_1_hydraulic_mode_engaged = (rudder1HydraulicModeAvail && rtb_AND_aa); - A380SecComputer_B.logic.rudder_1_electric_mode_engaged = (rudder1ElectricModeAvail && rudder1ElectricModeHasPriority); - A380SecComputer_B.logic.rudder_2_hydraulic_mode_avail = rtb_AND7_g; - A380SecComputer_B.logic.rudder_2_electric_mode_avail = rtb_AND9_e; - A380SecComputer_B.logic.rudder_2_hydraulic_mode_engaged = (rtb_AND7_g && rtb_AND4_ab); - A380SecComputer_B.logic.rudder_2_electric_mode_engaged = (rtb_AND9_e && rudder2ElectricModeHasPriority); + A380SecComputer_B.logic.rudder_1_hydraulic_mode_engaged = (rudder1HydraulicModeAvail && rtb_AND_b3); + A380SecComputer_B.logic.rudder_1_electric_mode_engaged = (rudder1ElectricModeAvail && rtb_AND7_g); + A380SecComputer_B.logic.rudder_2_hydraulic_mode_avail = rudder1HydraulicModeHasPriority_tmp; + A380SecComputer_B.logic.rudder_2_electric_mode_avail = rudder2ElectricModeAvail; + A380SecComputer_B.logic.rudder_2_hydraulic_mode_engaged = (rudder1HydraulicModeHasPriority_tmp && rtb_AND4_ab); + A380SecComputer_B.logic.rudder_2_electric_mode_engaged = (rudder2ElectricModeAvail && rudder2ElectricModeHasPriority); A380SecComputer_B.logic.rudder_trim_avail = rudderTrimAvail; - A380SecComputer_B.logic.aileron_droop_active = (rtb_AND_l || rtb_AND1_hw); + A380SecComputer_B.logic.aileron_droop_active = (rtb_AND_b || rtb_AND1_cb); A380SecComputer_B.logic.ths_automatic_mode_active = rtb_Compare_l; A380SecComputer_B.logic.is_yellow_hydraulic_power_avail = rtb_logic_c_is_yellow_hydraulic_power_avail; A380SecComputer_B.logic.is_green_hydraulic_power_avail = rtb_logic_c_is_green_hydraulic_power_avail; A380SecComputer_B.logic.eha_ebha_elec_mode_inhibited = false; A380SecComputer_B.logic.left_sidestick_disabled = A380SecComputer_DWork.pLeftStickDisabled; A380SecComputer_B.logic.right_sidestick_disabled = A380SecComputer_DWork.pRightStickDisabled; - A380SecComputer_B.logic.left_sidestick_priority_locked = rtb_AND1_p; - A380SecComputer_B.logic.right_sidestick_priority_locked = rtb_AND7; + A380SecComputer_B.logic.left_sidestick_priority_locked = rtb_AND; + A380SecComputer_B.logic.right_sidestick_priority_locked = rtb_AND1; if (!A380SecComputer_DWork.pRightStickDisabled) { ca = A380SecComputer_U.in.analog_inputs.fo_pitch_stick_pos; } else { @@ -1142,12 +1136,12 @@ void A380SecComputer::step() } if (A380SecComputer_DWork.pLeftStickDisabled) { - abs_rate_c = A380SecComputer_P.Constant_Value_p; + denom = A380SecComputer_P.Constant_Value_p; } else { - abs_rate_c = A380SecComputer_U.in.analog_inputs.capt_pitch_stick_pos; + denom = A380SecComputer_U.in.analog_inputs.capt_pitch_stick_pos; } - rtb_eta_deg = ca + abs_rate_c; + rtb_eta_deg = ca + denom; if (rtb_eta_deg > A380SecComputer_P.Saturation_UpperSat_d) { A380SecComputer_B.logic.total_sidestick_pitch_command = A380SecComputer_P.Saturation_UpperSat_d; } else if (rtb_eta_deg < A380SecComputer_P.Saturation_LowerSat_h) { @@ -1163,12 +1157,12 @@ void A380SecComputer::step() } if (A380SecComputer_DWork.pLeftStickDisabled) { - abs_rate_c = A380SecComputer_P.Constant1_Value_p; + denom = A380SecComputer_P.Constant1_Value_p; } else { - abs_rate_c = A380SecComputer_U.in.analog_inputs.capt_roll_stick_pos; + denom = A380SecComputer_U.in.analog_inputs.capt_roll_stick_pos; } - rtb_eta_deg = ca + abs_rate_c; + rtb_eta_deg = ca + denom; if (rtb_eta_deg > A380SecComputer_P.Saturation1_UpperSat) { A380SecComputer_B.logic.total_sidestick_roll_command = A380SecComputer_P.Saturation1_UpperSat; } else if (rtb_eta_deg < A380SecComputer_P.Saturation1_LowerSat) { @@ -1185,7 +1179,7 @@ void A380SecComputer::step() A380SecComputer_B.logic.ir_failure_not_self_detected = A380SecComputer_P.Constant_Value_ad; A380SecComputer_B.logic.adr_computation_data.V_ias_kn = rtb_V_ias; A380SecComputer_B.logic.adr_computation_data.V_tas_kn = rtb_V_tas; - A380SecComputer_B.logic.adr_computation_data.mach = rtb_mach_a; + A380SecComputer_B.logic.adr_computation_data.mach = rtb_mach_f; A380SecComputer_B.logic.adr_computation_data.alpha_deg = A380SecComputer_DWork.pY; A380SecComputer_B.logic.ir_computation_data.theta_deg = rtb_theta; A380SecComputer_B.logic.ir_computation_data.phi_deg = rtb_phi; @@ -1214,7 +1208,7 @@ void A380SecComputer::step() A380SecComputer_RateLimiter(ca, A380SecComputer_P.RateLimiterVariableTs2_up, A380SecComputer_P.RateLimiterVariableTs2_lo, A380SecComputer_U.in.time.dt, A380SecComputer_P.RateLimiterVariableTs2_InitialCondition, &rtb_Switch8_o, &A380SecComputer_DWork.sf_RateLimiter); - rtb_y_c = (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant_const_l); + rtb_y_ej = (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant_const_l); rtb_eta_deg = A380SecComputer_P.Gain_Gain_e * rtb_Switch1_k + rtb_Switch8_o; if (rtb_eta_deg > A380SecComputer_P.Saturation2_UpperSat) { rtb_eta_deg = A380SecComputer_P.Saturation2_UpperSat; @@ -1222,17 +1216,17 @@ void A380SecComputer::step() rtb_eta_deg = A380SecComputer_P.Saturation2_LowerSat; } - rtb_AND2_c = !rtb_y_c; + rtb_AND9_e = !rtb_y_ej; A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs_up, A380SecComputer_P.RateLimiterGenericVariableTs_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.left_aileron_1_pos_deg, ((!A380SecComputer_B.logic.left_aileron_1_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_e); + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_e); if (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant_const_f) { rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_inboard_aileron_command_deg.Data; rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_inboard_aileron_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_midboard_aileron_command_deg.Data; rtb_V_tas = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_midboard_aileron_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_spoiler_1_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_spoiler_1_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_spoiler_1_command_deg.Data; rtb_phi = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_spoiler_2_command_deg.Data; rtb_q = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_spoiler_2_command_deg.Data; @@ -1259,7 +1253,7 @@ void A380SecComputer::step() rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_inboard_aileron_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_midboard_aileron_command_deg.Data; rtb_V_tas = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_midboard_aileron_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_spoiler_1_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_spoiler_1_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_spoiler_1_command_deg.Data; rtb_phi = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_spoiler_2_command_deg.Data; rtb_q = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_spoiler_2_command_deg.Data; @@ -1286,7 +1280,7 @@ void A380SecComputer::step() rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_inboard_aileron_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_midboard_aileron_command_deg.Data; rtb_V_tas = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_midboard_aileron_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_spoiler_1_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_spoiler_1_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_spoiler_1_command_deg.Data; rtb_phi = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_spoiler_2_command_deg.Data; rtb_q = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_spoiler_2_command_deg.Data; @@ -1325,8 +1319,8 @@ void A380SecComputer::step() rtb_alpha = 0.0F; } - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.left_aileron_1_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.left_aileron_1_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.left_aileron_1_command_deg = rtb_leftAileron1Command; } @@ -1341,9 +1335,9 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs1_up, A380SecComputer_P.RateLimiterGenericVariableTs1_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.right_aileron_1_pos_deg, ((!A380SecComputer_B.logic.right_aileron_1_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_o); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.right_aileron_1_command_deg = abs_rate_c; + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_o); + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.right_aileron_1_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.right_aileron_1_command_deg = rtb_rightAileron1Command; } @@ -1364,9 +1358,9 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs2_up, A380SecComputer_P.RateLimiterGenericVariableTs2_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.left_aileron_2_pos_deg, ((!A380SecComputer_B.logic.left_aileron_2_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_a); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.left_aileron_2_command_deg = abs_rate_c; + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_a); + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.left_aileron_2_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.left_aileron_2_command_deg = rtb_Data_ch; } @@ -1381,9 +1375,9 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs3_up, A380SecComputer_P.RateLimiterGenericVariableTs3_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.right_aileron_2_pos_deg, ((!A380SecComputer_B.logic.right_aileron_2_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_p); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.right_aileron_2_command_deg = abs_rate_c; + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_p); + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.right_aileron_2_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.right_aileron_2_command_deg = rtb_alpha; } @@ -1417,41 +1411,41 @@ void A380SecComputer::step() } if (rtb_Switch8_o >= 0.0) { - abs_rate_c = A380SecComputer_DWork.pY_e - rtb_Switch8_o; + denom = A380SecComputer_DWork.pY_e - rtb_Switch8_o; rtb_Switch8_o = A380SecComputer_DWork.pY_e; } else { - abs_rate_c = A380SecComputer_DWork.pY_e; + denom = A380SecComputer_DWork.pY_e; rtb_Switch8_o += A380SecComputer_DWork.pY_e; } - ca = std::fmax(abs_rate_c - (rtb_Switch8_o - std::fmax(rtb_Switch8_o, -45.0)), -45.0); - rtb_Switch8_o = std::fmax(rtb_Switch8_o - (abs_rate_c - std::fmax(abs_rate_c, -45.0)), -45.0); + ca = std::fmax(denom - (rtb_Switch8_o - std::fmax(rtb_Switch8_o, -45.0)), -45.0); + rtb_Switch8_o = std::fmax(rtb_Switch8_o - (denom - std::fmax(denom, -45.0)), -45.0); A380SecComputer_RateLimiter_e(ca, A380SecComputer_P.RateLimiterGenericVariableTs8_up, A380SecComputer_P.RateLimiterGenericVariableTs8_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.left_spoiler_1_pos_deg, - ((!A380SecComputer_B.logic.left_spoiler_1_hydraulic_mode_engaged) || rtb_AND2_c), &abs_rate_c, + ((!A380SecComputer_B.logic.left_spoiler_1_hydraulic_mode_engaged) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_os); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_mach_a = rtb_r; + rtb_mach_f = rtb_r; rtb_theta = rtb_n_x; } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { - rtb_mach_a = rtb_phi; + rtb_mach_f = rtb_phi; rtb_theta = rtb_q; } - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_1_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_1_command_deg = denom; } else { - A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_1_command_deg = rtb_mach_a; + A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_1_command_deg = rtb_mach_f; } A380SecComputer_RateLimiter_e(rtb_Switch8_o, A380SecComputer_P.RateLimiterGenericVariableTs9_up, A380SecComputer_P.RateLimiterGenericVariableTs9_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.right_spoiler_1_pos_deg, - ((!A380SecComputer_B.logic.right_spoiler_1_hydraulic_mode_engaged) || rtb_AND2_c), &abs_rate_c, + ((!A380SecComputer_B.logic.right_spoiler_1_hydraulic_mode_engaged) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_d); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_1_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_1_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_1_command_deg = rtb_theta; } @@ -1459,7 +1453,7 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(ca, A380SecComputer_P.RateLimiterGenericVariableTs10_up, A380SecComputer_P.RateLimiterGenericVariableTs10_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.left_spoiler_2_pos_deg, - ((!A380SecComputer_B.logic.left_spoiler_2_hydraulic_mode_engaged) || rtb_AND2_c), &abs_rate_c, + ((!A380SecComputer_B.logic.left_spoiler_2_hydraulic_mode_engaged) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_bv); if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { rtb_theta_dot = 0.0F; @@ -1469,8 +1463,8 @@ void A380SecComputer::step() rtb_phi_dot = rtb_n_z; } - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_2_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_2_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.left_spoiler_2_command_deg = rtb_theta_dot; } @@ -1478,10 +1472,10 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(rtb_Switch8_o, A380SecComputer_P.RateLimiterGenericVariableTs11_up, A380SecComputer_P.RateLimiterGenericVariableTs11_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.right_spoiler_2_pos_deg, - ((!A380SecComputer_B.logic.right_spoiler_2_hydraulic_mode_engaged) || rtb_AND2_c), &abs_rate_c, + ((!A380SecComputer_B.logic.right_spoiler_2_hydraulic_mode_engaged) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_g); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_2_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_2_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.right_spoiler_2_command_deg = rtb_phi_dot; } @@ -1495,7 +1489,7 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(ca, A380SecComputer_P.RateLimiterGenericVariableTs6_up, A380SecComputer_P.RateLimiterGenericVariableTs6_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.rudder_1_pos_deg, (((!A380SecComputer_B.logic.rudder_1_electric_mode_engaged) && - (!A380SecComputer_B.logic.rudder_1_hydraulic_mode_engaged)) || rtb_AND2_c), &abs_rate_c, + (!A380SecComputer_B.logic.rudder_1_hydraulic_mode_engaged)) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_j); if (!A380SecComputer_U.in.discrete_inputs.is_unit_1) { if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { @@ -1506,8 +1500,8 @@ void A380SecComputer::step() } } - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.rudder_1_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.rudder_1_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.rudder_1_command_deg = rtb_Data_awh; } @@ -1521,10 +1515,10 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(ca, A380SecComputer_P.RateLimiterGenericVariableTs7_up, A380SecComputer_P.RateLimiterGenericVariableTs7_lo, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.rudder_2_pos_deg, (((!A380SecComputer_B.logic.rudder_2_electric_mode_engaged) && - (!A380SecComputer_B.logic.rudder_2_hydraulic_mode_engaged)) || rtb_AND2_c), &abs_rate_c, + (!A380SecComputer_B.logic.rudder_2_hydraulic_mode_engaged)) || rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_gz); - if (rtb_y_c) { - A380SecComputer_B.laws.lateral_law_outputs.rudder_2_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.lateral_law_outputs.rudder_2_command_deg = denom; } else { A380SecComputer_B.laws.lateral_law_outputs.rudder_2_command_deg = rtb_Data_nu; } @@ -1535,46 +1529,46 @@ void A380SecComputer::step() rtb_eta_deg = A380SecComputer_P.Constant_Value_a; } - rtb_AND2_c = (A380SecComputer_B.logic.master_prim != A380SecComputer_P.CompareToConstant_const_fl); + rtb_AND9_e = (A380SecComputer_B.logic.master_prim != A380SecComputer_P.CompareToConstant_const_fl); A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs_up_a, A380SecComputer_P.RateLimiterGenericVariableTs_lo_f, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.elevator_1_pos_deg, ((!A380SecComputer_B.logic.elevator_1_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_c); - rtb_y_c = (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant2_const_f); + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_c); + rtb_y_ej = (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant2_const_f); if (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant_const_fs) { rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_inboard_elevator_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_inboard_elevator_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_outboard_elevator_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_1_bus.left_outboard_elevator_command_deg.Data; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_1_bus.right_outboard_elevator_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_1_bus.ths_command_deg.Data; } else if (A380SecComputer_B.logic.master_prim == A380SecComputer_P.CompareToConstant1_const_c) { rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_inboard_elevator_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_inboard_elevator_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_outboard_elevator_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_2_bus.left_outboard_elevator_command_deg.Data; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_2_bus.right_outboard_elevator_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_2_bus.ths_command_deg.Data; } else { rtb_alpha = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_inboard_elevator_command_deg.Data; rtb_theta = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_inboard_elevator_command_deg.Data; - rtb_mach_a = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_outboard_elevator_command_deg.Data; + rtb_mach_f = A380SecComputer_U.in.bus_inputs.prim_3_bus.left_outboard_elevator_command_deg.Data; rtb_Data_ch = A380SecComputer_U.in.bus_inputs.prim_3_bus.right_outboard_elevator_command_deg.Data; rtb_V_ias = A380SecComputer_U.in.bus_inputs.prim_3_bus.ths_command_deg.Data; } if (A380SecComputer_U.in.discrete_inputs.is_unit_1) { - rtb_V_tas = rtb_mach_a; - rtb_mach_a = rtb_alpha; + rtb_V_tas = rtb_mach_f; + rtb_mach_f = rtb_alpha; rtb_theta = rtb_Data_ch; } else if (A380SecComputer_U.in.discrete_inputs.is_unit_2) { rtb_V_tas = rtb_Data_ch; } else { rtb_V_tas = rtb_alpha; - rtb_mach_a = rtb_theta; + rtb_mach_f = rtb_theta; rtb_theta = 0.0F; } - if (rtb_y_c) { - A380SecComputer_B.laws.pitch_law_outputs.elevator_1_command_deg = abs_rate_c; + if (rtb_y_ej) { + A380SecComputer_B.laws.pitch_law_outputs.elevator_1_command_deg = denom; } else { A380SecComputer_B.laws.pitch_law_outputs.elevator_1_command_deg = rtb_V_tas; } @@ -1582,19 +1576,19 @@ void A380SecComputer::step() A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs1_up_a, A380SecComputer_P.RateLimiterGenericVariableTs1_lo_c, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.elevator_2_pos_deg, ((!A380SecComputer_B.logic.elevator_2_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_p0); - if (rtb_y_c) { - A380SecComputer_B.laws.pitch_law_outputs.elevator_2_command_deg = abs_rate_c; + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_p0); + if (rtb_y_ej) { + A380SecComputer_B.laws.pitch_law_outputs.elevator_2_command_deg = denom; } else { - A380SecComputer_B.laws.pitch_law_outputs.elevator_2_command_deg = rtb_mach_a; + A380SecComputer_B.laws.pitch_law_outputs.elevator_2_command_deg = rtb_mach_f; } A380SecComputer_RateLimiter_e(rtb_eta_deg, A380SecComputer_P.RateLimiterGenericVariableTs2_up_l, A380SecComputer_P.RateLimiterGenericVariableTs2_lo_k, A380SecComputer_U.in.time.dt, A380SecComputer_U.in.analog_inputs.elevator_3_pos_deg, ((!A380SecComputer_B.logic.elevator_3_engaged) || - rtb_AND2_c), &abs_rate_c, &A380SecComputer_DWork.sf_RateLimiter_cd); - if (rtb_y_c) { - A380SecComputer_B.laws.pitch_law_outputs.elevator_3_command_deg = abs_rate_c; + rtb_AND9_e), &denom, &A380SecComputer_DWork.sf_RateLimiter_cd); + if (rtb_y_ej) { + A380SecComputer_B.laws.pitch_law_outputs.elevator_3_command_deg = denom; } else { A380SecComputer_B.laws.pitch_law_outputs.elevator_3_command_deg = rtb_theta; } @@ -1607,24 +1601,20 @@ void A380SecComputer::step() if (static_cast(A380SecComputer_B.logic.active_pitch_law) != 5) { rtb_Switch1_k = A380SecComputer_P.Constant_Value_a; } - } else { - rtb_Switch1_k = A380SecComputer_B.logic.ths_manual_mode_c_deg_s; - } - abs_rate_c = A380SecComputer_P.DiscreteTimeIntegratorVariableTsLimit_Gain * rtb_Switch1_k * - A380SecComputer_U.in.time.dt; - if (A380SecComputer_B.logic.ths_automatic_mode_active) { - rtb_AND2_c = ((!A380SecComputer_B.logic.ths_engaged) || rtb_AND2_c); + rtb_AND9_e = ((!A380SecComputer_B.logic.ths_engaged) || rtb_AND9_e); } else { - rtb_AND2_c = !A380SecComputer_B.logic.ths_engaged; + rtb_Switch1_k = A380SecComputer_B.logic.ths_manual_mode_c_deg_s; + rtb_AND9_e = !A380SecComputer_B.logic.ths_engaged; } - A380SecComputer_DWork.icLoad = (rtb_AND2_c || A380SecComputer_DWork.icLoad); + denom = A380SecComputer_P.DiscreteTimeIntegratorVariableTsLimit_Gain * rtb_Switch1_k * A380SecComputer_U.in.time.dt; + A380SecComputer_DWork.icLoad = (rtb_AND9_e || A380SecComputer_DWork.icLoad); if (A380SecComputer_DWork.icLoad) { - A380SecComputer_DWork.Delay_DSTATE = A380SecComputer_U.in.analog_inputs.ths_pos_deg - abs_rate_c; + A380SecComputer_DWork.Delay_DSTATE = A380SecComputer_U.in.analog_inputs.ths_pos_deg - denom; } - A380SecComputer_DWork.Delay_DSTATE += abs_rate_c; + A380SecComputer_DWork.Delay_DSTATE += denom; if (A380SecComputer_DWork.Delay_DSTATE > ca) { A380SecComputer_DWork.Delay_DSTATE = ca; } else { @@ -1637,7 +1627,7 @@ void A380SecComputer::step() } } - if (rtb_y_c) { + if (rtb_y_ej) { A380SecComputer_B.laws.pitch_law_outputs.ths_command_deg = A380SecComputer_DWork.Delay_DSTATE; } else if (A380SecComputer_B.logic.ths_automatic_mode_active) { A380SecComputer_B.laws.pitch_law_outputs.ths_command_deg = rtb_V_ias; @@ -2625,8 +2615,8 @@ void A380SecComputer::step() A380SecComputer_B.Data_dn = A380SecComputer_U.in.bus_inputs.ir_1_bus.drift_angle_deg.Data; A380SecComputer_B.SSM_fk = A380SecComputer_U.in.bus_inputs.ir_1_bus.flight_path_angle_deg.SSM; A380SecComputer_B.Data_iyw = A380SecComputer_U.in.bus_inputs.ir_1_bus.flight_path_angle_deg.Data; - A380SecComputer_DWork.Delay_DSTATE_c = rtb_AND1_p; - A380SecComputer_DWork.Delay1_DSTATE = rtb_AND7; + A380SecComputer_DWork.Delay_DSTATE_c = rtb_AND; + A380SecComputer_DWork.Delay1_DSTATE = rtb_AND1; A380SecComputer_DWork.Memory_PreviousInput_n = A380SecComputer_DWork.Delay_DSTATE_d; A380SecComputer_DWork.icLoad = false; } else { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.h index 926fa376097..5178b04ca85 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380SecComputer_h_ -#define RTW_HEADER_A380SecComputer_h_ +#ifndef A380SecComputer_h_ +#define A380SecComputer_h_ #include "rtwtypes.h" #include "A380SecComputer_types.h" #include "A380LateralDirectLaw.h" diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_private.h index 104e591b1dd..ac85dcbaafe 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380SecComputer_private_h_ -#define RTW_HEADER_A380SecComputer_private_h_ +#ifndef A380SecComputer_private_h_ +#define A380SecComputer_private_h_ #include "rtwtypes.h" #include "A380SecComputer_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_types.h index efc39cd0a74..c4c6beeb796 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380SecComputer_types.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_A380SecComputer_types_h_ -#define RTW_HEADER_A380SecComputer_types_h_ +#ifndef A380SecComputer_types_h_ +#define A380SecComputer_types_h_ #include "rtwtypes.h" #ifndef DEFINED_TYPEDEF_FOR_SignStatusMatrix_ #define DEFINED_TYPEDEF_FOR_SignStatusMatrix_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.cpp index ba7df214633..b5d1ea9d6d6 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.cpp @@ -1,8 +1,10 @@ #include "AutopilotLaws.h" -#include "AutopilotLaws_private.h" -#include "look1_binlxpw.h" -#include "mod_mvZvttxs.h" +#include "rtwtypes.h" +#include "AutopilotLaws_types.h" +#include +#include "mod_OlzklkXq.h" #include "rt_modd.h" +#include "look1_binlxpw.h" const uint8_T AutopilotLaws_IN_any{ 1U }; @@ -10,11 +12,11 @@ const uint8_T AutopilotLaws_IN_left{ 2U }; const uint8_T AutopilotLaws_IN_right{ 3U }; -const uint8_T AutopilotLaws_IN_any_o{ 1U }; +const uint8_T AutopilotLaws_IN_any_f{ 1U }; -const uint8_T AutopilotLaws_IN_left_f{ 2U }; +const uint8_T AutopilotLaws_IN_left_d{ 2U }; -const uint8_T AutopilotLaws_IN_right_l{ 3U }; +const uint8_T AutopilotLaws_IN_right_d{ 3U }; const uint8_T AutopilotLaws_IN_InAir{ 1U }; @@ -68,11 +70,11 @@ void AutopilotLawsModelClass::AutopilotLaws_MATLABFunction_f_Init(rtDW_MATLABFun void AutopilotLawsModelClass::AutopilotLaws_MATLABFunction_m(real_T rtu_Psi_c, real_T rtu_dPsi, real_T rtu_Phi_c, real_T *rty_up, real_T *rty_lo, rtDW_MATLABFunction_AutopilotLaws_d_T *localDW) { + boolean_T wasPsiCmdChanged; static const int8_T b[5]{ 0, 5, 10, 20, 30 }; static const int8_T c[5]{ 5, 5, 10, 30, 30 }; - boolean_T wasPsiCmdChanged; if (!localDW->lastPsi_not_empty) { localDW->lastPsi = rtu_Psi_c; localDW->lastPsi_not_empty = true; @@ -107,10 +109,14 @@ void AutopilotLawsModelClass::AutopilotLaws_MATLABFunction_m(real_T rtu_Psi_c, r localDW->limit = c[low_i]; } else if (r == 1.0) { localDW->limit = c[low_i + 1]; - } else if (c[low_i + 1] == c[low_i]) { - localDW->limit = c[low_i]; } else { - localDW->limit = (1.0 - r) * static_cast(c[low_i]) + static_cast(c[low_i + 1]) * r; + int8_T tmp; + tmp = c[low_i + 1]; + if (tmp == c[low_i]) { + localDW->limit = c[low_i]; + } else { + localDW->limit = (1.0 - r) * static_cast(c[low_i]) + static_cast(tmp) * r; + } } } } @@ -132,7 +138,7 @@ void AutopilotLawsModelClass::AutopilotLaws_Chart_Init(real_T *rty_out) void AutopilotLawsModelClass::AutopilotLaws_Chart(real_T rtu_right, real_T rtu_left, boolean_T rtu_use_short_path, real_T *rty_out, rtDW_Chart_AutopilotLaws_T *localDW) { - if (localDW->is_active_c10_AutopilotLaws == 0U) { + if (localDW->is_active_c10_AutopilotLaws == 0) { localDW->is_active_c10_AutopilotLaws = 1U; localDW->is_c10_AutopilotLaws = AutopilotLaws_IN_any; if (std::abs(rtu_left) < std::abs(rtu_right)) { @@ -226,9 +232,9 @@ void AutopilotLawsModelClass::AutopilotLaws_Chart_g_Init(real_T *rty_out) void AutopilotLawsModelClass::AutopilotLaws_Chart_h(real_T rtu_right, real_T rtu_left, real_T rtu_use_short_path, real_T *rty_out, rtDW_Chart_AutopilotLaws_m_T *localDW) { - if (localDW->is_active_c15_AutopilotLaws == 0U) { + if (localDW->is_active_c15_AutopilotLaws == 0) { localDW->is_active_c15_AutopilotLaws = 1U; - localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_o; + localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_f; if (std::abs(rtu_left) < std::abs(rtu_right)) { *rty_out = rtu_left; } else { @@ -236,17 +242,17 @@ void AutopilotLawsModelClass::AutopilotLaws_Chart_h(real_T rtu_right, real_T rtu } } else { switch (localDW->is_c15_AutopilotLaws) { - case AutopilotLaws_IN_any_o: + case AutopilotLaws_IN_any_f: { real_T tmp; real_T tmp_0; tmp = std::abs(rtu_right); tmp_0 = std::abs(rtu_left); if ((rtu_use_short_path == 0.0) && (tmp < tmp_0) && (tmp >= 10.0) && (tmp <= 20.0)) { - localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_right_l; + localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_right_d; *rty_out = rtu_right; } else if ((rtu_use_short_path == 0.0) && (tmp_0 < tmp) && (tmp_0 >= 10.0) && (tmp_0 <= 20.0)) { - localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_left_f; + localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_left_d; *rty_out = rtu_left; } else if (tmp_0 < tmp) { *rty_out = rtu_left; @@ -256,14 +262,14 @@ void AutopilotLawsModelClass::AutopilotLaws_Chart_h(real_T rtu_right, real_T rtu } break; - case AutopilotLaws_IN_left_f: + case AutopilotLaws_IN_left_d: { real_T tmp; real_T tmp_0; tmp = std::abs(rtu_left); tmp_0 = std::abs(rtu_right); if ((rtu_use_short_path != 0.0) || (tmp_0 < 10.0) || (tmp < 10.0)) { - localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_o; + localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_f; if (tmp < tmp_0) { *rty_out = rtu_left; } else { @@ -282,7 +288,7 @@ void AutopilotLawsModelClass::AutopilotLaws_Chart_h(real_T rtu_right, real_T rtu tmp = std::abs(rtu_left); tmp_0 = std::abs(rtu_right); if ((rtu_use_short_path != 0.0) || (tmp_0 < 10.0) || (tmp < 10.0)) { - localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_o; + localDW->is_c15_AutopilotLaws = AutopilotLaws_IN_any_f; if (tmp < tmp_0) { *rty_out = rtu_left; } else { @@ -362,14 +368,14 @@ void AutopilotLawsModelClass::AutopilotLaws_SpeedProtectionSignalSelection(const rtu_VS_FD, real_T rtu_VS_AP, real_T rtu_VLS_FD, real_T rtu_VLS_AP, real_T rtu_VMAX_FD, real_T rtu_VMAX_AP, real_T rtu_margin, real_T *rty_FD, real_T *rty_AP) { - real_T rtu_in_0; + real_T tmp; if (rtu_in->input.V_c_kn <= rtu_in->data.VLS_kn) { - rtu_in_0 = rtu_in->data.VLS_kn - 5.0; + tmp = rtu_in->data.VLS_kn - 5.0; } else { - rtu_in_0 = rtu_in->data.VLS_kn; + tmp = rtu_in->data.VLS_kn; } - if (rtu_in->data.V_ias_kn < rtu_in_0 + rtu_margin) { + if (rtu_in->data.V_ias_kn < tmp + rtu_margin) { *rty_FD = std::fmin(rtu_VS_FD, rtu_VLS_FD); *rty_AP = std::fmin(rtu_VS_AP, rtu_VLS_AP); } else if (rtu_in->data.V_ias_kn > rtu_in->data.VMAX_kn - rtu_margin) { @@ -388,13 +394,6 @@ void AutopilotLawsModelClass::AutopilotLaws_VSLimiter(real_T rtu_u, const ap_law *rty_y = std::fmax(-limit, std::fmin(limit, rtu_u)); } -void AutopilotLawsModelClass::AutopilotLaws_VSLimiter_f(real_T rtu_u, const ap_laws_output *rtu_in, real_T *rty_y) -{ - real_T limit; - limit = 9.81 / (rtu_in->data.V_tas_kn * 0.51444444444444448) * 0.3 * 57.295779513082323; - *rty_y = std::fmax(-limit, std::fmin(limit, rtu_u)); -} - void AutopilotLawsModelClass::AutopilotLaws_SignalEnablerGSTrack(real_T rtu_u, boolean_T rtu_e, real_T *rty_y) { if (rtu_e) { @@ -407,124 +406,124 @@ void AutopilotLawsModelClass::AutopilotLaws_SignalEnablerGSTrack(real_T rtu_u, b void AutopilotLawsModelClass::AutopilotLaws_Voter1(real_T rtu_u1, real_T rtu_u2, real_T rtu_u3, real_T *rty_Y) { real_T v[3]; - int32_T rtu_u1_0; + int32_T tmp; v[0] = rtu_u1; v[1] = rtu_u2; v[2] = rtu_u3; if (rtu_u1 < rtu_u2) { if (rtu_u2 < rtu_u3) { - rtu_u1_0 = 1; + tmp = 1; } else if (rtu_u1 < rtu_u3) { - rtu_u1_0 = 2; + tmp = 2; } else { - rtu_u1_0 = 0; + tmp = 0; } } else if (rtu_u1 < rtu_u3) { - rtu_u1_0 = 0; + tmp = 0; } else if (rtu_u2 < rtu_u3) { - rtu_u1_0 = 2; + tmp = 2; } else { - rtu_u1_0 = 1; + tmp = 1; } - *rty_Y = v[rtu_u1_0]; + *rty_Y = v[tmp]; } void AutopilotLawsModelClass::step() { - static const int8_T b[5]{ 15, 30, 30, 19, 19 }; - + ap_laws_output rtb_BusAssignment; real_T result_tmp[9]; real_T result[3]; real_T result_0[3]; - real_T L; + real_T Phi1; real_T Phi2; real_T R; real_T a; real_T b_L; real_T b_R; - real_T distance_m; - real_T rtb_Add3_aj; - real_T rtb_Add3_g; - real_T rtb_Add3_i; - real_T rtb_Add3_j4; - real_T rtb_Add3_lz; - real_T rtb_Cos1_j; - real_T rtb_Cos1_pk; - real_T rtb_Cos_i; - real_T rtb_FD_h; - real_T rtb_Gain1_pj; + real_T limit; + real_T rtb_AP_mp; + real_T rtb_Divide; + real_T rtb_FD_f; real_T rtb_Gain4; + real_T rtb_Gain7_j; real_T rtb_GainTheta; real_T rtb_GainTheta1; - real_T rtb_Gain_n4; - real_T rtb_Product_dh; - real_T rtb_Saturation; + real_T rtb_Gain_a0; + real_T rtb_Gain_lb; + real_T rtb_MaxH_dot_RA1; + real_T rtb_Mod2_d; + real_T rtb_Product_g5; + real_T rtb_Product_hz; real_T rtb_Sum1_g; real_T rtb_Sum3_m3; real_T rtb_Sum_es; + real_T rtb_Sum_gq; real_T rtb_Sum_i; - real_T rtb_Sum_kq; real_T rtb_Vz; - real_T rtb_Y_i; + real_T rtb_Y_af; + real_T rtb_Y_e; + real_T rtb_Y_h; real_T rtb_Y_j; - real_T rtb_Y_pf; real_T rtb_dme; - real_T rtb_error_d; - real_T rtb_lo_b; - real_T rtb_lo_k; + real_T rtb_lo; + real_T rtb_lo_i; real_T rtb_uDLookupTable_m; int32_T i; - int32_T rtb_fpmtoms; + int32_T low_i; + int32_T low_ip1; + int32_T mid_i; int32_T rtb_on_ground; - boolean_T guard1{ false }; - + int8_T tmp; boolean_T rtb_Compare_jy; - boolean_T rtb_Compare_l; - boolean_T rtb_Delay_j; + boolean_T rtb_OR1; boolean_T rtb_valid; - boolean_T rtb_valid_d; - rtb_fpmtoms = ((AutopilotLaws_U.in.input.enabled_AP1 != 0.0) || (AutopilotLaws_U.in.input.enabled_AP2 != 0.0)); + boolean_T rtb_valid_e; + static const int8_T b[5]{ 15, 30, 30, 19, 19 }; + + real_T Phi1_tmp; + real_T limit_tmp; + real_T rtb_Y_a_tmp; + boolean_T guard1; + rtb_Y_e = ((AutopilotLaws_U.in.input.enabled_AP1 != 0.0) || (AutopilotLaws_U.in.input.enabled_AP2 != 0.0)); rtb_GainTheta = AutopilotLaws_P.GainTheta_Gain * AutopilotLaws_U.in.data.Theta_deg; rtb_GainTheta1 = AutopilotLaws_P.GainTheta1_Gain * AutopilotLaws_U.in.data.Phi_deg; - b_R = 0.017453292519943295 * rtb_GainTheta; - rtb_dme = 0.017453292519943295 * rtb_GainTheta1; - Phi2 = std::tan(b_R); - a = std::sin(rtb_dme); + rtb_dme = 0.017453292519943295 * rtb_GainTheta; + Phi1 = 0.017453292519943295 * rtb_GainTheta1; + Phi2 = std::tan(rtb_dme); + b_L = std::cos(Phi1); + Phi1 = std::sin(Phi1); rtb_dme = std::cos(rtb_dme); result_tmp[0] = 1.0; - result_tmp[3] = a * Phi2; - result_tmp[6] = rtb_dme * Phi2; + result_tmp[3] = Phi1 * Phi2; + result_tmp[6] = b_L * Phi2; result_tmp[1] = 0.0; - result_tmp[4] = rtb_dme; - result_tmp[7] = -a; + result_tmp[4] = b_L; + result_tmp[7] = -Phi1; result_tmp[2] = 0.0; - distance_m = std::cos(b_R); - rtb_Add3_j4 = 1.0 / distance_m; - result_tmp[5] = rtb_Add3_j4 * a; - result_tmp[8] = rtb_Add3_j4 * rtb_dme; - rtb_error_d = AutopilotLaws_P.Gain_Gain_de * AutopilotLaws_U.in.data.p_rad_s * AutopilotLaws_P.Gainpk_Gain; - rtb_Saturation = AutopilotLaws_P.Gain_Gain_d * AutopilotLaws_U.in.data.q_rad_s * AutopilotLaws_P.Gainqk_Gain; - Phi2 = AutopilotLaws_P.Gain_Gain_m * AutopilotLaws_U.in.data.r_rad_s; - for (rtb_on_ground = 0; rtb_on_ground < 3; rtb_on_ground++) { - result[rtb_on_ground] = (result_tmp[rtb_on_ground + 3] * rtb_Saturation + result_tmp[rtb_on_ground] * rtb_error_d) + - result_tmp[rtb_on_ground + 6] * Phi2; - } - - rtb_error_d = std::sin(b_R); - result_tmp[0] = distance_m; + result_tmp[5] = 1.0 / rtb_dme * Phi1; + result_tmp[8] = 1.0 / rtb_dme * b_L; + Phi2 = AutopilotLaws_P.Gain_Gain_de * AutopilotLaws_U.in.data.p_rad_s * AutopilotLaws_P.Gainpk_Gain; + rtb_Gain7_j = AutopilotLaws_P.Gain_Gain_d * AutopilotLaws_U.in.data.q_rad_s * AutopilotLaws_P.Gainqk_Gain; + R = AutopilotLaws_P.Gain_Gain_m * AutopilotLaws_U.in.data.r_rad_s; + for (i = 0; i < 3; i++) { + result[i] = (result_tmp[i + 3] * rtb_Gain7_j + result_tmp[i] * Phi2) + result_tmp[i + 6] * R; + } + + rtb_Gain7_j = AutopilotLaws_U.in.data.H_radio_ft + AutopilotLaws_P.Bias_Bias; + Phi2 = std::sin(0.017453292519943295 * rtb_GainTheta); + result_tmp[0] = rtb_dme; result_tmp[3] = 0.0; - result_tmp[6] = -rtb_error_d; - result_tmp[1] = a * rtb_error_d; - result_tmp[4] = rtb_dme; - result_tmp[7] = distance_m * a; - result_tmp[2] = rtb_dme * rtb_error_d; - result_tmp[5] = 0.0 - a; - result_tmp[8] = rtb_dme * distance_m; - for (rtb_on_ground = 0; rtb_on_ground < 3; rtb_on_ground++) { - result_0[rtb_on_ground] = (result_tmp[rtb_on_ground + 3] * AutopilotLaws_U.in.data.by_m_s2 + - result_tmp[rtb_on_ground] * AutopilotLaws_U.in.data.bx_m_s2) + result_tmp[rtb_on_ground + 6] * - AutopilotLaws_U.in.data.bz_m_s2; + result_tmp[6] = -Phi2; + result_tmp[1] = Phi1 * Phi2; + result_tmp[4] = b_L; + result_tmp[7] = rtb_dme * Phi1; + result_tmp[2] = b_L * Phi2; + result_tmp[5] = 0.0 - Phi1; + result_tmp[8] = b_L * rtb_dme; + for (i = 0; i < 3; i++) { + result_0[i] = (result_tmp[i + 3] * AutopilotLaws_U.in.data.by_m_s2 + result_tmp[i] * AutopilotLaws_U.in.data.bx_m_s2) + + result_tmp[i + 6] * AutopilotLaws_U.in.data.bz_m_s2; } if (AutopilotLaws_U.in.data.nav_dme_valid != 0.0) { @@ -532,57 +531,57 @@ void AutopilotLawsModelClass::step() } else if (AutopilotLaws_U.in.data.nav_loc_valid) { a = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lat - AutopilotLaws_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) + rtb_Mod2_d = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); a = std::cos(0.017453292519943295 * AutopilotLaws_U.in.data.aircraft_position.lat) * std::cos(0.017453292519943295 * - AutopilotLaws_U.in.data.nav_loc_position.lat) * distance_m * distance_m + a * a; + AutopilotLaws_U.in.data.nav_loc_position.lat) * rtb_Mod2_d * rtb_Mod2_d + a * a; rtb_dme = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - distance_m = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_loc_position.alt; - rtb_dme = std::sqrt(rtb_dme * rtb_dme + distance_m * distance_m) / 1852.0; + a = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_loc_position.alt; + rtb_dme = std::sqrt(rtb_dme * rtb_dme + a * a) / 1852.0; } else { rtb_dme = 0.0; } - rtb_error_d = 0.017453292519943295 * AutopilotLaws_U.in.data.aircraft_position.lat; + Phi1_tmp = 0.017453292519943295 * AutopilotLaws_U.in.data.aircraft_position.lat; Phi2 = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_loc_position.lat; - rtb_Saturation = 0.017453292519943295 * AutopilotLaws_U.in.data.aircraft_position.lon; a = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lat - AutopilotLaws_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) * + rtb_Mod2_d = std::sin((AutopilotLaws_U.in.data.nav_loc_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); - a = std::cos(rtb_error_d) * std::cos(Phi2) * distance_m * distance_m + a * a; - distance_m = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - a = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_loc_position.alt; - L = std::cos(Phi2); - R = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_loc_position.lon - rtb_Saturation; - b_L = mod_mvZvttxs((mod_mvZvttxs(mod_mvZvttxs(360.0) + 360.0) - (mod_mvZvttxs(mod_mvZvttxs + R = std::cos(Phi2); + rtb_Product_g5 = std::cos(Phi1_tmp); + a = rtb_Product_g5 * R * rtb_Mod2_d * rtb_Mod2_d + a * a; + a = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; + rtb_Mod2_d = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_loc_position.alt; + b_L = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(360.0) + 360.0) - (mod_OlzklkXq(mod_OlzklkXq (AutopilotLaws_U.in.data.nav_loc_magvar_deg) + 360.0) + 360.0)) + 360.0); - b_R = mod_mvZvttxs(360.0 - b_L); + b_R = mod_OlzklkXq(360.0 - b_L); + rtb_Gain_a0 = 0.017453292519943295 * AutopilotLaws_U.in.data.aircraft_position.lon; + rtb_Sum_gq = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_loc_position.lon - rtb_Gain_a0; + Phi1 = mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(std::atan2(std::sin(rtb_Sum_gq) * R, rtb_Product_g5 * std::sin(Phi2) - + std::sin(Phi1_tmp) * R * std::cos(rtb_Sum_gq)) * 57.295779513082323 + 360.0)) + 360.0); if (std::abs(b_L) < std::abs(b_R)) { b_R = -b_L; } - rtb_Add3_j4 = std::cos(rtb_error_d); - rtb_error_d = std::sin(rtb_error_d); - L = mod_mvZvttxs(mod_mvZvttxs(mod_mvZvttxs(std::atan2(std::sin(R) * L, rtb_Add3_j4 * std::sin(Phi2) - rtb_error_d * L * - std::cos(R)) * 57.295779513082323 + 360.0)) + 360.0) + 360.0; - Phi2 = mod_mvZvttxs((mod_mvZvttxs(mod_mvZvttxs(mod_mvZvttxs(mod_mvZvttxs(AutopilotLaws_U.in.data.nav_loc_deg - b_R) + - 360.0)) + 360.0) - L) + 360.0); - b_R = mod_mvZvttxs(360.0 - Phi2); + Phi2 = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(AutopilotLaws_U.in.data.nav_loc_deg - b_R) + + 360.0)) + 360.0) - (Phi1 + 360.0)) + 360.0); + b_L = mod_OlzklkXq(360.0 - Phi2); guard1 = false; - if (std::abs(std::sqrt(distance_m * distance_m + a * a) / 1852.0) < 30.0) { - L = mod_mvZvttxs((mod_mvZvttxs(mod_mvZvttxs(AutopilotLaws_U.in.data.nav_loc_deg) + 360.0) - L) + 360.0); - R = mod_mvZvttxs(360.0 - L); - if (std::abs(L) < std::abs(R)) { - R = -L; + if (std::sqrt(a * a + rtb_Mod2_d * rtb_Mod2_d) / 1852.0 < 30.0) { + Phi1 = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(AutopilotLaws_U.in.data.nav_loc_deg) + 360.0) - (Phi1 + 360.0)) + + 360.0); + R = mod_OlzklkXq(360.0 - Phi1); + if (std::abs(Phi1) < std::abs(R)) { + R = -Phi1; } if ((std::abs(R) < 90.0) && ((AutopilotLaws_U.in.data.nav_loc_position.lat != 0.0) || (AutopilotLaws_U.in.data.nav_loc_position.lon != 0.0) || (AutopilotLaws_U.in.data.nav_loc_position.alt != 0.0))) { rtb_valid = true; - if (std::abs(Phi2) < std::abs(b_R)) { - b_R = -Phi2; + if (std::abs(Phi2) < std::abs(b_L)) { + b_L = -Phi2; } } else { guard1 = true; @@ -593,7 +592,7 @@ void AutopilotLawsModelClass::step() if (guard1) { rtb_valid = false; - b_R = 0.0; + b_L = 0.0; } if (AutopilotLaws_U.in.data.nav_gs_valid || (!AutopilotLaws_DWork.nav_gs_deg_not_empty)) { @@ -604,95 +603,74 @@ void AutopilotLawsModelClass::step() Phi2 = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_gs_position.lat; a = std::sin((AutopilotLaws_U.in.data.nav_gs_position.lat - AutopilotLaws_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotLaws_U.in.data.nav_gs_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) * + rtb_Mod2_d = std::sin((AutopilotLaws_U.in.data.nav_gs_position.lon - AutopilotLaws_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); - L = std::cos(Phi2); - a = rtb_Add3_j4 * L * distance_m * distance_m + a * a; - distance_m = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - a = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_gs_position.alt; - distance_m = std::sqrt(distance_m * distance_m + a * a); - rtb_Saturation = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_gs_position.lon - rtb_Saturation; - rtb_Saturation = std::atan2(std::sin(rtb_Saturation) * L, rtb_Add3_j4 * std::sin(Phi2) - rtb_error_d * L * std::cos - (rtb_Saturation)) * 57.295779513082323; - if (rtb_Saturation + 360.0 == 0.0) { - rtb_error_d = 0.0; + R = std::cos(Phi2); + rtb_Product_g5 = std::cos(Phi1_tmp); + a = rtb_Product_g5 * R * rtb_Mod2_d * rtb_Mod2_d + a * a; + a = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; + b_R = AutopilotLaws_U.in.data.aircraft_position.alt - AutopilotLaws_U.in.data.nav_gs_position.alt; + a = std::sqrt(a * a + b_R * b_R); + rtb_Mod2_d = 0.017453292519943295 * AutopilotLaws_U.in.data.nav_gs_position.lon - rtb_Gain_a0; + Phi1 = std::atan2(std::sin(rtb_Mod2_d) * R, rtb_Product_g5 * std::sin(Phi2) - std::sin(Phi1_tmp) * R * std::cos + (rtb_Mod2_d)) * 57.295779513082323; + if (Phi1 + 360.0 == 0.0) { + Phi2 = 0.0; } else { - rtb_error_d = std::fmod(rtb_Saturation + 360.0, 360.0); - if (rtb_error_d == 0.0) { - rtb_error_d = 0.0; - } else if (rtb_Saturation + 360.0 < 0.0) { - rtb_error_d += 360.0; + Phi2 = std::fmod(Phi1 + 360.0, 360.0); + if (Phi2 == 0.0) { + Phi2 = 0.0; + } else if (Phi2 < 0.0) { + Phi2 += 360.0; } } guard1 = false; - if (std::abs(distance_m / 1852.0) < 30.0) { + if (a / 1852.0 < 30.0) { if (AutopilotLaws_U.in.data.nav_loc_deg == 0.0) { - Phi2 = 0.0; + Phi1 = 0.0; } else { - Phi2 = std::fmod(AutopilotLaws_U.in.data.nav_loc_deg, 360.0); - if (Phi2 == 0.0) { - Phi2 = 0.0; - } else if (AutopilotLaws_U.in.data.nav_loc_deg < 0.0) { - Phi2 += 360.0; + Phi1 = std::fmod(AutopilotLaws_U.in.data.nav_loc_deg, 360.0); + if (Phi1 == 0.0) { + Phi1 = 0.0; + } else if (Phi1 < 0.0) { + Phi1 += 360.0; } } - if (rtb_error_d == 0.0) { - rtb_Saturation = 0.0; - } else { - rtb_Saturation = std::fmod(rtb_error_d, 360.0); - if (rtb_Saturation == 0.0) { - rtb_Saturation = 0.0; - } else if (rtb_error_d < 0.0) { - rtb_Saturation += 360.0; - } - } - - if (Phi2 + 360.0 == 0.0) { - Phi2 = 0.0; - } else { - Phi2 = std::fmod(Phi2 + 360.0, 360.0); - } - - if (rtb_Saturation + 360.0 == 0.0) { - rtb_Saturation = 0.0; + if (Phi2 == 0.0) { + Phi1_tmp = 0.0; } else { - rtb_Saturation = std::fmod(rtb_Saturation + 360.0, 360.0); + Phi1_tmp = std::fmod(Phi2, 360.0); } - rtb_error_d = (Phi2 - (rtb_Saturation + 360.0)) + 360.0; - if (rtb_error_d == 0.0) { - L = 0.0; + Phi1 = (std::fmod(Phi1 + 360.0, 360.0) - (std::fmod(Phi1_tmp + 360.0, 360.0) + 360.0)) + 360.0; + if (Phi1 == 0.0) { + Phi1 = 0.0; } else { - L = std::fmod(rtb_error_d, 360.0); - if (L == 0.0) { - L = 0.0; - } else if (rtb_error_d < 0.0) { - L += 360.0; + Phi1 = std::fmod(Phi1, 360.0); + if (Phi1 == 0.0) { + Phi1 = 0.0; + } else if (Phi1 < 0.0) { + Phi1 += 360.0; } } - if (360.0 - L == 0.0) { + if (360.0 - Phi1 == 0.0) { R = 0.0; } else { - R = std::fmod(360.0 - L, 360.0); - if (R == 0.0) { - R = 0.0; - } else if (360.0 - L < 0.0) { - R += 360.0; - } + R = std::fmod(360.0 - Phi1, 360.0); } - if (std::abs(L) < std::abs(R)) { - R = -L; + if (Phi1 < R) { + R = -Phi1; } if ((std::abs(R) < 90.0) && ((AutopilotLaws_U.in.data.nav_gs_position.lat != 0.0) || (AutopilotLaws_U.in.data.nav_gs_position.lon != 0.0) || (AutopilotLaws_U.in.data.nav_gs_position.alt != 0.0))) { - rtb_valid_d = true; - rtb_error_d = std::asin(a / distance_m) * 57.295779513082323 - AutopilotLaws_DWork.nav_gs_deg; + rtb_valid_e = true; + Phi1 = std::asin(b_R / a) * 57.295779513082323 - AutopilotLaws_DWork.nav_gs_deg; } else { guard1 = true; } @@ -701,38 +679,38 @@ void AutopilotLawsModelClass::step() } if (guard1) { - rtb_valid_d = false; - rtb_error_d = 0.0; + rtb_valid_e = false; + Phi1 = 0.0; } - rtb_Saturation = AutopilotLaws_P.Gain_Gain_n * AutopilotLaws_U.in.data.gear_strut_compression_1 - + Phi2 = AutopilotLaws_P.Gain_Gain_n * AutopilotLaws_U.in.data.gear_strut_compression_1 - AutopilotLaws_P.Constant1_Value_b; - if (rtb_Saturation > AutopilotLaws_P.Saturation_UpperSat_p) { - rtb_Saturation = AutopilotLaws_P.Saturation_UpperSat_p; - } else if (rtb_Saturation < AutopilotLaws_P.Saturation_LowerSat_g) { - rtb_Saturation = AutopilotLaws_P.Saturation_LowerSat_g; + if (Phi2 > AutopilotLaws_P.Saturation_UpperSat_p) { + Phi2 = AutopilotLaws_P.Saturation_UpperSat_p; + } else if (Phi2 < AutopilotLaws_P.Saturation_LowerSat_g) { + Phi2 = AutopilotLaws_P.Saturation_LowerSat_g; } - Phi2 = AutopilotLaws_P.Gain1_Gain_ll * AutopilotLaws_U.in.data.gear_strut_compression_2 - + R = AutopilotLaws_P.Gain1_Gain_ll * AutopilotLaws_U.in.data.gear_strut_compression_2 - AutopilotLaws_P.Constant1_Value_b; - if (Phi2 > AutopilotLaws_P.Saturation1_UpperSat_j) { - Phi2 = AutopilotLaws_P.Saturation1_UpperSat_j; - } else if (Phi2 < AutopilotLaws_P.Saturation1_LowerSat_d) { - Phi2 = AutopilotLaws_P.Saturation1_LowerSat_d; + if (R > AutopilotLaws_P.Saturation1_UpperSat_j) { + R = AutopilotLaws_P.Saturation1_UpperSat_j; + } else if (R < AutopilotLaws_P.Saturation1_LowerSat_d) { + R = AutopilotLaws_P.Saturation1_LowerSat_d; } - if (AutopilotLaws_DWork.is_active_c5_AutopilotLaws == 0U) { + if (AutopilotLaws_DWork.is_active_c5_AutopilotLaws == 0) { AutopilotLaws_DWork.is_active_c5_AutopilotLaws = 1U; AutopilotLaws_DWork.is_c5_AutopilotLaws = AutopilotLaws_IN_OnGround; rtb_on_ground = 1; - } else if (AutopilotLaws_DWork.is_c5_AutopilotLaws == 1) { - if ((rtb_Saturation > 0.05) || (Phi2 > 0.05)) { + } else if (AutopilotLaws_DWork.is_c5_AutopilotLaws == AutopilotLaws_IN_InAir) { + if ((Phi2 > 0.05) || (R > 0.05)) { AutopilotLaws_DWork.is_c5_AutopilotLaws = AutopilotLaws_IN_OnGround; rtb_on_ground = 1; } else { rtb_on_ground = 0; } - } else if ((rtb_Saturation == 0.0) && (Phi2 == 0.0)) { + } else if ((Phi2 == 0.0) && (R == 0.0)) { AutopilotLaws_DWork.is_c5_AutopilotLaws = AutopilotLaws_IN_InAir; rtb_on_ground = 0; } else { @@ -741,91 +719,91 @@ void AutopilotLawsModelClass::step() rtb_Compare_jy = (AutopilotLaws_U.in.data.altimeter_setting_left_mbar != AutopilotLaws_DWork.DelayInput1_DSTATE); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_DWork.DelayInput1_DSTATE_g; - AutopilotLaws_Y.out = AutopilotLaws_P.ap_laws_output_MATLABStruct; - AutopilotLaws_Y.out.output.ap_on = rtb_fpmtoms; - AutopilotLaws_Y.out.time = AutopilotLaws_U.in.time; - AutopilotLaws_Y.out.data.aircraft_position = AutopilotLaws_U.in.data.aircraft_position; - AutopilotLaws_Y.out.data.Theta_deg = rtb_GainTheta; - AutopilotLaws_Y.out.data.Phi_deg = rtb_GainTheta1; - AutopilotLaws_Y.out.data.qk_deg_s = result[1]; - AutopilotLaws_Y.out.data.rk_deg_s = result[2]; - AutopilotLaws_Y.out.data.pk_deg_s = result[0]; - AutopilotLaws_Y.out.data.V_ias_kn = AutopilotLaws_U.in.data.V_ias_kn; - AutopilotLaws_Y.out.data.V_tas_kn = AutopilotLaws_U.in.data.V_tas_kn; - AutopilotLaws_Y.out.data.V_mach = AutopilotLaws_U.in.data.V_mach; - AutopilotLaws_Y.out.data.V_gnd_kn = AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_Y.out.data.alpha_deg = AutopilotLaws_U.in.data.alpha_deg; - AutopilotLaws_Y.out.data.beta_deg = AutopilotLaws_U.in.data.beta_deg; - AutopilotLaws_Y.out.data.H_ft = AutopilotLaws_U.in.data.H_ft; - AutopilotLaws_Y.out.data.H_ind_ft = AutopilotLaws_U.in.data.H_ind_ft; - AutopilotLaws_Y.out.data.H_radio_ft = AutopilotLaws_U.in.data.H_radio_ft; - AutopilotLaws_Y.out.data.H_dot_ft_min = AutopilotLaws_U.in.data.H_dot_ft_min; - AutopilotLaws_Y.out.data.Psi_magnetic_deg = AutopilotLaws_U.in.data.Psi_magnetic_deg; - AutopilotLaws_Y.out.data.Psi_magnetic_track_deg = AutopilotLaws_U.in.data.Psi_magnetic_track_deg; - AutopilotLaws_Y.out.data.Psi_true_deg = AutopilotLaws_U.in.data.Psi_true_deg; - AutopilotLaws_Y.out.data.ax_m_s2 = result_0[0]; - AutopilotLaws_Y.out.data.ay_m_s2 = result_0[1]; - AutopilotLaws_Y.out.data.az_m_s2 = result_0[2]; - AutopilotLaws_Y.out.data.bx_m_s2 = AutopilotLaws_U.in.data.bx_m_s2; - AutopilotLaws_Y.out.data.by_m_s2 = AutopilotLaws_U.in.data.by_m_s2; - AutopilotLaws_Y.out.data.bz_m_s2 = AutopilotLaws_U.in.data.bz_m_s2; - AutopilotLaws_Y.out.data.nav_valid = AutopilotLaws_U.in.data.nav_valid; - AutopilotLaws_Y.out.data.nav_loc_deg = AutopilotLaws_U.in.data.nav_loc_deg; - AutopilotLaws_Y.out.data.nav_gs_deg = AutopilotLaws_P.Gain3_Gain_a * AutopilotLaws_U.in.data.nav_gs_deg; - AutopilotLaws_Y.out.data.nav_dme_valid = AutopilotLaws_U.in.data.nav_dme_valid; - AutopilotLaws_Y.out.data.nav_dme_nmi = rtb_dme; - AutopilotLaws_Y.out.data.nav_loc_valid = AutopilotLaws_U.in.data.nav_loc_valid; - AutopilotLaws_Y.out.data.nav_loc_magvar_deg = AutopilotLaws_U.in.data.nav_loc_magvar_deg; - AutopilotLaws_Y.out.data.nav_loc_error_deg = AutopilotLaws_U.in.data.nav_loc_error_deg; - AutopilotLaws_Y.out.data.nav_loc_position = AutopilotLaws_U.in.data.nav_loc_position; - AutopilotLaws_Y.out.data.nav_e_loc_valid = rtb_valid; - AutopilotLaws_Y.out.data.nav_e_loc_error_deg = b_R; - AutopilotLaws_Y.out.data.nav_gs_valid = AutopilotLaws_U.in.data.nav_gs_valid; - AutopilotLaws_Y.out.data.nav_gs_error_deg = AutopilotLaws_U.in.data.nav_gs_error_deg; - AutopilotLaws_Y.out.data.nav_gs_position = AutopilotLaws_U.in.data.nav_gs_position; - AutopilotLaws_Y.out.data.nav_e_gs_valid = rtb_valid_d; - AutopilotLaws_Y.out.data.nav_e_gs_error_deg = rtb_error_d; - AutopilotLaws_Y.out.data.flight_guidance_xtk_nmi = AutopilotLaws_U.in.data.flight_guidance_xtk_nmi; - AutopilotLaws_Y.out.data.flight_guidance_tae_deg = AutopilotLaws_U.in.data.flight_guidance_tae_deg; - AutopilotLaws_Y.out.data.flight_guidance_phi_deg = AutopilotLaws_U.in.data.flight_guidance_phi_deg; - AutopilotLaws_Y.out.data.flight_guidance_phi_limit_deg = AutopilotLaws_U.in.data.flight_guidance_phi_limit_deg; - AutopilotLaws_Y.out.data.flight_phase = AutopilotLaws_U.in.data.flight_phase; - AutopilotLaws_Y.out.data.V2_kn = AutopilotLaws_U.in.data.V2_kn; - AutopilotLaws_Y.out.data.VAPP_kn = AutopilotLaws_U.in.data.VAPP_kn; - AutopilotLaws_Y.out.data.VLS_kn = AutopilotLaws_U.in.data.VLS_kn; - AutopilotLaws_Y.out.data.VMAX_kn = AutopilotLaws_U.in.data.VMAX_kn; - AutopilotLaws_Y.out.data.is_flight_plan_available = AutopilotLaws_U.in.data.is_flight_plan_available; - AutopilotLaws_Y.out.data.altitude_constraint_ft = AutopilotLaws_U.in.data.altitude_constraint_ft; - AutopilotLaws_Y.out.data.thrust_reduction_altitude = AutopilotLaws_U.in.data.thrust_reduction_altitude; - AutopilotLaws_Y.out.data.thrust_reduction_altitude_go_around = + rtb_BusAssignment = AutopilotLaws_P.ap_laws_output_MATLABStruct; + rtb_BusAssignment.output.ap_on = rtb_Y_e; + rtb_BusAssignment.time = AutopilotLaws_U.in.time; + rtb_BusAssignment.data.aircraft_position = AutopilotLaws_U.in.data.aircraft_position; + rtb_BusAssignment.data.Theta_deg = rtb_GainTheta; + rtb_BusAssignment.data.Phi_deg = rtb_GainTheta1; + rtb_BusAssignment.data.qk_deg_s = result[1]; + rtb_BusAssignment.data.rk_deg_s = result[2]; + rtb_BusAssignment.data.pk_deg_s = result[0]; + rtb_BusAssignment.data.V_ias_kn = AutopilotLaws_U.in.data.V_ias_kn; + rtb_BusAssignment.data.V_tas_kn = AutopilotLaws_U.in.data.V_tas_kn; + rtb_BusAssignment.data.V_mach = AutopilotLaws_U.in.data.V_mach; + rtb_BusAssignment.data.V_gnd_kn = AutopilotLaws_U.in.data.V_gnd_kn; + rtb_BusAssignment.data.alpha_deg = AutopilotLaws_U.in.data.alpha_deg; + rtb_BusAssignment.data.beta_deg = AutopilotLaws_U.in.data.beta_deg; + rtb_BusAssignment.data.H_ft = AutopilotLaws_U.in.data.H_ft; + rtb_BusAssignment.data.H_ind_ft = AutopilotLaws_U.in.data.H_ind_ft; + rtb_BusAssignment.data.H_radio_ft = rtb_Gain7_j; + rtb_BusAssignment.data.H_dot_ft_min = AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_BusAssignment.data.Psi_magnetic_deg = AutopilotLaws_U.in.data.Psi_magnetic_deg; + rtb_BusAssignment.data.Psi_magnetic_track_deg = AutopilotLaws_U.in.data.Psi_magnetic_track_deg; + rtb_BusAssignment.data.Psi_true_deg = AutopilotLaws_U.in.data.Psi_true_deg; + rtb_BusAssignment.data.ax_m_s2 = result_0[0]; + rtb_BusAssignment.data.ay_m_s2 = result_0[1]; + rtb_BusAssignment.data.az_m_s2 = result_0[2]; + rtb_BusAssignment.data.bx_m_s2 = AutopilotLaws_U.in.data.bx_m_s2; + rtb_BusAssignment.data.by_m_s2 = AutopilotLaws_U.in.data.by_m_s2; + rtb_BusAssignment.data.bz_m_s2 = AutopilotLaws_U.in.data.bz_m_s2; + rtb_BusAssignment.data.nav_valid = AutopilotLaws_U.in.data.nav_valid; + rtb_BusAssignment.data.nav_loc_deg = AutopilotLaws_U.in.data.nav_loc_deg; + rtb_BusAssignment.data.nav_gs_deg = AutopilotLaws_P.Gain3_Gain_a * AutopilotLaws_U.in.data.nav_gs_deg; + rtb_BusAssignment.data.nav_dme_valid = AutopilotLaws_U.in.data.nav_dme_valid; + rtb_BusAssignment.data.nav_dme_nmi = rtb_dme; + rtb_BusAssignment.data.nav_loc_valid = AutopilotLaws_U.in.data.nav_loc_valid; + rtb_BusAssignment.data.nav_loc_magvar_deg = AutopilotLaws_U.in.data.nav_loc_magvar_deg; + rtb_BusAssignment.data.nav_loc_error_deg = AutopilotLaws_U.in.data.nav_loc_error_deg; + rtb_BusAssignment.data.nav_loc_position = AutopilotLaws_U.in.data.nav_loc_position; + rtb_BusAssignment.data.nav_e_loc_valid = rtb_valid; + rtb_BusAssignment.data.nav_e_loc_error_deg = b_L; + rtb_BusAssignment.data.nav_gs_valid = AutopilotLaws_U.in.data.nav_gs_valid; + rtb_BusAssignment.data.nav_gs_error_deg = AutopilotLaws_U.in.data.nav_gs_error_deg; + rtb_BusAssignment.data.nav_gs_position = AutopilotLaws_U.in.data.nav_gs_position; + rtb_BusAssignment.data.nav_e_gs_valid = rtb_valid_e; + rtb_BusAssignment.data.nav_e_gs_error_deg = Phi1; + rtb_BusAssignment.data.flight_guidance_xtk_nmi = AutopilotLaws_U.in.data.flight_guidance_xtk_nmi; + rtb_BusAssignment.data.flight_guidance_tae_deg = AutopilotLaws_U.in.data.flight_guidance_tae_deg; + rtb_BusAssignment.data.flight_guidance_phi_deg = AutopilotLaws_U.in.data.flight_guidance_phi_deg; + rtb_BusAssignment.data.flight_guidance_phi_limit_deg = AutopilotLaws_U.in.data.flight_guidance_phi_limit_deg; + rtb_BusAssignment.data.flight_phase = AutopilotLaws_U.in.data.flight_phase; + rtb_BusAssignment.data.V2_kn = AutopilotLaws_U.in.data.V2_kn; + rtb_BusAssignment.data.VAPP_kn = AutopilotLaws_U.in.data.VAPP_kn; + rtb_BusAssignment.data.VLS_kn = AutopilotLaws_U.in.data.VLS_kn; + rtb_BusAssignment.data.VMAX_kn = AutopilotLaws_U.in.data.VMAX_kn; + rtb_BusAssignment.data.is_flight_plan_available = AutopilotLaws_U.in.data.is_flight_plan_available; + rtb_BusAssignment.data.altitude_constraint_ft = AutopilotLaws_U.in.data.altitude_constraint_ft; + rtb_BusAssignment.data.thrust_reduction_altitude = AutopilotLaws_U.in.data.thrust_reduction_altitude; + rtb_BusAssignment.data.thrust_reduction_altitude_go_around = AutopilotLaws_U.in.data.thrust_reduction_altitude_go_around; - AutopilotLaws_Y.out.data.acceleration_altitude = AutopilotLaws_U.in.data.acceleration_altitude; - AutopilotLaws_Y.out.data.acceleration_altitude_engine_out = AutopilotLaws_U.in.data.acceleration_altitude_engine_out; - AutopilotLaws_Y.out.data.acceleration_altitude_go_around = AutopilotLaws_U.in.data.acceleration_altitude_go_around; - AutopilotLaws_Y.out.data.acceleration_altitude_go_around_engine_out = + rtb_BusAssignment.data.acceleration_altitude = AutopilotLaws_U.in.data.acceleration_altitude; + rtb_BusAssignment.data.acceleration_altitude_engine_out = AutopilotLaws_U.in.data.acceleration_altitude_engine_out; + rtb_BusAssignment.data.acceleration_altitude_go_around = AutopilotLaws_U.in.data.acceleration_altitude_go_around; + rtb_BusAssignment.data.acceleration_altitude_go_around_engine_out = AutopilotLaws_U.in.data.acceleration_altitude_go_around_engine_out; - AutopilotLaws_Y.out.data.cruise_altitude = AutopilotLaws_U.in.data.cruise_altitude; - AutopilotLaws_Y.out.data.on_ground = rtb_on_ground; - AutopilotLaws_Y.out.data.zeta_deg = AutopilotLaws_P.Gain2_Gain_b * AutopilotLaws_U.in.data.zeta_pos; - AutopilotLaws_Y.out.data.throttle_lever_1_pos = AutopilotLaws_U.in.data.throttle_lever_1_pos; - AutopilotLaws_Y.out.data.throttle_lever_2_pos = AutopilotLaws_U.in.data.throttle_lever_2_pos; - AutopilotLaws_Y.out.data.flaps_handle_index = AutopilotLaws_U.in.data.flaps_handle_index; - AutopilotLaws_Y.out.data.is_engine_operative_1 = AutopilotLaws_U.in.data.is_engine_operative_1; - AutopilotLaws_Y.out.data.is_engine_operative_2 = AutopilotLaws_U.in.data.is_engine_operative_2; - AutopilotLaws_Y.out.data.altimeter_setting_changed = (rtb_Compare_jy || + rtb_BusAssignment.data.cruise_altitude = AutopilotLaws_U.in.data.cruise_altitude; + rtb_BusAssignment.data.on_ground = rtb_on_ground; + rtb_BusAssignment.data.zeta_deg = AutopilotLaws_P.Gain2_Gain_b * AutopilotLaws_U.in.data.zeta_pos; + rtb_BusAssignment.data.throttle_lever_1_pos = AutopilotLaws_U.in.data.throttle_lever_1_pos; + rtb_BusAssignment.data.throttle_lever_2_pos = AutopilotLaws_U.in.data.throttle_lever_2_pos; + rtb_BusAssignment.data.flaps_handle_index = AutopilotLaws_U.in.data.flaps_handle_index; + rtb_BusAssignment.data.is_engine_operative_1 = AutopilotLaws_U.in.data.is_engine_operative_1; + rtb_BusAssignment.data.is_engine_operative_2 = AutopilotLaws_U.in.data.is_engine_operative_2; + rtb_BusAssignment.data.altimeter_setting_changed = (rtb_Compare_jy || (AutopilotLaws_U.in.data.altimeter_setting_right_mbar != AutopilotLaws_DWork.DelayInput1_DSTATE)); - AutopilotLaws_Y.out.data.total_weight_kg = AutopilotLaws_U.in.data.total_weight_kg; - AutopilotLaws_Y.out.input = AutopilotLaws_U.in.input; + rtb_BusAssignment.data.total_weight_kg = AutopilotLaws_U.in.data.total_weight_kg; + rtb_BusAssignment.input = AutopilotLaws_U.in.input; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value_e; AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_U.in.data.Psi_magnetic_deg - AutopilotLaws_DWork.DelayInput1_DSTATE) + AutopilotLaws_P.Constant3_Value_e; - b_R = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_e); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_e - b_R; - rtb_error_d = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_e); - if (b_R < rtb_error_d) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_h * b_R; + b_L = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_e); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_e - b_L; + Phi1 = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_e); + if (b_L < Phi1) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_h * b_L; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_e * rtb_error_d; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_e * Phi1; } AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_U.in.data.Psi_magnetic_track_deg; @@ -834,204 +812,146 @@ void AutopilotLawsModelClass::step() AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_b; AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_b); - rtb_Saturation = AutopilotLaws_U.in.data.nav_loc_deg - AutopilotLaws_U.in.data.nav_loc_magvar_deg; - R = rt_modd(rt_modd(rtb_Saturation, AutopilotLaws_P.Constant3_Value_n) + AutopilotLaws_P.Constant3_Value_n, + rtb_Mod2_d = AutopilotLaws_U.in.data.nav_loc_deg - AutopilotLaws_U.in.data.nav_loc_magvar_deg; + R = rt_modd(rt_modd(rtb_Mod2_d, AutopilotLaws_P.Constant3_Value_n) + AutopilotLaws_P.Constant3_Value_n, AutopilotLaws_P.Constant3_Value_n); - b_R = rt_modd((AutopilotLaws_DWork.DelayInput1_DSTATE - (R + AutopilotLaws_P.Constant3_Value_i)) + + b_L = rt_modd((AutopilotLaws_DWork.DelayInput1_DSTATE - (R + AutopilotLaws_P.Constant3_Value_i)) + AutopilotLaws_P.Constant3_Value_i, AutopilotLaws_P.Constant3_Value_i); - Phi2 = rt_modd(AutopilotLaws_P.Constant3_Value_i - b_R, AutopilotLaws_P.Constant3_Value_i); + Phi1 = rt_modd(AutopilotLaws_P.Constant3_Value_i - b_L, AutopilotLaws_P.Constant3_Value_i); if (AutopilotLaws_P.ManualSwitch_CurrentSetting == 1) { - rtb_error_d = AutopilotLaws_P.Constant_Value_d; + Phi2 = AutopilotLaws_P.Constant_Value_d; } else { - rtb_error_d = AutopilotLaws_U.in.input.lateral_law; + Phi2 = AutopilotLaws_U.in.input.lateral_law; } - rtb_valid = (rtb_error_d == AutopilotLaws_P.CompareToConstant2_const); - if (b_R < Phi2) { - b_R *= AutopilotLaws_P.Gain1_Gain; + rtb_valid = (Phi2 == AutopilotLaws_P.CompareToConstant2_const); + if (b_L < Phi1) { + Phi1_tmp = AutopilotLaws_P.Gain1_Gain * b_L; } else { - b_R = AutopilotLaws_P.Gain_Gain * Phi2; + Phi1_tmp = AutopilotLaws_P.Gain_Gain * Phi1; } - b_R = std::abs(b_R); + b_L = std::abs(Phi1_tmp); if (!AutopilotLaws_DWork.limit_not_empty) { - AutopilotLaws_DWork.limit = b_R; + AutopilotLaws_DWork.limit = b_L; AutopilotLaws_DWork.limit_not_empty = true; } if (!rtb_valid) { - AutopilotLaws_DWork.limit = std::fmin(std::fmax(b_R, 15.0), 115.0); + AutopilotLaws_DWork.limit = std::fmin(std::fmax(b_L, 15.0), 115.0); } - if (rtb_valid && (b_R < 15.0)) { + if (rtb_valid && (b_L < 15.0)) { AutopilotLaws_DWork.limit = 15.0; } - AutopilotLaws_MATLABFunction(AutopilotLaws_P.tau_Value, AutopilotLaws_P.zeta_Value, &Phi2, &rtb_lo_k); + AutopilotLaws_MATLABFunction(AutopilotLaws_P.tau_Value, AutopilotLaws_P.zeta_Value, &Phi1, &a); if (rtb_dme > AutopilotLaws_P.Saturation_UpperSat_b) { - b_R = AutopilotLaws_P.Saturation_UpperSat_b; - } else if (rtb_dme < AutopilotLaws_P.Saturation_LowerSat_n) { - b_R = AutopilotLaws_P.Saturation_LowerSat_n; + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_b; + } else if (rtb_dme < AutopilotLaws_P.Saturation_LowerSat_nz) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_nz; } else { - b_R = rtb_dme; + Phi1_tmp = rtb_dme; + } + + rtb_Divide = std::sin(AutopilotLaws_P.Gain1_Gain_f * AutopilotLaws_U.in.data.nav_loc_error_deg) * Phi1_tmp * + AutopilotLaws_P.Gain_Gain_h * a / AutopilotLaws_U.in.data.V_gnd_kn; + if (rtb_Divide > AutopilotLaws_DWork.limit) { + rtb_Divide = AutopilotLaws_DWork.limit; + } else if (rtb_Divide < -AutopilotLaws_DWork.limit) { + rtb_Divide = -AutopilotLaws_DWork.limit; } - b_R = std::sin(AutopilotLaws_P.Gain1_Gain_f * AutopilotLaws_U.in.data.nav_loc_error_deg) * b_R * - AutopilotLaws_P.Gain_Gain_h * rtb_lo_k / AutopilotLaws_U.in.data.V_gnd_kn; AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_DWork.DelayInput1_DSTATE - (rt_modd(rt_modd (AutopilotLaws_U.in.data.nav_loc_error_deg + R, AutopilotLaws_P.Constant3_Value_c2) + AutopilotLaws_P.Constant3_Value_c2, AutopilotLaws_P.Constant3_Value_c2) + AutopilotLaws_P.Constant3_Value_p)) + AutopilotLaws_P.Constant3_Value_p; - a = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_p); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_p - a; - distance_m = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_p); - if (a < distance_m) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_p * a; + b_L = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_p); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_p - b_L; + R = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_p); + if (b_L < R) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_p * b_L; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_a * distance_m; - } - - if (b_R > AutopilotLaws_DWork.limit) { - b_R = AutopilotLaws_DWork.limit; - } else if (b_R < -AutopilotLaws_DWork.limit) { - b_R = -AutopilotLaws_DWork.limit; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_a * R; } - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_P.Gain2_Gain_i * AutopilotLaws_DWork.DelayInput1_DSTATE + b_R) - * Phi2; - a = AutopilotLaws_DWork.DelayInput1_DSTATE * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_RateLimiter_n(rtb_error_d == AutopilotLaws_P.CompareToConstant1_const, + AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_P.Gain2_Gain_i * AutopilotLaws_DWork.DelayInput1_DSTATE + + rtb_Divide) * Phi1; + rtb_Product_g5 = AutopilotLaws_DWork.DelayInput1_DSTATE * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_RateLimiter_n((Phi2 == AutopilotLaws_P.CompareToConstant1_const), AutopilotLaws_P.RateLimiterVariableTs_up, AutopilotLaws_P.RateLimiterVariableTs_lo, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition, &rtb_Y_pf, &AutopilotLaws_DWork.sf_RateLimiter_n); + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition, &a, &AutopilotLaws_DWork.sf_RateLimiter_n); AutopilotLaws_LagFilter(AutopilotLaws_U.in.data.nav_loc_error_deg, AutopilotLaws_P.LagFilter2_C1, - AutopilotLaws_U.in.time.dt, &Phi2, &AutopilotLaws_DWork.sf_LagFilter_h); - b_R = AutopilotLaws_P.DiscreteDerivativeVariableTs_Gain * Phi2; - AutopilotLaws_DWork.DelayInput1_DSTATE = b_R - AutopilotLaws_DWork.Delay_DSTATE; + AutopilotLaws_U.in.time.dt, &Phi1, &AutopilotLaws_DWork.sf_LagFilter_h); + b_L = AutopilotLaws_P.DiscreteDerivativeVariableTs_Gain * Phi1; + AutopilotLaws_DWork.DelayInput1_DSTATE = b_L - AutopilotLaws_DWork.Delay_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE /= AutopilotLaws_U.in.time.dt; - AutopilotLaws_LagFilter(Phi2 + AutopilotLaws_P.Gain3_Gain_i * AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.LagFilter_C1, AutopilotLaws_U.in.time.dt, &rtb_Y_i, &AutopilotLaws_DWork.sf_LagFilter_m); - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Saturation; + AutopilotLaws_LagFilter(Phi1 + AutopilotLaws_P.Gain3_Gain_i * AutopilotLaws_DWork.DelayInput1_DSTATE, + AutopilotLaws_P.LagFilter_C1, AutopilotLaws_U.in.time.dt, &rtb_Y_af, &AutopilotLaws_DWork.sf_LagFilter_m); + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Mod2_d; AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_if); AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_if; - L = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_if); - rtb_Compare_jy = (AutopilotLaws_U.in.data.H_radio_ft <= AutopilotLaws_P.CompareToConstant_const); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_nr * AutopilotLaws_U.in.data.nav_loc_error_deg; - Phi2 = std::sin(AutopilotLaws_DWork.DelayInput1_DSTATE); - if (rtb_dme > AutopilotLaws_P.Saturation_UpperSat_o) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_o; - } else if (rtb_dme < AutopilotLaws_P.Saturation_LowerSat_o) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_o; + rtb_Mod2_d = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_if); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value_m; + AutopilotLaws_DWork.DelayInput1_DSTATE = (rtb_Mod2_d - AutopilotLaws_DWork.DelayInput1_DSTATE) + + AutopilotLaws_P.Constant3_Value_m; + Phi1 = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_m); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_m - Phi1; + AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, + AutopilotLaws_P.Constant3_Value_m); + AutopilotLaws_Chart_h(Phi1, AutopilotLaws_P.Gain_Gain_fn * AutopilotLaws_DWork.DelayInput1_DSTATE, + AutopilotLaws_P.Constant2_Value_l, &R, &AutopilotLaws_DWork.sf_Chart_h); + if (rtb_Gain7_j <= AutopilotLaws_P.CompareToConstant_const) { + Phi1_tmp = (AutopilotLaws_P.Gain_Gain_ae * R + AutopilotLaws_P.Gain1_Gain_k * AutopilotLaws_U.in.data.beta_deg) * + AutopilotLaws_P.Gain5_Gain; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_dme; - } - - AutopilotLaws_DWork.DelayInput1_DSTATE = Phi2 * AutopilotLaws_DWork.DelayInput1_DSTATE * AutopilotLaws_P.Gain2_Gain_gs; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation1_UpperSat_g) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation1_UpperSat_g; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation1_LowerSat_k) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation1_LowerSat_k; - } - - rtb_Compare_l = (rtb_error_d == AutopilotLaws_P.CompareToConstant_const_k); - if (!rtb_Compare_l) { - AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_InitialCondition; - } - - AutopilotLaws_DWork.Delay_DSTATE_h += AutopilotLaws_P.Gain6_Gain_b * AutopilotLaws_DWork.DelayInput1_DSTATE * - AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_Gain * AutopilotLaws_U.in.time.dt; - if (AutopilotLaws_DWork.Delay_DSTATE_h > AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_UpperLimit) { - AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_UpperLimit; - } else if (AutopilotLaws_DWork.Delay_DSTATE_h < AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_LowerLimit) { - AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_LowerLimit; + Phi1_tmp = AutopilotLaws_P.Constant1_Value; } - rtb_dme = AutopilotLaws_DWork.DelayInput1_DSTATE * look1_binlxpw(AutopilotLaws_U.in.data.V_gnd_kn, - AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_j, AutopilotLaws_P.ScheduledGain_Table_p, 2U); - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Saturation; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_dk); - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_dk; - AutopilotLaws_storevalue(rtb_Compare_l, rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_dk), &rtb_lo_k, &AutopilotLaws_DWork.sf_storevalue); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.nav_loc_error_deg + rtb_lo_k; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_o); - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_o; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_o); - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_n1; - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_U.in.data.Psi_true_deg - - AutopilotLaws_DWork.DelayInput1_DSTATE) + AutopilotLaws_P.Constant3_Value_n1; - rtb_Saturation = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_n1); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_n1 - rtb_Saturation; - Phi2 = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_n1); - if (rtb_Saturation < Phi2) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_j * rtb_Saturation; - } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_i * Phi2; + AutopilotLaws_LagFilter(Phi1_tmp, AutopilotLaws_P.LagFilter1_C1, AutopilotLaws_U.in.time.dt, &b_R, + &AutopilotLaws_DWork.sf_LagFilter_c); + if (b_R > AutopilotLaws_P.Saturation_UpperSat_e) { + b_R = AutopilotLaws_P.Saturation_UpperSat_e; + } else if (b_R < AutopilotLaws_P.Saturation_LowerSat_f) { + b_R = AutopilotLaws_P.Saturation_LowerSat_f; } - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_DWork.Delay_DSTATE_h + rtb_dme) + - AutopilotLaws_P.Gain1_Gain_fq * AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_U.in.data.Psi_true_deg; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_hr); - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Constant3_Value_hr; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_hr); - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_DWork.DelayInput1_DSTATE - - (AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value_nr)) + AutopilotLaws_P.Constant3_Value_nr; - rtb_dme = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_nr); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_nr - rtb_dme; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_nr); - AutopilotLaws_Chart_h(rtb_dme, AutopilotLaws_P.Gain_Gain_o * AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant1_Value_e, &rtb_Saturation, &AutopilotLaws_DWork.sf_Chart_b); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value_m; - AutopilotLaws_DWork.DelayInput1_DSTATE = (L - AutopilotLaws_DWork.DelayInput1_DSTATE) + - AutopilotLaws_P.Constant3_Value_m; - rtb_dme = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_m); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_m - rtb_dme; - AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant3_Value_m); - AutopilotLaws_Chart_h(rtb_dme, AutopilotLaws_P.Gain_Gain_fn * AutopilotLaws_DWork.DelayInput1_DSTATE, - AutopilotLaws_P.Constant2_Value_l, &distance_m, &AutopilotLaws_DWork.sf_Chart_h); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.Psi_magnetic_deg + AutopilotLaws_P.Constant3_Value_cd; AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_U.in.input.Psi_c_deg - AutopilotLaws_DWork.DelayInput1_DSTATE) + AutopilotLaws_P.Constant3_Value_cd; - rtb_dme = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_cd); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_cd - rtb_dme; + R = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_cd); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_cd - R; AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_cd); - rtb_valid = ((rtb_error_d == AutopilotLaws_P.CompareToConstant5_const) == AutopilotLaws_P.CompareToConstant_const_hx); - Phi2 = AutopilotLaws_P.Subsystem_Value / AutopilotLaws_U.in.time.dt; + rtb_valid = ((Phi2 == AutopilotLaws_P.CompareToConstant5_const) == AutopilotLaws_P.CompareToConstant_const_hx); + Phi1 = AutopilotLaws_P.Subsystem_Value / AutopilotLaws_U.in.time.dt; if (!rtb_valid) { for (i = 0; i < 100; i++) { AutopilotLaws_DWork.Delay_DSTATE_l[i] = AutopilotLaws_P.Delay_InitialCondition; } } - if (Phi2 < 1.0) { - rtb_valid_d = rtb_valid; + if (Phi1 < 1.0) { + rtb_valid_e = rtb_valid; } else { - if (Phi2 > 100.0) { + if (Phi1 > 100.0) { i = 100; } else { - i = static_cast(static_cast(std::fmod(std::trunc(Phi2), 4.294967296E+9))); + i = static_cast(static_cast(std::fmod(std::trunc(Phi1), 4.294967296E+9))); } - rtb_valid_d = AutopilotLaws_DWork.Delay_DSTATE_l[100U - i]; + rtb_valid_e = AutopilotLaws_DWork.Delay_DSTATE_l[100U - static_cast(i)]; } - AutopilotLaws_Chart(rtb_dme, AutopilotLaws_P.Gain_Gain_cy * AutopilotLaws_DWork.DelayInput1_DSTATE, rtb_valid != - rtb_valid_d, &Phi2, &AutopilotLaws_DWork.sf_Chart); + AutopilotLaws_Chart(R, AutopilotLaws_P.Gain_Gain_cy * AutopilotLaws_DWork.DelayInput1_DSTATE, (rtb_valid != + rtb_valid_e), &Phi1, &AutopilotLaws_DWork.sf_Chart); AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_h, AutopilotLaws_P.ScheduledGain_Table_o, 6U); - rtb_dme = Phi2 * AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_o5 * result[2]; - b_L = AutopilotLaws_P.Gain1_Gain_o * rtb_dme + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_MATLABFunction_m(AutopilotLaws_U.in.input.Psi_c_deg, Phi2, b_L, &rtb_dme, &rtb_lo_b, + R = Phi1 * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_o * result[2]; + rtb_Sum_gq = AutopilotLaws_P.Gain1_Gain_o * R + AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_MATLABFunction_m(AutopilotLaws_U.in.input.Psi_c_deg, Phi1, rtb_Sum_gq, &rtb_Y_j, &rtb_lo_i, &AutopilotLaws_DWork.sf_MATLABFunction_m); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.Psi_magnetic_track_deg + AutopilotLaws_P.Constant3_Value_k; @@ -1041,147 +961,141 @@ void AutopilotLawsModelClass::step() AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant3_Value_k - R; AutopilotLaws_DWork.DelayInput1_DSTATE = rt_modd(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Constant3_Value_k); - rtb_valid_d = ((rtb_error_d == AutopilotLaws_P.CompareToConstant4_const) == AutopilotLaws_P.CompareToConstant_const_e); - Phi2 = AutopilotLaws_P.Subsystem_Value_n / AutopilotLaws_U.in.time.dt; - if (!rtb_valid_d) { + rtb_valid_e = ((Phi2 == AutopilotLaws_P.CompareToConstant4_const) == AutopilotLaws_P.CompareToConstant_const_e); + Phi1 = AutopilotLaws_P.Subsystem_Value_n / AutopilotLaws_U.in.time.dt; + if (!rtb_valid_e) { for (i = 0; i < 100; i++) { AutopilotLaws_DWork.Delay_DSTATE_h5[i] = AutopilotLaws_P.Delay_InitialCondition_b; } } - if (Phi2 < 1.0) { - rtb_Delay_j = rtb_valid_d; + if (Phi1 < 1.0) { + rtb_Compare_jy = rtb_valid_e; } else { - if (Phi2 > 100.0) { + if (Phi1 > 100.0) { i = 100; } else { - i = static_cast(static_cast(std::fmod(std::trunc(Phi2), 4.294967296E+9))); + i = static_cast(static_cast(std::fmod(std::trunc(Phi1), 4.294967296E+9))); } - rtb_Delay_j = AutopilotLaws_DWork.Delay_DSTATE_h5[100U - i]; + rtb_Compare_jy = AutopilotLaws_DWork.Delay_DSTATE_h5[100U - static_cast(i)]; } - AutopilotLaws_Chart(R, AutopilotLaws_P.Gain_Gain_p * AutopilotLaws_DWork.DelayInput1_DSTATE, rtb_valid_d != - rtb_Delay_j, &Phi2, &AutopilotLaws_DWork.sf_Chart_ba); + AutopilotLaws_Chart(R, AutopilotLaws_P.Gain_Gain_p * AutopilotLaws_DWork.DelayInput1_DSTATE, (rtb_valid_e != + rtb_Compare_jy), &Phi1, &AutopilotLaws_DWork.sf_Chart_ba); AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_o, AutopilotLaws_P.ScheduledGain_Table_e, 6U); - R = Phi2 * AutopilotLaws_DWork.DelayInput1_DSTATE; + R = Phi1 * AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain_Gain_l * result[2]; rtb_Sum_i = AutopilotLaws_P.Gain1_Gain_i4 * R + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_MATLABFunction_m(AutopilotLaws_U.in.input.Psi_c_deg, Phi2, rtb_Sum_i, &rtb_Y_j, &rtb_lo_k, - &AutopilotLaws_DWork.sf_MATLABFunction_e); - AutopilotLaws_MATLABFunction(AutopilotLaws_P.tau_Value_c, AutopilotLaws_P.zeta_Value_h, - &AutopilotLaws_DWork.DelayInput1_DSTATE, &R); + AutopilotLaws_MATLABFunction_m(AutopilotLaws_U.in.input.Psi_c_deg, Phi1, rtb_Sum_i, &rtb_Y_h, &rtb_lo, + &AutopilotLaws_DWork.sf_MATLABFunction_e5); + AutopilotLaws_MATLABFunction(AutopilotLaws_P.tau_Value_c, AutopilotLaws_P.zeta_Value_h, &R, &rtb_Divide); AutopilotLaws_RateLimiter(AutopilotLaws_U.in.data.flight_guidance_phi_deg, AutopilotLaws_P.RateLimiterVariableTs_up_h, AutopilotLaws_P.RateLimiterVariableTs_lo_n, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_l, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_RateLimiter); - AutopilotLaws_LagFilter(rtb_Gain1_pj, AutopilotLaws_P.LagFilter_C1_g, AutopilotLaws_U.in.time.dt, &Phi2, - &AutopilotLaws_DWork.sf_LagFilter); - switch (static_cast(rtb_error_d)) { + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_l, &Phi1, &AutopilotLaws_DWork.sf_RateLimiter); + AutopilotLaws_LagFilter(Phi1, AutopilotLaws_P.LagFilter_C1_g, AutopilotLaws_U.in.time.dt, + &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_LagFilter); + switch (static_cast(Phi2)) { case 0: - b_L = rtb_GainTheta1; + rtb_Sum_gq = rtb_GainTheta1; break; case 1: - if (b_L > rtb_dme) { - b_L = rtb_dme; - } else if (b_L < rtb_lo_b) { - b_L = rtb_lo_b; + if (rtb_Sum_gq > rtb_Y_j) { + rtb_Sum_gq = rtb_Y_j; + } else if (rtb_Sum_gq < rtb_lo_i) { + rtb_Sum_gq = rtb_lo_i; } break; case 2: - if (rtb_Sum_i > rtb_Y_j) { - b_L = rtb_Y_j; - } else if (rtb_Sum_i < rtb_lo_k) { - b_L = rtb_lo_k; + if (rtb_Sum_i > rtb_Y_h) { + rtb_Sum_gq = rtb_Y_h; + } else if (rtb_Sum_i < rtb_lo) { + rtb_Sum_gq = rtb_lo; } else { - b_L = rtb_Sum_i; + rtb_Sum_gq = rtb_Sum_i; } break; case 3: - rtb_Add3_j4 = AutopilotLaws_P.Gain_Gain_c * AutopilotLaws_U.in.data.flight_guidance_xtk_nmi * R / + Phi1_tmp = AutopilotLaws_P.Gain_Gain_c * AutopilotLaws_U.in.data.flight_guidance_xtk_nmi * rtb_Divide / AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat; } - b_L = Phi2 - (AutopilotLaws_P.Gain2_Gain * AutopilotLaws_U.in.data.flight_guidance_tae_deg + rtb_Add3_j4) * - AutopilotLaws_DWork.DelayInput1_DSTATE * AutopilotLaws_U.in.data.V_gnd_kn; + rtb_Sum_gq = AutopilotLaws_DWork.DelayInput1_DSTATE - (AutopilotLaws_P.Gain2_Gain * + AutopilotLaws_U.in.data.flight_guidance_tae_deg + Phi1_tmp) * R * AutopilotLaws_U.in.data.V_gnd_kn; break; case 4: - b_L = a; + rtb_Sum_gq = rtb_Product_g5; break; case 5: - rtb_dme = rt_modd((AutopilotLaws_U.in.data.Psi_magnetic_deg - (AutopilotLaws_U.in.data.Psi_true_deg + + Phi1 = rt_modd((AutopilotLaws_U.in.data.Psi_magnetic_deg - (AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value)) + AutopilotLaws_P.Constant3_Value, AutopilotLaws_P.Constant3_Value); - Phi2 = rt_modd(AutopilotLaws_P.Constant3_Value - rtb_dme, AutopilotLaws_P.Constant3_Value); - if (rtb_dme < Phi2) { - rtb_dme *= AutopilotLaws_P.Gain1_Gain_l; + R = rt_modd(AutopilotLaws_P.Constant3_Value - Phi1, AutopilotLaws_P.Constant3_Value); + if (Phi1 < R) { + Phi1_tmp = AutopilotLaws_P.Gain1_Gain_l * Phi1; } else { - rtb_dme = AutopilotLaws_P.Gain_Gain_g * Phi2; + Phi1_tmp = AutopilotLaws_P.Gain_Gain_g * R; } - Phi2 = rt_modd((rt_modd(rt_modd(AutopilotLaws_U.in.data.Psi_magnetic_track_deg + rtb_dme, - AutopilotLaws_P.Constant3_Value_d) + AutopilotLaws_P.Constant3_Value_d, AutopilotLaws_P.Constant3_Value_d) - (L + - AutopilotLaws_P.Constant3_Value_c)) + AutopilotLaws_P.Constant3_Value_c, AutopilotLaws_P.Constant3_Value_c); - rtb_dme = rt_modd(AutopilotLaws_P.Constant3_Value_c - Phi2, AutopilotLaws_P.Constant3_Value_c); - if (rtb_Y_pf > AutopilotLaws_P.Saturation_UpperSat_a) { - rtb_Y_pf = AutopilotLaws_P.Saturation_UpperSat_a; - } else if (rtb_Y_pf < AutopilotLaws_P.Saturation_LowerSat_a) { - rtb_Y_pf = AutopilotLaws_P.Saturation_LowerSat_a; + Phi1 = rt_modd((rt_modd(rt_modd(AutopilotLaws_U.in.data.Psi_magnetic_track_deg + Phi1_tmp, + AutopilotLaws_P.Constant3_Value_d) + AutopilotLaws_P.Constant3_Value_d, AutopilotLaws_P.Constant3_Value_d) - + (rtb_Mod2_d + AutopilotLaws_P.Constant3_Value_c)) + AutopilotLaws_P.Constant3_Value_c, + AutopilotLaws_P.Constant3_Value_c); + R = rt_modd(AutopilotLaws_P.Constant3_Value_c - Phi1, AutopilotLaws_P.Constant3_Value_c); + if (a > AutopilotLaws_P.Saturation_UpperSat_a) { + a = AutopilotLaws_P.Saturation_UpperSat_a; + } else if (a < AutopilotLaws_P.Saturation_LowerSat_a) { + a = AutopilotLaws_P.Saturation_LowerSat_a; } - if (Phi2 < rtb_dme) { - Phi2 *= AutopilotLaws_P.Gain1_Gain_g; + if (Phi1 < R) { + Phi1_tmp = AutopilotLaws_P.Gain1_Gain_g * Phi1; } else { - Phi2 = AutopilotLaws_P.Gain_Gain_f * rtb_dme; + Phi1_tmp = AutopilotLaws_P.Gain_Gain_f * R; } - if (rtb_Compare_jy) { - rtb_dme = AutopilotLaws_P.k_beta_Phi_Gain * AutopilotLaws_U.in.data.beta_deg; - } else { - rtb_dme = AutopilotLaws_P.Constant1_Value_fk; - } - - rtb_Add3_j4 = (rtb_Y_i * look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, + Phi1_tmp = (rtb_Y_af * look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, AutopilotLaws_P.ScheduledGain2_BreakpointsForDimension1, AutopilotLaws_P.ScheduledGain2_Table, 6U) * - AutopilotLaws_P.Gain4_Gain * look1_binlxpw(AutopilotLaws_U.in.data.H_radio_ft, + AutopilotLaws_P.Gain4_Gain * look1_binlxpw(rtb_Gain7_j, AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1, AutopilotLaws_P.ScheduledGain_Table, 5U) + std::sin - (AutopilotLaws_P.Gain1_Gain_b * Phi2) * AutopilotLaws_U.in.data.V_gnd_kn * - AutopilotLaws_P.Gain2_Gain_g) + rtb_dme; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation1_UpperSat) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation1_UpperSat; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation1_LowerSat) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation1_LowerSat; + (AutopilotLaws_P.Gain1_Gain_b * Phi1_tmp) * AutopilotLaws_U.in.data.V_gnd_kn * + AutopilotLaws_P.Gain2_Gain_g) + (AutopilotLaws_U.in.data.beta_deg * look1_binlxpw(rtb_Gain7_j, + AutopilotLaws_P.ScheduledGain1_BreakpointsForDimension1, AutopilotLaws_P.ScheduledGain1_Table, 4U) + b_R * + look1_binlxpw(rtb_Gain7_j, AutopilotLaws_P.ScheduledGain3_BreakpointsForDimension1, + AutopilotLaws_P.ScheduledGain3_Table, 5U)); + if (Phi1_tmp > AutopilotLaws_P.Saturation1_UpperSat) { + Phi1_tmp = AutopilotLaws_P.Saturation1_UpperSat; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation1_LowerSat) { + Phi1_tmp = AutopilotLaws_P.Saturation1_LowerSat; } - b_L = (AutopilotLaws_P.Constant_Value - rtb_Y_pf) * a + rtb_Add3_j4 * rtb_Y_pf; + rtb_Sum_gq = (AutopilotLaws_P.Constant_Value - a) * rtb_Product_g5 + Phi1_tmp * a; break; default: - b_L = AutopilotLaws_P.Constant3_Value_h; + rtb_Sum_gq = AutopilotLaws_P.Constant3_Value_h; break; } - rtb_dme = std::abs(AutopilotLaws_U.in.data.V_tas_kn); - if (rtb_dme > 600.0) { - rtb_dme = 19.0; + Phi1 = std::abs(AutopilotLaws_U.in.data.V_tas_kn); + if (Phi1 > 600.0) { + Phi1 = 19.0; } else { - int32_T low_i; - int32_T low_ip1; i = 5; low_i = 1; low_ip1 = 2; while (i > low_ip1) { - int32_T mid_i; mid_i = (low_i + i) >> 1; - if (rtb_dme >= (static_cast(mid_i) - 1.0) * 150.0) { + if (Phi1 >= (static_cast(mid_i) - 1.0) * 150.0) { low_i = mid_i; low_ip1 = mid_i + 1; } else { @@ -1189,65 +1103,130 @@ void AutopilotLawsModelClass::step() } } - Phi2 = (rtb_dme - (static_cast(low_i) - 1.0) * 150.0) / static_cast(150 * low_i - (low_i - 1) * 150); - if (Phi2 == 0.0) { - rtb_dme = b[low_i - 1]; - } else if (Phi2 == 1.0) { - rtb_dme = b[low_i]; - } else if (b[low_i - 1] == b[low_i]) { - rtb_dme = b[low_i - 1]; + Phi1 = (Phi1 - (static_cast(low_i) - 1.0) * 150.0) / static_cast(150 * low_i - (low_i - 1) * 150); + if (Phi1 == 0.0) { + Phi1 = b[low_i - 1]; + } else if (Phi1 == 1.0) { + Phi1 = b[low_i]; } else { - rtb_dme = (1.0 - Phi2) * static_cast(b[low_i - 1]) + Phi2 * static_cast(b[low_i]); + tmp = b[low_i - 1]; + if (tmp == b[low_i]) { + Phi1 = tmp; + } else { + Phi1 = (1.0 - Phi1) * static_cast(tmp) + Phi1 * static_cast(b[low_i]); + } } } if ((AutopilotLaws_U.in.input.lateral_mode != 30.0) && (AutopilotLaws_U.in.input.lateral_mode != 31.0) && (AutopilotLaws_U.in.input.lateral_mode != 32.0) && (AutopilotLaws_U.in.input.lateral_mode != 33.0) && (AutopilotLaws_U.in.input.lateral_mode != 34.0)) { - rtb_dme = std::fmin(25.0, rtb_dme); - } else if (AutopilotLaws_U.in.data.H_radio_ft < 700.0) { - rtb_dme = 10.0; + Phi1 = std::fmin(25.0, Phi1); + } else if (rtb_Gain7_j < 700.0) { + Phi1 = 10.0; } - Phi2 = std::abs(AutopilotLaws_U.in.data.flight_guidance_phi_limit_deg); - if (!AutopilotLaws_DWork.pY_not_empty_g) { - AutopilotLaws_DWork.pY_b = 25.0; - AutopilotLaws_DWork.pY_not_empty_g = true; + rtb_Gain7_j = std::abs(AutopilotLaws_U.in.data.flight_guidance_phi_limit_deg); + if (!AutopilotLaws_DWork.pY_not_empty_d) { + AutopilotLaws_DWork.pY_f = 25.0; + AutopilotLaws_DWork.pY_not_empty_d = true; } - if ((AutopilotLaws_U.in.input.lateral_mode == 20.0) && (Phi2 > 0.0)) { - rtb_dme = Phi2; + if ((AutopilotLaws_U.in.input.lateral_mode == 20.0) && (rtb_Gain7_j > 0.0)) { + Phi1 = rtb_Gain7_j; } - AutopilotLaws_DWork.pY_b += std::fmax(std::fmin(rtb_dme - AutopilotLaws_DWork.pY_b, 5.0 * AutopilotLaws_U.in.time.dt), + AutopilotLaws_DWork.pY_f += std::fmax(std::fmin(Phi1 - AutopilotLaws_DWork.pY_f, 5.0 * AutopilotLaws_U.in.time.dt), -5.0 * AutopilotLaws_U.in.time.dt); - if (b_L > AutopilotLaws_DWork.pY_b) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_DWork.pY_b; + if (rtb_Sum_gq > AutopilotLaws_DWork.pY_f) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_DWork.pY_f; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_lt * AutopilotLaws_DWork.pY_b; - if (b_L >= AutopilotLaws_DWork.DelayInput1_DSTATE) { - AutopilotLaws_DWork.DelayInput1_DSTATE = b_L; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_lt * AutopilotLaws_DWork.pY_f; + if (rtb_Sum_gq >= AutopilotLaws_DWork.DelayInput1_DSTATE) { + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Sum_gq; } } AutopilotLaws_LagFilter(AutopilotLaws_P.Gain_Gain_lu * (AutopilotLaws_DWork.DelayInput1_DSTATE - rtb_GainTheta1), - AutopilotLaws_P.LagFilter_C1_a, AutopilotLaws_U.in.time.dt, &rtb_Y_i, &AutopilotLaws_DWork.sf_LagFilter_mp); - AutopilotLaws_RateLimiter_n(rtb_Compare_l, AutopilotLaws_P.RateLimiterVariableTs_up_n, + AutopilotLaws_P.LagFilter_C1_a, AutopilotLaws_U.in.time.dt, &rtb_Y_af, &AutopilotLaws_DWork.sf_LagFilter_mp); + if (rtb_dme > AutopilotLaws_P.Saturation_UpperSat_o) { + rtb_dme = AutopilotLaws_P.Saturation_UpperSat_o; + } else if (rtb_dme < AutopilotLaws_P.Saturation_LowerSat_o) { + rtb_dme = AutopilotLaws_P.Saturation_LowerSat_o; + } + + R = std::sin(AutopilotLaws_P.Gain1_Gain_nr * AutopilotLaws_U.in.data.nav_loc_error_deg) * rtb_dme * + AutopilotLaws_P.Gain2_Gain_gs; + if (R > AutopilotLaws_P.Saturation1_UpperSat_g) { + R = AutopilotLaws_P.Saturation1_UpperSat_g; + } else if (R < AutopilotLaws_P.Saturation1_LowerSat_k) { + R = AutopilotLaws_P.Saturation1_LowerSat_k; + } + + rtb_Compare_jy = (Phi2 == AutopilotLaws_P.CompareToConstant_const_k); + rtb_OR1 = !rtb_Compare_jy; + if (rtb_OR1) { + AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_InitialCondition; + } + + AutopilotLaws_DWork.Delay_DSTATE_h += AutopilotLaws_P.Gain6_Gain_b * R * + AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_Gain * AutopilotLaws_U.in.time.dt; + if (AutopilotLaws_DWork.Delay_DSTATE_h > AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_UpperLimit) { + AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_UpperLimit; + } else if (AutopilotLaws_DWork.Delay_DSTATE_h < AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_LowerLimit) { + AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_LowerLimit; + } + + AutopilotLaws_storevalue(rtb_Compare_jy, rt_modd(rt_modd(AutopilotLaws_U.in.data.nav_loc_deg - + AutopilotLaws_U.in.data.nav_loc_magvar_deg, AutopilotLaws_P.Constant3_Value_dk) + AutopilotLaws_P.Constant3_Value_dk, + AutopilotLaws_P.Constant3_Value_dk), &rtb_Y_h, &AutopilotLaws_DWork.sf_storevalue); + Phi1 = rt_modd((AutopilotLaws_U.in.data.Psi_true_deg - (rt_modd(rt_modd(AutopilotLaws_U.in.data.nav_loc_error_deg + + rtb_Y_h, AutopilotLaws_P.Constant3_Value_o) + AutopilotLaws_P.Constant3_Value_o, AutopilotLaws_P.Constant3_Value_o) + + AutopilotLaws_P.Constant3_Value_n1)) + AutopilotLaws_P.Constant3_Value_n1, AutopilotLaws_P.Constant3_Value_n1); + rtb_dme = rt_modd(AutopilotLaws_P.Constant3_Value_n1 - Phi1, AutopilotLaws_P.Constant3_Value_n1); + if (Phi1 < rtb_dme) { + Phi1_tmp = AutopilotLaws_P.Gain1_Gain_j * Phi1; + } else { + Phi1_tmp = AutopilotLaws_P.Gain_Gain_i * rtb_dme; + } + + rtb_dme = rt_modd((rt_modd(rt_modd(((R * look1_binlxpw(AutopilotLaws_U.in.data.V_gnd_kn, + AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_j, AutopilotLaws_P.ScheduledGain_Table_p, 2U) + + AutopilotLaws_DWork.Delay_DSTATE_h) + AutopilotLaws_P.Gain1_Gain_fq * Phi1_tmp) + + AutopilotLaws_U.in.data.Psi_true_deg, AutopilotLaws_P.Constant3_Value_hr) + AutopilotLaws_P.Constant3_Value_hr, + AutopilotLaws_P.Constant3_Value_hr) - (AutopilotLaws_U.in.data.Psi_true_deg + AutopilotLaws_P.Constant3_Value_nr)) + + AutopilotLaws_P.Constant3_Value_nr, AutopilotLaws_P.Constant3_Value_nr); + AutopilotLaws_Chart_h(rtb_dme, AutopilotLaws_P.Gain_Gain_oc * rt_modd(AutopilotLaws_P.Constant3_Value_nr - rtb_dme, + AutopilotLaws_P.Constant3_Value_nr), AutopilotLaws_P.Constant1_Value_e, &Phi1, &AutopilotLaws_DWork.sf_Chart_b); + AutopilotLaws_RateLimiter_n(rtb_Compare_jy, AutopilotLaws_P.RateLimiterVariableTs_up_n, AutopilotLaws_P.RateLimiterVariableTs_lo_k, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_i, &rtb_Y_j, &AutopilotLaws_DWork.sf_RateLimiter_e); - if (rtb_Y_j > AutopilotLaws_P.Saturation_UpperSat_k) { - rtb_Sum_kq = AutopilotLaws_P.Saturation_UpperSat_k; - } else if (rtb_Y_j < AutopilotLaws_P.Saturation_LowerSat_f3) { - rtb_Sum_kq = AutopilotLaws_P.Saturation_LowerSat_f3; + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_i, &a, &AutopilotLaws_DWork.sf_RateLimiter_e); + if (a > AutopilotLaws_P.Saturation_UpperSat_k) { + rtb_Divide = AutopilotLaws_P.Saturation_UpperSat_k; + } else if (a < AutopilotLaws_P.Saturation_LowerSat_f3) { + rtb_Divide = AutopilotLaws_P.Saturation_LowerSat_f3; } else { - rtb_Sum_kq = rtb_Y_j; + rtb_Divide = a; } - rtb_Saturation = (AutopilotLaws_P.Gain_Gain_b * result[2] * rtb_Sum_kq + (AutopilotLaws_P.Constant_Value_a - - rtb_Sum_kq) * (AutopilotLaws_P.Gain4_Gain_o * AutopilotLaws_U.in.data.beta_deg)) + AutopilotLaws_P.Gain5_Gain_o * - rtb_Saturation; - if (rtb_fpmtoms > AutopilotLaws_P.Switch_Threshold_n) { - switch (static_cast(rtb_error_d)) { + if (rtb_OR1 || (!AutopilotLaws_DWork.storage_not_empty)) { + AutopilotLaws_DWork.storage = rtb_BusAssignment.data.zeta_deg; + AutopilotLaws_DWork.storage_not_empty = true; + } + + Phi1 = (AutopilotLaws_P.Gain_Gain_b * result[2] * rtb_Divide + (AutopilotLaws_P.Constant_Value_a - rtb_Divide) * + (AutopilotLaws_P.Gain10_Gain * AutopilotLaws_DWork.storage)) + AutopilotLaws_P.Gain5_Gain_o * Phi1; + if (Phi1 > AutopilotLaws_P.Saturation2_UpperSat) { + Phi1 = AutopilotLaws_P.Saturation2_UpperSat; + } else if (Phi1 < AutopilotLaws_P.Saturation2_LowerSat) { + Phi1 = AutopilotLaws_P.Saturation2_LowerSat; + } + + AutopilotLaws_RateLimiter_n(rtb_Compare_jy, AutopilotLaws_P.RateLimiterVariableTs2_up, + AutopilotLaws_P.RateLimiterVariableTs2_lo, AutopilotLaws_U.in.time.dt, + AutopilotLaws_P.RateLimiterVariableTs2_InitialCondition, &a, &AutopilotLaws_DWork.sf_RateLimiter_m); + if (rtb_Y_e > AutopilotLaws_P.Switch_Threshold_n) { + switch (static_cast(Phi2)) { case 0: R = AutopilotLaws_P.beta1_Value; break; @@ -1273,61 +1252,61 @@ void AutopilotLawsModelClass::step() break; default: - R = AutopilotLaws_P.Gain3_Gain * rtb_Saturation; + if (a > AutopilotLaws_P.Saturation_UpperSat_g) { + rtb_dme = AutopilotLaws_P.Saturation_UpperSat_g; + } else if (a < AutopilotLaws_P.Saturation_LowerSat_n) { + rtb_dme = AutopilotLaws_P.Saturation_LowerSat_n; + } else { + rtb_dme = a; + } + + R = AutopilotLaws_P.Gain3_Gain * Phi1 * rtb_dme + (AutopilotLaws_P.Constant_Value_p - rtb_dme) * + AutopilotLaws_DWork.storage; break; } } else { - R = AutopilotLaws_P.Constant1_Value; - } - - if (rtb_Compare_jy) { - rtb_dme = AutopilotLaws_P.Gain_Gain_ae * distance_m + AutopilotLaws_P.Gain1_Gain_k * - AutopilotLaws_U.in.data.beta_deg; - } else { - rtb_dme = AutopilotLaws_P.Constant1_Value_fk; + R = AutopilotLaws_P.Constant1_Value_j; } - AutopilotLaws_LagFilter(rtb_dme, AutopilotLaws_P.LagFilter1_C1, AutopilotLaws_U.in.time.dt, &rtb_Y_j, - &AutopilotLaws_DWork.sf_LagFilter_c); - switch (static_cast(rtb_error_d)) { + switch (static_cast(Phi2)) { case 0: - rtb_Saturation = AutopilotLaws_P.beta_Value; + Phi2 = AutopilotLaws_P.beta_Value; break; case 1: - rtb_Saturation = AutopilotLaws_P.beta_Value_e; + Phi2 = AutopilotLaws_P.beta_Value_e; break; case 2: - rtb_Saturation = AutopilotLaws_P.beta_Value_b; + Phi2 = AutopilotLaws_P.beta_Value_b; break; case 3: - rtb_Saturation = AutopilotLaws_P.beta_Value_i; + Phi2 = AutopilotLaws_P.beta_Value_i; break; case 4: - rtb_Saturation = AutopilotLaws_P.beta_Value_c; + Phi2 = AutopilotLaws_P.beta_Value_c; break; case 5: - if (rtb_Y_j > AutopilotLaws_P.Saturation_UpperSat_e) { - rtb_Saturation = AutopilotLaws_P.Saturation_UpperSat_e; - } else if (rtb_Y_j < AutopilotLaws_P.Saturation_LowerSat_f) { - rtb_Saturation = AutopilotLaws_P.Saturation_LowerSat_f; - } else { - rtb_Saturation = rtb_Y_j; - } + Phi2 = b_R; break; default: - rtb_Saturation *= AutopilotLaws_P.Gain7_Gain; + if (a > AutopilotLaws_P.Saturation_UpperSat_j) { + a = AutopilotLaws_P.Saturation_UpperSat_j; + } else if (a < AutopilotLaws_P.Saturation_LowerSat_p) { + a = AutopilotLaws_P.Saturation_LowerSat_p; + } + + Phi2 = AutopilotLaws_P.Gain7_Gain * Phi1 * a + (AutopilotLaws_P.Constant_Value_o - a) * AutopilotLaws_DWork.storage; break; } - AutopilotLaws_LagFilter(rtb_Saturation, AutopilotLaws_P.LagFilter_C1_k, AutopilotLaws_U.in.time.dt, &rtb_dme, + AutopilotLaws_LagFilter(Phi2, AutopilotLaws_P.LagFilter_C1_k, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LagFilter_h2); - AutopilotLaws_DWork.icLoad = ((rtb_fpmtoms == 0) || AutopilotLaws_DWork.icLoad); + AutopilotLaws_DWork.icLoad = ((rtb_Y_e == 0.0) || AutopilotLaws_DWork.icLoad); if (AutopilotLaws_DWork.icLoad) { AutopilotLaws_DWork.Delay_DSTATE_hc = rtb_GainTheta1; } @@ -1341,54 +1320,54 @@ void AutopilotLawsModelClass::step() if ((AutopilotLaws_U.in.input.lateral_mode == 30.0) || (AutopilotLaws_U.in.input.lateral_mode == 31.0) || (AutopilotLaws_U.in.input.lateral_mode == 32.0) || (AutopilotLaws_U.in.input.lateral_mode == 33.0) || (AutopilotLaws_U.in.input.lateral_mode == 34.0)) { - rtb_Add3_j4 = 7.5; + Phi1_tmp = 7.5; } else { - rtb_Add3_j4 = 5.0; + Phi1_tmp = 5.0; } - AutopilotLaws_DWork.pY += std::fmax(std::fmin(rtb_Add3_j4 - AutopilotLaws_DWork.pY, 2.5 * AutopilotLaws_U.in.time.dt), + AutopilotLaws_DWork.pY += std::fmax(std::fmin(Phi1_tmp - AutopilotLaws_DWork.pY, 2.5 * AutopilotLaws_U.in.time.dt), -2.5 * AutopilotLaws_U.in.time.dt); AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmin(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_DWork.pY * AutopilotLaws_U.in.time.dt); AutopilotLaws_DWork.Delay_DSTATE_hc += std::fmax(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Gain1_Gain_kf * AutopilotLaws_DWork.pY * AutopilotLaws_U.in.time.dt); AutopilotLaws_LagFilter(AutopilotLaws_DWork.Delay_DSTATE_hc, AutopilotLaws_P.LagFilter_C1_l, - AutopilotLaws_U.in.time.dt, &rtb_Y_pf, &AutopilotLaws_DWork.sf_LagFilter_o); - AutopilotLaws_RateLimiter(static_cast(rtb_fpmtoms), AutopilotLaws_P.RateLimiterVariableTs_up_b, + AutopilotLaws_U.in.time.dt, &b_R, &AutopilotLaws_DWork.sf_LagFilter_o); + AutopilotLaws_RateLimiter(rtb_Y_e, AutopilotLaws_P.RateLimiterVariableTs_up_b, AutopilotLaws_P.RateLimiterVariableTs_lo_b, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_il, &rtb_Y_j, &AutopilotLaws_DWork.sf_RateLimiter_d); - if (rtb_Y_j > AutopilotLaws_P.Saturation_UpperSat_m) { + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_il, &rtb_Y_h, &AutopilotLaws_DWork.sf_RateLimiter_d); + if (rtb_Y_h > AutopilotLaws_P.Saturation_UpperSat_m) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_m; - } else if (rtb_Y_j < AutopilotLaws_P.Saturation_LowerSat_fw) { + } else if (rtb_Y_h < AutopilotLaws_P.Saturation_LowerSat_fw) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_fw; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Y_j; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Y_h; } - rtb_error_d = rtb_Y_pf * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Y_e = b_R * AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_ii - AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE *= rtb_GainTheta1; - AutopilotLaws_DWork.DelayInput1_DSTATE += rtb_error_d; - AutopilotLaws_Y.out.output.Phi_loc_c = a; - rtb_Add3_j4 = AutopilotLaws_P.Gain_Gain_m3 * R; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_c) { - AutopilotLaws_Y.out.output.Nosewheel_c = AutopilotLaws_P.Saturation_UpperSat_c; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_d) { - AutopilotLaws_Y.out.output.Nosewheel_c = AutopilotLaws_P.Saturation_LowerSat_d; + AutopilotLaws_DWork.DelayInput1_DSTATE += rtb_Y_e; + rtb_BusAssignment.output.Phi_loc_c = rtb_Product_g5; + Phi1_tmp = AutopilotLaws_P.Gain_Gain_m3 * R; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_c) { + rtb_BusAssignment.output.Nosewheel_c = AutopilotLaws_P.Saturation_UpperSat_c; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_d) { + rtb_BusAssignment.output.Nosewheel_c = AutopilotLaws_P.Saturation_LowerSat_d; } else { - AutopilotLaws_Y.out.output.Nosewheel_c = rtb_Add3_j4; + rtb_BusAssignment.output.Nosewheel_c = Phi1_tmp; } - AutopilotLaws_Y.out.output.flight_director.Beta_c_deg = rtb_dme; - AutopilotLaws_Y.out.output.autopilot.Beta_c_deg = rtb_Saturation; - AutopilotLaws_Y.out.output.flight_director.Phi_c_deg = rtb_Y_i; - AutopilotLaws_Y.out.output.autopilot.Phi_c_deg = AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_WashoutFilter(rtb_GainTheta, AutopilotLaws_P.WashoutFilter_C1, AutopilotLaws_U.in.time.dt, &rtb_dme, + rtb_BusAssignment.output.flight_director.Beta_c_deg = rtb_Y_j; + rtb_BusAssignment.output.autopilot.Beta_c_deg = Phi2; + rtb_BusAssignment.output.flight_director.Phi_c_deg = rtb_Y_af; + rtb_BusAssignment.output.autopilot.Phi_c_deg = AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_WashoutFilter(rtb_GainTheta, AutopilotLaws_P.WashoutFilter_C1, AutopilotLaws_U.in.time.dt, &Phi1, &AutopilotLaws_DWork.sf_WashoutFilter_f); if (AutopilotLaws_P.ManualSwitch_CurrentSetting_b == 1) { - rtb_error_d = AutopilotLaws_P.Constant_Value_m; + rtb_dme = AutopilotLaws_P.Constant_Value_m; } else { - rtb_error_d = AutopilotLaws_U.in.input.vertical_law; + rtb_dme = AutopilotLaws_U.in.input.vertical_law; } if (AutopilotLaws_U.in.input.ALT_soft_mode_active) { @@ -1403,14 +1382,14 @@ void AutopilotLawsModelClass::step() AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_h; } - if (rtb_error_d != AutopilotLaws_P.CompareToConstant5_const_e) { + if (rtb_dme != AutopilotLaws_P.CompareToConstant5_const_e) { AutopilotLaws_B.u = (AutopilotLaws_U.in.input.H_c_ft + AutopilotLaws_U.in.data.H_ft) - AutopilotLaws_U.in.data.H_ind_ft; } AutopilotLaws_LagFilter(AutopilotLaws_B.u - AutopilotLaws_U.in.data.H_ft, AutopilotLaws_P.LagFilter_C1_ai, - AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LagFilter_g); - AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Gain_Gain_ft * rtb_Y_j; + AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_LagFilter_g); + AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_P.Gain_Gain_ft * rtb_Y_h; if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_n) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_n; } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_d4) { @@ -1418,7 +1397,7 @@ void AutopilotLawsModelClass::step() } AutopilotLaws_DWork.DelayInput1_DSTATE -= AutopilotLaws_U.in.data.H_dot_ft_min; - Phi2 = AutopilotLaws_P.ftmintoms_Gain * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain * AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain * AutopilotLaws_U.in.data.V_tas_kn; if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ar) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ar; @@ -1426,60 +1405,56 @@ void AutopilotLawsModelClass::step() AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_n5; } - rtb_Add3_j4 = Phi2 / AutopilotLaws_DWork.DelayInput1_DSTATE; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - a = AutopilotLaws_P.Gain_Gain_k * std::asin(rtb_Add3_j4); - rtb_Compare_jy = (rtb_error_d == AutopilotLaws_P.CompareToConstant1_const_c); - if (!AutopilotLaws_DWork.wasActive_not_empty_p) { - AutopilotLaws_DWork.wasActive_c = rtb_Compare_jy; - AutopilotLaws_DWork.wasActive_not_empty_p = true; + rtb_Product_g5 = AutopilotLaws_P.Gain_Gain_k * std::asin(Phi1_tmp); + rtb_Compare_jy = (rtb_dme == AutopilotLaws_P.CompareToConstant1_const_c); + if (!AutopilotLaws_DWork.wasActive_not_empty_n) { + AutopilotLaws_DWork.wasActive_n = rtb_Compare_jy; + AutopilotLaws_DWork.wasActive_not_empty_n = true; } - distance_m = AutopilotLaws_U.in.input.H_c_ft - AutopilotLaws_U.in.data.H_ind_ft; - if (distance_m < 0.0) { - Phi2 = -1.0; - } else if (distance_m > 0.0) { - Phi2 = 1.0; + rtb_Y_a_tmp = AutopilotLaws_U.in.input.H_c_ft - AutopilotLaws_U.in.data.H_ind_ft; + if (rtb_Y_a_tmp < 0.0) { + low_i = -1; } else { - Phi2 = distance_m; + low_i = (rtb_Y_a_tmp > 0.0); } - Phi2 = Phi2 * AutopilotLaws_DWork.dH_offset + distance_m; - if ((!AutopilotLaws_DWork.wasActive_c) && rtb_Compare_jy) { - AutopilotLaws_DWork.k = AutopilotLaws_U.in.data.H_dot_ft_min / Phi2; + rtb_Y_e = static_cast(low_i) * AutopilotLaws_DWork.dH_offset + rtb_Y_a_tmp; + if ((!AutopilotLaws_DWork.wasActive_n) && rtb_Compare_jy) { + AutopilotLaws_DWork.k = AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Y_e; AutopilotLaws_DWork.dH_offset = std::abs(500.0 / std::abs(AutopilotLaws_DWork.k) - 100.0); - if (Phi2 < 0.0) { - L = -1.0; - } else if (Phi2 > 0.0) { - L = 1.0; + if (rtb_Y_e < 0.0) { + i = -1; } else { - L = Phi2; + i = (rtb_Y_e > 0.0); } - Phi2 += L * AutopilotLaws_DWork.dH_offset; - AutopilotLaws_DWork.k = AutopilotLaws_U.in.data.H_dot_ft_min / Phi2; + rtb_Y_e += static_cast(i) * AutopilotLaws_DWork.dH_offset; + AutopilotLaws_DWork.k = AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Y_e; AutopilotLaws_DWork.maxH_dot = std::abs(AutopilotLaws_U.in.data.H_dot_ft_min); } - Phi2 *= AutopilotLaws_DWork.k; - if (std::abs(Phi2) > AutopilotLaws_DWork.maxH_dot) { - if (Phi2 < 0.0) { - Phi2 = -1.0; - } else if (Phi2 > 0.0) { - Phi2 = 1.0; + rtb_Y_e *= AutopilotLaws_DWork.k; + if (std::abs(rtb_Y_e) > AutopilotLaws_DWork.maxH_dot) { + if (rtb_Y_e < 0.0) { + i = -1; + } else { + i = (rtb_Y_e > 0.0); } - Phi2 *= AutopilotLaws_DWork.maxH_dot; + rtb_Y_e = static_cast(i) * AutopilotLaws_DWork.maxH_dot; } - AutopilotLaws_DWork.wasActive_c = rtb_Compare_jy; - AutopilotLaws_DWork.DelayInput1_DSTATE = Phi2 - AutopilotLaws_U.in.data.H_dot_ft_min; - Phi2 = AutopilotLaws_P.ftmintoms_Gain_c * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.wasActive_n = rtb_Compare_jy; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Y_e - AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_c * AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_h * AutopilotLaws_U.in.data.V_tas_kn; if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_d) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_d; @@ -1487,242 +1462,236 @@ void AutopilotLawsModelClass::step() AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_nr; } - rtb_Add3_j4 = Phi2 / AutopilotLaws_DWork.DelayInput1_DSTATE; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - Phi2 = AutopilotLaws_P.Gain_Gain_es * std::asin(rtb_Add3_j4); + rtb_Y_e = AutopilotLaws_P.Gain_Gain_es * std::asin(Phi1_tmp); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain * AutopilotLaws_U.in.data.H_dot_ft_min; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_m * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_j) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_j; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_i) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_i; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_m * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_jh) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_jh; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_i) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_i; } - AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / rtb_Add3_j4) * + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * AutopilotLaws_P.Gain_Gain_e3; R = AutopilotLaws_P.Gain1_Gain_c * rtb_GainTheta1; AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain * (AutopilotLaws_P.GStoGS_CAS_Gain * (AutopilotLaws_P.ktstomps_Gain * - AutopilotLaws_U.in.data.V_gnd_kn)), AutopilotLaws_P.WashoutFilter_C1_e, AutopilotLaws_U.in.time.dt, &rtb_Y_j, + AutopilotLaws_U.in.data.V_gnd_kn)), AutopilotLaws_P.WashoutFilter_C1_e, AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_WashoutFilter); - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_b * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ei) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ei; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_dz) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_dz; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_b * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_ei) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_ei; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_dz) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_dz; } - AutopilotLaws_LeadLagFilter(rtb_Y_j - AutopilotLaws_P.g_Gain * (AutopilotLaws_P.Gain1_Gain_lp * + AutopilotLaws_LeadLagFilter(rtb_Y_h - AutopilotLaws_P.g_Gain * (AutopilotLaws_P.Gain1_Gain_lp * (AutopilotLaws_P.Gain_Gain_am * ((AutopilotLaws_P.Gain1_Gain_go * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_lx * (AutopilotLaws_P.Gain_Gain_c1 * std::atan(AutopilotLaws_P.fpmtoms_Gain_g * AutopilotLaws_U.in.data.H_dot_ft_min / - rtb_Add3_j4))) * (AutopilotLaws_P.Constant_Value_dy - std::cos(R)) + std::sin(R) * std::sin + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_dy - std::cos(R)) + std::sin(R) * std::sin (AutopilotLaws_P.Gain1_Gain_pf * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - AutopilotLaws_P.Gain1_Gain_e * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1, AutopilotLaws_P.HighPassFilter_C2, - AutopilotLaws_P.HighPassFilter_C3, AutopilotLaws_P.HighPassFilter_C4, AutopilotLaws_U.in.time.dt, &rtb_Y_pf, + AutopilotLaws_P.HighPassFilter_C3, AutopilotLaws_P.HighPassFilter_C4, AutopilotLaws_U.in.time.dt, &b_R, &AutopilotLaws_DWork.sf_LeadLagFilter); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_b * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1, AutopilotLaws_P.LowPassFilter_C2, AutopilotLaws_P.LowPassFilter_C3, - AutopilotLaws_P.LowPassFilter_C4, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LeadLagFilter_o); - R = (rtb_Y_pf + rtb_Y_j) * AutopilotLaws_P.ug_Gain; - rtb_Sum_kq = AutopilotLaws_P.Gain1_Gain_bf * AutopilotLaws_DWork.DelayInput1_DSTATE; - L = R + rtb_Sum_kq; - b_L = AutopilotLaws_P.Constant3_Value_nq - AutopilotLaws_P.Constant4_Value; - rtb_lo_k = (AutopilotLaws_P.Gain1_Gain_ik * R + rtb_Sum_kq) * AutopilotLaws_P.Gain_Gain_aj; - if (b_L > AutopilotLaws_P.Switch_Threshold_l) { + AutopilotLaws_P.LowPassFilter_C4, AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_LeadLagFilter_o); + R = (b_R + rtb_Y_h) * AutopilotLaws_P.ug_Gain; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_bf * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Gain7_j = R + rtb_Divide; + a = AutopilotLaws_P.Constant3_Value_nq - AutopilotLaws_P.Constant4_Value; + rtb_Mod2_d = (AutopilotLaws_P.Gain1_Gain_ik * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_aj; + if (a > AutopilotLaws_P.Switch_Threshold_l) { R = AutopilotLaws_P.Constant1_Value_g; } else { - R = AutopilotLaws_P.Gain5_Gain * rtb_lo_k; + R = AutopilotLaws_P.Gain5_Gain_g * rtb_Mod2_d; } - AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Y_j); - rtb_lo_b = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Y_j) * AutopilotLaws_P.Gain1_Gain_oz; - if (rtb_lo_b <= R) { - if (b_L > AutopilotLaws_P.Switch1_Threshold) { + AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Y_h); + b_R = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Y_h) * AutopilotLaws_P.Gain1_Gain_oz; + if (b_R <= R) { + if (a > AutopilotLaws_P.Switch1_Threshold) { R = AutopilotLaws_P.Constant_Value_g; } else { - R = AutopilotLaws_P.Gain6_Gain * rtb_lo_k; + R = AutopilotLaws_P.Gain6_Gain * rtb_Mod2_d; } - if (rtb_lo_b >= R) { - R = rtb_lo_b; + if (b_R >= R) { + R = b_R; } } - rtb_lo_k = (AutopilotLaws_P.Gain_Gain_b0 * L - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; + rtb_Gain7_j = (AutopilotLaws_P.Gain_Gain_b0 * rtb_Gain7_j - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_a * AutopilotLaws_U.in.data.H_dot_ft_min; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_p * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_h) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_h; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_e) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_e; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_p * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_h) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_h; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_e) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_e; } - AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / rtb_Add3_j4) * + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * AutopilotLaws_P.Gain_Gain_d4; R = AutopilotLaws_P.Gain1_Gain_j0 * rtb_GainTheta1; AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_h * (AutopilotLaws_P.GStoGS_CAS_Gain_m * (AutopilotLaws_P.ktstomps_Gain_g * AutopilotLaws_U.in.data.V_gnd_kn)), AutopilotLaws_P.WashoutFilter_C1_e4, - AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_WashoutFilter_d); - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_l * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_i) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_i; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_h) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_h; + AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_WashoutFilter_d); + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_l * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_i) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_i; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_h) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_h; } - AutopilotLaws_LeadLagFilter(rtb_Y_j - AutopilotLaws_P.g_Gain_h * (AutopilotLaws_P.Gain1_Gain_dv * + AutopilotLaws_LeadLagFilter(rtb_Y_h - AutopilotLaws_P.g_Gain_h * (AutopilotLaws_P.Gain1_Gain_dv * (AutopilotLaws_P.Gain_Gain_id * ((AutopilotLaws_P.Gain1_Gain_kd * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_o4 * (AutopilotLaws_P.Gain_Gain_bs * std::atan(AutopilotLaws_P.fpmtoms_Gain_c * AutopilotLaws_U.in.data.H_dot_ft_min / - rtb_Add3_j4))) * (AutopilotLaws_P.Constant_Value_c - std::cos(R)) + std::sin(R) * std::sin + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_c - std::cos(R)) + std::sin(R) * std::sin (AutopilotLaws_P.Gain1_Gain_bk * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - AutopilotLaws_P.Gain1_Gain_lxx * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_e, AutopilotLaws_P.HighPassFilter_C2_c, AutopilotLaws_P.HighPassFilter_C3_f, AutopilotLaws_P.HighPassFilter_C4_c, - AutopilotLaws_U.in.time.dt, &rtb_Y_pf, &AutopilotLaws_DWork.sf_LeadLagFilter_h); + AutopilotLaws_U.in.time.dt, &b_R, &AutopilotLaws_DWork.sf_LeadLagFilter_h); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_i * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_n, AutopilotLaws_P.LowPassFilter_C2_a, AutopilotLaws_P.LowPassFilter_C3_o, - AutopilotLaws_P.LowPassFilter_C4_o, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LeadLagFilter_m); - R = (rtb_Y_pf + rtb_Y_j) * AutopilotLaws_P.ug_Gain_a; - rtb_Sum_kq = AutopilotLaws_P.Gain1_Gain_hm * AutopilotLaws_DWork.DelayInput1_DSTATE; - L = R + rtb_Sum_kq; - b_L = AutopilotLaws_P.Constant1_Value_b4 - AutopilotLaws_P.Constant2_Value_c; - rtb_lo_b = (AutopilotLaws_P.Gain1_Gain_mz * R + rtb_Sum_kq) * AutopilotLaws_P.Gain_Gain_ie; - if (b_L > AutopilotLaws_P.Switch_Threshold_b) { + AutopilotLaws_P.LowPassFilter_C4_o, AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_LeadLagFilter_m); + R = (b_R + rtb_Y_h) * AutopilotLaws_P.ug_Gain_a; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_hm * AutopilotLaws_DWork.DelayInput1_DSTATE; + a = R + rtb_Divide; + rtb_Mod2_d = AutopilotLaws_P.Constant1_Value_b4 - AutopilotLaws_P.Constant2_Value_c; + b_R = (AutopilotLaws_P.Gain1_Gain_mz * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_ie; + if (rtb_Mod2_d > AutopilotLaws_P.Switch_Threshold_b) { R = AutopilotLaws_P.Constant1_Value_a; } else { - R = AutopilotLaws_P.Gain5_Gain_l * rtb_lo_b; + R = AutopilotLaws_P.Gain5_Gain_l * b_R; } - rtb_Y_j = AutopilotLaws_U.in.data.V_ias_kn - AutopilotLaws_U.in.data.VMAX_kn; - rtb_Gain1_pj = rtb_Y_j * AutopilotLaws_P.Gain1_Gain_f1; - if (rtb_Gain1_pj <= R) { - if (b_L > AutopilotLaws_P.Switch1_Threshold_f) { - R = AutopilotLaws_P.Constant_Value_p; + rtb_Gain_a0 = AutopilotLaws_U.in.data.V_ias_kn - AutopilotLaws_U.in.data.VMAX_kn; + rtb_Sum_gq = rtb_Gain_a0 * AutopilotLaws_P.Gain1_Gain_f1; + if (rtb_Sum_gq <= R) { + if (rtb_Mod2_d > AutopilotLaws_P.Switch1_Threshold_f) { + R = AutopilotLaws_P.Constant_Value_p0; } else { - R = AutopilotLaws_P.Gain6_Gain_j * rtb_lo_b; + R = AutopilotLaws_P.Gain6_Gain_j * b_R; } - if (rtb_Gain1_pj >= R) { - R = rtb_Gain1_pj; + if (rtb_Sum_gq >= R) { + R = rtb_Sum_gq; } } - R += AutopilotLaws_P.Gain_Gain_kj * L - AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_SpeedProtectionSignalSelection(&AutopilotLaws_Y.out, Phi2, AutopilotLaws_P.VS_Gain * Phi2, rtb_lo_k, - AutopilotLaws_P.Gain_Gain_m0 * rtb_lo_k, R, AutopilotLaws_P.Gain_Gain_lr * R, AutopilotLaws_P.Constant_Value_ig, - &b_L, &L); + R += AutopilotLaws_P.Gain_Gain_kj * a - AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_SpeedProtectionSignalSelection(&rtb_BusAssignment, rtb_Y_e, AutopilotLaws_P.VS_Gain * rtb_Y_e, + rtb_Gain7_j, AutopilotLaws_P.Gain_Gain_m0 * rtb_Gain7_j, R, AutopilotLaws_P.Gain_Gain_lr * R, + AutopilotLaws_P.Constant_Value_ig, &rtb_Mod2_d, &a); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_p * AutopilotLaws_U.in.data.H_dot_ft_min; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_f * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_eik) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_eik; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_ad) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_ad; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_f * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_eik) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_eik; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_ad) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_ad; } - AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / rtb_Add3_j4) * + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * AutopilotLaws_P.Gain_Gain_e33; R = AutopilotLaws_P.Gain1_Gain_ok * AutopilotLaws_DWork.DelayInput1_DSTATE; - Phi2 = AutopilotLaws_P.Gain1_Gain_jd * rtb_GainTheta1; - rtb_lo_k = std::cos(Phi2); - rtb_lo_b = std::sin(Phi2); - Phi2 = AutopilotLaws_P.ktstomps_Gain_f * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_m * (AutopilotLaws_P.GStoGS_CAS_Gain_l * Phi2), - AutopilotLaws_P.WashoutFilter_C1_k, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_WashoutFilter_n); - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_a * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_f) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_f; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_c) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_c; - } - - AutopilotLaws_LeadLagFilter(rtb_Gain1_pj - AutopilotLaws_P.g_Gain_j * (AutopilotLaws_P.Gain1_Gain_ca * + rtb_Divide = AutopilotLaws_P.Gain1_Gain_jd * rtb_GainTheta1; + rtb_Y_e = std::cos(rtb_Divide); + b_R = std::sin(rtb_Divide); + rtb_Gain7_j = AutopilotLaws_P.Gain1_Gain_id * AutopilotLaws_U.in.data.Psi_magnetic_track_deg; + rtb_Divide = AutopilotLaws_P.ktstomps_Gain_f * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_m * (AutopilotLaws_P.GStoGS_CAS_Gain_l * rtb_Divide), + AutopilotLaws_P.WashoutFilter_C1_k, AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_WashoutFilter_n); + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_a * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_f) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_f; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_c) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_c; + } + + AutopilotLaws_LeadLagFilter(rtb_Divide - AutopilotLaws_P.g_Gain_j * (AutopilotLaws_P.Gain1_Gain_ca * (AutopilotLaws_P.Gain_Gain_ms * ((AutopilotLaws_P.Gain1_Gain_dh * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_cv * (AutopilotLaws_P.Gain_Gain_nq * std::atan(AutopilotLaws_P.fpmtoms_Gain_h * AutopilotLaws_U.in.data.H_dot_ft_min / - rtb_Add3_j4))) * (AutopilotLaws_P.Constant_Value_l - rtb_lo_k) + rtb_lo_b * std::sin(AutopilotLaws_P.Gain1_Gain_id * - AutopilotLaws_U.in.data.Psi_magnetic_track_deg - AutopilotLaws_P.Gain1_Gain_ct * - AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_b, + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_l - rtb_Y_e) + b_R * std::sin(rtb_Gain7_j - + AutopilotLaws_P.Gain1_Gain_ct * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_b, AutopilotLaws_P.HighPassFilter_C2_g, AutopilotLaws_P.HighPassFilter_C3_n, AutopilotLaws_P.HighPassFilter_C4_b, - AutopilotLaws_U.in.time.dt, &Phi2, &AutopilotLaws_DWork.sf_LeadLagFilter_es); + AutopilotLaws_U.in.time.dt, &rtb_Gain7_j, &AutopilotLaws_DWork.sf_LeadLagFilter_es); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_j * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_d, AutopilotLaws_P.LowPassFilter_C2_p, AutopilotLaws_P.LowPassFilter_C3_a, - AutopilotLaws_P.LowPassFilter_C4_b, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, + AutopilotLaws_P.LowPassFilter_C4_b, AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_LeadLagFilter_ja); - Phi2 = (Phi2 + rtb_Gain1_pj) * AutopilotLaws_P.ug_Gain_o; - rtb_lo_k = (AutopilotLaws_P.Gain1_Gain_hu * Phi2 + R) * AutopilotLaws_P.Gain_Gain_bn; + rtb_Divide = (rtb_Gain7_j + rtb_Divide) * AutopilotLaws_P.ug_Gain_o; + rtb_Y_e = (AutopilotLaws_P.Gain1_Gain_hu * rtb_Divide + R) * AutopilotLaws_P.Gain_Gain_bn; AutopilotLaws_Voter1(AutopilotLaws_U.in.data.VLS_kn, AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VMAX_kn, - &rtb_lo_b); - rtb_lo_b = (AutopilotLaws_U.in.data.V_ias_kn - rtb_lo_b) * AutopilotLaws_P.Gain1_Gain_hz; - rtb_Compare_jy = ((distance_m > AutopilotLaws_P.CompareToConstant6_const) && (rtb_lo_k < - AutopilotLaws_P.CompareToConstant5_const_a) && (rtb_lo_b < AutopilotLaws_P.CompareToConstant2_const_d) && - (rtb_error_d == AutopilotLaws_P.CompareToConstant2_const_e)); - R += Phi2; + &rtb_Gain7_j); + rtb_Gain7_j = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Gain7_j) * AutopilotLaws_P.Gain1_Gain_hz; + rtb_Compare_jy = ((rtb_Y_a_tmp > AutopilotLaws_P.CompareToConstant6_const) && (rtb_Y_e < + AutopilotLaws_P.CompareToConstant5_const_a) && (rtb_Gain7_j < AutopilotLaws_P.CompareToConstant2_const_d) && + (rtb_dme == AutopilotLaws_P.CompareToConstant2_const_e)); + b_R = rtb_Divide + R; if (rtb_Compare_jy) { - Phi2 = AutopilotLaws_P.Constant_Value_f; + R = AutopilotLaws_P.Constant_Value_f; } else { - if (distance_m > AutopilotLaws_P.CompareToConstant_const_l) { - Phi2 = AutopilotLaws_P.Constant1_Value_c; + if (rtb_Y_a_tmp > AutopilotLaws_P.CompareToConstant_const_l) { + R = AutopilotLaws_P.Constant1_Value_c; } else { - Phi2 = AutopilotLaws_P.Gain5_Gain_k * rtb_lo_k; + R = AutopilotLaws_P.Gain5_Gain_k * rtb_Y_e; } - if (rtb_lo_b <= Phi2) { - if (distance_m > AutopilotLaws_P.CompareToConstant4_const_o) { - Phi2 = std::fmax(AutopilotLaws_P.Constant2_Value, AutopilotLaws_P.Gain1_Gain_kg * rtb_lo_k); + if (rtb_Gain7_j <= R) { + if (rtb_Y_a_tmp > AutopilotLaws_P.CompareToConstant4_const_o) { + R = std::fmax(AutopilotLaws_P.Constant2_Value, AutopilotLaws_P.Gain1_Gain_kg * rtb_Y_e); } else { - Phi2 = AutopilotLaws_P.Gain6_Gain_a * rtb_lo_k; + R = AutopilotLaws_P.Gain6_Gain_a * rtb_Y_e; } - if (rtb_lo_b >= Phi2) { - Phi2 = rtb_lo_b; + if (rtb_Gain7_j >= R) { + R = rtb_Gain7_j; } } } - rtb_lo_b = (AutopilotLaws_P.Gain_Gain_d4y * R - AutopilotLaws_DWork.DelayInput1_DSTATE) + Phi2; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_n * AutopilotLaws_U.in.data.V_tas_kn; - if (distance_m < 0.0) { - Phi2 = -1.0; - } else if (distance_m > 0.0) { - Phi2 = 1.0; - } else { - Phi2 = distance_m; - } - - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ju) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ju; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_gw) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_gw; + rtb_lo_i = (AutopilotLaws_P.Gain_Gain_d4y * b_R - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; + AutopilotLaws_DWork.DelayInput1_DSTATE = static_cast(low_i) * AutopilotLaws_P.Constant3_Value_ix; + AutopilotLaws_DWork.DelayInput1_DSTATE -= AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_d * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_n * AutopilotLaws_U.in.data.V_tas_kn; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ju) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ju; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_gw) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_gw; } - rtb_Add3_j4 = (Phi2 * AutopilotLaws_P.Constant3_Value_ix - AutopilotLaws_U.in.data.H_dot_ft_min) * - AutopilotLaws_P.ftmintoms_Gain_d / rtb_Add3_j4; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Sum_i = AutopilotLaws_P.Gain_Gain_nz * std::asin(rtb_Add3_j4); - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_au * AutopilotLaws_U.in.data.V_tas_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_l) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_l; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_hm) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_hm; + rtb_Sum_i = AutopilotLaws_P.Gain_Gain_nz * std::asin(Phi1_tmp); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.input.H_dot_c_fpm - AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_l * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_au * AutopilotLaws_U.in.data.V_tas_kn; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_l) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_l; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_hm) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_hm; } - rtb_Add3_j4 = (AutopilotLaws_U.in.input.H_dot_c_fpm - AutopilotLaws_U.in.data.H_dot_ft_min) * - AutopilotLaws_P.ftmintoms_Gain_l / rtb_Add3_j4; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Y_i = AutopilotLaws_P.Gain_Gain_ey * std::asin(rtb_Add3_j4); + rtb_Y_e = AutopilotLaws_P.Gain_Gain_ey * std::asin(Phi1_tmp); if (!AutopilotLaws_DWork.prevVerticalLaw_not_empty) { AutopilotLaws_DWork.prevVerticalLaw = AutopilotLaws_U.in.input.vertical_law; AutopilotLaws_DWork.prevVerticalLaw_not_empty = true; @@ -1739,605 +1708,601 @@ void AutopilotLawsModelClass::step() ((AutopilotLaws_U.in.input.H_dot_c_fpm == 0.0) && (AutopilotLaws_U.in.input.vertical_law == 4.0) && AutopilotLaws_DWork.islevelOffActive)); if (AutopilotLaws_U.in.input.vertical_mode == 50.0) { - rtb_Add3_j4 = 0.3; + Phi1_tmp = 0.3; } else if (AutopilotLaws_DWork.islevelOffActive) { - rtb_Add3_j4 = 0.1; + Phi1_tmp = 0.1; } else { - rtb_Add3_j4 = 0.05; + Phi1_tmp = 0.05; } - rtb_lo_k = 9.81 / (AutopilotLaws_U.in.data.V_tas_kn * 0.51444444444444448); - rtb_Y_pf = rtb_lo_k * rtb_Add3_j4 * 57.295779513082323; + limit_tmp = 9.81 / (AutopilotLaws_U.in.data.V_tas_kn * 0.51444444444444448); + limit = limit_tmp * Phi1_tmp * 57.295779513082323; AutopilotLaws_DWork.prevVerticalLaw = AutopilotLaws_U.in.input.vertical_law; AutopilotLaws_DWork.prevTarget = AutopilotLaws_U.in.input.H_dot_c_fpm; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_o * AutopilotLaws_U.in.data.V_gnd_kn; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_fr) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_fr; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_cd) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_cd; - } - - Phi2 = std::atan(AutopilotLaws_P.fpmtoms_Gain_o * AutopilotLaws_U.in.data.H_dot_ft_min / - AutopilotLaws_DWork.DelayInput1_DSTATE) * AutopilotLaws_P.Gain_Gain_lx; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_jn * rtb_GainTheta; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_d * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_hb) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_hb; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_k) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_k; - } - - R = AutopilotLaws_DWork.DelayInput1_DSTATE - std::atan(AutopilotLaws_P.fpmtoms_Gain_e * - AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Add3_j4) * AutopilotLaws_P.Gain_Gain_in * AutopilotLaws_P.Gain1_Gain_ps; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_hi * rtb_GainTheta1; - rtb_Cos_i = std::cos(AutopilotLaws_DWork.DelayInput1_DSTATE); - rtb_Cos1_pk = std::sin(AutopilotLaws_DWork.DelayInput1_DSTATE); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_da * AutopilotLaws_U.in.data.Psi_magnetic_deg; - rtb_Add3_g = AutopilotLaws_P.Gain1_Gain_hg * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - - AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.ktstomps_Gain_m * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_k * (AutopilotLaws_P.GStoGS_CAS_Gain_k * - AutopilotLaws_DWork.DelayInput1_DSTATE), AutopilotLaws_P.WashoutFilter_C1_o, AutopilotLaws_U.in.time.dt, - &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_WashoutFilter_fs); - AutopilotLaws_LeadLagFilter(rtb_Gain1_pj - AutopilotLaws_P.g_Gain_m * (AutopilotLaws_P.Gain1_Gain_kdq * - (AutopilotLaws_P.Gain_Gain_b5 * (R * (AutopilotLaws_P.Constant_Value_od - rtb_Cos_i) + rtb_Cos1_pk * std::sin - (rtb_Add3_g)))), AutopilotLaws_P.HighPassFilter_C1_g, AutopilotLaws_P.HighPassFilter_C2_l, - AutopilotLaws_P.HighPassFilter_C3_j, AutopilotLaws_P.HighPassFilter_C4_i, AutopilotLaws_U.in.time.dt, - &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_LeadLagFilter_b); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_o * AutopilotLaws_U.in.data.H_dot_ft_min; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_o * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_fr) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_fr; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_cd) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_cd; + } + + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * + AutopilotLaws_P.Gain_Gain_lx; + R = AutopilotLaws_P.Gain1_Gain_hi * rtb_GainTheta1; + rtb_Gain7_j = std::cos(R); + b_R = std::sin(R); + rtb_Divide = AutopilotLaws_P.Gain1_Gain_hg * AutopilotLaws_U.in.data.Psi_magnetic_track_deg; + R = AutopilotLaws_P.ktstomps_Gain_m * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_k * (AutopilotLaws_P.GStoGS_CAS_Gain_k * R), + AutopilotLaws_P.WashoutFilter_C1_o, AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_WashoutFilter_fs); + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_d * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_hb) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_hb; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_k) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_k; + } + + AutopilotLaws_LeadLagFilter(R - AutopilotLaws_P.g_Gain_m * (AutopilotLaws_P.Gain1_Gain_kdq * + (AutopilotLaws_P.Gain_Gain_b5 * ((AutopilotLaws_P.Gain1_Gain_jn * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_ps * + (AutopilotLaws_P.Gain_Gain_in * std::atan(AutopilotLaws_P.fpmtoms_Gain_e * AutopilotLaws_U.in.data.H_dot_ft_min / + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_od - rtb_Gain7_j) + b_R * std::sin(rtb_Divide - + AutopilotLaws_P.Gain1_Gain_da * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_g, + AutopilotLaws_P.HighPassFilter_C2_l, AutopilotLaws_P.HighPassFilter_C3_j, AutopilotLaws_P.HighPassFilter_C4_i, + AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_LeadLagFilter_b); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_c * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_m, AutopilotLaws_P.LowPassFilter_C2_l, AutopilotLaws_P.LowPassFilter_C3_i, - AutopilotLaws_P.LowPassFilter_C4_k, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LeadLagFilter_kq); - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_DWork.DelayInput1_DSTATE + rtb_Gain1_pj) * - AutopilotLaws_P.ug_Gain_aa; - R = AutopilotLaws_P.Gain1_Gain_gf * Phi2; - rtb_Cos_i = AutopilotLaws_DWork.DelayInput1_DSTATE + R; - rtb_Cos1_pk = AutopilotLaws_P.Constant3_Value_h1 - AutopilotLaws_P.Constant4_Value_f; - R = (AutopilotLaws_P.Gain1_Gain_ov * AutopilotLaws_DWork.DelayInput1_DSTATE + R) * AutopilotLaws_P.Gain_Gain_jy; - if (rtb_Cos1_pk > AutopilotLaws_P.Switch_Threshold_o) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_m5; + AutopilotLaws_P.LowPassFilter_C4_k, AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LeadLagFilter_kq); + R = (rtb_Divide + R) * AutopilotLaws_P.ug_Gain_aa; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_gf * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Gain7_j = R + rtb_Divide; + b_R = AutopilotLaws_P.Constant3_Value_h1 - AutopilotLaws_P.Constant4_Value_f; + rtb_Y_af = (AutopilotLaws_P.Gain1_Gain_ov * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_jy; + if (b_R > AutopilotLaws_P.Switch_Threshold_o) { + R = AutopilotLaws_P.Constant1_Value_m5; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain5_Gain_h * R; + R = AutopilotLaws_P.Gain5_Gain_h * rtb_Y_af; } - AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Gain1_pj); - rtb_Gain1_pj = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Gain1_pj) * AutopilotLaws_P.Gain1_Gain_dvi; - if (rtb_Gain1_pj <= AutopilotLaws_DWork.DelayInput1_DSTATE) { - if (rtb_Cos1_pk > AutopilotLaws_P.Switch1_Threshold_c) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_b; + AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Divide); + rtb_lo = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Divide) * AutopilotLaws_P.Gain1_Gain_dvi; + if (rtb_lo <= R) { + if (b_R > AutopilotLaws_P.Switch1_Threshold_c) { + R = AutopilotLaws_P.Constant_Value_b; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain6_Gain_ai * R; + R = AutopilotLaws_P.Gain6_Gain_ai * rtb_Y_af; } - if (rtb_Gain1_pj >= AutopilotLaws_DWork.DelayInput1_DSTATE) { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Gain1_pj; + if (rtb_lo >= R) { + R = rtb_lo; } } - rtb_Add3_g = (AutopilotLaws_P.Gain_Gain_j * rtb_Cos_i - Phi2) + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_bq * AutopilotLaws_U.in.data.V_gnd_kn; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ba) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ba; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_p) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_p; - } - - Phi2 = std::atan(AutopilotLaws_P.fpmtoms_Gain_p3 * AutopilotLaws_U.in.data.H_dot_ft_min / - AutopilotLaws_DWork.DelayInput1_DSTATE) * AutopilotLaws_P.Gain_Gain_py; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_hk * rtb_GainTheta; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_l5 * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_b3) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_b3; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_es) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_es; - } - - R = AutopilotLaws_DWork.DelayInput1_DSTATE - std::atan(AutopilotLaws_P.fpmtoms_Gain_j * - AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Add3_j4) * AutopilotLaws_P.Gain_Gain_e5 * AutopilotLaws_P.Gain1_Gain_ja; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_er * rtb_GainTheta1; - rtb_Cos_i = std::cos(AutopilotLaws_DWork.DelayInput1_DSTATE); - rtb_Cos1_pk = std::sin(AutopilotLaws_DWork.DelayInput1_DSTATE); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_fl * AutopilotLaws_U.in.data.Psi_magnetic_deg; - rtb_Add3_i = AutopilotLaws_P.Gain1_Gain_ero * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - - AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.ktstomps_Gain_a * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_i * (AutopilotLaws_P.GStoGS_CAS_Gain_n * - AutopilotLaws_DWork.DelayInput1_DSTATE), AutopilotLaws_P.WashoutFilter_C1_p, AutopilotLaws_U.in.time.dt, - &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_WashoutFilter_j); - AutopilotLaws_LeadLagFilter(rtb_Gain1_pj - AutopilotLaws_P.g_Gain_g * (AutopilotLaws_P.Gain1_Gain_hv * - (AutopilotLaws_P.Gain_Gain_mx * (R * (AutopilotLaws_P.Constant_Value_ia - rtb_Cos_i) + rtb_Cos1_pk * std::sin - (rtb_Add3_i)))), AutopilotLaws_P.HighPassFilter_C1_n, AutopilotLaws_P.HighPassFilter_C2_m, - AutopilotLaws_P.HighPassFilter_C3_k, AutopilotLaws_P.HighPassFilter_C4_h, AutopilotLaws_U.in.time.dt, - &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_LeadLagFilter_c); + rtb_Gain7_j = (AutopilotLaws_P.Gain_Gain_j * rtb_Gain7_j - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_p3 * AutopilotLaws_U.in.data.H_dot_ft_min; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_bq * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_ba) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_ba; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_pk) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_pk; + } + + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * + AutopilotLaws_P.Gain_Gain_py; + R = AutopilotLaws_P.Gain1_Gain_er * rtb_GainTheta1; + b_R = std::cos(R); + rtb_Y_af = std::sin(R); + rtb_Divide = AutopilotLaws_P.Gain1_Gain_ero * AutopilotLaws_U.in.data.Psi_magnetic_track_deg; + R = AutopilotLaws_P.ktstomps_Gain_a * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_i * (AutopilotLaws_P.GStoGS_CAS_Gain_n * R), + AutopilotLaws_P.WashoutFilter_C1_p, AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_WashoutFilter_j); + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_l5 * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_b3) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_b3; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_es) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_es; + } + + AutopilotLaws_LeadLagFilter(R - AutopilotLaws_P.g_Gain_g * (AutopilotLaws_P.Gain1_Gain_hv * + (AutopilotLaws_P.Gain_Gain_mx * ((AutopilotLaws_P.Gain1_Gain_hk * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_ja * + (AutopilotLaws_P.Gain_Gain_e5 * std::atan(AutopilotLaws_P.fpmtoms_Gain_j * AutopilotLaws_U.in.data.H_dot_ft_min / + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_ia - b_R) + rtb_Y_af * std::sin(rtb_Divide - + AutopilotLaws_P.Gain1_Gain_fl * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_n, + AutopilotLaws_P.HighPassFilter_C2_m, AutopilotLaws_P.HighPassFilter_C3_k, AutopilotLaws_P.HighPassFilter_C4_h, + AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_LeadLagFilter_c); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_o * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_l, AutopilotLaws_P.LowPassFilter_C2_c, AutopilotLaws_P.LowPassFilter_C3_g, - AutopilotLaws_P.LowPassFilter_C4_d, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LeadLagFilter_p); - AutopilotLaws_DWork.DelayInput1_DSTATE = (AutopilotLaws_DWork.DelayInput1_DSTATE + rtb_Gain1_pj) * - AutopilotLaws_P.ug_Gain_f; - R = AutopilotLaws_P.Gain1_Gain_ot * Phi2; - rtb_Gain1_pj = AutopilotLaws_DWork.DelayInput1_DSTATE + R; - rtb_Cos_i = AutopilotLaws_P.Constant1_Value_d - AutopilotLaws_P.Constant2_Value_k; - R = (AutopilotLaws_P.Gain1_Gain_ou * AutopilotLaws_DWork.DelayInput1_DSTATE + R) * AutopilotLaws_P.Gain_Gain_jg; - if (rtb_Cos_i > AutopilotLaws_P.Switch_Threshold_a) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_mi; + AutopilotLaws_P.LowPassFilter_C4_d, AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LeadLagFilter_p); + R = (rtb_Divide + R) * AutopilotLaws_P.ug_Gain_f; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_ot * AutopilotLaws_DWork.DelayInput1_DSTATE; + b_R = R + rtb_Divide; + rtb_Y_af = AutopilotLaws_P.Constant1_Value_d - AutopilotLaws_P.Constant2_Value_k; + rtb_lo = (AutopilotLaws_P.Gain1_Gain_ou * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_jg; + if (rtb_Y_af > AutopilotLaws_P.Switch_Threshold_a) { + R = AutopilotLaws_P.Constant1_Value_mi; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain5_Gain_g * R; + R = AutopilotLaws_P.Gain5_Gain_gm * rtb_lo; } - rtb_Cos1_pk = rtb_Y_j * AutopilotLaws_P.Gain1_Gain_gy; - if (rtb_Cos1_pk <= AutopilotLaws_DWork.DelayInput1_DSTATE) { - if (rtb_Cos_i > AutopilotLaws_P.Switch1_Threshold_b) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_ow; + rtb_Divide = rtb_Gain_a0 * AutopilotLaws_P.Gain1_Gain_gy; + if (rtb_Divide <= R) { + if (rtb_Y_af > AutopilotLaws_P.Switch1_Threshold_b) { + R = AutopilotLaws_P.Constant_Value_ow; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain6_Gain_c * R; + R = AutopilotLaws_P.Gain6_Gain_c * rtb_lo; } - if (rtb_Cos1_pk >= AutopilotLaws_DWork.DelayInput1_DSTATE) { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Cos1_pk; + if (rtb_Divide >= R) { + R = rtb_Divide; } } - Phi2 = (AutopilotLaws_P.Gain_Gain_dm * rtb_Gain1_pj - Phi2) + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_SpeedProtectionSignalSelection(&AutopilotLaws_Y.out, rtb_Y_i, std::fmax(-rtb_Y_pf, std::fmin(rtb_Y_pf, - AutopilotLaws_P.VS_Gain_h * rtb_Y_i)), rtb_Add3_g, AutopilotLaws_P.Gain_Gain_h4 * rtb_Add3_g, Phi2, - AutopilotLaws_P.Gain_Gain_eq * Phi2, AutopilotLaws_P.Constant_Value_ga, &rtb_Cos1_pk, &rtb_Cos_i); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_c * AutopilotLaws_U.in.data.V_gnd_kn; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_oz) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_oz; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ou) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ou; + R += AutopilotLaws_P.Gain_Gain_dm * b_R - AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_SpeedProtectionSignalSelection(&rtb_BusAssignment, rtb_Y_e, std::fmax(-limit, std::fmin(limit, + AutopilotLaws_P.VS_Gain_h * rtb_Y_e)), rtb_Gain7_j, AutopilotLaws_P.Gain_Gain_h4 * rtb_Gain7_j, R, + AutopilotLaws_P.Gain_Gain_eq * R, AutopilotLaws_P.Constant_Value_ga, &rtb_Sum_gq, &rtb_lo); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_ps * AutopilotLaws_U.in.data.H_dot_ft_min; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_c * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_oz) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_oz; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_ou) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_ou; } - rtb_Add3_g = AutopilotLaws_U.in.input.FPA_c_deg - std::atan(AutopilotLaws_P.fpmtoms_Gain_ps * - AutopilotLaws_U.in.data.H_dot_ft_min / AutopilotLaws_DWork.DelayInput1_DSTATE) * AutopilotLaws_P.Gain_Gain_gt; - if (!AutopilotLaws_DWork.prevVerticalLaw_not_empty_n) { - AutopilotLaws_DWork.prevVerticalLaw_b = AutopilotLaws_U.in.input.vertical_law; - AutopilotLaws_DWork.prevVerticalLaw_not_empty_n = true; + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * + AutopilotLaws_P.Gain_Gain_gt; + rtb_Y_e = AutopilotLaws_U.in.input.FPA_c_deg - AutopilotLaws_DWork.DelayInput1_DSTATE; + if (!AutopilotLaws_DWork.prevVerticalLaw_not_empty_k) { + AutopilotLaws_DWork.prevVerticalLaw_c = AutopilotLaws_U.in.input.vertical_law; + AutopilotLaws_DWork.prevVerticalLaw_not_empty_k = true; } - if (!AutopilotLaws_DWork.prevTarget_not_empty_j) { - AutopilotLaws_DWork.prevTarget_k = AutopilotLaws_U.in.input.FPA_c_deg; - AutopilotLaws_DWork.prevTarget_not_empty_j = true; + if (!AutopilotLaws_DWork.prevTarget_not_empty_i) { + AutopilotLaws_DWork.prevTarget_p = AutopilotLaws_U.in.input.FPA_c_deg; + AutopilotLaws_DWork.prevTarget_not_empty_i = true; } - AutopilotLaws_DWork.islevelOffActive_k = (((AutopilotLaws_U.in.input.vertical_law == 5.0) && - (AutopilotLaws_DWork.prevVerticalLaw_b != 5.0) && (AutopilotLaws_U.in.input.FPA_c_deg == 0.0)) || - ((AutopilotLaws_U.in.input.FPA_c_deg == 0.0) && (AutopilotLaws_DWork.prevTarget_k > 1.0)) || + AutopilotLaws_DWork.islevelOffActive_l = (((AutopilotLaws_U.in.input.vertical_law == 5.0) && + (AutopilotLaws_DWork.prevVerticalLaw_c != 5.0) && (AutopilotLaws_U.in.input.FPA_c_deg == 0.0)) || + ((AutopilotLaws_U.in.input.FPA_c_deg == 0.0) && (AutopilotLaws_DWork.prevTarget_p > 1.0)) || ((AutopilotLaws_U.in.input.FPA_c_deg == 0.0) && (AutopilotLaws_U.in.input.vertical_law == 5.0) && - AutopilotLaws_DWork.islevelOffActive_k)); - if (AutopilotLaws_DWork.islevelOffActive_k) { - rtb_Add3_j4 = 0.1; + AutopilotLaws_DWork.islevelOffActive_l)); + if (AutopilotLaws_DWork.islevelOffActive_l) { + Phi1_tmp = 0.1; } else { - rtb_Add3_j4 = 0.05; - } - - rtb_Y_pf = rtb_lo_k * rtb_Add3_j4 * 57.295779513082323; - AutopilotLaws_DWork.prevVerticalLaw_b = AutopilotLaws_U.in.input.vertical_law; - AutopilotLaws_DWork.prevTarget_k = AutopilotLaws_U.in.input.FPA_c_deg; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_cv * AutopilotLaws_U.in.data.V_gnd_kn; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_bb) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_bb; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_a4) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_a4; - } - - Phi2 = std::atan(AutopilotLaws_P.fpmtoms_Gain_d * AutopilotLaws_U.in.data.H_dot_ft_min / - AutopilotLaws_DWork.DelayInput1_DSTATE) * AutopilotLaws_P.Gain_Gain_hv; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_ej * rtb_GainTheta; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_k * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_pj) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_pj; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_py) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_py; - } - - R = AutopilotLaws_DWork.DelayInput1_DSTATE - std::atan(AutopilotLaws_P.fpmtoms_Gain_f * - AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Add3_j4) * AutopilotLaws_P.Gain_Gain_bf * AutopilotLaws_P.Gain1_Gain_jv; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_gfa * rtb_GainTheta1; - rtb_Add3_i = std::cos(AutopilotLaws_DWork.DelayInput1_DSTATE); - rtb_Cos1_j = std::sin(AutopilotLaws_DWork.DelayInput1_DSTATE); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_kw * AutopilotLaws_U.in.data.Psi_magnetic_deg; - rtb_Add3_j4 = AutopilotLaws_P.Gain1_Gain_j4 * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - - AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.ktstomps_Gain_j4 * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_kb * (AutopilotLaws_P.GStoGS_CAS_Gain_o * - AutopilotLaws_DWork.DelayInput1_DSTATE), AutopilotLaws_P.WashoutFilter_C1_j, AutopilotLaws_U.in.time.dt, &rtb_Y_i, - &AutopilotLaws_DWork.sf_WashoutFilter_h); - AutopilotLaws_LeadLagFilter(rtb_Y_i - AutopilotLaws_P.g_Gain_l * (AutopilotLaws_P.Gain1_Gain_n4 * - (AutopilotLaws_P.Gain_Gain_bc * (R * (AutopilotLaws_P.Constant_Value_lf - rtb_Add3_i) + rtb_Cos1_j * std::sin - (rtb_Add3_j4)))), AutopilotLaws_P.HighPassFilter_C1_i, AutopilotLaws_P.HighPassFilter_C2_h, - AutopilotLaws_P.HighPassFilter_C3_m, AutopilotLaws_P.HighPassFilter_C4_n, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LeadLagFilter_e); + Phi1_tmp = 0.05; + } + + limit = limit_tmp * Phi1_tmp * 57.295779513082323; + AutopilotLaws_DWork.prevVerticalLaw_c = AutopilotLaws_U.in.input.vertical_law; + AutopilotLaws_DWork.prevTarget_p = AutopilotLaws_U.in.input.FPA_c_deg; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_d * AutopilotLaws_U.in.data.H_dot_ft_min; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_cv * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_bb) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_bb; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_a4) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_a4; + } + + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * + AutopilotLaws_P.Gain_Gain_hv; + R = AutopilotLaws_P.Gain1_Gain_gfa * rtb_GainTheta1; + rtb_Gain7_j = std::cos(R); + b_R = std::sin(R); + R = AutopilotLaws_P.ktstomps_Gain_j4 * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_kb * (AutopilotLaws_P.GStoGS_CAS_Gain_o * R), + AutopilotLaws_P.WashoutFilter_C1_j, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_WashoutFilter_h); + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_k * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_pj) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_pj; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_py) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_py; + } + + AutopilotLaws_LeadLagFilter(rtb_Y_j - AutopilotLaws_P.g_Gain_l * (AutopilotLaws_P.Gain1_Gain_n4 * + (AutopilotLaws_P.Gain_Gain_bc * ((AutopilotLaws_P.Gain1_Gain_ej * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_jv * + (AutopilotLaws_P.Gain_Gain_bf * std::atan(AutopilotLaws_P.fpmtoms_Gain_f * AutopilotLaws_U.in.data.H_dot_ft_min / + Phi1_tmp))) * (AutopilotLaws_P.Constant_Value_lf - rtb_Gain7_j) + b_R * std::sin(AutopilotLaws_P.Gain1_Gain_j4 * + AutopilotLaws_U.in.data.Psi_magnetic_track_deg - AutopilotLaws_P.Gain1_Gain_kw * + AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_i, + AutopilotLaws_P.HighPassFilter_C2_h, AutopilotLaws_P.HighPassFilter_C3_m, AutopilotLaws_P.HighPassFilter_C4_n, + AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LeadLagFilter_e); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_k * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_l4, AutopilotLaws_P.LowPassFilter_C2_po, AutopilotLaws_P.LowPassFilter_C3_f, - AutopilotLaws_P.LowPassFilter_C4_dt, AutopilotLaws_U.in.time.dt, &rtb_Y_i, &AutopilotLaws_DWork.sf_LeadLagFilter_kp); - AutopilotLaws_DWork.DelayInput1_DSTATE = (rtb_Gain1_pj + rtb_Y_i) * AutopilotLaws_P.ug_Gain_n; - R = AutopilotLaws_P.Gain1_Gain_b1 * Phi2; - rtb_Gain1_pj = AutopilotLaws_DWork.DelayInput1_DSTATE + R; - rtb_Add3_i = AutopilotLaws_P.Constant3_Value_nk - AutopilotLaws_P.Constant4_Value_o; - R = (AutopilotLaws_P.Gain1_Gain_on * AutopilotLaws_DWork.DelayInput1_DSTATE + R) * AutopilotLaws_P.Gain_Gain_hy; - if (rtb_Add3_i > AutopilotLaws_P.Switch_Threshold_d) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_m; + AutopilotLaws_P.LowPassFilter_C4_dt, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LeadLagFilter_kp); + R = (R + rtb_Y_j) * AutopilotLaws_P.ug_Gain_n; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_b1 * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Gain7_j = R + rtb_Divide; + b_R = AutopilotLaws_P.Constant3_Value_nk - AutopilotLaws_P.Constant4_Value_o; + rtb_Y_af = (AutopilotLaws_P.Gain1_Gain_on * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_hy; + if (b_R > AutopilotLaws_P.Switch_Threshold_d) { + R = AutopilotLaws_P.Constant1_Value_m; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain5_Gain_b * R; + R = AutopilotLaws_P.Gain5_Gain_b * rtb_Y_af; } - AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Y_i); - rtb_Y_i = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Y_i) * AutopilotLaws_P.Gain1_Gain_m1; - if (rtb_Y_i <= AutopilotLaws_DWork.DelayInput1_DSTATE) { - if (rtb_Add3_i > AutopilotLaws_P.Switch1_Threshold_d) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_p0; + AutopilotLaws_V_LSSpeedSelection1(AutopilotLaws_U.in.input.V_c_kn, AutopilotLaws_U.in.data.VLS_kn, &rtb_Y_j); + rtb_Divide = (AutopilotLaws_U.in.data.V_ias_kn - rtb_Y_j) * AutopilotLaws_P.Gain1_Gain_m1; + if (rtb_Divide <= R) { + if (b_R > AutopilotLaws_P.Switch1_Threshold_d) { + R = AutopilotLaws_P.Constant_Value_p0d; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain6_Gain_n * R; + R = AutopilotLaws_P.Gain6_Gain_n * rtb_Y_af; } - if (rtb_Y_i >= AutopilotLaws_DWork.DelayInput1_DSTATE) { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Y_i; + if (rtb_Divide >= R) { + R = rtb_Divide; } } - rtb_Add3_i = (AutopilotLaws_P.Gain_Gain_d0 * rtb_Gain1_pj - Phi2) + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_hi * AutopilotLaws_U.in.data.V_gnd_kn; - if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_cv) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_cv; - } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_hd) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_hd; - } - - Phi2 = std::atan(AutopilotLaws_P.fpmtoms_Gain_o2 * AutopilotLaws_U.in.data.H_dot_ft_min / - AutopilotLaws_DWork.DelayInput1_DSTATE) * AutopilotLaws_P.Gain_Gain_pp; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_iw * rtb_GainTheta; - rtb_Sum_kq = AutopilotLaws_P.kntoms_Gain_i * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Sum_kq > AutopilotLaws_P.Saturation_UpperSat_nu) { - rtb_Sum_kq = AutopilotLaws_P.Saturation_UpperSat_nu; - } else if (rtb_Sum_kq < AutopilotLaws_P.Saturation_LowerSat_ae) { - rtb_Sum_kq = AutopilotLaws_P.Saturation_LowerSat_ae; - } - - R = AutopilotLaws_DWork.DelayInput1_DSTATE - std::atan(AutopilotLaws_P.fpmtoms_Gain_hz * - AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Sum_kq) * AutopilotLaws_P.Gain_Gain_ej * AutopilotLaws_P.Gain1_Gain_lw; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_ky * rtb_GainTheta1; - rtb_Cos1_j = std::cos(AutopilotLaws_DWork.DelayInput1_DSTATE); - rtb_Add3_j4 = std::sin(AutopilotLaws_DWork.DelayInput1_DSTATE); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_nrn * AutopilotLaws_U.in.data.Psi_magnetic_deg; - rtb_Add3_lz = AutopilotLaws_P.Gain1_Gain_ip * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - - AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.ktstomps_Gain_l * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_ip * (AutopilotLaws_P.GStoGS_CAS_Gain_e * - AutopilotLaws_DWork.DelayInput1_DSTATE), AutopilotLaws_P.WashoutFilter_C1_c, AutopilotLaws_U.in.time.dt, &rtb_Y_i, - &AutopilotLaws_DWork.sf_WashoutFilter_g5); - AutopilotLaws_LeadLagFilter(rtb_Y_i - AutopilotLaws_P.g_Gain_hq * (AutopilotLaws_P.Gain1_Gain_mx * - (AutopilotLaws_P.Gain_Gain_d3 * (R * (AutopilotLaws_P.Constant_Value_fo - rtb_Cos1_j) + rtb_Add3_j4 * std::sin - (rtb_Add3_lz)))), AutopilotLaws_P.HighPassFilter_C1_d, AutopilotLaws_P.HighPassFilter_C2_i, - AutopilotLaws_P.HighPassFilter_C3_d, AutopilotLaws_P.HighPassFilter_C4_nr, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LeadLagFilter_j); + b_R = (AutopilotLaws_P.Gain_Gain_d0 * rtb_Gain7_j - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_o2 * AutopilotLaws_U.in.data.H_dot_ft_min; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_hi * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_cv) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_cv; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_hd) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_hd; + } + + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * + AutopilotLaws_P.Gain_Gain_pp; + rtb_Gain7_j = AutopilotLaws_P.kntoms_Gain_i * AutopilotLaws_U.in.data.V_gnd_kn; + if (rtb_Gain7_j > AutopilotLaws_P.Saturation_UpperSat_nu) { + rtb_Gain7_j = AutopilotLaws_P.Saturation_UpperSat_nu; + } else if (rtb_Gain7_j < AutopilotLaws_P.Saturation_LowerSat_ae) { + rtb_Gain7_j = AutopilotLaws_P.Saturation_LowerSat_ae; + } + + R = AutopilotLaws_P.Gain1_Gain_ky * rtb_GainTheta1; + rtb_Y_af = std::cos(R); + rtb_Divide = std::sin(R); + R = AutopilotLaws_P.ktstomps_Gain_l * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_ip * (AutopilotLaws_P.GStoGS_CAS_Gain_e * R), + AutopilotLaws_P.WashoutFilter_C1_c, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_WashoutFilter_g5); + AutopilotLaws_LeadLagFilter(rtb_Y_j - AutopilotLaws_P.g_Gain_hq * (AutopilotLaws_P.Gain1_Gain_mx * + (AutopilotLaws_P.Gain_Gain_d3 * ((AutopilotLaws_P.Gain1_Gain_iw * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_lw * + (AutopilotLaws_P.Gain_Gain_ej * std::atan(AutopilotLaws_P.fpmtoms_Gain_hz * AutopilotLaws_U.in.data.H_dot_ft_min / + rtb_Gain7_j))) * (AutopilotLaws_P.Constant_Value_fo - rtb_Y_af) + rtb_Divide * std::sin + (AutopilotLaws_P.Gain1_Gain_ip * AutopilotLaws_U.in.data.Psi_magnetic_track_deg - AutopilotLaws_P.Gain1_Gain_nrn * + AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_d, + AutopilotLaws_P.HighPassFilter_C2_i, AutopilotLaws_P.HighPassFilter_C3_d, AutopilotLaws_P.HighPassFilter_C4_nr, + AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LeadLagFilter_j); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_mh * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_e, AutopilotLaws_P.LowPassFilter_C2_i, AutopilotLaws_P.LowPassFilter_C3_o5, - AutopilotLaws_P.LowPassFilter_C4_f, AutopilotLaws_U.in.time.dt, &rtb_Y_i, &AutopilotLaws_DWork.sf_LeadLagFilter_a); - AutopilotLaws_DWork.DelayInput1_DSTATE = (rtb_Gain1_pj + rtb_Y_i) * AutopilotLaws_P.ug_Gain_e; - R = AutopilotLaws_P.Gain1_Gain_be * Phi2; - rtb_Gain1_pj = AutopilotLaws_DWork.DelayInput1_DSTATE + R; - rtb_Y_i = AutopilotLaws_P.Constant1_Value_o - AutopilotLaws_P.Constant2_Value_h; - R = (AutopilotLaws_P.Gain1_Gain_nj * AutopilotLaws_DWork.DelayInput1_DSTATE + R) * AutopilotLaws_P.Gain_Gain_aq; - if (rtb_Y_i > AutopilotLaws_P.Switch_Threshold_g) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_f; + AutopilotLaws_P.LowPassFilter_C4_f, AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LeadLagFilter_a); + R = (R + rtb_Y_j) * AutopilotLaws_P.ug_Gain_e; + rtb_Divide = AutopilotLaws_P.Gain1_Gain_be * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Gain7_j = R + rtb_Divide; + rtb_Y_af = AutopilotLaws_P.Constant1_Value_o - AutopilotLaws_P.Constant2_Value_h; + rtb_Divide = (AutopilotLaws_P.Gain1_Gain_nj * R + rtb_Divide) * AutopilotLaws_P.Gain_Gain_aq; + if (rtb_Y_af > AutopilotLaws_P.Switch_Threshold_g) { + R = AutopilotLaws_P.Constant1_Value_f; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain5_Gain_a * R; + R = AutopilotLaws_P.Gain5_Gain_a * rtb_Divide; } - rtb_Y_j *= AutopilotLaws_P.Gain1_Gain_fle; - if (rtb_Y_j <= AutopilotLaws_DWork.DelayInput1_DSTATE) { - if (rtb_Y_i > AutopilotLaws_P.Switch1_Threshold_h) { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_i; + rtb_Y_h = rtb_Gain_a0 * AutopilotLaws_P.Gain1_Gain_fle; + if (rtb_Y_h <= R) { + if (rtb_Y_af > AutopilotLaws_P.Switch1_Threshold_h) { + R = AutopilotLaws_P.Constant_Value_i; } else { - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain6_Gain_g * R; + R = AutopilotLaws_P.Gain6_Gain_g * rtb_Divide; } - if (rtb_Y_j >= AutopilotLaws_DWork.DelayInput1_DSTATE) { - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Y_j; + if (rtb_Y_h >= R) { + R = rtb_Y_h; } } - Phi2 = (AutopilotLaws_P.Gain_Gain_gx * rtb_Gain1_pj - Phi2) + AutopilotLaws_DWork.DelayInput1_DSTATE; - AutopilotLaws_SpeedProtectionSignalSelection(&AutopilotLaws_Y.out, rtb_Add3_g, std::fmax(-rtb_Y_pf, std::fmin(rtb_Y_pf, - AutopilotLaws_P.Gain_Gain_c3 * rtb_Add3_g)), rtb_Add3_i, AutopilotLaws_P.Gain_Gain_fnw * rtb_Add3_i, Phi2, - AutopilotLaws_P.Gain_Gain_ko * Phi2, AutopilotLaws_P.Constant_Value_fov, &rtb_FD_h, &rtb_Cos1_j); - rtb_Add3_g = AutopilotLaws_P.Gain2_Gain_n * AutopilotLaws_U.in.data.H_dot_ft_min * - AutopilotLaws_P.DiscreteDerivativeVariableTs1_Gain; - AutopilotLaws_LagFilter((rtb_Add3_g - AutopilotLaws_DWork.Delay_DSTATE_c) / AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.LagFilter2_C1_d, AutopilotLaws_U.in.time.dt, &AutopilotLaws_DWork.DelayInput1_DSTATE, - &AutopilotLaws_DWork.sf_LagFilter_f); - Phi2 = AutopilotLaws_P.kn2ms_Gain * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_LagFilter(AutopilotLaws_P.Gain_Gain_os * (std::tan(AutopilotLaws_P.Gain1_Gain_ox * result[1]) * Phi2), - AutopilotLaws_P.LagFilter3_C1, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_LagFilter_l); - AutopilotLaws_LagFilter(AutopilotLaws_DWork.DelayInput1_DSTATE - rtb_Gain1_pj, AutopilotLaws_P.LagFilter4_C1, - AutopilotLaws_U.in.time.dt, &Phi2, &AutopilotLaws_DWork.sf_LagFilter_i); - AutopilotLaws_WashoutFilter(Phi2, AutopilotLaws_P.WashoutFilter1_C1, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_WashoutFilter_db); - rtb_Add3_j4 = AutopilotLaws_P.Gain4_Gain_n * rtb_Gain1_pj; + rtb_Gain7_j = (AutopilotLaws_P.Gain_Gain_gx * rtb_Gain7_j - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; + AutopilotLaws_SpeedProtectionSignalSelection(&rtb_BusAssignment, rtb_Y_e, std::fmax(-limit, std::fmin(limit, + AutopilotLaws_P.Gain_Gain_c3 * rtb_Y_e)), b_R, AutopilotLaws_P.Gain_Gain_fnw * b_R, rtb_Gain7_j, + AutopilotLaws_P.Gain_Gain_ko * rtb_Gain7_j, AutopilotLaws_P.Constant_Value_fov, &rtb_FD_f, &rtb_AP_mp); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain2_Gain_n * AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Gain_a0 = AutopilotLaws_P.DiscreteDerivativeVariableTs1_Gain * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Gain_a0 - AutopilotLaws_DWork.Delay_DSTATE_c; + AutopilotLaws_LagFilter(AutopilotLaws_DWork.DelayInput1_DSTATE / AutopilotLaws_U.in.time.dt, + AutopilotLaws_P.LagFilter2_C1_d, AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LagFilter_f); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_ox * result[1]; + rtb_Y_e = std::tan(AutopilotLaws_DWork.DelayInput1_DSTATE); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kn2ms_Gain * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_LagFilter(AutopilotLaws_P.Gain_Gain_os * (rtb_Y_e * AutopilotLaws_DWork.DelayInput1_DSTATE), + AutopilotLaws_P.LagFilter3_C1, AutopilotLaws_U.in.time.dt, &AutopilotLaws_DWork.DelayInput1_DSTATE, + &AutopilotLaws_DWork.sf_LagFilter_l); + AutopilotLaws_LagFilter(R - AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.LagFilter4_C1, + AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LagFilter_i); + AutopilotLaws_WashoutFilter(R, AutopilotLaws_P.WashoutFilter1_C1, AutopilotLaws_U.in.time.dt, + &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_WashoutFilter_db); + AutopilotLaws_DWork.DelayInput1_DSTATE *= AutopilotLaws_P.Gain4_Gain_n; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ko) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ko; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ez) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ez; + } + + rtb_Y_e = AutopilotLaws_P.Gain2_Gain_k * AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_LagFilter(AutopilotLaws_U.in.data.nav_gs_error_deg, AutopilotLaws_P.LagFilter1_C1_l, - AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_LagFilter_gx); - R = rtb_Gain1_pj * look1_binlxpw(AutopilotLaws_U.in.data.H_radio_ft, - AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_a, AutopilotLaws_P.ScheduledGain_Table_j, 7U) * - AutopilotLaws_P.Gain_Gain_gm; - rtb_Compare_l = ((AutopilotLaws_U.in.input.vertical_mode == AutopilotLaws_P.CompareGSTRACK_const) || - (AutopilotLaws_U.in.input.vertical_mode == AutopilotLaws_P.CompareGSTRACK2_const)); - AutopilotLaws_RateLimiter_n(rtb_Compare_l, AutopilotLaws_P.RateLimiterVariableTs_up_d, + AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LagFilter_gx); + AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(rtb_BusAssignment.data.H_radio_ft, + AutopilotLaws_P.ScheduledGain_BreakpointsForDimension1_a, AutopilotLaws_P.ScheduledGain_Table_j, 7U); + rtb_Gain7_j = R * AutopilotLaws_DWork.DelayInput1_DSTATE * AutopilotLaws_P.Gain_Gain_gm; + rtb_OR1 = ((AutopilotLaws_U.in.input.vertical_mode == AutopilotLaws_P.CompareGSTRACK_const) || + (AutopilotLaws_U.in.input.vertical_mode == AutopilotLaws_P.CompareGSTRACK2_const)); + AutopilotLaws_RateLimiter_n(rtb_OR1, AutopilotLaws_P.RateLimiterVariableTs_up_d, AutopilotLaws_P.RateLimiterVariableTs_lo_c, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_m, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_RateLimiter_l); - if (rtb_Gain1_pj > AutopilotLaws_P.Saturation_UpperSat_j1) { - Phi2 = AutopilotLaws_P.Saturation_UpperSat_j1; - } else if (rtb_Gain1_pj < AutopilotLaws_P.Saturation_LowerSat_nq) { - Phi2 = AutopilotLaws_P.Saturation_LowerSat_nq; - } else { - Phi2 = rtb_Gain1_pj; + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_m, &AutopilotLaws_DWork.DelayInput1_DSTATE, + &AutopilotLaws_DWork.sf_RateLimiter_l); + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_j1) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_j1; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_nq) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_nq; } + rtb_Y_e = (rtb_Y_e + rtb_Gain7_j) * AutopilotLaws_DWork.DelayInput1_DSTATE; + b_R = AutopilotLaws_P.Constant_Value_lu - AutopilotLaws_DWork.DelayInput1_DSTATE; AutopilotLaws_LagFilter(AutopilotLaws_U.in.data.nav_gs_error_deg, AutopilotLaws_P.LagFilter2_C1_e, - AutopilotLaws_U.in.time.dt, &rtb_Y_i, &AutopilotLaws_DWork.sf_LagFilter_cf); - rtb_Add3_i = AutopilotLaws_P.DiscreteDerivativeVariableTs_Gain_g * rtb_Y_i; - AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(AutopilotLaws_U.in.data.H_radio_ft, - AutopilotLaws_P.ScheduledGain3_BreakpointsForDimension1, AutopilotLaws_P.ScheduledGain3_Table, 4U); - AutopilotLaws_LagFilter(rtb_Y_i + (rtb_Add3_i - AutopilotLaws_DWork.Delay_DSTATE_b) / AutopilotLaws_U.in.time.dt * - AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.LagFilter_C1_d, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LagFilter_p); - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ko) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ko; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_ez) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_ez; - } - - AutopilotLaws_SignalEnablerGSTrack(AutopilotLaws_P.Gain3_Gain_c * ((AutopilotLaws_P.Gain2_Gain_k * rtb_Add3_j4 + R) * - Phi2 + (AutopilotLaws_P.Constant_Value_lu - Phi2) * (rtb_Gain1_pj * look1_binlxpw(AutopilotLaws_U.in.data.H_radio_ft, - AutopilotLaws_P.ScheduledGain2_BreakpointsForDimension1_h, AutopilotLaws_P.ScheduledGain2_Table_p, 7U))), - (AutopilotLaws_U.in.data.H_radio_ft > AutopilotLaws_P.CompareToConstant_const_kt) && - AutopilotLaws_U.in.data.nav_gs_valid, &rtb_Sum_kq); - AutopilotLaws_storevalue(rtb_error_d == AutopilotLaws_P.CompareToConstant6_const_e, - AutopilotLaws_Y.out.data.nav_gs_deg, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_storevalue_g); - if (rtb_Gain1_pj > AutopilotLaws_P.Saturation_UpperSat_e0) { - Phi2 = AutopilotLaws_P.Saturation_UpperSat_e0; - } else if (rtb_Gain1_pj < AutopilotLaws_P.Saturation_LowerSat_ph) { - Phi2 = AutopilotLaws_P.Saturation_LowerSat_ph; - } else { - Phi2 = rtb_Gain1_pj; - } - - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_g4 * AutopilotLaws_U.in.data.H_dot_ft_min; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_k4 * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_eb) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_eb; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_gk) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_gk; - } - - AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / rtb_Add3_j4) * + AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LagFilter_cf); + rtb_Gain_lb = AutopilotLaws_P.DiscreteDerivativeVariableTs_Gain_g * rtb_Y_j; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Gain_lb - AutopilotLaws_DWork.Delay_DSTATE_b; + AutopilotLaws_DWork.DelayInput1_DSTATE /= AutopilotLaws_U.in.time.dt; + R = look1_binlxpw(rtb_BusAssignment.data.H_radio_ft, AutopilotLaws_P.ScheduledGain3_BreakpointsForDimension1_i, + AutopilotLaws_P.ScheduledGain3_Table_a, 4U); + AutopilotLaws_LagFilter(rtb_Y_j + AutopilotLaws_DWork.DelayInput1_DSTATE * R, AutopilotLaws_P.LagFilter_C1_d, + AutopilotLaws_U.in.time.dt, &R, &AutopilotLaws_DWork.sf_LagFilter_p); + AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(rtb_BusAssignment.data.H_radio_ft, + AutopilotLaws_P.ScheduledGain2_BreakpointsForDimension1_h, AutopilotLaws_P.ScheduledGain2_Table_p, 7U); + AutopilotLaws_SignalEnablerGSTrack(AutopilotLaws_P.Gain3_Gain_c * (rtb_Y_e + b_R * (R * + AutopilotLaws_DWork.DelayInput1_DSTATE)), ((rtb_BusAssignment.data.H_radio_ft > + AutopilotLaws_P.CompareToConstant_const_kt) && AutopilotLaws_U.in.data.nav_gs_valid), &rtb_Gain7_j); + AutopilotLaws_storevalue((rtb_dme == AutopilotLaws_P.CompareToConstant6_const_e), rtb_BusAssignment.data.nav_gs_deg, + &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_storevalue_g); + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_e0) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_e0; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ph) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ph; + } + + rtb_Divide = AutopilotLaws_P.kntoms_Gain_k4 * AutopilotLaws_U.in.data.V_gnd_kn; + if (rtb_Divide > AutopilotLaws_P.Saturation_UpperSat_eb) { + rtb_Divide = AutopilotLaws_P.Saturation_UpperSat_eb; + } else if (rtb_Divide < AutopilotLaws_P.Saturation_LowerSat_gk) { + rtb_Divide = AutopilotLaws_P.Saturation_LowerSat_gk; + } + + R = std::atan(AutopilotLaws_P.fpmtoms_Gain_g4 * AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Divide) * AutopilotLaws_P.Gain_Gain_ow; - AutopilotLaws_SignalEnablerGSTrack(AutopilotLaws_P.Gain2_Gain_l * (Phi2 - AutopilotLaws_DWork.DelayInput1_DSTATE), - rtb_Compare_l, &rtb_Gain1_pj); - AutopilotLaws_Voter1(rtb_Sum_kq + rtb_Gain1_pj, AutopilotLaws_P.Gain1_Gain_d4 * ((Phi2 + AutopilotLaws_P.Bias_Bias) - - AutopilotLaws_DWork.DelayInput1_DSTATE), AutopilotLaws_P.Gain_Gain_eyl * ((Phi2 + AutopilotLaws_P.Bias1_Bias) - - AutopilotLaws_DWork.DelayInput1_DSTATE), &R); - rtb_Product_dh = R * look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, - AutopilotLaws_P.ScheduledGain1_BreakpointsForDimension1, AutopilotLaws_P.ScheduledGain1_Table, 6U); - rtb_Gain4 = (rtb_GainTheta - AutopilotLaws_P.Constant2_Value_f) * AutopilotLaws_P.Gain4_Gain_oy; - rtb_Y_i = AutopilotLaws_P.Gain5_Gain_c * AutopilotLaws_U.in.data.bz_m_s2; + AutopilotLaws_SignalEnablerGSTrack(AutopilotLaws_P.Gain2_Gain_l * (AutopilotLaws_DWork.DelayInput1_DSTATE - R), + rtb_OR1, &rtb_Divide); + AutopilotLaws_Voter1(rtb_Gain7_j + rtb_Divide, AutopilotLaws_P.Gain1_Gain_d4 * + ((AutopilotLaws_DWork.DelayInput1_DSTATE + AutopilotLaws_P.Bias_Bias_k) - R), + AutopilotLaws_P.Gain_Gain_eyl * ((AutopilotLaws_DWork.DelayInput1_DSTATE + + AutopilotLaws_P.Bias1_Bias) - R), &rtb_Y_e); + AutopilotLaws_DWork.DelayInput1_DSTATE = look1_binlxpw(AutopilotLaws_U.in.data.V_tas_kn, + AutopilotLaws_P.ScheduledGain1_BreakpointsForDimension1_d, AutopilotLaws_P.ScheduledGain1_Table_n, 6U); + rtb_Product_hz = rtb_Y_e * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_GainTheta - AutopilotLaws_P.Constant2_Value_f; + rtb_Gain4 = AutopilotLaws_P.Gain4_Gain_o * AutopilotLaws_DWork.DelayInput1_DSTATE; + rtb_Y_j = AutopilotLaws_P.Gain5_Gain_c * AutopilotLaws_U.in.data.bz_m_s2; AutopilotLaws_WashoutFilter(AutopilotLaws_U.in.data.bx_m_s2, AutopilotLaws_P.WashoutFilter_C1_m, - AutopilotLaws_U.in.time.dt, &rtb_Y_pf, &AutopilotLaws_DWork.sf_WashoutFilter_g); - rtb_Compare_l = (rtb_error_d == AutopilotLaws_P.CompareToConstant7_const); + AutopilotLaws_U.in.time.dt, &rtb_Y_af, &AutopilotLaws_DWork.sf_WashoutFilter_g); + rtb_OR1 = (rtb_dme == AutopilotLaws_P.CompareToConstant7_const); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntofpm_Gain * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_DWork.DelayInput1_DSTATE *= AutopilotLaws_P.maxslope_Gain; AutopilotLaws_LagFilter(AutopilotLaws_U.in.data.H_dot_ft_min, AutopilotLaws_P.LagFilterH_C1, - AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LagFilter_a); - Phi2 = rtb_Y_j - AutopilotLaws_P.kntofpm_Gain * AutopilotLaws_U.in.data.V_gnd_kn * AutopilotLaws_P.maxslope_Gain; - AutopilotLaws_LeadLagFilter(AutopilotLaws_U.in.data.H_radio_ft, AutopilotLaws_P.LeadLagFilter_C1, + AutopilotLaws_U.in.time.dt, &b_R, &AutopilotLaws_DWork.sf_LagFilter_a); + R = b_R - AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_LeadLagFilter(rtb_BusAssignment.data.H_radio_ft, AutopilotLaws_P.LeadLagFilter_C1, AutopilotLaws_P.LeadLagFilter_C2, AutopilotLaws_P.LeadLagFilter_C3, AutopilotLaws_P.LeadLagFilter_C4, - AutopilotLaws_U.in.time.dt, &rtb_Y_j, &AutopilotLaws_DWork.sf_LeadLagFilter_k); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_oa * rtb_Y_j; - rtb_Add3_lz = std::fmax(Phi2, AutopilotLaws_DWork.DelayInput1_DSTATE); + AutopilotLaws_U.in.time.dt, &rtb_Y_h, &AutopilotLaws_DWork.sf_LeadLagFilter_k); + rtb_Divide = AutopilotLaws_P.Gain1_Gain_oa * rtb_Y_h; + AutopilotLaws_DWork.DelayInput1_DSTATE += b_R; + rtb_MaxH_dot_RA1 = std::fmin(std::fmax(R, rtb_Divide), AutopilotLaws_DWork.DelayInput1_DSTATE); if (!AutopilotLaws_DWork.wasActive_not_empty) { - AutopilotLaws_DWork.wasActive = rtb_Compare_l; + AutopilotLaws_DWork.wasActive = rtb_OR1; AutopilotLaws_DWork.wasActive_not_empty = true; } - if ((!AutopilotLaws_DWork.wasActive) && rtb_Compare_l) { - R = std::abs(rtb_Add3_lz) / 60.0; - AutopilotLaws_DWork.Tau = AutopilotLaws_U.in.data.H_radio_ft / (R - 2.5); - AutopilotLaws_DWork.H_bias = AutopilotLaws_DWork.Tau * R - AutopilotLaws_U.in.data.H_radio_ft; + if ((!AutopilotLaws_DWork.wasActive) && rtb_OR1) { + rtb_Y_e = std::abs(rtb_MaxH_dot_RA1) / 60.0; + AutopilotLaws_DWork.Tau = rtb_BusAssignment.data.H_radio_ft / (rtb_Y_e - 2.5); + AutopilotLaws_DWork.H_bias = AutopilotLaws_DWork.Tau * rtb_Y_e - rtb_BusAssignment.data.H_radio_ft; } - if (rtb_Compare_l) { - rtb_Vz = -1.0 / AutopilotLaws_DWork.Tau * (AutopilotLaws_U.in.data.H_radio_ft + AutopilotLaws_DWork.H_bias) * 60.0; + if (rtb_OR1) { + rtb_Vz = -1.0 / AutopilotLaws_DWork.Tau * (rtb_BusAssignment.data.H_radio_ft + AutopilotLaws_DWork.H_bias) * 60.0; } else { - rtb_Vz = rtb_Add3_lz; + rtb_Vz = rtb_MaxH_dot_RA1; } - AutopilotLaws_DWork.wasActive = rtb_Compare_l; + AutopilotLaws_DWork.wasActive = rtb_OR1; AutopilotLaws_LeadLagFilter(rtb_Vz, AutopilotLaws_P.LeadLagFilter_C1_a, AutopilotLaws_P.LeadLagFilter_C2_p, - AutopilotLaws_P.LeadLagFilter_C3_m, AutopilotLaws_P.LeadLagFilter_C4_k, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, + AutopilotLaws_P.LeadLagFilter_C3_m, AutopilotLaws_P.LeadLagFilter_C4_k, AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_LeadLagFilter_hp); AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_av * AutopilotLaws_U.in.data.V_gnd_kn; if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_i0) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_i0; + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_i0; } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_nd) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_nd; + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_nd; } else { - rtb_Add3_j4 = AutopilotLaws_DWork.DelayInput1_DSTATE; + Phi1_tmp = AutopilotLaws_DWork.DelayInput1_DSTATE; } - R = AutopilotLaws_P.ftmintoms_Gain_k * rtb_Gain1_pj / rtb_Add3_j4; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_k * rtb_Divide / Phi1_tmp; if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ew) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ew; } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_an) { AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_an; } - rtb_Add3_j4 = (rtb_Vz - rtb_Add3_lz) * AutopilotLaws_P.ftmintoms_Gain_j / AutopilotLaws_DWork.DelayInput1_DSTATE; - if (R > 1.0) { - R = 1.0; - } else if (R < -1.0) { - R = -1.0; + Phi1_tmp = (rtb_Vz - rtb_MaxH_dot_RA1) * AutopilotLaws_P.ftmintoms_Gain_j / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (rtb_Y_e > 1.0) { + rtb_Y_e = 1.0; + } else if (rtb_Y_e < -1.0) { + rtb_Y_e = -1.0; } - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Sum1_g = AutopilotLaws_P.Gain_Gain_gr * std::asin(R) * AutopilotLaws_P.Gain1_Gain_ml + - AutopilotLaws_P.Gain_Gain_by * std::asin(rtb_Add3_j4) * AutopilotLaws_P.Gain2_Gain_m; + rtb_Sum1_g = AutopilotLaws_P.Gain_Gain_gr * std::asin(rtb_Y_e) * AutopilotLaws_P.Gain1_Gain_ml + + AutopilotLaws_P.Gain_Gain_by * std::asin(Phi1_tmp) * AutopilotLaws_P.Gain2_Gain_m; rtb_uDLookupTable_m = look1_binlxpw(AutopilotLaws_U.in.data.total_weight_kg, AutopilotLaws_P.uDLookupTable_bp01Data, AutopilotLaws_P.uDLookupTable_tableData, 3U); rtb_Sum_es = AutopilotLaws_P.Constant1_Value_o0 - rtb_GainTheta; rtb_Sum3_m3 = AutopilotLaws_P.Constant2_Value_kz - AutopilotLaws_U.in.data.H_ind_ft; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.fpmtoms_Gain_po * AutopilotLaws_U.in.data.H_dot_ft_min; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_bh * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_pd) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_pd; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_l) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_l; + Phi1_tmp = AutopilotLaws_P.kntoms_Gain_bh * AutopilotLaws_U.in.data.V_gnd_kn; + if (Phi1_tmp > AutopilotLaws_P.Saturation_UpperSat_pd) { + Phi1_tmp = AutopilotLaws_P.Saturation_UpperSat_pd; + } else if (Phi1_tmp < AutopilotLaws_P.Saturation_LowerSat_l) { + Phi1_tmp = AutopilotLaws_P.Saturation_LowerSat_l; } - AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / rtb_Add3_j4) * + AutopilotLaws_DWork.DelayInput1_DSTATE = std::atan(AutopilotLaws_DWork.DelayInput1_DSTATE / Phi1_tmp) * AutopilotLaws_P.Gain_Gain_cr; R = AutopilotLaws_P.Gain1_Gain_ga * AutopilotLaws_DWork.DelayInput1_DSTATE; - rtb_Gain1_pj = AutopilotLaws_P.Gain1_Gain_hm2 * rtb_GainTheta1; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_py * AutopilotLaws_U.in.data.V_gnd_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ec) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ec; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_m) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_m; - } - - rtb_GainTheta1 = (AutopilotLaws_P.Gain1_Gain_ol * rtb_GainTheta - std::atan(AutopilotLaws_P.fpmtoms_Gain_k * - AutopilotLaws_U.in.data.H_dot_ft_min / rtb_Add3_j4) * AutopilotLaws_P.Gain_Gain_hc * AutopilotLaws_P.Gain1_Gain_ln) * - (AutopilotLaws_P.Constant_Value_h - std::cos(rtb_Gain1_pj)); - rtb_Add3_j4 = std::sin(rtb_Gain1_pj); - rtb_Sum_kq = AutopilotLaws_P.Gain1_Gain_it * AutopilotLaws_U.in.data.Psi_magnetic_track_deg; - rtb_Add3_aj = rtb_Sum_kq - AutopilotLaws_P.Gain1_Gain_a * AutopilotLaws_U.in.data.Psi_magnetic_deg; - rtb_Gain1_pj = AutopilotLaws_P.ktstomps_Gain_k5 * AutopilotLaws_U.in.data.V_gnd_kn; - AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_f * (AutopilotLaws_P.GStoGS_CAS_Gain_j * rtb_Gain1_pj), - AutopilotLaws_P.WashoutFilter_C1_cn, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, + rtb_Y_e = AutopilotLaws_P.kntoms_Gain_py * AutopilotLaws_U.in.data.V_gnd_kn; + if (rtb_Y_e > AutopilotLaws_P.Saturation_UpperSat_ec) { + rtb_Y_e = AutopilotLaws_P.Saturation_UpperSat_ec; + } else if (rtb_Y_e < AutopilotLaws_P.Saturation_LowerSat_m) { + rtb_Y_e = AutopilotLaws_P.Saturation_LowerSat_m; + } + + rtb_Divide = AutopilotLaws_P.Gain1_Gain_hm2 * rtb_GainTheta1; + rtb_GainTheta1 = std::cos(rtb_Divide); + limit = std::sin(rtb_Divide); + rtb_Gain7_j = AutopilotLaws_P.Gain1_Gain_it * AutopilotLaws_U.in.data.Psi_magnetic_track_deg; + rtb_Divide = AutopilotLaws_P.ktstomps_Gain_k5 * AutopilotLaws_U.in.data.V_gnd_kn; + AutopilotLaws_WashoutFilter(AutopilotLaws_P._Gain_f * (AutopilotLaws_P.GStoGS_CAS_Gain_j * rtb_Divide), + AutopilotLaws_P.WashoutFilter_C1_cn, AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_WashoutFilter_i); - AutopilotLaws_LeadLagFilter(rtb_Gain1_pj - AutopilotLaws_P.g_Gain_p * (AutopilotLaws_P.Gain1_Gain_mxw * - (AutopilotLaws_P.Gain_Gain_er * (rtb_GainTheta1 + rtb_Add3_j4 * std::sin(rtb_Add3_aj)))), - AutopilotLaws_P.HighPassFilter_C1_gw, AutopilotLaws_P.HighPassFilter_C2_e, AutopilotLaws_P.HighPassFilter_C3_di, - AutopilotLaws_P.HighPassFilter_C4_a, AutopilotLaws_U.in.time.dt, &rtb_Sum_kq, - &AutopilotLaws_DWork.sf_LeadLagFilter_g); + AutopilotLaws_LeadLagFilter(rtb_Divide - AutopilotLaws_P.g_Gain_p * (AutopilotLaws_P.Gain1_Gain_mxw * + (AutopilotLaws_P.Gain_Gain_er * ((AutopilotLaws_P.Gain1_Gain_ol * rtb_GainTheta - AutopilotLaws_P.Gain1_Gain_ln * + (AutopilotLaws_P.Gain_Gain_hc * std::atan(AutopilotLaws_P.fpmtoms_Gain_k * AutopilotLaws_U.in.data.H_dot_ft_min / + rtb_Y_e))) * (AutopilotLaws_P.Constant_Value_h - rtb_GainTheta1) + limit * std::sin(rtb_Gain7_j - + AutopilotLaws_P.Gain1_Gain_a * AutopilotLaws_U.in.data.Psi_magnetic_deg)))), AutopilotLaws_P.HighPassFilter_C1_gw, + AutopilotLaws_P.HighPassFilter_C2_e, AutopilotLaws_P.HighPassFilter_C3_di, AutopilotLaws_P.HighPassFilter_C4_a, + AutopilotLaws_U.in.time.dt, &rtb_Gain7_j, &AutopilotLaws_DWork.sf_LeadLagFilter_g); AutopilotLaws_LeadLagFilter(AutopilotLaws_P.ktstomps_Gain_mf * AutopilotLaws_U.in.data.V_ias_kn, AutopilotLaws_P.LowPassFilter_C1_d1, AutopilotLaws_P.LowPassFilter_C2_e, AutopilotLaws_P.LowPassFilter_C3_l, - AutopilotLaws_P.LowPassFilter_C4_a, AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, - &AutopilotLaws_DWork.sf_LeadLagFilter_n); - rtb_Gain1_pj = (rtb_Sum_kq + rtb_Gain1_pj) * AutopilotLaws_P.ug_Gain_c; - rtb_GainTheta1 = (AutopilotLaws_P.Gain1_Gain_nc * rtb_Gain1_pj + R) * AutopilotLaws_P.Gain_Gain_bg; - rtb_Add3_j4 = (AutopilotLaws_U.in.data.V_ias_kn - AutopilotLaws_U.in.input.V_c_kn) * AutopilotLaws_P.Gain1_Gain_ke; - rtb_Compare_l = ((rtb_Sum3_m3 > AutopilotLaws_P.CompareToConstant6_const_d) && (rtb_GainTheta1 < - AutopilotLaws_P.CompareToConstant5_const_h) && (rtb_Add3_j4 < AutopilotLaws_P.CompareToConstant2_const_j) && - (rtb_error_d == AutopilotLaws_P.CompareToConstant8_const)); - R += rtb_Gain1_pj; - if (rtb_Compare_l) { - rtb_Gain1_pj = AutopilotLaws_P.Constant_Value_o; + AutopilotLaws_P.LowPassFilter_C4_a, AutopilotLaws_U.in.time.dt, &rtb_Divide, &AutopilotLaws_DWork.sf_LeadLagFilter_n); + rtb_Divide = (rtb_Gain7_j + rtb_Divide) * AutopilotLaws_P.ug_Gain_c; + rtb_GainTheta1 = (AutopilotLaws_P.Gain1_Gain_nc * rtb_Divide + R) * AutopilotLaws_P.Gain_Gain_bg; + rtb_Y_e = (AutopilotLaws_U.in.data.V_ias_kn - AutopilotLaws_U.in.input.V_c_kn) * AutopilotLaws_P.Gain1_Gain_ke; + rtb_OR1 = ((rtb_Sum3_m3 > AutopilotLaws_P.CompareToConstant6_const_d) && (rtb_GainTheta1 < + AutopilotLaws_P.CompareToConstant5_const_h) && (rtb_Y_e < AutopilotLaws_P.CompareToConstant2_const_j) && + (rtb_dme == AutopilotLaws_P.CompareToConstant8_const)); + rtb_Gain7_j = rtb_Divide + R; + if (rtb_OR1) { + R = AutopilotLaws_P.Constant_Value_o3; } else { if (rtb_Sum3_m3 > AutopilotLaws_P.CompareToConstant_const_h) { - rtb_Gain1_pj = AutopilotLaws_P.Constant1_Value_g5; + R = AutopilotLaws_P.Constant1_Value_g5; } else { - rtb_Gain1_pj = AutopilotLaws_P.Gain5_Gain_n * rtb_GainTheta1; + R = AutopilotLaws_P.Gain5_Gain_n * rtb_GainTheta1; } - if (rtb_Add3_j4 <= rtb_Gain1_pj) { + if (rtb_Y_e <= R) { if (rtb_Sum3_m3 > AutopilotLaws_P.CompareToConstant4_const_e) { - rtb_Gain1_pj = std::fmax(AutopilotLaws_P.Constant2_Value_m, AutopilotLaws_P.Gain1_Gain_m * rtb_GainTheta1); + R = std::fmax(AutopilotLaws_P.Constant2_Value_m, AutopilotLaws_P.Gain1_Gain_m * rtb_GainTheta1); } else { - rtb_Gain1_pj = AutopilotLaws_P.Gain6_Gain_fa * rtb_GainTheta1; + R = AutopilotLaws_P.Gain6_Gain_fa * rtb_GainTheta1; } - if (rtb_Add3_j4 >= rtb_Gain1_pj) { - rtb_Gain1_pj = rtb_Add3_j4; + if (rtb_Y_e >= R) { + R = rtb_Y_e; } } } - rtb_GainTheta1 = (AutopilotLaws_P.Gain_Gain_c2 * R - AutopilotLaws_DWork.DelayInput1_DSTATE) + rtb_Gain1_pj; - rtb_Add3_j4 = AutopilotLaws_P.kntoms_Gain_om * AutopilotLaws_U.in.data.V_tas_kn; + rtb_GainTheta1 = (AutopilotLaws_P.Gain_Gain_c2 * rtb_Gain7_j - AutopilotLaws_DWork.DelayInput1_DSTATE) + R; if (rtb_Sum3_m3 < 0.0) { - R = -1.0; - } else if (rtb_Sum3_m3 > 0.0) { - R = 1.0; + i = -1; } else { - R = rtb_Sum3_m3; + i = (rtb_Sum3_m3 > 0.0); } - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ed) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ed; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_ee) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_ee; + AutopilotLaws_DWork.DelayInput1_DSTATE = static_cast(i) * AutopilotLaws_P.Constant3_Value_ew; + AutopilotLaws_DWork.DelayInput1_DSTATE -= AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_m * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_om * AutopilotLaws_U.in.data.V_tas_kn; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ed) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ed; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ee) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ee; } - rtb_Add3_j4 = (R * AutopilotLaws_P.Constant3_Value_ew - AutopilotLaws_U.in.data.H_dot_ft_min) * - AutopilotLaws_P.ftmintoms_Gain_m / rtb_Add3_j4; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Gain_n4 = AutopilotLaws_P.Gain_Gain_kon * std::asin(rtb_Add3_j4); - rtb_Gain1_pj = AutopilotLaws_P.kntoms_Gain_iw * AutopilotLaws_U.in.data.V_tas_kn; - if (rtb_Gain1_pj > AutopilotLaws_P.Saturation_UpperSat_jt) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_UpperSat_jt; - } else if (rtb_Gain1_pj < AutopilotLaws_P.Saturation_LowerSat_ih) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_LowerSat_ih; + rtb_Gain7_j = AutopilotLaws_P.Gain_Gain_kon * std::asin(Phi1_tmp); + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_iaf - AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Y_e = AutopilotLaws_P.ftmintoms_Gain_lv * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_iw * AutopilotLaws_U.in.data.V_tas_kn; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_jt) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_jt; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ih) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ih; } - rtb_Add3_j4 = (AutopilotLaws_P.Constant_Value_iaf - AutopilotLaws_U.in.data.H_dot_ft_min) * - AutopilotLaws_P.ftmintoms_Gain_lv / rtb_Gain1_pj; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Y_e / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Add3_aj = AutopilotLaws_P.Gain_Gain_o1 * std::asin(rtb_Add3_j4); - if (rtb_Compare_l) { - rtb_Gain1_pj = rtb_GainTheta1; + R = AutopilotLaws_P.Gain_Gain_o1 * std::asin(Phi1_tmp); + if (rtb_OR1) { + Phi1_tmp = rtb_GainTheta1; } else if (rtb_Sum3_m3 > AutopilotLaws_P.Switch_Threshold_k) { - rtb_Gain1_pj = std::fmax(rtb_GainTheta1, rtb_Gain_n4); + Phi1_tmp = std::fmax(rtb_GainTheta1, rtb_Gain7_j); } else { - rtb_Gain1_pj = std::fmin(rtb_GainTheta1, rtb_Gain_n4); + Phi1_tmp = std::fmin(rtb_GainTheta1, rtb_Gain7_j); } - AutopilotLaws_Voter1(rtb_Sum_es, rtb_Gain1_pj, rtb_Add3_aj, &R); + AutopilotLaws_Voter1(rtb_Sum_es, Phi1_tmp, R, &rtb_Y_e); AutopilotLaws_LagFilter(AutopilotLaws_U.in.input.H_c_ft - AutopilotLaws_U.in.data.H_ft, AutopilotLaws_P.LagFilter_C1_b, - AutopilotLaws_U.in.time.dt, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_LagFilter_d); - rtb_Add3_j4 = AutopilotLaws_P.Gain2_Gain_hq * rtb_Gain1_pj; - rtb_Gain1_pj = AutopilotLaws_P.kntoms_Gain_j * AutopilotLaws_U.in.data.V_tas_kn; - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_f3) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_f3; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_b) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_b; + AutopilotLaws_U.in.time.dt, &AutopilotLaws_DWork.DelayInput1_DSTATE, &AutopilotLaws_DWork.sf_LagFilter_d); + AutopilotLaws_DWork.DelayInput1_DSTATE *= AutopilotLaws_P.Gain2_Gain_hq; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_f3) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_f3; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_b) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_b; } - if (rtb_Gain1_pj > AutopilotLaws_P.Saturation_UpperSat_nuy) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_UpperSat_nuy; - } else if (rtb_Gain1_pj < AutopilotLaws_P.Saturation_LowerSat_dj) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_LowerSat_dj; + AutopilotLaws_DWork.DelayInput1_DSTATE += AutopilotLaws_U.in.input.H_dot_c_fpm; + AutopilotLaws_DWork.DelayInput1_DSTATE -= AutopilotLaws_U.in.data.H_dot_ft_min; + rtb_Divide = AutopilotLaws_P.ftmintoms_Gain_kr * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.kntoms_Gain_j * AutopilotLaws_U.in.data.V_tas_kn; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_nuy) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_nuy; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_dj) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_dj; } - rtb_Add3_j4 = ((AutopilotLaws_U.in.input.H_dot_c_fpm + rtb_Add3_j4) - AutopilotLaws_U.in.data.H_dot_ft_min) * - AutopilotLaws_P.ftmintoms_Gain_kr / rtb_Gain1_pj; - if (rtb_Add3_j4 > 1.0) { - rtb_Add3_j4 = 1.0; - } else if (rtb_Add3_j4 < -1.0) { - rtb_Add3_j4 = -1.0; + Phi1_tmp = rtb_Divide / AutopilotLaws_DWork.DelayInput1_DSTATE; + if (Phi1_tmp > 1.0) { + Phi1_tmp = 1.0; + } else if (Phi1_tmp < -1.0) { + Phi1_tmp = -1.0; } - rtb_Sum_kq = AutopilotLaws_P.Gain_Gain_fs * std::asin(rtb_Add3_j4); - switch (static_cast(rtb_error_d)) { + rtb_Divide = AutopilotLaws_P.Gain_Gain_fs * std::asin(Phi1_tmp); + switch (static_cast(rtb_dme)) { case 0: - b_L = AutopilotLaws_P.Constant_Value_dh; + rtb_Mod2_d = AutopilotLaws_P.Constant_Value_dh; break; case 1: - b_L = a; + rtb_Mod2_d = rtb_Product_g5; break; case 2: @@ -2345,235 +2310,243 @@ void AutopilotLawsModelClass::step() case 3: if (rtb_Compare_jy) { - b_L = rtb_lo_b; - } else if (distance_m > AutopilotLaws_P.Switch_Threshold) { - b_L = std::fmax(rtb_lo_b, rtb_Sum_i); + rtb_Mod2_d = rtb_lo_i; + } else if (rtb_Y_a_tmp > AutopilotLaws_P.Switch_Threshold) { + rtb_Mod2_d = std::fmax(rtb_lo_i, rtb_Sum_i); } else { - b_L = std::fmin(rtb_lo_b, rtb_Sum_i); + rtb_Mod2_d = std::fmin(rtb_lo_i, rtb_Sum_i); } break; case 4: - b_L = rtb_Cos1_pk; + rtb_Mod2_d = rtb_Sum_gq; break; case 5: - b_L = rtb_FD_h; + rtb_Mod2_d = rtb_FD_f; break; case 6: - b_L = AutopilotLaws_P.Gain1_Gain_d * rtb_Product_dh; + rtb_Mod2_d = AutopilotLaws_P.Gain1_Gain_d * rtb_Product_hz; break; case 7: if (rtb_on_ground > AutopilotLaws_P.Switch1_Threshold_j) { - b_L = AutopilotLaws_P.Gain2_Gain_h * rtb_Gain4; + rtb_Mod2_d = AutopilotLaws_P.Gain2_Gain_h * rtb_Gain4; } else { - b_L = ((AutopilotLaws_P.Gain1_Gain_i * rtb_Y_pf + rtb_Y_i) + rtb_Sum1_g * rtb_uDLookupTable_m) * + rtb_Mod2_d = ((AutopilotLaws_P.Gain1_Gain_i * rtb_Y_af + rtb_Y_j) + rtb_Sum1_g * rtb_uDLookupTable_m) * AutopilotLaws_P.Gain6_Gain_f; } break; case 8: - b_L = R; + rtb_Mod2_d = rtb_Y_e; break; default: - b_L = rtb_Sum_kq; + rtb_Mod2_d = rtb_Divide; break; } - if (b_L > AutopilotLaws_P.Constant1_Value_i) { - rtb_Gain1_pj = AutopilotLaws_P.Constant1_Value_i; + if (rtb_Mod2_d > AutopilotLaws_P.Constant1_Value_i) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_i; } else { - rtb_Gain1_pj = AutopilotLaws_P.Gain1_Gain_n * AutopilotLaws_P.Constant1_Value_i; - if (b_L >= rtb_Gain1_pj) { - rtb_Gain1_pj = b_L; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_n * AutopilotLaws_P.Constant1_Value_i; + if (rtb_Mod2_d >= AutopilotLaws_DWork.DelayInput1_DSTATE) { + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Mod2_d; } } - AutopilotLaws_RateLimiter(rtb_Gain1_pj - rtb_dme, AutopilotLaws_P.RateLimiterVariableTs1_up, + AutopilotLaws_RateLimiter(AutopilotLaws_DWork.DelayInput1_DSTATE - Phi1, AutopilotLaws_P.RateLimiterVariableTs1_up, AutopilotLaws_P.RateLimiterVariableTs1_lo, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs1_InitialCondition, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_RateLimiter_h); - AutopilotLaws_LagFilter(rtb_Gain1_pj, AutopilotLaws_P.LagFilter_C1_gh, AutopilotLaws_U.in.time.dt, &R, - &AutopilotLaws_DWork.sf_LagFilter_pe); - AutopilotLaws_DWork.icLoad_f = ((rtb_fpmtoms == 0) || AutopilotLaws_DWork.icLoad_f); + AutopilotLaws_P.RateLimiterVariableTs1_InitialCondition, &AutopilotLaws_DWork.DelayInput1_DSTATE, + &AutopilotLaws_DWork.sf_RateLimiter_h); + AutopilotLaws_LagFilter(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.LagFilter_C1_gh, + AutopilotLaws_U.in.time.dt, &rtb_Y_e, &AutopilotLaws_DWork.sf_LagFilter_pe); + AutopilotLaws_DWork.icLoad_f = ((rtb_BusAssignment.output.ap_on == 0.0) || AutopilotLaws_DWork.icLoad_f); if (AutopilotLaws_DWork.icLoad_f) { AutopilotLaws_DWork.Delay_DSTATE_h2 = rtb_GainTheta; } - AutopilotLaws_VSLimiter(AutopilotLaws_P.VS_Gain_n * a, &AutopilotLaws_Y.out, &rtb_Gain1_pj); - if (!rtb_Compare_jy) { - if (distance_m > AutopilotLaws_P.Switch_Threshold_h) { - rtb_lo_b = std::fmax(rtb_lo_b, AutopilotLaws_P.VS_Gain_j * rtb_Sum_i); - } else { - rtb_lo_b = std::fmin(rtb_lo_b, AutopilotLaws_P.VS_Gain_j * rtb_Sum_i); - } + AutopilotLaws_VSLimiter(AutopilotLaws_P.VS_Gain_n * rtb_Product_g5, &rtb_BusAssignment, &rtb_Mod2_d); + if (rtb_Compare_jy) { + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_lo_i; + } else if (rtb_Y_a_tmp > AutopilotLaws_P.Switch_Threshold_h) { + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(rtb_lo_i, AutopilotLaws_P.VS_Gain_j * rtb_Sum_i); + } else { + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmin(rtb_lo_i, AutopilotLaws_P.VS_Gain_j * rtb_Sum_i); } - AutopilotLaws_VSLimiter(AutopilotLaws_P.Gain_Gain_k2 * rtb_lo_b, &AutopilotLaws_Y.out, &distance_m); - AutopilotLaws_VSLimiter_f(rtb_Product_dh, &AutopilotLaws_Y.out, &rtb_lo_b); - a = AutopilotLaws_P.Gain3_Gain_l * rtb_Y_pf; - b_L = AutopilotLaws_P.VS_Gain_e * rtb_Sum1_g; - AutopilotLaws_WashoutFilter(rtb_Saturation, AutopilotLaws_P.WashoutFilter1_C1_h, AutopilotLaws_U.in.time.dt, &rtb_dme, + AutopilotLaws_VSLimiter(AutopilotLaws_P.Gain_Gain_k2 * AutopilotLaws_DWork.DelayInput1_DSTATE, &rtb_BusAssignment, + &rtb_lo_i); + limit = limit_tmp * 0.3 * 57.295779513082323; + rtb_Product_g5 = AutopilotLaws_P.Gain3_Gain_l * rtb_Y_af; + rtb_Sum_gq = AutopilotLaws_P.VS_Gain_e * rtb_Sum1_g; + AutopilotLaws_WashoutFilter(Phi2, AutopilotLaws_P.WashoutFilterBeta_c_C1, AutopilotLaws_U.in.time.dt, &Phi1, &AutopilotLaws_DWork.sf_WashoutFilter_k); - rtb_Add3_j4 = std::abs(rtb_dme); - if (rtb_Add3_j4 > AutopilotLaws_P.Saturation_UpperSat_ig) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_UpperSat_ig; - } else if (rtb_Add3_j4 < AutopilotLaws_P.Saturation_LowerSat_ous) { - rtb_Add3_j4 = AutopilotLaws_P.Saturation_LowerSat_ous; - } - - rtb_Saturation = AutopilotLaws_P.Gain_Gain_j0 * rtb_Add3_j4; - if (rtb_on_ground <= AutopilotLaws_P.Switch_Threshold_c) { - rtb_Gain4 = ((rtb_Y_i + a) + rtb_uDLookupTable_m * b_L) + rtb_Saturation; - } - - AutopilotLaws_VSLimiter_f(rtb_Gain4, &AutopilotLaws_Y.out, &rtb_dme); - if (!rtb_Compare_l) { - if (rtb_Sum3_m3 > AutopilotLaws_P.Switch_Threshold_hz) { - rtb_GainTheta1 = std::fmax(rtb_GainTheta1, AutopilotLaws_P.VS_Gain_n5 * rtb_Gain_n4); - } else { - rtb_GainTheta1 = std::fmin(rtb_GainTheta1, AutopilotLaws_P.VS_Gain_n5 * rtb_Gain_n4); - } + AutopilotLaws_DWork.DelayInput1_DSTATE = std::abs(Phi1); + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ig) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ig; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_ous) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_ous; + } + + Phi2 = AutopilotLaws_P.Gain_Gain_j0 * AutopilotLaws_DWork.DelayInput1_DSTATE; + Phi1 = limit_tmp * 0.6 * 57.295779513082323; + if (rtb_OR1) { + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_GainTheta1; + } else if (rtb_Sum3_m3 > AutopilotLaws_P.Switch_Threshold_hz) { + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(rtb_GainTheta1, AutopilotLaws_P.VS_Gain_n5 * rtb_Gain7_j); + } else { + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmin(rtb_GainTheta1, AutopilotLaws_P.VS_Gain_n5 * rtb_Gain7_j); } - AutopilotLaws_Voter1(rtb_Sum_es, AutopilotLaws_P.Gain_Gain_o2 * rtb_GainTheta1, AutopilotLaws_P.VS_Gain_nx * - rtb_Add3_aj, &rtb_Sum_i); - AutopilotLaws_VSLimiter(rtb_Sum_i, &AutopilotLaws_Y.out, &rtb_GainTheta1); + AutopilotLaws_Voter1(rtb_Sum_es, AutopilotLaws_P.Gain_Gain_o2 * AutopilotLaws_DWork.DelayInput1_DSTATE, + AutopilotLaws_P.VS_Gain_nx * R, &rtb_GainTheta1); + rtb_Gain7_j = limit_tmp * 0.5 * 57.295779513082323; if (AutopilotLaws_U.in.input.vertical_mode == 24.0) { - rtb_Add3_j4 = 0.15; + Phi1_tmp = 0.15; } else { - rtb_Add3_j4 = 0.1; + Phi1_tmp = 0.1; } - rtb_Y_pf = rtb_lo_k * rtb_Add3_j4 * 57.295779513082323; - switch (static_cast(rtb_error_d)) { + R = limit_tmp * Phi1_tmp * 57.295779513082323; + switch (static_cast(rtb_dme)) { case 0: - rtb_Gain1_pj = AutopilotLaws_P.Constant_Value_dh; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_dh; break; case 1: + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_Mod2_d; break; case 2: - rtb_Gain1_pj = L; + AutopilotLaws_DWork.DelayInput1_DSTATE = a; break; case 3: - rtb_Gain1_pj = distance_m; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_lo_i; break; case 4: - rtb_Gain1_pj = rtb_Cos_i; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_lo; break; case 5: - rtb_Gain1_pj = rtb_Cos1_j; + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_AP_mp; break; case 6: - rtb_Gain1_pj = rtb_lo_b; + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(-limit, std::fmin(limit, rtb_Product_hz)); break; case 7: - rtb_Gain1_pj = rtb_dme; + if (rtb_on_ground <= AutopilotLaws_P.Switch_Threshold_c) { + rtb_Gain4 = ((rtb_Y_j + rtb_Product_g5) + rtb_uDLookupTable_m * rtb_Sum_gq) + Phi2; + } + + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(-Phi1, std::fmin(Phi1, rtb_Gain4)); break; case 8: - rtb_Gain1_pj = rtb_GainTheta1; + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(-rtb_Gain7_j, std::fmin(rtb_Gain7_j, rtb_GainTheta1)); break; default: - rtb_Gain1_pj = std::fmax(-rtb_Y_pf, std::fmin(rtb_Y_pf, AutopilotLaws_P.VS_Gain_ne * rtb_Sum_kq)); + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmax(-R, std::fmin(R, AutopilotLaws_P.VS_Gain_ne * rtb_Divide)); break; } - rtb_Gain1_pj += rtb_GainTheta; - if (rtb_Gain1_pj > AutopilotLaws_P.Constant1_Value_i) { - rtb_Gain1_pj = AutopilotLaws_P.Constant1_Value_i; + AutopilotLaws_DWork.DelayInput1_DSTATE += rtb_GainTheta; + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Constant1_Value_i) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant1_Value_i; } else { rtb_GainTheta1 = AutopilotLaws_P.Gain1_Gain_m4 * AutopilotLaws_P.Constant1_Value_i; - if (rtb_Gain1_pj < rtb_GainTheta1) { - rtb_Gain1_pj = rtb_GainTheta1; + if (AutopilotLaws_DWork.DelayInput1_DSTATE < rtb_GainTheta1) { + AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_GainTheta1; } } - rtb_GainTheta1 = rtb_lo_k * 0.3 * 57.295779513082323; - AutopilotLaws_DWork.DelayInput1_DSTATE = rtb_GainTheta1 * AutopilotLaws_U.in.time.dt; - rtb_Gain1_pj = std::fmin(rtb_Gain1_pj - AutopilotLaws_DWork.Delay_DSTATE_h2, AutopilotLaws_DWork.DelayInput1_DSTATE); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain1_Gain_i0 * rtb_GainTheta1; - AutopilotLaws_DWork.DelayInput1_DSTATE *= AutopilotLaws_U.in.time.dt; - AutopilotLaws_DWork.Delay_DSTATE_h2 += std::fmax(rtb_Gain1_pj, AutopilotLaws_DWork.DelayInput1_DSTATE); + AutopilotLaws_DWork.DelayInput1_DSTATE -= AutopilotLaws_DWork.Delay_DSTATE_h2; + AutopilotLaws_DWork.DelayInput1_DSTATE = std::fmin(AutopilotLaws_DWork.DelayInput1_DSTATE, Phi1 * + AutopilotLaws_U.in.time.dt); + AutopilotLaws_DWork.Delay_DSTATE_h2 += std::fmax(AutopilotLaws_DWork.DelayInput1_DSTATE, AutopilotLaws_P.Gain1_Gain_i0 + * Phi1 * AutopilotLaws_U.in.time.dt); AutopilotLaws_LagFilter(AutopilotLaws_DWork.Delay_DSTATE_h2, AutopilotLaws_P.LagFilter_C1_i, - AutopilotLaws_U.in.time.dt, &rtb_dme, &AutopilotLaws_DWork.sf_LagFilter_gn); - AutopilotLaws_RateLimiter(static_cast(rtb_fpmtoms), AutopilotLaws_P.RateLimiterVariableTs_up_i, + AutopilotLaws_U.in.time.dt, &Phi1, &AutopilotLaws_DWork.sf_LagFilter_gn); + AutopilotLaws_RateLimiter(rtb_BusAssignment.output.ap_on, AutopilotLaws_P.RateLimiterVariableTs_up_i, AutopilotLaws_P.RateLimiterVariableTs_lo_o, AutopilotLaws_U.in.time.dt, - AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_p, &rtb_Gain1_pj, &AutopilotLaws_DWork.sf_RateLimiter_eb); - if (rtb_Gain1_pj > AutopilotLaws_P.Saturation_UpperSat_ix) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_UpperSat_ix; - } else if (rtb_Gain1_pj < AutopilotLaws_P.Saturation_LowerSat_eq) { - rtb_Gain1_pj = AutopilotLaws_P.Saturation_LowerSat_eq; - } - - rtb_GainTheta1 = rtb_dme * rtb_Gain1_pj; - AutopilotLaws_LagFilter(rtb_Y_j, AutopilotLaws_P.LagFilter1_C1_d, AutopilotLaws_U.in.time.dt, &rtb_dme, + AutopilotLaws_P.RateLimiterVariableTs_InitialCondition_p, &AutopilotLaws_DWork.DelayInput1_DSTATE, + &AutopilotLaws_DWork.sf_RateLimiter_eb); + if (AutopilotLaws_DWork.DelayInput1_DSTATE > AutopilotLaws_P.Saturation_UpperSat_ix) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_UpperSat_ix; + } else if (AutopilotLaws_DWork.DelayInput1_DSTATE < AutopilotLaws_P.Saturation_LowerSat_eq) { + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Saturation_LowerSat_eq; + } + + rtb_GainTheta1 = Phi1 * AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Constant_Value_i4 - AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_DWork.DelayInput1_DSTATE *= rtb_GainTheta; + AutopilotLaws_DWork.DelayInput1_DSTATE += rtb_GainTheta1; + R = AutopilotLaws_P.kntofpm_Gain_h * AutopilotLaws_U.in.data.V_gnd_kn * AutopilotLaws_P.maxslope_Gain_j; + AutopilotLaws_LagFilter(rtb_Y_h, AutopilotLaws_P.LagFilter1_C1_d, AutopilotLaws_U.in.time.dt, &Phi1, &AutopilotLaws_DWork.sf_LagFilter_cs); - AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.Gain7_Gain_l * rtb_dme; - AutopilotLaws_Y.out.output.flight_director.Theta_c_deg = R; - AutopilotLaws_Y.out.output.autopilot.Theta_c_deg = (AutopilotLaws_P.Constant_Value_i4 - rtb_Gain1_pj) * rtb_GainTheta - + rtb_GainTheta1; - AutopilotLaws_Y.out.output.flare_law.condition_Flare = ((AutopilotLaws_U.in.data.H_radio_ft < 60.0) && - ((AutopilotLaws_U.in.data.H_radio_ft * 15.0 <= std::abs(std::fmax(AutopilotLaws_DWork.DelayInput1_DSTATE, Phi2))) || - (AutopilotLaws_U.in.data.H_radio_ft <= 45.0))); - AutopilotLaws_Y.out.output.flare_law.H_dot_radio_fpm = rtb_Add3_lz; + AutopilotLaws_Y.out = rtb_BusAssignment; + AutopilotLaws_Y.out.output.flight_director.Theta_c_deg = rtb_Y_e; + AutopilotLaws_Y.out.output.autopilot.Theta_c_deg = AutopilotLaws_DWork.DelayInput1_DSTATE; + AutopilotLaws_Y.out.output.flare_law.condition_Flare = ((rtb_BusAssignment.data.H_radio_ft < 80.0) && + ((rtb_BusAssignment.data.H_radio_ft * 12.7 <= std::abs(std::fmin(std::fmax(b_R - R, AutopilotLaws_P.Gain7_Gain_l * + Phi1), R + b_R))) || (rtb_BusAssignment.data.H_radio_ft <= 45.0))); + AutopilotLaws_Y.out.output.flare_law.H_dot_radio_fpm = rtb_MaxH_dot_RA1; AutopilotLaws_Y.out.output.flare_law.H_dot_c_fpm = rtb_Vz; - AutopilotLaws_Y.out.output.flare_law.delta_Theta_H_dot_deg = b_L; - AutopilotLaws_Y.out.output.flare_law.delta_Theta_bz_deg = rtb_Y_i; - AutopilotLaws_Y.out.output.flare_law.delta_Theta_bx_deg = a; - AutopilotLaws_Y.out.output.flare_law.delta_Theta_beta_c_deg = rtb_Saturation; + AutopilotLaws_Y.out.output.flare_law.delta_Theta_H_dot_deg = rtb_Sum_gq; + AutopilotLaws_Y.out.output.flare_law.delta_Theta_bz_deg = rtb_Y_j; + AutopilotLaws_Y.out.output.flare_law.delta_Theta_bx_deg = rtb_Product_g5; + AutopilotLaws_Y.out.output.flare_law.delta_Theta_beta_c_deg = Phi2; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_U.in.data.altimeter_setting_left_mbar; AutopilotLaws_DWork.DelayInput1_DSTATE_g = AutopilotLaws_U.in.data.altimeter_setting_right_mbar; - AutopilotLaws_DWork.Delay_DSTATE = b_R; - for (rtb_fpmtoms = 0; rtb_fpmtoms < 99; rtb_fpmtoms++) { - AutopilotLaws_DWork.Delay_DSTATE_l[rtb_fpmtoms] = AutopilotLaws_DWork.Delay_DSTATE_l[rtb_fpmtoms + 1]; - AutopilotLaws_DWork.Delay_DSTATE_h5[rtb_fpmtoms] = AutopilotLaws_DWork.Delay_DSTATE_h5[rtb_fpmtoms + 1]; + AutopilotLaws_DWork.Delay_DSTATE = b_L; + for (rtb_on_ground = 0; rtb_on_ground < 99; rtb_on_ground++) { + AutopilotLaws_DWork.Delay_DSTATE_l[rtb_on_ground] = AutopilotLaws_DWork.Delay_DSTATE_l[rtb_on_ground + 1]; + AutopilotLaws_DWork.Delay_DSTATE_h5[rtb_on_ground] = AutopilotLaws_DWork.Delay_DSTATE_h5[rtb_on_ground + 1]; } AutopilotLaws_DWork.Delay_DSTATE_l[99] = rtb_valid; - AutopilotLaws_DWork.Delay_DSTATE_h5[99] = rtb_valid_d; + AutopilotLaws_DWork.Delay_DSTATE_h5[99] = rtb_valid_e; AutopilotLaws_DWork.icLoad = false; - AutopilotLaws_DWork.Delay_DSTATE_c = rtb_Add3_g; - AutopilotLaws_DWork.Delay_DSTATE_b = rtb_Add3_i; + AutopilotLaws_DWork.Delay_DSTATE_c = rtb_Gain_a0; + AutopilotLaws_DWork.Delay_DSTATE_b = rtb_Gain_lb; AutopilotLaws_DWork.icLoad_f = false; } void AutopilotLawsModelClass::initialize() { { - real_T rtb_out_f; + real_T rtb_out_k; + int32_T i; AutopilotLaws_DWork.DelayInput1_DSTATE = AutopilotLaws_P.DetectChange_vinit; AutopilotLaws_DWork.DelayInput1_DSTATE_g = AutopilotLaws_P.DetectChange1_vinit; AutopilotLaws_DWork.Delay_DSTATE = AutopilotLaws_P.DiscreteDerivativeVariableTs_InitialCondition; - AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_InitialCondition; - for (int32_T i{0}; i < 100; i++) { + for (i = 0; i < 100; i++) { AutopilotLaws_DWork.Delay_DSTATE_l[i] = AutopilotLaws_P.Delay_InitialCondition; AutopilotLaws_DWork.Delay_DSTATE_h5[i] = AutopilotLaws_P.Delay_InitialCondition_b; } + AutopilotLaws_DWork.Delay_DSTATE_h = AutopilotLaws_P.DiscreteTimeIntegratorVariableTs_InitialCondition; AutopilotLaws_DWork.icLoad = true; AutopilotLaws_DWork.Delay_DSTATE_c = AutopilotLaws_P.DiscreteDerivativeVariableTs1_InitialCondition; AutopilotLaws_DWork.Delay_DSTATE_b = AutopilotLaws_P.DiscreteDerivativeVariableTs_InitialCondition_f; AutopilotLaws_DWork.icLoad_f = true; - AutopilotLaws_Chart_g_Init(&rtb_out_f); - AutopilotLaws_Chart_g_Init(&rtb_out_f); - AutopilotLaws_Chart_Init(&rtb_out_f); + AutopilotLaws_Chart_g_Init(&rtb_out_k); + AutopilotLaws_Chart_Init(&rtb_out_k); AutopilotLaws_MATLABFunction_f_Init(&AutopilotLaws_DWork.sf_MATLABFunction_m); - AutopilotLaws_Chart_Init(&rtb_out_f); - AutopilotLaws_MATLABFunction_f_Init(&AutopilotLaws_DWork.sf_MATLABFunction_e); + AutopilotLaws_Chart_Init(&rtb_out_k); + AutopilotLaws_MATLABFunction_f_Init(&AutopilotLaws_DWork.sf_MATLABFunction_e5); + AutopilotLaws_Chart_g_Init(&rtb_out_k); AutopilotLaws_B.u = AutopilotLaws_P.Y_Y0; AutopilotLaws_DWork.k = 5.0; AutopilotLaws_DWork.maxH_dot = 1500.0; + AutopilotLaws_DWork.Tau = 1.0; } } @@ -2589,6 +2562,4 @@ AutopilotLawsModelClass::AutopilotLawsModelClass(): { } -AutopilotLawsModelClass::~AutopilotLawsModelClass() -{ -} +AutopilotLawsModelClass::~AutopilotLawsModelClass() = default; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.h index 249b17195a4..ff0a59131ec 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws.h @@ -1,10 +1,9 @@ -#ifndef RTW_HEADER_AutopilotLaws_h_ -#define RTW_HEADER_AutopilotLaws_h_ -#include +#ifndef AutopilotLaws_h_ +#define AutopilotLaws_h_ #include "rtwtypes.h" #include "AutopilotLaws_types.h" -class AutopilotLawsModelClass +class AutopilotLawsModelClass final { public: struct rtDW_LagFilter_AutopilotLaws_T { @@ -75,8 +74,8 @@ class AutopilotLawsModelClass real_T Delay_DSTATE_h2; real_T prevVerticalLaw; real_T prevTarget; - real_T prevVerticalLaw_b; - real_T prevTarget_k; + real_T prevVerticalLaw_c; + real_T prevTarget_p; real_T Tau; real_T H_bias; real_T dH_offset; @@ -84,7 +83,8 @@ class AutopilotLawsModelClass real_T maxH_dot; real_T nav_gs_deg; real_T pY; - real_T pY_b; + real_T pY_f; + real_T storage; real_T limit; boolean_T Delay_DSTATE_l[100]; boolean_T Delay_DSTATE_h5[100]; @@ -95,16 +95,17 @@ class AutopilotLawsModelClass boolean_T prevVerticalLaw_not_empty; boolean_T prevTarget_not_empty; boolean_T islevelOffActive; - boolean_T prevVerticalLaw_not_empty_n; - boolean_T prevTarget_not_empty_j; - boolean_T islevelOffActive_k; + boolean_T prevVerticalLaw_not_empty_k; + boolean_T prevTarget_not_empty_i; + boolean_T islevelOffActive_l; boolean_T wasActive; boolean_T wasActive_not_empty; - boolean_T wasActive_c; - boolean_T wasActive_not_empty_p; + boolean_T wasActive_n; + boolean_T wasActive_not_empty_n; boolean_T nav_gs_deg_not_empty; boolean_T pY_not_empty; - boolean_T pY_not_empty_g; + boolean_T pY_not_empty_d; + boolean_T storage_not_empty; boolean_T limit_not_empty; rtDW_WashoutFilter_AutopilotLaws_T sf_WashoutFilter_j; rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter_p; @@ -142,9 +143,9 @@ class AutopilotLawsModelClass rtDW_WashoutFilter_AutopilotLaws_T sf_WashoutFilter_k; rtDW_WashoutFilter_AutopilotLaws_T sf_WashoutFilter_g; rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter_hp; + rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_a; rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter_k; rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_cs; - rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_a; rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_g; rtDW_WashoutFilter_AutopilotLaws_T sf_WashoutFilter_d; rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter_m; @@ -153,12 +154,13 @@ class AutopilotLawsModelClass rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter_o; rtDW_LeadLagFilter_AutopilotLaws_T sf_LeadLagFilter; rtDW_Chart_AutopilotLaws_T sf_Chart_ba; - rtDW_MATLABFunction_AutopilotLaws_d_T sf_MATLABFunction_e; + rtDW_MATLABFunction_AutopilotLaws_d_T sf_MATLABFunction_e5; rtDW_RateLimiter_AutopilotLaws_T sf_RateLimiter_d; rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_o; rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_mp; rtDW_storevalue_AutopilotLaws_T sf_storevalue; rtDW_Chart_AutopilotLaws_m_T sf_Chart_b; + rtDW_RateLimiter_AutopilotLaws_l_T sf_RateLimiter_m; rtDW_RateLimiter_AutopilotLaws_l_T sf_RateLimiter_e; rtDW_LagFilter_AutopilotLaws_T sf_LagFilter_h2; rtDW_Chart_AutopilotLaws_m_T sf_Chart_h; @@ -184,18 +186,20 @@ class AutopilotLawsModelClass ap_laws_output ap_laws_output_MATLABStruct; real_T ScheduledGain2_BreakpointsForDimension1[7]; real_T ScheduledGain_BreakpointsForDimension1[6]; - real_T ScheduledGain_BreakpointsForDimension1_j[3]; + real_T ScheduledGain1_BreakpointsForDimension1[5]; + real_T ScheduledGain3_BreakpointsForDimension1[6]; real_T ScheduledGain_BreakpointsForDimension1_h[7]; real_T ScheduledGain_BreakpointsForDimension1_o[7]; + real_T ScheduledGain_BreakpointsForDimension1_j[3]; real_T ScheduledGain_BreakpointsForDimension1_a[8]; - real_T ScheduledGain3_BreakpointsForDimension1[5]; + real_T ScheduledGain3_BreakpointsForDimension1_i[5]; real_T ScheduledGain2_BreakpointsForDimension1_h[8]; - real_T ScheduledGain1_BreakpointsForDimension1[7]; + real_T ScheduledGain1_BreakpointsForDimension1_d[7]; real_T LagFilter2_C1; real_T LagFilter_C1; + real_T LagFilter1_C1; real_T LagFilter_C1_g; real_T LagFilter_C1_a; - real_T LagFilter1_C1; real_T LagFilter_C1_k; real_T LagFilter_C1_l; real_T WashoutFilter_C1; @@ -237,7 +241,7 @@ class AutopilotLawsModelClass real_T LowPassFilter_C1_d1; real_T LagFilter_C1_b; real_T LagFilter_C1_gh; - real_T WashoutFilter1_C1_h; + real_T WashoutFilterBeta_c_C1; real_T LagFilter_C1_i; real_T LagFilter1_C1_d; real_T HighPassFilter_C2; @@ -308,9 +312,10 @@ class AutopilotLawsModelClass real_T VS_Gain_ne; real_T RateLimiterVariableTs_InitialCondition; real_T DiscreteDerivativeVariableTs_InitialCondition; - real_T DiscreteTimeIntegratorVariableTs_InitialCondition; real_T RateLimiterVariableTs_InitialCondition_l; + real_T DiscreteTimeIntegratorVariableTs_InitialCondition; real_T RateLimiterVariableTs_InitialCondition_i; + real_T RateLimiterVariableTs2_InitialCondition; real_T RateLimiterVariableTs_InitialCondition_il; real_T DiscreteDerivativeVariableTs1_InitialCondition; real_T RateLimiterVariableTs_InitialCondition_m; @@ -320,22 +325,24 @@ class AutopilotLawsModelClass real_T DiscreteTimeIntegratorVariableTs_LowerLimit; real_T ScheduledGain2_Table[7]; real_T ScheduledGain_Table[6]; - real_T ScheduledGain_Table_p[3]; + real_T ScheduledGain1_Table[5]; + real_T ScheduledGain3_Table[6]; real_T ScheduledGain_Table_o[7]; real_T ScheduledGain_Table_e[7]; + real_T ScheduledGain_Table_p[3]; real_T ScheduledGain_Table_j[8]; - real_T ScheduledGain3_Table[5]; + real_T ScheduledGain3_Table_a[5]; real_T ScheduledGain2_Table_p[8]; - real_T ScheduledGain1_Table[7]; + real_T ScheduledGain1_Table_n[7]; real_T DiscreteTimeIntegratorVariableTs_UpperLimit; real_T Subsystem_Value; real_T Subsystem_Value_n; real_T CompareToConstant2_const; real_T CompareToConstant1_const; real_T CompareToConstant_const; - real_T CompareToConstant_const_k; real_T CompareToConstant5_const; real_T CompareToConstant4_const; + real_T CompareToConstant_const_k; real_T CompareToConstant5_const_e; real_T CompareToConstant1_const_c; real_T CompareToConstant6_const; @@ -358,6 +365,7 @@ class AutopilotLawsModelClass real_T RateLimiterVariableTs_lo; real_T RateLimiterVariableTs_lo_n; real_T RateLimiterVariableTs_lo_k; + real_T RateLimiterVariableTs2_lo; real_T RateLimiterVariableTs_lo_b; real_T RateLimiterVariableTs_lo_c; real_T RateLimiterVariableTs1_lo; @@ -365,6 +373,7 @@ class AutopilotLawsModelClass real_T RateLimiterVariableTs_up; real_T RateLimiterVariableTs_up_h; real_T RateLimiterVariableTs_up_n; + real_T RateLimiterVariableTs2_up; real_T RateLimiterVariableTs_up_b; real_T RateLimiterVariableTs_up_d; real_T RateLimiterVariableTs1_up; @@ -381,11 +390,12 @@ class AutopilotLawsModelClass real_T Gain_Gain_e; real_T Gain1_Gain_k; real_T Gain_Gain_ae; + real_T Gain5_Gain; + real_T Constant1_Value; real_T Gain2_Gain; real_T Gain_Gain_c; real_T Saturation_UpperSat; real_T Saturation_LowerSat; - real_T k_beta_Phi_Gain; real_T Gain1_Gain_g; real_T Gain1_Gain_l; real_T Gain_Gain_f; @@ -407,8 +417,9 @@ class AutopilotLawsModelClass real_T beta_Value_b; real_T beta_Value_i; real_T beta_Value_c; - real_T Saturation_UpperSat_e; - real_T Saturation_LowerSat_f; + real_T Constant_Value_o; + real_T Saturation_UpperSat_j; + real_T Saturation_LowerSat_p; real_T Gain7_Gain; real_T Gain1_Gain_j; real_T Gain_Gain_i; @@ -419,15 +430,18 @@ class AutopilotLawsModelClass real_T beta1_Value_m; real_T beta1_Value_d; real_T beta1_Value_hy; + real_T Constant_Value_p; + real_T Saturation_UpperSat_g; + real_T Saturation_LowerSat_n; real_T Gain3_Gain; - real_T Constant1_Value; + real_T Constant1_Value_j; real_T Constant_Value_d; real_T Constant_Value_g; real_T Gain6_Gain; real_T Switch1_Threshold; real_T Constant1_Value_g; - real_T Gain5_Gain; - real_T Constant_Value_p; + real_T Gain5_Gain_g; + real_T Constant_Value_p0; real_T Gain6_Gain_j; real_T Switch1_Threshold_f; real_T Constant1_Value_a; @@ -437,7 +451,7 @@ class AutopilotLawsModelClass real_T Saturation1_UpperSat_a; real_T Saturation1_LowerSat_i; real_T Constant1_Value_h; - real_T Constant_Value_p0; + real_T Constant_Value_p0d; real_T Gain6_Gain_n; real_T Switch1_Threshold_d; real_T Constant1_Value_m; @@ -460,7 +474,7 @@ class AutopilotLawsModelClass real_T Gain6_Gain_a; real_T Gain5_Gain_k; real_T Switch_Threshold_h; - real_T Constant_Value_o; + real_T Constant_Value_o3; real_T Constant1_Value_g5; real_T Gain1_Gain_m; real_T Constant2_Value_m; @@ -480,7 +494,7 @@ class AutopilotLawsModelClass real_T Gain6_Gain_c; real_T Switch1_Threshold_b; real_T Constant1_Value_mi; - real_T Gain5_Gain_g; + real_T Gain5_Gain_gm; real_T GainTheta_Gain; real_T GainTheta1_Gain; real_T Gain_Gain_d; @@ -488,6 +502,7 @@ class AutopilotLawsModelClass real_T Gain_Gain_m; real_T Gain_Gain_de; real_T Gainpk_Gain; + real_T Bias_Bias; real_T Gain3_Gain_a; real_T Gain_Gain_n; real_T Constant1_Value_b; @@ -505,14 +520,29 @@ class AutopilotLawsModelClass real_T zeta_Value; real_T Gain1_Gain_f; real_T Saturation_UpperSat_b; - real_T Saturation_LowerSat_n; + real_T Saturation_LowerSat_nz; real_T Gain_Gain_h; real_T Constant3_Value_p; real_T Constant3_Value_c2; real_T Gain2_Gain_i; real_T Gain3_Gain_i; real_T Constant3_Value_if; - real_T Constant1_Value_fk; + real_T Constant3_Value_m; + real_T Gain_Gain_fn; + real_T Constant2_Value_l; + real_T Saturation_UpperSat_e; + real_T Saturation_LowerSat_f; + real_T Constant3_Value_cd; + real_T Gain_Gain_cy; + real_T Gain1_Gain_o; + real_T Gain_Gain_o; + real_T Constant3_Value_k; + real_T Gain_Gain_p; + real_T Gain1_Gain_i4; + real_T Gain_Gain_l; + real_T tau_Value_c; + real_T zeta_Value_h; + real_T Gain_Gain_lu; real_T Constant3_Value_nr; real_T Constant3_Value_hr; real_T Gain1_Gain_nr; @@ -526,28 +556,16 @@ class AutopilotLawsModelClass real_T Constant3_Value_o; real_T Constant3_Value_dk; real_T Gain1_Gain_fq; - real_T Gain_Gain_o; + real_T Gain_Gain_oc; real_T Constant1_Value_e; - real_T Constant3_Value_m; - real_T Gain_Gain_fn; - real_T Constant2_Value_l; - real_T Constant3_Value_cd; - real_T Gain_Gain_cy; - real_T Gain1_Gain_o; - real_T Gain_Gain_o5; - real_T Constant3_Value_k; - real_T Gain_Gain_p; - real_T Gain1_Gain_i4; - real_T Gain_Gain_l; - real_T tau_Value_c; - real_T zeta_Value_h; - real_T Gain_Gain_lu; real_T Gain5_Gain_o; real_T Gain_Gain_b; real_T Saturation_UpperSat_k; real_T Saturation_LowerSat_f3; real_T Constant_Value_a; - real_T Gain4_Gain_o; + real_T Gain10_Gain; + real_T Saturation2_UpperSat; + real_T Saturation2_LowerSat; real_T Switch_Threshold_n; real_T Gain_Gain_m3; real_T Saturation_UpperSat_c; @@ -573,7 +591,7 @@ class AutopilotLawsModelClass real_T Gain_Gain_es; real_T fpmtoms_Gain; real_T kntoms_Gain_m; - real_T Saturation_UpperSat_j; + real_T Saturation_UpperSat_jh; real_T Saturation_LowerSat_i; real_T Gain_Gain_e3; real_T Gain1_Gain_go; @@ -714,7 +732,7 @@ class AutopilotLawsModelClass real_T fpmtoms_Gain_p3; real_T kntoms_Gain_bq; real_T Saturation_UpperSat_ba; - real_T Saturation_LowerSat_p; + real_T Saturation_LowerSat_pk; real_T Gain_Gain_py; real_T Gain1_Gain_hk; real_T fpmtoms_Gain_j; @@ -839,12 +857,12 @@ class AutopilotLawsModelClass real_T Saturation_LowerSat_gk; real_T Gain_Gain_ow; real_T Gain2_Gain_l; - real_T Bias_Bias; + real_T Bias_Bias_k; real_T Gain1_Gain_d4; real_T Bias1_Bias; real_T Gain_Gain_eyl; real_T Constant2_Value_f; - real_T Gain4_Gain_oy; + real_T Gain4_Gain_o; real_T Gain5_Gain_c; real_T kntofpm_Gain; real_T maxslope_Gain; @@ -924,6 +942,8 @@ class AutopilotLawsModelClass real_T Saturation_UpperSat_ix; real_T Saturation_LowerSat_eq; real_T Constant_Value_i4; + real_T kntofpm_Gain_h; + real_T maxslope_Gain_j; real_T Gain7_Gain_l; boolean_T Delay_InitialCondition; boolean_T Delay_InitialCondition_b; @@ -931,8 +951,10 @@ class AutopilotLawsModelClass uint8_T ManualSwitch_CurrentSetting_b; }; - AutopilotLawsModelClass(AutopilotLawsModelClass const&) =delete; + AutopilotLawsModelClass(AutopilotLawsModelClass const&) = delete; AutopilotLawsModelClass& operator= (AutopilotLawsModelClass const&) & = delete; + AutopilotLawsModelClass(AutopilotLawsModelClass &&) = delete; + AutopilotLawsModelClass& operator= (AutopilotLawsModelClass &&) = delete; void setExternalInputs(const ExternalInputs_AutopilotLaws_T *pExternalInputs_AutopilotLaws_T) { AutopilotLaws_U = *pExternalInputs_AutopilotLaws_T; @@ -981,7 +1003,6 @@ class AutopilotLawsModelClass rtu_VS_AP, real_T rtu_VLS_FD, real_T rtu_VLS_AP, real_T rtu_VMAX_FD, real_T rtu_VMAX_AP, real_T rtu_margin, real_T *rty_FD, real_T *rty_AP); static void AutopilotLaws_VSLimiter(real_T rtu_u, const ap_laws_output *rtu_in, real_T *rty_y); - static void AutopilotLaws_VSLimiter_f(real_T rtu_u, const ap_laws_output *rtu_in, real_T *rty_y); static void AutopilotLaws_SignalEnablerGSTrack(real_T rtu_u, boolean_T rtu_e, real_T *rty_y); static void AutopilotLaws_Voter1(real_T rtu_u1, real_T rtu_u2, real_T rtu_u3, real_T *rty_Y); }; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_data.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_data.cpp index fcaf83d534d..b4246e887e1 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_data.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_data.cpp @@ -1,5 +1,4 @@ #include "AutopilotLaws.h" -#include "AutopilotLaws_private.h" AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::AutopilotLaws_P{ @@ -162,7 +161,10 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut { 0.0, 50.0, 100.0, 1000.0, 2500.0, 3000.0 }, - { 0.0, 150.0, 200.0 }, + { 0.0, 40.0, 45.0, 100.0, 200.0 }, + + + { -10.0, 0.0, 5.0, 10.0, 30.0, 100.0 }, { 100.0, 150.0, 200.0, 250.0, 300.0, 400.0, 500.0 }, @@ -171,6 +173,9 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut { 100.0, 150.0, 200.0, 250.0, 300.0, 400.0, 500.0 }, + { 0.0, 150.0, 200.0 }, + + { 0.0, 50.0, 100.0, 200.0, 400.0, 1000.0, 2500.0, 3000.0 }, @@ -186,12 +191,12 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 1.0, + 0.7, + 4.0, 2.0, - 0.7, - 2.0, 1.0, @@ -404,7 +409,7 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 1.0, - 0.81, + 1.3, 1.0, @@ -434,16 +439,21 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 0.0, + 0.0, + -3.0, { 1.6, 1.6, 2.0, 2.8, 3.2, 4.2, 4.5 }, - { 3.7, 3.7, 4.3, 7.8, 15.0, 15.0 }, + { 3.7, 3.7, 4.4, 7.8, 15.0, 15.0 }, - { 0.8, 0.2, 0.2 }, + { 0.0, 0.0, 0.8, 0.8, 0.8 }, + + + { 0.0, 0.4, 0.4, 0.4, 0.4, 0.4 }, { 1.6, 1.6, 2.0, 2.8, 3.2, 4.2, 4.5 }, @@ -452,6 +462,9 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut { 1.6, 1.6, 2.0, 2.8, 3.2, 4.2, 4.5 }, + { 0.8, 0.2, 0.2 }, + + { 0.0, 0.0, -0.15, -0.4, -0.775, -1.6, -3.0, -3.0 }, @@ -475,12 +488,12 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 30.0, - 6.0, - 1.0, 2.0, + 6.0, + 1.0, 2.0, @@ -525,6 +538,8 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut -1000.0, + -1000.0, + -10.0, -1000.0, @@ -537,7 +552,9 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 10.0, - 0.2, + 0.125, + + 0.33333333333333331, 1.0, @@ -571,6 +588,10 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut -1.0, + 1.5, + + 0.0, + -1.0, -1.0, @@ -579,8 +600,6 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut -45.0, - 0.4, - -1.0, -1.0, @@ -623,11 +642,13 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 0.0, - 15.0, + 1.0, - -15.0, + 1.0, + + 0.0, - 1.4, + 2.4, -1.0, @@ -647,7 +668,13 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 0.0, - 2.0, + 1.0, + + 1.0, + + 0.0, + + 2.4, 0.0, @@ -785,6 +812,8 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut -1.0, + -5.0, + -1.0, 2.0, @@ -833,69 +862,71 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 360.0, - 0.0, - - 360.0, - 360.0, - 0.017453292519943295, + -1.0, - 100.0, + 1.0, - 2.0, + 15.0, - 1200.0, + -15.0, - 70.0, + 360.0, - -70.0, + -1.0, - 0.1, + 1.16, - 360.0, + -2.0, 360.0, - 360.0, + -1.0, - 1.5, + 1.16, - -1.0, + -2.0, - 1.0, + 3.0, - 360.0, + 0.8, -1.0, - 1.0, + 360.0, 360.0, - -1.0, + 0.017453292519943295, - 1.16, + 100.0, - -2.0, + 2.0, - 360.0, + 1200.0, - -1.0, + 70.0, - 1.16, + -70.0, - -2.0, + 0.1, - 3.0, + 360.0, - 0.8, + 360.0, + + 360.0, + + 1.8, -1.0, + 1.0, + -1.2, - 1.0, + 0.3, 1.0, @@ -905,6 +936,10 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 1.0, + 20.0, + + -20.0, + 0.0, -0.04, @@ -1503,7 +1538,7 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 101.26859142607174, - 0.02, + 0.03, 60.0, @@ -1530,10 +1565,10 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 1.0, - { 1.0, 1.0, 1.15, 1.15 }, + { 1.0, 1.0, 1.2, 1.2 }, - { 0.0, 45000.0, 65000.0, 70000.0 }, + { 0.0, 300000.0, 500000.0, 544000.0 }, 18.0, @@ -1645,7 +1680,7 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut -2.0, - 1.3, + 0.3, 0.0, @@ -1659,6 +1694,10 @@ AutopilotLawsModelClass::Parameters_AutopilotLaws_T AutopilotLawsModelClass::Aut 1.0, + 101.26859142607174, + + 0.03, + 60.0, false, diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_private.h index 77af3005203..9a53af0c5e2 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_private.h @@ -1,5 +1,6 @@ -#ifndef RTW_HEADER_AutopilotLaws_private_h_ -#define RTW_HEADER_AutopilotLaws_private_h_ +#ifndef AutopilotLaws_private_h_ +#define AutopilotLaws_private_h_ #include "rtwtypes.h" +#include "AutopilotLaws_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_types.h index 790103e5d44..3ad2adda2da 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotLaws_types.h @@ -1,7 +1,6 @@ -#ifndef RTW_HEADER_AutopilotLaws_types_h_ -#define RTW_HEADER_AutopilotLaws_types_h_ +#ifndef AutopilotLaws_types_h_ +#define AutopilotLaws_types_h_ #include "rtwtypes.h" - #ifndef DEFINED_TYPEDEF_FOR_ap_raw_laws_flare_ #define DEFINED_TYPEDEF_FOR_ap_raw_laws_flare_ @@ -280,13 +279,23 @@ struct ap_laws_output #endif -#ifndef DEFINED_TYPEDEF_FOR_ap_output_law_ -#define DEFINED_TYPEDEF_FOR_ap_output_law_ +#ifndef DEFINED_TYPEDEF_FOR_lateral_mode_ +#define DEFINED_TYPEDEF_FOR_lateral_mode_ -struct ap_output_law -{ - real_T flight_director; - real_T autopilot; +enum class lateral_mode + : int32_T { + NONE = 0, + HDG = 10, + TRACK = 11, + NAV = 20, + LOC_CPT = 30, + LOC_TRACK = 31, + LAND = 32, + FLARE = 33, + ROLL_OUT = 34, + RWY = 40, + RWY_TRACK = 41, + GA_TRACK = 50 }; #endif @@ -294,48 +303,29 @@ struct ap_output_law #ifndef DEFINED_TYPEDEF_FOR_vertical_mode_ #define DEFINED_TYPEDEF_FOR_vertical_mode_ -typedef enum { - vertical_mode_NONE = 0, - vertical_mode_ALT = 10, - vertical_mode_ALT_CPT = 11, - vertical_mode_OP_CLB = 12, - vertical_mode_OP_DES = 13, - vertical_mode_VS = 14, - vertical_mode_FPA = 15, - vertical_mode_ALT_CST = 20, - vertical_mode_ALT_CST_CPT = 21, - vertical_mode_CLB = 22, - vertical_mode_DES = 23, - vertical_mode_FINAL_DES = 24, - vertical_mode_GS_CPT = 30, - vertical_mode_GS_TRACK = 31, - vertical_mode_LAND = 32, - vertical_mode_FLARE = 33, - vertical_mode_ROLL_OUT = 34, - vertical_mode_SRS = 40, - vertical_mode_SRS_GA = 41, - vertical_mode_TCAS = 50 -} vertical_mode; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_lateral_mode_ -#define DEFINED_TYPEDEF_FOR_lateral_mode_ - -typedef enum { - lateral_mode_NONE = 0, - lateral_mode_HDG = 10, - lateral_mode_TRACK = 11, - lateral_mode_NAV = 20, - lateral_mode_LOC_CPT = 30, - lateral_mode_LOC_TRACK = 31, - lateral_mode_LAND = 32, - lateral_mode_FLARE = 33, - lateral_mode_ROLL_OUT = 34, - lateral_mode_RWY = 40, - lateral_mode_RWY_TRACK = 41, - lateral_mode_GA_TRACK = 50 -} lateral_mode; +enum class vertical_mode + : int32_T { + NONE = 0, + ALT = 10, + ALT_CPT = 11, + OP_CLB = 12, + OP_DES = 13, + VS = 14, + FPA = 15, + ALT_CST = 20, + ALT_CST_CPT = 21, + CLB = 22, + DES = 23, + FINAL_DES = 24, + GS_CPT = 30, + GS_TRACK = 31, + LAND = 32, + FLARE = 33, + ROLL_OUT = 34, + SRS = 40, + SRS_GA = 41, + TCAS = 50 +}; #endif #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.cpp index 39ceb9f2090..f7edb88d2e5 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.cpp @@ -2,7 +2,7 @@ #include "rtwtypes.h" #include "AutopilotStateMachine_types.h" #include -#include "mod_2RcCQkwc.h" +#include "mod_OlzklkXq.h" #include "multiword_types.h" #include "rt_remd.h" #include "AutopilotStateMachine_private.h" @@ -44,15 +44,15 @@ const uint8_T AutopilotStateMachine_IN_InAir{ 1U }; const uint8_T AutopilotStateMachine_IN_OnGround{ 2U }; -const real_T AutopilotStateMachine_N_p{ 2.0 }; +const real_T AutopilotStateMachine_N_c{ 2.0 }; -const real_T AutopilotStateMachine_N_l{ 3.0 }; +const real_T AutopilotStateMachine_N_a{ 3.0 }; const real_T AutopilotStateMachine_N_j{ 4.0 }; -const real_T AutopilotStateMachine_N_b{ 5.0 }; +const real_T AutopilotStateMachine_N_k{ 5.0 }; -const real_T AutopilotStateMachine_N_h{ 6.0 }; +const real_T AutopilotStateMachine_N_kp{ 6.0 }; const uint8_T AutopilotStateMachine_IN_ALT{ 1U }; @@ -74,11 +74,11 @@ const uint8_T AutopilotStateMachine_IN_GS_CPT{ 2U }; const uint8_T AutopilotStateMachine_IN_GS_TRACK{ 3U }; -const uint8_T AutopilotStateMachine_IN_LAND_c{ 4U }; +const uint8_T AutopilotStateMachine_IN_LAND_d{ 4U }; -const uint8_T AutopilotStateMachine_IN_OFF_a{ 1U }; +const uint8_T AutopilotStateMachine_IN_OFF_o{ 1U }; -const uint8_T AutopilotStateMachine_IN_ON_b{ 2U }; +const uint8_T AutopilotStateMachine_IN_ON_g{ 2U }; const uint8_T AutopilotStateMachine_IN_OP_CLB{ 9U }; @@ -127,18 +127,18 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_ON_TO_NAV(const ap_sm_out void AutopilotStateMachine::AutopilotStateMachine_NAV_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::NAV; - AutopilotStateMachine_B.out_p.law = lateral_law::HPATH; + AutopilotStateMachine_B.out_g.mode = lateral_mode::NAV; + AutopilotStateMachine_B.out_g.law = lateral_law::HPATH; } void AutopilotStateMachine::AutopilotStateMachine_HDG_entry(const ap_sm_output *BusAssignment) { if (BusAssignment->input.TRK_FPA_mode) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::TRACK; - AutopilotStateMachine_B.out_p.law = lateral_law::TRACK; + AutopilotStateMachine_B.out_g.mode = lateral_mode::TRACK; + AutopilotStateMachine_B.out_g.law = lateral_law::TRACK; } else { - AutopilotStateMachine_B.out_p.mode = lateral_mode::HDG; - AutopilotStateMachine_B.out_p.law = lateral_law::HDG; + AutopilotStateMachine_B.out_g.mode = lateral_mode::HDG; + AutopilotStateMachine_B.out_g.law = lateral_law::HDG; } } @@ -149,39 +149,39 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_ON_TO_LOC(const ap_sm_out void AutopilotStateMachine::AutopilotStateMachine_HDG_during(const ap_sm_output *BusAssignment) { - AutopilotStateMachine_B.out_p.mode_reversion = false; - AutopilotStateMachine_B.out_p.Psi_c_deg = BusAssignment->input.Psi_fcu_deg; + AutopilotStateMachine_B.out_g.mode_reversion = false; + AutopilotStateMachine_B.out_g.Psi_c_deg = BusAssignment->input.Psi_fcu_deg; if (BusAssignment->input.TRK_FPA_mode) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::TRACK; - AutopilotStateMachine_B.out_p.law = lateral_law::TRACK; + AutopilotStateMachine_B.out_g.mode = lateral_mode::TRACK; + AutopilotStateMachine_B.out_g.law = lateral_law::TRACK; } else { - AutopilotStateMachine_B.out_p.mode = lateral_mode::HDG; - AutopilotStateMachine_B.out_p.law = lateral_law::HDG; + AutopilotStateMachine_B.out_g.mode = lateral_mode::HDG; + AutopilotStateMachine_B.out_g.law = lateral_law::HDG; } } void AutopilotStateMachine::AutopilotStateMachine_LOC_CPT_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::LOC_CPT; - AutopilotStateMachine_B.out_p.law = lateral_law::LOC_CPT; + AutopilotStateMachine_B.out_g.mode = lateral_mode::LOC_CPT; + AutopilotStateMachine_B.out_g.law = lateral_law::LOC_CPT; } void AutopilotStateMachine::AutopilotStateMachine_OFF_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::NONE; - AutopilotStateMachine_B.out_p.law = lateral_law::NONE; + AutopilotStateMachine_B.out_g.mode = lateral_mode::NONE; + AutopilotStateMachine_B.out_g.law = lateral_law::NONE; } void AutopilotStateMachine::AutopilotStateMachine_ROLL_OUT_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::ROLL_OUT; - AutopilotStateMachine_B.out_p.law = lateral_law::ROLL_OUT; + AutopilotStateMachine_B.out_g.mode = lateral_mode::ROLL_OUT; + AutopilotStateMachine_B.out_g.law = lateral_law::ROLL_OUT; } void AutopilotStateMachine::AutopilotStateMachine_FLARE_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::FLARE; - AutopilotStateMachine_B.out_p.law = lateral_law::LOC_TRACK; + AutopilotStateMachine_B.out_g.mode = lateral_mode::FLARE; + AutopilotStateMachine_B.out_g.law = lateral_law::LOC_TRACK; } boolean_T AutopilotStateMachine::AutopilotStateMachine_LOC_TO_X(const ap_sm_output *BusAssignment) @@ -194,14 +194,14 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_LOC_TO_X(const ap_sm_outp void AutopilotStateMachine::AutopilotStateMachine_LOC_TRACK_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::LOC_TRACK; - AutopilotStateMachine_B.out_p.law = lateral_law::LOC_TRACK; + AutopilotStateMachine_B.out_g.mode = lateral_mode::LOC_TRACK; + AutopilotStateMachine_B.out_g.law = lateral_law::LOC_TRACK; } void AutopilotStateMachine::AutopilotStateMachine_LAND_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::LAND; - AutopilotStateMachine_B.out_p.law = lateral_law::LOC_TRACK; + AutopilotStateMachine_B.out_g.mode = lateral_mode::LAND; + AutopilotStateMachine_B.out_g.law = lateral_law::LOC_TRACK; } boolean_T AutopilotStateMachine::AutopilotStateMachine_NAV_TO_HDG(const ap_sm_output *BusAssignment) @@ -223,34 +223,29 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_NAV_TO_HDG(const ap_sm_ou boolean_T AutopilotStateMachine::AutopilotStateMachine_RWY_TO_RWY_TRK(const ap_sm_output *BusAssignment) { real_T R; - real_T r; + real_T b_y_tmp; real_T x; x = (BusAssignment->data.Psi_magnetic_deg - (BusAssignment->data.nav_loc_deg + 360.0)) + 360.0; if (x == 0.0) { - r = 0.0; + x = 0.0; } else { - r = std::fmod(x, 360.0); - if (r == 0.0) { - r = 0.0; + x = std::fmod(x, 360.0); + if (x == 0.0) { + x = 0.0; } else if (x < 0.0) { - r += 360.0; + x += 360.0; } } - x = std::abs(-r); - if (360.0 - x == 0.0) { + b_y_tmp = std::abs(-x); + if (360.0 - b_y_tmp == 0.0) { R = 0.0; } else { - R = std::fmod(360.0 - x, 360.0); - if (R == 0.0) { - R = 0.0; - } else if (360.0 - x < 0.0) { - R += 360.0; - } + R = std::fmod(360.0 - b_y_tmp, 360.0); } - if (x < std::abs(R)) { - R = -r; + if (b_y_tmp < R) { + R = -x; } return ((BusAssignment->data.H_radio_ft >= 30.0) && (!BusAssignment->lateral.armed.NAV)) || @@ -260,34 +255,29 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_RWY_TO_RWY_TRK(const ap_s boolean_T AutopilotStateMachine::AutopilotStateMachine_RWY_TO_OFF(const ap_sm_output *BusAssignment) { real_T R; - real_T r; + real_T b_y_tmp; real_T x; x = (BusAssignment->data.Psi_magnetic_deg - (BusAssignment->data.nav_loc_deg + 360.0)) + 360.0; if (x == 0.0) { - r = 0.0; + x = 0.0; } else { - r = std::fmod(x, 360.0); - if (r == 0.0) { - r = 0.0; + x = std::fmod(x, 360.0); + if (x == 0.0) { + x = 0.0; } else if (x < 0.0) { - r += 360.0; + x += 360.0; } } - x = std::abs(-r); - if (360.0 - x == 0.0) { + b_y_tmp = std::abs(-x); + if (360.0 - b_y_tmp == 0.0) { R = 0.0; } else { - R = std::fmod(360.0 - x, 360.0); - if (R == 0.0) { - R = 0.0; - } else if (360.0 - x < 0.0) { - R += 360.0; - } + R = std::fmod(360.0 - b_y_tmp, 360.0); } - if (x < std::abs(R)) { - R = -r; + if (b_y_tmp < R) { + R = -x; } return (!BusAssignment->data.nav_valid) && (std::abs(R) > 20.0); @@ -295,16 +285,16 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_RWY_TO_OFF(const ap_sm_ou void AutopilotStateMachine::AutopilotStateMachine_RWY_TRK_entry(const ap_sm_output *BusAssignment) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::RWY_TRACK; - AutopilotStateMachine_B.out_p.law = lateral_law::TRACK; - AutopilotStateMachine_B.out_p.Psi_c_deg = BusAssignment->data.Psi_magnetic_track_deg; + AutopilotStateMachine_B.out_g.mode = lateral_mode::RWY_TRACK; + AutopilotStateMachine_B.out_g.law = lateral_law::TRACK; + AutopilotStateMachine_B.out_g.Psi_c_deg = BusAssignment->data.Psi_magnetic_track_deg; } void AutopilotStateMachine::AutopilotStateMachine_GA_TRK_entry(const ap_sm_output *BusAssignment) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::GA_TRACK; - AutopilotStateMachine_B.out_p.law = lateral_law::TRACK; - AutopilotStateMachine_B.out_p.Psi_c_deg = BusAssignment->data.Psi_magnetic_track_deg; + AutopilotStateMachine_B.out_g.mode = lateral_mode::GA_TRACK; + AutopilotStateMachine_B.out_g.law = lateral_law::TRACK; + AutopilotStateMachine_B.out_g.Psi_c_deg = BusAssignment->data.Psi_magnetic_track_deg; } void AutopilotStateMachine::AutopilotStateMachine_ON(const ap_sm_output *BusAssignment) @@ -491,31 +481,26 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_OFF_TO_NAV(const ap_sm_ou boolean_T AutopilotStateMachine::AutopilotStateMachine_OFF_TO_RWY(const ap_sm_output *BusAssignment) { real_T R; - real_T r; + real_T b_y_tmp; real_T x; boolean_T y; x = (BusAssignment->data.Psi_magnetic_deg - (BusAssignment->data.nav_loc_deg + 360.0)) + 360.0; if (x == 0.0) { - r = 0.0; + x = 0.0; } else { - r = std::fmod(x, 360.0); - if (r == 0.0) { - r = 0.0; + x = std::fmod(x, 360.0); + if (x == 0.0) { + x = 0.0; } else if (x < 0.0) { - r += 360.0; + x += 360.0; } } - x = std::abs(-r); - if (360.0 - x == 0.0) { + b_y_tmp = std::abs(-x); + if (360.0 - b_y_tmp == 0.0) { R = 0.0; } else { - R = std::fmod(360.0 - x, 360.0); - if (R == 0.0) { - R = 0.0; - } else if (360.0 - x < 0.0) { - R += 360.0; - } + R = std::fmod(360.0 - b_y_tmp, 360.0); } if ((BusAssignment->input.FD_active || (BusAssignment->output.enabled_AP1 != 0.0) || @@ -524,8 +509,8 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_OFF_TO_RWY(const ap_sm_ou ((BusAssignment->data.throttle_lever_1_pos >= 35.0) || (BusAssignment->data.throttle_lever_2_pos >= 35.0)) && BusAssignment->data.nav_loc_valid) { if (std::abs(BusAssignment->data.nav_loc_error_deg) <= 0.4) { - if (x < std::abs(R)) { - R = -r; + if (b_y_tmp < R) { + R = -x; } if (std::abs(R) <= 20.0) { @@ -563,8 +548,8 @@ boolean_T AutopilotStateMachine::AutopilotStateMachine_OFF_TO_RWY_TRK(const ap_s void AutopilotStateMachine::AutopilotStateMachine_RWY_entry(void) { - AutopilotStateMachine_B.out_p.mode = lateral_mode::RWY; - AutopilotStateMachine_B.out_p.law = lateral_law::ROLL_OUT; + AutopilotStateMachine_B.out_g.mode = lateral_mode::RWY; + AutopilotStateMachine_B.out_g.law = lateral_law::ROLL_OUT; } boolean_T AutopilotStateMachine::AutopilotStateMachine_TCAS_TO_ALT(void) const @@ -718,7 +703,7 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS_exit(void) } } -void AutopilotStateMachine::AutopilotStateMachine_OFF_entry_m(void) +void AutopilotStateMachine::AutopilotStateMachine_OFF_entry_i(void) { AutopilotStateMachine_B.out.mode = vertical_mode::NONE; AutopilotStateMachine_B.out.law = vertical_law::NONE; @@ -928,12 +913,12 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) boolean_T tmp; if (AutopilotStateMachine_TCAS_TO_ALT() && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT; AutopilotStateMachine_ALT_entry(); } else if (AutopilotStateMachine_TCAS_TO_ALT_CPT()) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CPT; AutopilotStateMachine_ALT_CPT_entry(); } else { @@ -944,14 +929,14 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; AutopilotStateMachine_GS_CPT_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; AutopilotStateMachine_FINAL_DES_entry(); } else { @@ -962,12 +947,12 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; if (tmp && (tmp_0 < -40.0)) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; AutopilotStateMachine_OP_DES_entry(); } else if (tmp && (tmp_0 > 40.0)) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; AutopilotStateMachine_OP_CLB_entry(); } else { @@ -978,14 +963,14 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_CLB; AutopilotStateMachine_CLB_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_DES; AutopilotStateMachine_DES_entry(); } else if ((!AutopilotStateMachine_B.out.FD_connect) && @@ -996,8 +981,8 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP1 == 0.0) && (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP2 == 0.0)))) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } else if (AutopilotStateMachine_B.BusAssignment_g.input.VS_push || AutopilotStateMachine_B.BusAssignment_g.input.VS_pull) { guard1 = true; @@ -1009,7 +994,7 @@ void AutopilotStateMachine::AutopilotStateMachine_TCAS(void) if (guard1) { AutopilotStateMachine_TCAS_exit(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; AutopilotStateMachine_VS_entry(); } @@ -1588,6 +1573,86 @@ void AutopilotStateMachine::AutopilotStateMachine_ALT_CST_CPT_entry(void) AutopilotStateMachine_B.out.H_c_ft = AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft; } +void AutopilotStateMachine::AutopilotStateMachine_CLB(void) +{ + real_T tmp_0; + boolean_T guard1; + boolean_T guard2; + boolean_T guard3; + boolean_T tmp; + if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT) { + AutopilotStateMachine_DWork.local_H_constraint_ft = AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CST_CPT; + AutopilotStateMachine_ALT_CST_CPT_entry(); + } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.ALT && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CPT; + AutopilotStateMachine_ALT_CPT_entry(); + } else { + guard1 = false; + guard2 = false; + guard3 = false; + if (AutopilotStateMachine_B.BusAssignment_g.input.VS_push || AutopilotStateMachine_B.BusAssignment_g.input.VS_pull) + { + guard1 = true; + } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; + AutopilotStateMachine_GS_CPT_entry(); + } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; + AutopilotStateMachine_FINAL_DES_entry(); + } else { + tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || + AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); + tmp_0 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; + if (tmp && (tmp_0 < -40.0)) { + guard2 = true; + } else if (tmp && (tmp_0 > 40.0)) { + guard3 = true; + } else if ((AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft < + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) && (std::abs(tmp_0) > 40.0)) { + AutopilotStateMachine_B.out.mode_reversion = true; + AutopilotStateMachine_B.out.mode_reversion_target_fpm = + AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; + guard1 = true; + } else if ((!AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB) && (tmp_0 > 40.0)) { + AutopilotStateMachine_B.out.mode_reversion = true; + AutopilotStateMachine_B.out.mode_reversion_target_fpm = + AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; + if (tmp_0 > 40.0) { + guard3 = true; + } else if (tmp_0 < -40.0) { + guard2 = true; + } else { + AutopilotStateMachine_CLB_during(); + } + } else { + AutopilotStateMachine_CLB_during(); + } + } + + if (guard3) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; + AutopilotStateMachine_OP_CLB_entry(); + } + + if (guard2) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; + AutopilotStateMachine_OP_DES_entry(); + } + + if (guard1) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; + AutopilotStateMachine_VS_entry(); + } + } +} + void AutopilotStateMachine::AutopilotStateMachine_DES_during(void) { AutopilotStateMachine_B.out.V_c_kn = AutopilotStateMachine_B.BusAssignment_g.input.V_fcu_kn; @@ -1656,66 +1721,6 @@ void AutopilotStateMachine::AutopilotStateMachine_DES_during(void) } } -void AutopilotStateMachine::AutopilotStateMachine_DES(void) -{ - real_T tmp; - boolean_T guard1; - boolean_T tmp_0; - if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT) { - AutopilotStateMachine_DWork.local_H_constraint_ft = AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CST_CPT; - AutopilotStateMachine_ALT_CST_CPT_entry(); - } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.ALT && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CPT; - AutopilotStateMachine_ALT_CPT_entry(); - } else { - guard1 = false; - if (AutopilotStateMachine_B.BusAssignment_g.input.VS_push || AutopilotStateMachine_B.BusAssignment_g.input.VS_pull) - { - guard1 = true; - } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; - AutopilotStateMachine_GS_CPT_entry(); - } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; - AutopilotStateMachine_FINAL_DES_entry(); - } else { - tmp = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; - if ((!AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES) || - ((AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft > - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) && (std::abs(tmp) > 40.0))) { - AutopilotStateMachine_B.out.mode_reversion = true; - AutopilotStateMachine_B.out.mode_reversion_target_fpm = - AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; - guard1 = true; - } else { - tmp_0 = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || - AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); - if (tmp_0 && (tmp < -40.0)) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; - AutopilotStateMachine_OP_DES_entry(); - } else if (tmp_0 && (tmp > 40.0)) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; - AutopilotStateMachine_OP_CLB_entry(); - } else { - AutopilotStateMachine_DES_during(); - } - } - } - - if (guard1) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; - AutopilotStateMachine_VS_entry(); - } - } -} - void AutopilotStateMachine::AutopilotStateMachine_FINAL_DES_during(void) { AutopilotStateMachine_B.out.V_c_kn = AutopilotStateMachine_B.BusAssignment_g.input.V_fcu_kn; @@ -1777,14 +1782,91 @@ void AutopilotStateMachine::AutopilotStateMachine_GS_TRACK_entry(void) AutopilotStateMachine_B.out.law = vertical_law::GS; } -void AutopilotStateMachine::AutopilotStateMachine_LAND_entry_b(void) +void AutopilotStateMachine::AutopilotStateMachine_LAND_entry_p(void) { AutopilotStateMachine_B.out.mode = vertical_mode::LAND; AutopilotStateMachine_B.out.mode_autothrust = athr_requested_mode::SPEED; AutopilotStateMachine_B.out.law = vertical_law::GS; } -void AutopilotStateMachine::AutopilotStateMachine_FLARE_entry_m(void) +void AutopilotStateMachine::AutopilotStateMachine_GS_TRACK(void) +{ + real_T tmp_0; + boolean_T guard1; + boolean_T tmp; + guard1 = false; + if (AutopilotStateMachine_GS_TO_ALT()) { + if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; + AutopilotStateMachine_GS_CPT_entry(); + } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; + AutopilotStateMachine_FINAL_DES_entry(); + } else { + tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || + AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); + tmp_0 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; + if (tmp && (tmp_0 < -40.0)) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; + AutopilotStateMachine_OP_DES_entry(); + } else if (tmp && (tmp_0 > 40.0)) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; + AutopilotStateMachine_OP_CLB_entry(); + } else { + tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (std::abs + (AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft - + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) > 40.0)); + if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_CLB; + AutopilotStateMachine_CLB_entry(); + } else if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_DES; + AutopilotStateMachine_DES_entry(); + } else { + guard1 = true; + } + } + } + } else { + guard1 = true; + } + + if (guard1) { + if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.LAND) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_LAND_d; + AutopilotStateMachine_LAND_entry_p(); + } else if (AutopilotStateMachine_GS_TO_X()) { + AutopilotStateMachine_B.out.mode_reversion = AutopilotStateMachine_GS_TO_X_MR(); + AutopilotStateMachine_B.out.mode_reversion_target_fpm = AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; + if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground == 0.0) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; + AutopilotStateMachine_VS_entry(); + } else if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) { + AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); + } + } + } +} + +void AutopilotStateMachine::AutopilotStateMachine_FLARE_entry_n(void) { AutopilotStateMachine_B.out.mode = vertical_mode::FLARE; AutopilotStateMachine_B.out.law = vertical_law::FLARE; @@ -1795,10 +1877,8 @@ void AutopilotStateMachine::AutopilotStateMachine_GS(void) { real_T tmp_0; boolean_T guard1; - boolean_T guard2; boolean_T tmp; guard1 = false; - guard2 = false; switch (AutopilotStateMachine_DWork.is_GS) { case AutopilotStateMachine_IN_FLARE: if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ROLL_OUT) { @@ -1820,8 +1900,8 @@ void AutopilotStateMachine::AutopilotStateMachine_GS(void) } else if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) { AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } else { guard1 = true; } @@ -1831,61 +1911,13 @@ void AutopilotStateMachine::AutopilotStateMachine_GS(void) break; case AutopilotStateMachine_IN_GS_TRACK: - if (AutopilotStateMachine_GS_TO_ALT()) { - if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; - AutopilotStateMachine_GS_CPT_entry(); - } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; - AutopilotStateMachine_FINAL_DES_entry(); - } else { - tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || - AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); - tmp_0 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; - if (tmp && (tmp_0 < -40.0)) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; - AutopilotStateMachine_OP_DES_entry(); - } else if (tmp && (tmp_0 > 40.0)) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; - AutopilotStateMachine_OP_CLB_entry(); - } else { - tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (std::abs - (AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft - - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) > 40.0)); - if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_CLB; - AutopilotStateMachine_CLB_entry(); - } else if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && tmp) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_DES; - AutopilotStateMachine_DES_entry(); - } else { - guard2 = true; - } - } - } - } else { - guard2 = true; - } + AutopilotStateMachine_GS_TRACK(); break; - case AutopilotStateMachine_IN_LAND_c: + case AutopilotStateMachine_IN_LAND_d: if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FLARE) { AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_FLARE; - AutopilotStateMachine_FLARE_entry_m(); + AutopilotStateMachine_FLARE_entry_n(); } break; @@ -1898,33 +1930,13 @@ void AutopilotStateMachine::AutopilotStateMachine_GS(void) } else if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) { AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } } break; } - if (guard2) { - if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.LAND) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_LAND_c; - AutopilotStateMachine_LAND_entry_b(); - } else if (AutopilotStateMachine_GS_TO_X()) { - AutopilotStateMachine_B.out.mode_reversion = AutopilotStateMachine_GS_TO_X_MR(); - AutopilotStateMachine_B.out.mode_reversion_target_fpm = AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; - if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground == 0.0) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; - AutopilotStateMachine_VS_entry(); - } else if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) { - AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); - } - } - } - if (guard1) { if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_TRACK) { AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_TRACK; @@ -2273,16 +2285,14 @@ void AutopilotStateMachine::AutopilotStateMachine_exit_internal_ON(void) } } -void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) +void AutopilotStateMachine::AutopilotStateMachine_ON_i(void) { - real_T tmp_0; + real_T tmp; boolean_T guard1; boolean_T guard2; boolean_T guard3; boolean_T guard4; - boolean_T guard5; - boolean_T guard6; - boolean_T tmp; + boolean_T tmp_0; if (AutopilotStateMachine_X_TO_SRS_GA()) { AutopilotStateMachine_exit_internal_ON(); AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_SRS_GA; @@ -2292,8 +2302,6 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) guard2 = false; guard3 = false; guard4 = false; - guard5 = false; - guard6 = false; if ((AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP1 == 0.0) && (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP2 == 0.0) && (((AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::OP_CLB) && @@ -2302,7 +2310,7 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) (AutopilotStateMachine_B.BusAssignment_g.data.V_ias_kn <= AutopilotStateMachine_B.BusAssignment_g.data.VLS_kn - 2.0)))) { AutopilotStateMachine_B.out.FD_disconnect = true; - guard6 = true; + guard4 = true; } else if (AutopilotStateMachine_X_TO_TCAS()) { AutopilotStateMachine_X_TO_TCAS_Action(); AutopilotStateMachine_exit_internal_ON(); @@ -2314,7 +2322,7 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) ((AutopilotStateMachine_B.BusAssignment_g.data.flight_phase == 7.0) && (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP1 == 0.0) && (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP2 == 0.0))) { - guard6 = true; + guard4 = true; } else { switch (AutopilotStateMachine_DWork.is_ON) { case AutopilotStateMachine_IN_ALT: @@ -2354,6 +2362,10 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) break; case AutopilotStateMachine_IN_CLB: + AutopilotStateMachine_CLB(); + break; + + case AutopilotStateMachine_IN_DES: if (AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT) { AutopilotStateMachine_DWork.local_H_constraint_ft = AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft; @@ -2376,42 +2388,32 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; AutopilotStateMachine_FINAL_DES_entry(); } else { - tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || - AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); - tmp_0 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - + tmp = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; - if (tmp && (tmp_0 < -40.0)) { - guard3 = true; - } else if (tmp && (tmp_0 > 40.0)) { - guard4 = true; - } else if ((AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft < - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) && (std::abs(tmp_0) > 40.0)) { + if ((!AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES) || + ((AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft > + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft) && (std::abs(tmp) > 40.0))) { AutopilotStateMachine_B.out.mode_reversion = true; AutopilotStateMachine_B.out.mode_reversion_target_fpm = AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; guard2 = true; - } else if ((!AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB) && (tmp_0 > 40.0)) { - AutopilotStateMachine_B.out.mode_reversion = true; - AutopilotStateMachine_B.out.mode_reversion_target_fpm = - AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; - if (tmp_0 > 40.0) { - guard4 = true; - } else if (tmp_0 < -40.0) { - guard3 = true; + } else { + tmp_0 = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || + AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); + if (tmp_0 && (tmp < -40.0)) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; + AutopilotStateMachine_OP_DES_entry(); + } else if (tmp_0 && (tmp > 40.0)) { + AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; + AutopilotStateMachine_OP_CLB_entry(); } else { - AutopilotStateMachine_CLB_during(); + AutopilotStateMachine_DES_during(); } - } else { - AutopilotStateMachine_CLB_during(); } } break; - case AutopilotStateMachine_IN_DES: - AutopilotStateMachine_DES(); - break; - case AutopilotStateMachine_IN_FINAL_DES: if ((!AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) || AutopilotStateMachine_B.BusAssignment_g.input.APPR_push || @@ -2424,13 +2426,13 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) AutopilotStateMachine_VS_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) { AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_NO_ACTIVE_CHILD; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } else { - guard5 = true; + guard3 = true; } } else { - guard5 = true; + guard3 = true; } break; @@ -2456,22 +2458,22 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) } } - if (guard6) { + if (guard4) { AutopilotStateMachine_exit_internal_ON(); - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } - if (guard5) { - tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || - AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); - tmp_0 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - + if (guard3) { + tmp_0 = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || + AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); + tmp = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; - if (tmp && (tmp_0 < -40.0)) { + if (tmp_0 && (tmp < -40.0)) { AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; AutopilotStateMachine_OP_DES_entry(); - } else if (tmp && (tmp_0 > 40.0)) { + } else if (tmp_0 && (tmp > 40.0)) { AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; AutopilotStateMachine_OP_CLB_entry(); } else { @@ -2479,16 +2481,6 @@ void AutopilotStateMachine::AutopilotStateMachine_ON_p(void) } } - if (guard4) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; - AutopilotStateMachine_OP_CLB_entry(); - } - - if (guard3) { - AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; - AutopilotStateMachine_OP_DES_entry(); - } - if (guard2) { AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; AutopilotStateMachine_VS_entry(); @@ -2508,29 +2500,21 @@ void AutopilotStateMachine::AutopilotStateMachine_SRS_GA_during(void) AutopilotStateMachine_B.out.mode_reversion_TRK_FPA = false; allEnginesOperative = (AutopilotStateMachine_B.BusAssignment_g.data.is_engine_operative_1 && AutopilotStateMachine_B.BusAssignment_g.data.is_engine_operative_2); - if (!AutopilotStateMachine_DWork.wereAllEnginesOperative_not_empty_p) { - AutopilotStateMachine_DWork.wereAllEnginesOperative_b = allEnginesOperative; - AutopilotStateMachine_DWork.wereAllEnginesOperative_not_empty_p = true; + if (!AutopilotStateMachine_DWork.wereAllEnginesOperative_not_empty_j) { + AutopilotStateMachine_DWork.wereAllEnginesOperative_o = allEnginesOperative; + AutopilotStateMachine_DWork.wereAllEnginesOperative_not_empty_j = true; } - if (AutopilotStateMachine_DWork.wereAllEnginesOperative_b && (!allEnginesOperative)) { + if (AutopilotStateMachine_DWork.wereAllEnginesOperative_o && (!allEnginesOperative)) { AutopilotStateMachine_B.out.V_c_kn = std::fmin(AutopilotStateMachine_B.BusAssignment_g.data.VLS_kn + 15.0, std::fmax (AutopilotStateMachine_B.BusAssignment_g.data.V_ias_kn, AutopilotStateMachine_B.BusAssignment_g.data.VAPP_kn)); } - AutopilotStateMachine_DWork.wereAllEnginesOperative_b = allEnginesOperative; + AutopilotStateMachine_DWork.wereAllEnginesOperative_o = allEnginesOperative; } void AutopilotStateMachine::step() { - static const real_T c[24]{ -3.7631613045100394E-12, -3.7631613045100418E-12, 6.2076488130688133E-12, - 2.3375903616618146E-12, -2.9675180723323623E-12, -2.9675180723323619E-12, 2.2735910872868498E-8, - 1.1446426959338374E-8, -1.4891939010927404E-8, -2.4704337359767112E-9, 1.1555108433994175E-8, -6.25E-9, - -1.897274956835846E-5, 1.520958826384842E-5, 7.1712086474912069E-6, -4.4094939746938354E-6, 1.3759855421341094E-5, - 2.4370072289329445E-5, 0.05, 0.05, 0.1, 0.1, 0.1, 0.15 }; - - static const int16_T b[7]{ 0, 1000, 3333, 4000, 6000, 8000, 10000 }; - uint64m_T tmp; uint64m_T tmp_0; uint64m_T tmp_1; @@ -2544,44 +2528,52 @@ void AutopilotStateMachine::step() real_T result_tmp[9]; real_T result[3]; real_T result_0[3]; - real_T L; - real_T L_tmp; real_T Phi2; + real_T R; real_T a; real_T b_L; real_T b_R; real_T c_R; - real_T distance_m; real_T rtb_GainTheta; real_T rtb_GainTheta1; - real_T rtb_Saturation1; real_T rtb_dme; + real_T xloc; int32_T high_i; int32_T low_i; int32_T low_ip1; int32_T mid_i; int32_T rtb_on_ground; - boolean_T conditionSoftAlt; - boolean_T engageCondition; - boolean_T guard1; - boolean_T guard2; - boolean_T inFlightDisarmCondition; + boolean_T isGoAroundModeActive; boolean_T rtb_AND; boolean_T rtb_AND_j; boolean_T rtb_BusAssignment1_input_APPR_push; boolean_T rtb_Compare_c; boolean_T rtb_Compare_dl; boolean_T rtb_FixPtRelationalOperator; - boolean_T rtb_Y_j; + boolean_T rtb_Y_n; boolean_T rtb_cFLARE; - boolean_T rtb_cLAND; boolean_T sCLB_tmp; boolean_T speedTargetChanged; - boolean_T state_d_tmp; - boolean_T state_d_tmp_0; - boolean_T state_d_tmp_1; - boolean_T state_k_tmp; - boolean_T state_k_tmp_0; + static const int16_T b[7]{ 0, 1000, 3333, 4000, 6000, 8000, 10000 }; + + static const real_T c[24]{ -3.7631613045100394E-12, -3.7631613045100418E-12, 6.2076488130688133E-12, + 2.3375903616618146E-12, -2.9675180723323623E-12, -2.9675180723323619E-12, 2.2735910872868498E-8, + 1.1446426959338374E-8, -1.4891939010927404E-8, -2.4704337359767112E-9, 1.1555108433994175E-8, -6.25E-9, + -1.897274956835846E-5, 1.520958826384842E-5, 7.1712086474912069E-6, -4.4094939746938354E-6, 1.3759855421341094E-5, + 2.4370072289329445E-5, 0.05, 0.05, 0.1, 0.1, 0.1, 0.15 }; + + real_T c_L_tmp_tmp_tmp; + real_T rtb_dme_tmp; + boolean_T guard1; + boolean_T guard2; + boolean_T sCLB_tmp_0; + boolean_T state_a_tmp; + boolean_T state_a_tmp_0; + boolean_T state_a_tmp_1; + boolean_T state_a_tmp_2; + boolean_T state_a_tmp_3; + boolean_T state_e_tmp; + boolean_T state_e_tmp_0; AutopilotStateMachine_DWork.DelayInput1_DSTATE_a = (static_cast (AutopilotStateMachine_U.in.input.AP_ENGAGE_push) > static_cast (AutopilotStateMachine_DWork.DelayInput1_DSTATE_a)); @@ -2617,41 +2609,39 @@ void AutopilotStateMachine::step() AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push = AutopilotStateMachine_DWork.DelayInput1_DSTATE_o; rtb_GainTheta = AutopilotStateMachine_P.GainTheta_Gain * AutopilotStateMachine_U.in.data.Theta_deg; rtb_GainTheta1 = AutopilotStateMachine_P.GainTheta1_Gain * AutopilotStateMachine_U.in.data.Phi_deg; - a = 0.017453292519943295 * rtb_GainTheta; - distance_m = 0.017453292519943295 * rtb_GainTheta1; - rtb_dme = std::tan(a); - rtb_Saturation1 = std::sin(distance_m); - distance_m = std::cos(distance_m); + c_R = 0.017453292519943295 * rtb_GainTheta; + Phi2 = 0.017453292519943295 * rtb_GainTheta1; + R = std::tan(c_R); + rtb_dme = std::cos(Phi2); + Phi2 = std::sin(Phi2); + c_R = std::cos(c_R); result_tmp[0] = 1.0; - result_tmp[3] = rtb_Saturation1 * rtb_dme; - result_tmp[6] = distance_m * rtb_dme; + result_tmp[3] = Phi2 * R; + result_tmp[6] = rtb_dme * R; result_tmp[1] = 0.0; - result_tmp[4] = distance_m; - result_tmp[7] = -rtb_Saturation1; + result_tmp[4] = rtb_dme; + result_tmp[7] = -Phi2; result_tmp[2] = 0.0; - rtb_dme = std::cos(a); - Phi2 = 1.0 / rtb_dme; - result_tmp[5] = Phi2 * rtb_Saturation1; - result_tmp[8] = Phi2 * distance_m; - Phi2 = AutopilotStateMachine_P.Gain_Gain_k * AutopilotStateMachine_U.in.data.p_rad_s * + result_tmp[5] = 1.0 / c_R * Phi2; + result_tmp[8] = 1.0 / c_R * rtb_dme; + R = AutopilotStateMachine_P.Gain_Gain_k * AutopilotStateMachine_U.in.data.p_rad_s * AutopilotStateMachine_P.Gainpk_Gain; - c_R = AutopilotStateMachine_P.Gain_Gain * AutopilotStateMachine_U.in.data.q_rad_s * - AutopilotStateMachine_P.Gainqk_Gain; - L = AutopilotStateMachine_P.Gain_Gain_a * AutopilotStateMachine_U.in.data.r_rad_s; + a = AutopilotStateMachine_P.Gain_Gain * AutopilotStateMachine_U.in.data.q_rad_s * AutopilotStateMachine_P.Gainqk_Gain; + xloc = AutopilotStateMachine_P.Gain_Gain_a * AutopilotStateMachine_U.in.data.r_rad_s; for (high_i = 0; high_i < 3; high_i++) { - result[high_i] = (result_tmp[high_i + 3] * c_R + result_tmp[high_i] * Phi2) + result_tmp[high_i + 6] * L; + result[high_i] = (result_tmp[high_i + 3] * a + result_tmp[high_i] * R) + result_tmp[high_i + 6] * xloc; } - a = std::sin(a); - result_tmp[0] = rtb_dme; + R = std::sin(0.017453292519943295 * rtb_GainTheta); + result_tmp[0] = c_R; result_tmp[3] = 0.0; - result_tmp[6] = -a; - result_tmp[1] = rtb_Saturation1 * a; - result_tmp[4] = distance_m; - result_tmp[7] = rtb_dme * rtb_Saturation1; - result_tmp[2] = distance_m * a; - result_tmp[5] = 0.0 - rtb_Saturation1; - result_tmp[8] = distance_m * rtb_dme; + result_tmp[6] = -R; + result_tmp[1] = Phi2 * R; + result_tmp[4] = rtb_dme; + result_tmp[7] = c_R * Phi2; + result_tmp[2] = rtb_dme * R; + result_tmp[5] = 0.0 - Phi2; + result_tmp[8] = rtb_dme * c_R; for (high_i = 0; high_i < 3; high_i++) { result_0[high_i] = (result_tmp[high_i + 3] * AutopilotStateMachine_U.in.data.by_m_s2 + result_tmp[high_i] * AutopilotStateMachine_U.in.data.bx_m_s2) + result_tmp[high_i + 6] * @@ -2663,54 +2653,52 @@ void AutopilotStateMachine::step() } else if (AutopilotStateMachine_U.in.data.nav_loc_valid) { a = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lat - AutopilotStateMachine_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lon - - AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); + xloc = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lon - + AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); a = std::cos(0.017453292519943295 * AutopilotStateMachine_U.in.data.aircraft_position.lat) * std::cos - (0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_loc_position.lat) * distance_m * distance_m + a * a; + (0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_loc_position.lat) * xloc * xloc + a * a; rtb_dme = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - distance_m = AutopilotStateMachine_U.in.data.aircraft_position.alt - - AutopilotStateMachine_U.in.data.nav_loc_position.alt; - AutopilotStateMachine_B.BusAssignment_g.data.nav_dme_nmi = std::sqrt(rtb_dme * rtb_dme + distance_m * distance_m) / - 1852.0; + a = AutopilotStateMachine_U.in.data.aircraft_position.alt - AutopilotStateMachine_U.in.data.nav_loc_position.alt; + AutopilotStateMachine_B.BusAssignment_g.data.nav_dme_nmi = std::sqrt(rtb_dme * rtb_dme + a * a) / 1852.0; } else { AutopilotStateMachine_B.BusAssignment_g.data.nav_dme_nmi = 0.0; } - rtb_dme = 0.017453292519943295 * AutopilotStateMachine_U.in.data.aircraft_position.lat; + rtb_dme_tmp = 0.017453292519943295 * AutopilotStateMachine_U.in.data.aircraft_position.lat; Phi2 = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_loc_position.lat; - rtb_Saturation1 = 0.017453292519943295 * AutopilotStateMachine_U.in.data.aircraft_position.lon; a = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lat - AutopilotStateMachine_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lon - - AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); + xloc = std::sin((AutopilotStateMachine_U.in.data.nav_loc_position.lon - + AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); c_R = std::cos(Phi2); - L_tmp = std::cos(rtb_dme); - a = L_tmp * c_R * distance_m * distance_m + a * a; - distance_m = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - a = AutopilotStateMachine_U.in.data.aircraft_position.alt - AutopilotStateMachine_U.in.data.nav_loc_position.alt; - L = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_loc_position.lon - rtb_Saturation1; - b_L = mod_2RcCQkwc((mod_2RcCQkwc(mod_2RcCQkwc(360.0) + 360.0) - (mod_2RcCQkwc(mod_2RcCQkwc + R = std::cos(rtb_dme_tmp); + a = R * c_R * xloc * xloc + a * a; + a = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; + xloc = AutopilotStateMachine_U.in.data.aircraft_position.alt - AutopilotStateMachine_U.in.data.nav_loc_position.alt; + b_L = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(360.0) + 360.0) - (mod_OlzklkXq(mod_OlzklkXq (AutopilotStateMachine_U.in.data.nav_loc_magvar_deg) + 360.0) + 360.0)) + 360.0); - b_R = mod_2RcCQkwc(360.0 - b_L); + b_R = mod_OlzklkXq(360.0 - b_L); + c_L_tmp_tmp_tmp = 0.017453292519943295 * AutopilotStateMachine_U.in.data.aircraft_position.lon; + rtb_dme = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_loc_position.lon - c_L_tmp_tmp_tmp; + rtb_dme = mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(std::atan2(std::sin(rtb_dme) * c_R, R * std::sin(Phi2) - std::sin + (rtb_dme_tmp) * c_R * std::cos(rtb_dme)) * 57.295779513082323 + 360.0)) + 360.0); if (std::abs(b_L) < std::abs(b_R)) { b_R = -b_L; } - rtb_dme = std::sin(rtb_dme); - L = mod_2RcCQkwc(mod_2RcCQkwc(mod_2RcCQkwc(std::atan2(std::sin(L) * c_R, L_tmp * std::sin(Phi2) - rtb_dme * c_R * std:: - cos(L)) * 57.295779513082323 + 360.0)) + 360.0) + 360.0; - Phi2 = mod_2RcCQkwc((mod_2RcCQkwc(mod_2RcCQkwc(mod_2RcCQkwc(mod_2RcCQkwc(AutopilotStateMachine_U.in.data.nav_loc_deg - - b_R) + 360.0)) + 360.0) - L) + 360.0); - c_R = mod_2RcCQkwc(360.0 - Phi2); + Phi2 = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(mod_OlzklkXq(AutopilotStateMachine_U.in.data.nav_loc_deg - + b_R) + 360.0)) + 360.0) - (rtb_dme + 360.0)) + 360.0); + c_R = mod_OlzklkXq(360.0 - Phi2); guard1 = false; - if (std::sqrt(distance_m * distance_m + a * a) / 1852.0 < 30.0) { - L = mod_2RcCQkwc((mod_2RcCQkwc(mod_2RcCQkwc(AutopilotStateMachine_U.in.data.nav_loc_deg) + 360.0) - L) + 360.0); - b_R = mod_2RcCQkwc(360.0 - L); - if (std::abs(L) < std::abs(b_R)) { - b_R = -L; + if (std::sqrt(a * a + xloc * xloc) / 1852.0 < 30.0) { + rtb_dme = mod_OlzklkXq((mod_OlzklkXq(mod_OlzklkXq(AutopilotStateMachine_U.in.data.nav_loc_deg) + 360.0) - (rtb_dme + + 360.0)) + 360.0); + R = mod_OlzklkXq(360.0 - rtb_dme); + if (std::abs(rtb_dme) < std::abs(R)) { + R = -rtb_dme; } - if ((std::abs(b_R) < 90.0) && ((AutopilotStateMachine_U.in.data.nav_loc_position.lat != 0.0) || + if ((std::abs(R) < 90.0) && ((AutopilotStateMachine_U.in.data.nav_loc_position.lat != 0.0) || (AutopilotStateMachine_U.in.data.nav_loc_position.lon != 0.0) || (AutopilotStateMachine_U.in.data.nav_loc_position.alt != 0.0))) { AutopilotStateMachine_B.BusAssignment_g.data.nav_e_loc_valid = true; @@ -2739,95 +2727,74 @@ void AutopilotStateMachine::step() Phi2 = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_gs_position.lat; a = std::sin((AutopilotStateMachine_U.in.data.nav_gs_position.lat - AutopilotStateMachine_U.in.data.aircraft_position.lat) * 0.017453292519943295 / 2.0); - distance_m = std::sin((AutopilotStateMachine_U.in.data.nav_gs_position.lon - - AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); + xloc = std::sin((AutopilotStateMachine_U.in.data.nav_gs_position.lon - + AutopilotStateMachine_U.in.data.aircraft_position.lon) * 0.017453292519943295 / 2.0); c_R = std::cos(Phi2); - a = L_tmp * c_R * distance_m * distance_m + a * a; - distance_m = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; - a = AutopilotStateMachine_U.in.data.aircraft_position.alt - AutopilotStateMachine_U.in.data.nav_gs_position.alt; - distance_m = std::sqrt(distance_m * distance_m + a * a); - rtb_Saturation1 = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_gs_position.lon - rtb_Saturation1; - rtb_Saturation1 = std::atan2(std::sin(rtb_Saturation1) * c_R, L_tmp * std::sin(Phi2) - rtb_dme * c_R * std::cos - (rtb_Saturation1)) * 57.295779513082323; - if (rtb_Saturation1 + 360.0 == 0.0) { + R = std::cos(rtb_dme_tmp); + a = R * c_R * xloc * xloc + a * a; + a = std::atan2(std::sqrt(a), std::sqrt(1.0 - a)) * 2.0 * 6.371E+6; + b_L = AutopilotStateMachine_U.in.data.aircraft_position.alt - AutopilotStateMachine_U.in.data.nav_gs_position.alt; + a = std::sqrt(a * a + b_L * b_L); + xloc = 0.017453292519943295 * AutopilotStateMachine_U.in.data.nav_gs_position.lon - c_L_tmp_tmp_tmp; + rtb_dme = std::atan2(std::sin(xloc) * c_R, R * std::sin(Phi2) - std::sin(rtb_dme_tmp) * c_R * std::cos(xloc)) * + 57.295779513082323; + if (rtb_dme + 360.0 == 0.0) { rtb_dme = 0.0; } else { - rtb_dme = std::fmod(rtb_Saturation1 + 360.0, 360.0); + rtb_dme = std::fmod(rtb_dme + 360.0, 360.0); if (rtb_dme == 0.0) { rtb_dme = 0.0; - } else if (rtb_Saturation1 + 360.0 < 0.0) { + } else if (rtb_dme < 0.0) { rtb_dme += 360.0; } } guard1 = false; - if (distance_m / 1852.0 < 30.0) { + if (a / 1852.0 < 30.0) { if (AutopilotStateMachine_U.in.data.nav_loc_deg == 0.0) { - Phi2 = 0.0; + R = 0.0; } else { - Phi2 = std::fmod(AutopilotStateMachine_U.in.data.nav_loc_deg, 360.0); - if (Phi2 == 0.0) { - Phi2 = 0.0; - } else if (AutopilotStateMachine_U.in.data.nav_loc_deg < 0.0) { - Phi2 += 360.0; + R = std::fmod(AutopilotStateMachine_U.in.data.nav_loc_deg, 360.0); + if (R == 0.0) { + R = 0.0; + } else if (R < 0.0) { + R += 360.0; } } if (rtb_dme == 0.0) { - rtb_Saturation1 = 0.0; - } else { - rtb_Saturation1 = std::fmod(rtb_dme, 360.0); - if (rtb_Saturation1 == 0.0) { - rtb_Saturation1 = 0.0; - } else if (rtb_dme < 0.0) { - rtb_Saturation1 += 360.0; - } - } - - if (Phi2 + 360.0 == 0.0) { - Phi2 = 0.0; - } else { - Phi2 = std::fmod(Phi2 + 360.0, 360.0); - } - - if (rtb_Saturation1 + 360.0 == 0.0) { c_R = 0.0; } else { - c_R = std::fmod(rtb_Saturation1 + 360.0, 360.0); + c_R = std::fmod(rtb_dme, 360.0); } - c_R = (Phi2 - (c_R + 360.0)) + 360.0; + c_R = (std::fmod(R + 360.0, 360.0) - (std::fmod(c_R + 360.0, 360.0) + 360.0)) + 360.0; if (c_R == 0.0) { - L = 0.0; + rtb_dme = 0.0; } else { - L = std::fmod(c_R, 360.0); - if (L == 0.0) { - L = 0.0; - } else if (c_R < 0.0) { - L += 360.0; + rtb_dme = std::fmod(c_R, 360.0); + if (rtb_dme == 0.0) { + rtb_dme = 0.0; + } else if (rtb_dme < 0.0) { + rtb_dme += 360.0; } } - if (360.0 - L == 0.0) { - b_R = 0.0; + if (360.0 - rtb_dme == 0.0) { + R = 0.0; } else { - b_R = std::fmod(360.0 - L, 360.0); - if (b_R == 0.0) { - b_R = 0.0; - } else if (360.0 - L < 0.0) { - b_R += 360.0; - } + R = std::fmod(360.0 - rtb_dme, 360.0); } - if (std::abs(L) < std::abs(b_R)) { - b_R = -L; + if (rtb_dme < R) { + R = -rtb_dme; } - if ((std::abs(b_R) < 90.0) && ((AutopilotStateMachine_U.in.data.nav_gs_position.lat != 0.0) || + if ((std::abs(R) < 90.0) && ((AutopilotStateMachine_U.in.data.nav_gs_position.lat != 0.0) || (AutopilotStateMachine_U.in.data.nav_gs_position.lon != 0.0) || (AutopilotStateMachine_U.in.data.nav_gs_position.alt != 0.0))) { AutopilotStateMachine_B.BusAssignment_g.data.nav_e_gs_valid = true; - AutopilotStateMachine_B.BusAssignment_g.data.nav_e_gs_error_deg = std::asin(a / distance_m) * 57.295779513082323 - + AutopilotStateMachine_B.BusAssignment_g.data.nav_e_gs_error_deg = std::asin(b_L / a) * 57.295779513082323 - AutopilotStateMachine_DWork.nav_gs_deg; } else { guard1 = true; @@ -2849,26 +2816,26 @@ void AutopilotStateMachine::step() rtb_dme = AutopilotStateMachine_P.Saturation_LowerSat; } - rtb_Saturation1 = AutopilotStateMachine_P.Gain1_Gain * AutopilotStateMachine_U.in.data.gear_strut_compression_2 - + Phi2 = AutopilotStateMachine_P.Gain1_Gain * AutopilotStateMachine_U.in.data.gear_strut_compression_2 - AutopilotStateMachine_P.Constant1_Value; - if (rtb_Saturation1 > AutopilotStateMachine_P.Saturation1_UpperSat) { - rtb_Saturation1 = AutopilotStateMachine_P.Saturation1_UpperSat; - } else if (rtb_Saturation1 < AutopilotStateMachine_P.Saturation1_LowerSat) { - rtb_Saturation1 = AutopilotStateMachine_P.Saturation1_LowerSat; + if (Phi2 > AutopilotStateMachine_P.Saturation1_UpperSat) { + Phi2 = AutopilotStateMachine_P.Saturation1_UpperSat; + } else if (Phi2 < AutopilotStateMachine_P.Saturation1_LowerSat) { + Phi2 = AutopilotStateMachine_P.Saturation1_LowerSat; } - if (AutopilotStateMachine_DWork.is_active_c5_AutopilotStateMachine == 0U) { + if (AutopilotStateMachine_DWork.is_active_c5_AutopilotStateMachine == 0) { AutopilotStateMachine_DWork.is_active_c5_AutopilotStateMachine = 1U; AutopilotStateMachine_DWork.is_c5_AutopilotStateMachine = AutopilotStateMachine_IN_OnGround; rtb_on_ground = 1; } else if (AutopilotStateMachine_DWork.is_c5_AutopilotStateMachine == AutopilotStateMachine_IN_InAir) { - if ((rtb_dme > 0.05) || (rtb_Saturation1 > 0.05)) { + if ((rtb_dme > 0.05) || (Phi2 > 0.05)) { AutopilotStateMachine_DWork.is_c5_AutopilotStateMachine = AutopilotStateMachine_IN_OnGround; rtb_on_ground = 1; } else { rtb_on_ground = 0; } - } else if ((rtb_dme == 0.0) && (rtb_Saturation1 == 0.0)) { + } else if ((rtb_dme == 0.0) && (Phi2 == 0.0)) { AutopilotStateMachine_DWork.is_c5_AutopilotStateMachine = AutopilotStateMachine_IN_InAir; rtb_on_ground = 0; } else { @@ -2880,29 +2847,29 @@ void AutopilotStateMachine::step() rtb_Compare_c = ((AutopilotStateMachine_U.in.data.altimeter_setting_left_mbar != AutopilotStateMachine_DWork.DelayInput1_DSTATE) || AutopilotStateMachine_DWork.DelayInput1_DSTATE_o); rtb_BusAssignment1_input_APPR_push = AutopilotStateMachine_DWork.DelayInput1_DSTATE_h; - if (!AutopilotStateMachine_DWork.eventTime_not_empty_o) { - AutopilotStateMachine_DWork.eventTime_h = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_o = true; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_a) { + AutopilotStateMachine_DWork.eventTime_o = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_a = true; } - if ((rtb_on_ground == 0) || (AutopilotStateMachine_DWork.eventTime_h == 0.0)) { - AutopilotStateMachine_DWork.eventTime_h = AutopilotStateMachine_U.in.time.simulation_time; + if ((rtb_on_ground == 0) || (AutopilotStateMachine_DWork.eventTime_o == 0.0)) { + AutopilotStateMachine_DWork.eventTime_o = AutopilotStateMachine_U.in.time.simulation_time; } - rtb_dme = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_h; - if (!AutopilotStateMachine_DWork.eventTime_not_empty_c) { - AutopilotStateMachine_DWork.eventTime_e = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_c = true; + rtb_dme = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_o; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_b) { + AutopilotStateMachine_DWork.eventTime_c = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_b = true; } - if ((rtb_on_ground != 0) || (AutopilotStateMachine_DWork.eventTime_e == 0.0)) { - AutopilotStateMachine_DWork.eventTime_e = AutopilotStateMachine_U.in.time.simulation_time; + if ((rtb_on_ground != 0) || (AutopilotStateMachine_DWork.eventTime_c == 0.0)) { + AutopilotStateMachine_DWork.eventTime_c = AutopilotStateMachine_U.in.time.simulation_time; } - rtb_Saturation1 = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_e; - if (!AutopilotStateMachine_DWork.eventTime_not_empty_i) { + Phi2 = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_c; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_c) { AutopilotStateMachine_DWork.eventTime_n = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_i = true; + AutopilotStateMachine_DWork.eventTime_not_empty_c = true; } if (((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS) && @@ -2911,41 +2878,41 @@ void AutopilotStateMachine::step() AutopilotStateMachine_DWork.eventTime_n = AutopilotStateMachine_U.in.time.simulation_time; } - a = AutopilotStateMachine_P.Constant_Value_j / AutopilotStateMachine_U.in.time.dt; - if (a < 1.0) { - a = AutopilotStateMachine_U.in.input.H_fcu_ft; + c_R = AutopilotStateMachine_P.Constant_Value_j / AutopilotStateMachine_U.in.time.dt; + if (c_R < 1.0) { + c_R = AutopilotStateMachine_U.in.input.H_fcu_ft; } else { - if (a > 100.0) { + if (c_R > 100.0) { high_i = 100; } else { - high_i = static_cast(static_cast(std::fmod(std::trunc(a), 4.294967296E+9))); + high_i = static_cast(static_cast(std::fmod(std::trunc(c_R), 4.294967296E+9))); } - a = AutopilotStateMachine_DWork.Delay_DSTATE_d5[100U - static_cast(high_i)]; + c_R = AutopilotStateMachine_DWork.Delay_DSTATE_d5[100U - static_cast(high_i)]; } - rtb_Compare_dl = (a != AutopilotStateMachine_U.in.input.H_fcu_ft); - rtb_Y_j = ((AutopilotStateMachine_U.in.input.H_constraint_ft != 0.0) && (((AutopilotStateMachine_U.in.input.H_fcu_ft > + rtb_Compare_dl = (c_R != AutopilotStateMachine_U.in.input.H_fcu_ft); + rtb_Y_n = ((AutopilotStateMachine_U.in.input.H_constraint_ft != 0.0) && (((AutopilotStateMachine_U.in.input.H_fcu_ft > AutopilotStateMachine_U.in.data.H_ind_ft) && (AutopilotStateMachine_U.in.input.H_constraint_ft > AutopilotStateMachine_U.in.data.H_ind_ft) && (AutopilotStateMachine_U.in.input.H_constraint_ft < AutopilotStateMachine_U.in.input.H_fcu_ft)) || ((AutopilotStateMachine_U.in.input.H_fcu_ft < AutopilotStateMachine_U.in.data.H_ind_ft) && (AutopilotStateMachine_U.in.input.H_constraint_ft < AutopilotStateMachine_U.in.data.H_ind_ft) && (AutopilotStateMachine_U.in.input.H_constraint_ft > AutopilotStateMachine_U.in.input.H_fcu_ft)))); - a = AutopilotStateMachine_P.Constant_Value_jq / AutopilotStateMachine_U.in.time.dt; - if (a < 1.0) { - a = AutopilotStateMachine_U.in.input.Psi_fcu_deg; + c_R = AutopilotStateMachine_P.Constant_Value_jq / AutopilotStateMachine_U.in.time.dt; + if (c_R < 1.0) { + c_R = AutopilotStateMachine_U.in.input.Psi_fcu_deg; } else { - if (a > 100.0) { + if (c_R > 100.0) { high_i = 100; } else { - high_i = static_cast(static_cast(std::fmod(std::trunc(a), 4.294967296E+9))); + high_i = static_cast(static_cast(std::fmod(std::trunc(c_R), 4.294967296E+9))); } - a = AutopilotStateMachine_DWork.Delay_DSTATE_c[100U - static_cast(high_i)]; + c_R = AutopilotStateMachine_DWork.Delay_DSTATE_c[100U - static_cast(high_i)]; } - AutopilotStateMachine_DWork.DelayInput1_DSTATE_o = (a != AutopilotStateMachine_U.in.input.Psi_fcu_deg); + AutopilotStateMachine_DWork.DelayInput1_DSTATE_o = (c_R != AutopilotStateMachine_U.in.input.Psi_fcu_deg); AutopilotStateMachine_DWork.DelayInput1_DSTATE_h = (AutopilotStateMachine_U.in.input.Psi_fcu_deg != AutopilotStateMachine_P.CompareToConstant_const_h); rtb_AND = (AutopilotStateMachine_DWork.DelayInput1_DSTATE_o && AutopilotStateMachine_DWork.DelayInput1_DSTATE_h); @@ -2956,26 +2923,26 @@ void AutopilotStateMachine::step() AutopilotStateMachine_DWork.pY_not_empty = true; } - a = AutopilotStateMachine_U.in.time.dt * AutopilotStateMachine_P.LagFilter_C1; - distance_m = a / (a + 2.0); - AutopilotStateMachine_DWork.pY = (2.0 - a) / (a + 2.0) * AutopilotStateMachine_DWork.pY + - (AutopilotStateMachine_U.in.data.nav_gs_error_deg * distance_m + AutopilotStateMachine_DWork.pU * distance_m); + c_R = AutopilotStateMachine_U.in.time.dt * AutopilotStateMachine_P.LagFilter_C1; + R = c_R / (c_R + 2.0); + AutopilotStateMachine_DWork.pY = (2.0 - c_R) / (c_R + 2.0) * AutopilotStateMachine_DWork.pY + + (AutopilotStateMachine_U.in.data.nav_gs_error_deg * R + AutopilotStateMachine_DWork.pU * R); AutopilotStateMachine_DWork.pU = AutopilotStateMachine_U.in.data.nav_gs_error_deg; rtb_FixPtRelationalOperator = (AutopilotStateMachine_DWork.pY < AutopilotStateMachine_DWork.DelayInput1_DSTATE_b); - a = AutopilotStateMachine_P.Constant_Value_m / AutopilotStateMachine_U.in.time.dt; - if (a < 1.0) { - a = AutopilotStateMachine_U.in.input.V_fcu_kn; + c_R = AutopilotStateMachine_P.Constant_Value_m / AutopilotStateMachine_U.in.time.dt; + if (c_R < 1.0) { + c_R = AutopilotStateMachine_U.in.input.V_fcu_kn; } else { - if (a > 100.0) { + if (c_R > 100.0) { high_i = 100; } else { - high_i = static_cast(static_cast(std::fmod(std::trunc(a), 4.294967296E+9))); + high_i = static_cast(static_cast(std::fmod(std::trunc(c_R), 4.294967296E+9))); } - a = AutopilotStateMachine_DWork.Delay_DSTATE_d2[100U - static_cast(high_i)]; + c_R = AutopilotStateMachine_DWork.Delay_DSTATE_d2[100U - static_cast(high_i)]; } - AutopilotStateMachine_DWork.DelayInput1_DSTATE_o = (a != AutopilotStateMachine_U.in.input.V_fcu_kn); + AutopilotStateMachine_DWork.DelayInput1_DSTATE_o = (c_R != AutopilotStateMachine_U.in.input.V_fcu_kn); AutopilotStateMachine_DWork.DelayInput1_DSTATE_h = (AutopilotStateMachine_U.in.input.V_fcu_kn != AutopilotStateMachine_P.CompareToConstant_const_l); rtb_AND_j = (AutopilotStateMachine_DWork.DelayInput1_DSTATE_o && AutopilotStateMachine_DWork.DelayInput1_DSTATE_h); @@ -2988,27 +2955,26 @@ void AutopilotStateMachine::step() speedTargetChanged = (std::abs(AutopilotStateMachine_U.in.input.V_fcu_kn - AutopilotStateMachine_DWork.lastTargetSpeed) > 2.0); AutopilotStateMachine_DWork.lastTargetSpeed = AutopilotStateMachine_U.in.input.V_fcu_kn; - a = std::abs(AutopilotStateMachine_U.in.input.V_fcu_kn - AutopilotStateMachine_U.in.data.V_ias_kn); - if ((a <= 4.0) || (!AutopilotStateMachine_DWork.timeDeltaSpeed4_not_empty)) { + c_R = std::abs(AutopilotStateMachine_U.in.input.V_fcu_kn - AutopilotStateMachine_U.in.data.V_ias_kn); + if ((c_R <= 4.0) || (!AutopilotStateMachine_DWork.timeDeltaSpeed4_not_empty)) { AutopilotStateMachine_DWork.timeDeltaSpeed4 = AutopilotStateMachine_U.in.time.simulation_time; AutopilotStateMachine_DWork.timeDeltaSpeed4_not_empty = true; } - if ((a <= 10.0) || (!AutopilotStateMachine_DWork.timeDeltaSpeed10_not_empty)) { + if ((c_R <= 10.0) || (!AutopilotStateMachine_DWork.timeDeltaSpeed10_not_empty)) { AutopilotStateMachine_DWork.timeDeltaSpeed10 = AutopilotStateMachine_U.in.time.simulation_time; AutopilotStateMachine_DWork.timeDeltaSpeed10_not_empty = true; } - conditionSoftAlt = ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT) && - (AutopilotStateMachine_U.in.data.flight_phase == 3.0) && - AutopilotStateMachine_U.in.input.MACH_mode && AutopilotStateMachine_U.in.input.ATHR_engaged && (a < - 4.0)); - if ((!conditionSoftAlt) || speedTargetChanged || (!AutopilotStateMachine_DWork.timeConditionSoftAlt_not_empty)) { + rtb_cFLARE = ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT) && + (AutopilotStateMachine_U.in.data.flight_phase == 3.0) && AutopilotStateMachine_U.in.input.MACH_mode && + AutopilotStateMachine_U.in.input.ATHR_engaged && (c_R < 4.0)); + if ((!rtb_cFLARE) || speedTargetChanged || (!AutopilotStateMachine_DWork.timeConditionSoftAlt_not_empty)) { AutopilotStateMachine_DWork.timeConditionSoftAlt = AutopilotStateMachine_U.in.time.simulation_time; AutopilotStateMachine_DWork.timeConditionSoftAlt_not_empty = true; } - AutopilotStateMachine_DWork.stateSoftAlt = ((conditionSoftAlt && (AutopilotStateMachine_U.in.time.simulation_time - + AutopilotStateMachine_DWork.stateSoftAlt = ((rtb_cFLARE && (AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.timeConditionSoftAlt >= 120.0)) || AutopilotStateMachine_DWork.stateSoftAlt); if (speedTargetChanged || (!AutopilotStateMachine_U.in.input.MACH_mode) || (!AutopilotStateMachine_U.in.input.ATHR_engaged) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != @@ -3024,29 +2990,29 @@ void AutopilotStateMachine::step() AutopilotStateMachine_DWork.Delay_DSTATE_g, AutopilotStateMachine_P.Raising_Value_a * AutopilotStateMachine_U.in.time.dt), AutopilotStateMachine_P.Falling_Value_f / AutopilotStateMachine_P.Debounce_Value * AutopilotStateMachine_U.in.time.dt); - engageCondition = ((AutopilotStateMachine_U.in.data.H_radio_ft > 100.0) && (rtb_Saturation1 > 5.0)); - rtb_Compare_c = ((AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT)) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_CPT) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT))); - speedTargetChanged = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT)); - conditionSoftAlt = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::GA_TRACK) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA)); - if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_a && engageCondition) { - state_d_tmp = !AutopilotStateMachine_DWork.sAP2; - if ((!AutopilotStateMachine_DWork.sAP1) && state_d_tmp) { + rtb_Compare_c = ((AutopilotStateMachine_U.in.data.H_radio_ft > 100.0) && (Phi2 > 5.0)); + speedTargetChanged = ((AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT)) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_CPT) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT))); + rtb_cFLARE = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT)); + isGoAroundModeActive = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::GA_TRACK) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA)); + if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_a && rtb_Compare_c) { + state_a_tmp = !AutopilotStateMachine_DWork.sAP2; + if ((!AutopilotStateMachine_DWork.sAP1) && state_a_tmp) { AutopilotStateMachine_DWork.sAP1 = true; - } else if (rtb_Compare_c) { - if (AutopilotStateMachine_DWork.sAP1 && state_d_tmp) { + } else if (speedTargetChanged) { + if (AutopilotStateMachine_DWork.sAP1 && state_a_tmp) { AutopilotStateMachine_DWork.sAP2 = true; } else { AutopilotStateMachine_DWork.sAP1 = ((AutopilotStateMachine_DWork.sAP2 && (!AutopilotStateMachine_DWork.sAP1)) || @@ -3055,9 +3021,9 @@ void AutopilotStateMachine::step() } } else if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_p) { if (!AutopilotStateMachine_DWork.sAP1) { - if (engageCondition) { + if (rtb_Compare_c) { AutopilotStateMachine_DWork.sAP1 = true; - AutopilotStateMachine_DWork.sAP2 = (rtb_Compare_c && AutopilotStateMachine_DWork.sAP2); + AutopilotStateMachine_DWork.sAP2 = (speedTargetChanged && AutopilotStateMachine_DWork.sAP2); } } else { AutopilotStateMachine_DWork.sAP1 = false; @@ -3065,135 +3031,129 @@ void AutopilotStateMachine::step() } } else if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_bo) { if (!AutopilotStateMachine_DWork.sAP2) { - if (engageCondition) { + if (rtb_Compare_c) { AutopilotStateMachine_DWork.sAP2 = true; - AutopilotStateMachine_DWork.sAP1 = (rtb_Compare_c && AutopilotStateMachine_DWork.sAP1); + AutopilotStateMachine_DWork.sAP1 = (speedTargetChanged && AutopilotStateMachine_DWork.sAP1); } } else { AutopilotStateMachine_DWork.sAP1 = false; AutopilotStateMachine_DWork.sAP2 = false; } } else { - state_d_tmp = !AutopilotStateMachine_DWork.sGoAroundModeActive; - if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_d || ((!speedTargetChanged) && - AutopilotStateMachine_DWork.sRollOutActive) || ((rtb_on_ground != 0) && conditionSoftAlt && state_d_tmp) || - (rtb_GainTheta > 25.0) || (rtb_GainTheta < -13.0) || (std::abs(rtb_GainTheta1) > 45.0)) { + state_a_tmp = !AutopilotStateMachine_DWork.sGoAroundModeActive; + if (AutopilotStateMachine_DWork.DelayInput1_DSTATE_d || ((!rtb_cFLARE) && AutopilotStateMachine_DWork.sRollOutActive) + || ((rtb_on_ground != 0) && isGoAroundModeActive && state_a_tmp) || (rtb_GainTheta > 25.0) || (rtb_GainTheta < + -13.0) || (std::abs(rtb_GainTheta1) > 45.0)) { AutopilotStateMachine_DWork.sAP1 = false; AutopilotStateMachine_DWork.sAP2 = false; - } else if ((!rtb_Compare_c) && AutopilotStateMachine_DWork.sLandModeArmedOrActive && (!conditionSoftAlt) && + } else if ((!speedTargetChanged) && AutopilotStateMachine_DWork.sLandModeArmedOrActive && (!isGoAroundModeActive) && AutopilotStateMachine_DWork.sAP1 && AutopilotStateMachine_DWork.sAP2) { AutopilotStateMachine_DWork.sAP2 = false; } else { - AutopilotStateMachine_DWork.sAP2 = ((conditionSoftAlt || state_d_tmp || (!AutopilotStateMachine_DWork.sAP1) || + AutopilotStateMachine_DWork.sAP2 = ((isGoAroundModeActive || state_a_tmp || (!AutopilotStateMachine_DWork.sAP1) || (!AutopilotStateMachine_DWork.sAP2)) && AutopilotStateMachine_DWork.sAP2); } } - AutopilotStateMachine_DWork.sLandModeArmedOrActive = rtb_Compare_c; - AutopilotStateMachine_DWork.sRollOutActive = speedTargetChanged; - AutopilotStateMachine_DWork.sGoAroundModeActive = conditionSoftAlt; + AutopilotStateMachine_DWork.sLandModeArmedOrActive = speedTargetChanged; + AutopilotStateMachine_DWork.sRollOutActive = rtb_cFLARE; + AutopilotStateMachine_DWork.sGoAroundModeActive = isGoAroundModeActive; if (!AutopilotStateMachine_DWork.wasFlightPlanAvailable_not_empty) { AutopilotStateMachine_DWork.wasFlightPlanAvailable = AutopilotStateMachine_U.in.data.is_flight_plan_available; AutopilotStateMachine_DWork.wasFlightPlanAvailable_not_empty = true; } - state_d_tmp = !AutopilotStateMachine_DWork.Delay_DSTATE.armed.NAV; - AutopilotStateMachine_DWork.state_d = ((AutopilotStateMachine_U.in.data.is_flight_plan_available && + state_a_tmp = !AutopilotStateMachine_DWork.Delay_DSTATE.armed.NAV; + AutopilotStateMachine_DWork.state_a = ((AutopilotStateMachine_U.in.data.is_flight_plan_available && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && (AutopilotStateMachine_DWork.DelayInput1_DSTATE_e || ((rtb_on_ground != 0) && (!AutopilotStateMachine_DWork.wasFlightPlanAvailable) && AutopilotStateMachine_U.in.data.is_flight_plan_available) || - (state_d_tmp && AutopilotStateMachine_U.in.input.FM_rnav_appr_selected && rtb_BusAssignment1_input_APPR_push) || - (state_d_tmp && (!AutopilotStateMachine_DWork.wasInSrsGa) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode + (state_a_tmp && AutopilotStateMachine_U.in.input.FM_rnav_appr_selected && rtb_BusAssignment1_input_APPR_push) || + (state_a_tmp && (!AutopilotStateMachine_DWork.wasInSrsGa) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA))) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) || AutopilotStateMachine_U.in.input.FM_rnav_appr_selected)) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK) || AutopilotStateMachine_U.in.input.FM_rnav_appr_selected) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LAND) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::FLARE)) || - AutopilotStateMachine_DWork.state_d); + AutopilotStateMachine_DWork.state_a); rtb_Compare_c = !rtb_BusAssignment1_input_APPR_push; - speedTargetChanged = !AutopilotStateMachine_U.in.input.FM_rnav_appr_selected; - rtb_cLAND = !AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC; - state_d_tmp_0 = !AutopilotStateMachine_DWork.Delay1_DSTATE.armed.FINAL_DES; - state_d_tmp_1 = !AutopilotStateMachine_DWork.DelayInput1_DSTATE_g; - AutopilotStateMachine_DWork.state_d = (state_d_tmp_1 && AutopilotStateMachine_U.in.data.is_flight_plan_available && - ((AutopilotStateMachine_U.in.data.H_radio_ft >= 30.0) || (!rtb_AND)) && (rtb_cLAND || + state_a_tmp_0 = !AutopilotStateMachine_U.in.input.FM_rnav_appr_selected; + state_a_tmp_1 = !AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC; + state_a_tmp_2 = !AutopilotStateMachine_DWork.Delay1_DSTATE.armed.FINAL_DES; + state_a_tmp_3 = !AutopilotStateMachine_DWork.DelayInput1_DSTATE_g; + AutopilotStateMachine_DWork.state_a = (state_a_tmp_3 && AutopilotStateMachine_U.in.data.is_flight_plan_available && + ((AutopilotStateMachine_U.in.data.H_radio_ft >= 30.0) || (!rtb_AND)) && (state_a_tmp_1 || AutopilotStateMachine_U.in.input.FM_rnav_appr_selected) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LAND) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::FLARE) && (state_d_tmp_0 || state_d_tmp || - speedTargetChanged || rtb_Compare_c) && AutopilotStateMachine_DWork.state_d); + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::FLARE) && (state_a_tmp_2 || state_a_tmp || + state_a_tmp_0 || rtb_Compare_c) && AutopilotStateMachine_DWork.state_a); AutopilotStateMachine_DWork.wasFlightPlanAvailable = AutopilotStateMachine_U.in.data.is_flight_plan_available; AutopilotStateMachine_DWork.wasInSrsGa = (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode:: SRS_GA); - rtb_cFLARE = (AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_CPT) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE)); - state_k_tmp = !rtb_cFLARE; - state_k_tmp_0 = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LAND) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::FLARE)); - conditionSoftAlt = (AutopilotStateMachine_U.in.input.FD_active || AutopilotStateMachine_DWork.sAP1 || - AutopilotStateMachine_DWork.sAP2); - AutopilotStateMachine_DWork.state_k = (((AutopilotStateMachine_U.in.data.H_radio_ft > 400.0) && + speedTargetChanged = (AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_CPT) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE)); + rtb_cFLARE = !speedTargetChanged; + isGoAroundModeActive = ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LAND) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::FLARE)); + state_e_tmp = (AutopilotStateMachine_U.in.input.FD_active || AutopilotStateMachine_DWork.sAP1 || + AutopilotStateMachine_DWork.sAP2); + AutopilotStateMachine_DWork.state_e = (((AutopilotStateMachine_U.in.data.H_radio_ft > 400.0) && AutopilotStateMachine_U.in.data.nav_valid && (AutopilotStateMachine_U.in.data.throttle_lever_1_pos < 45.0) && (AutopilotStateMachine_U.in.data.throttle_lever_2_pos < 45.0) && (AutopilotStateMachine_DWork.DelayInput1_DSTATE_fn || - (rtb_BusAssignment1_input_APPR_push && speedTargetChanged)) && state_k_tmp_0 && state_k_tmp && conditionSoftAlt) || - AutopilotStateMachine_DWork.state_k); - engageCondition = !AutopilotStateMachine_DWork.DelayInput1_DSTATE_fn; - AutopilotStateMachine_DWork.state_k = ((engageCondition || rtb_cLAND || rtb_cFLARE) && (rtb_Compare_c || state_k_tmp) && - (rtb_Compare_c || speedTargetChanged) && state_d_tmp && state_k_tmp_0 && + (rtb_BusAssignment1_input_APPR_push && state_a_tmp_0)) && isGoAroundModeActive && rtb_cFLARE && state_e_tmp) || + AutopilotStateMachine_DWork.state_e); + state_e_tmp_0 = !AutopilotStateMachine_DWork.DelayInput1_DSTATE_fn; + AutopilotStateMachine_DWork.state_e = ((state_e_tmp_0 || state_a_tmp_1 || speedTargetChanged) && (rtb_Compare_c || + rtb_cFLARE) && (rtb_Compare_c || state_a_tmp_0) && state_a_tmp && isGoAroundModeActive && (AutopilotStateMachine_U.in.data.throttle_lever_1_pos != 45.0) && - (AutopilotStateMachine_U.in.data.throttle_lever_2_pos != 45.0) && conditionSoftAlt && - AutopilotStateMachine_DWork.state_k); + (AutopilotStateMachine_U.in.data.throttle_lever_2_pos != 45.0) && state_e_tmp && AutopilotStateMachine_DWork.state_e); c_R = (AutopilotStateMachine_U.in.data.Psi_magnetic_track_deg - (AutopilotStateMachine_U.in.data.nav_loc_deg + 360.0)) + 360.0; if (c_R == 0.0) { - a = 0.0; + c_R = 0.0; } else { - a = std::fmod(c_R, 360.0); - if (a == 0.0) { - a = 0.0; + c_R = std::fmod(c_R, 360.0); + if (c_R == 0.0) { + c_R = 0.0; } else if (c_R < 0.0) { - a += 360.0; + c_R += 360.0; } } - if (360.0 - a == 0.0) { - distance_m = 0.0; + if (360.0 - c_R == 0.0) { + R = 0.0; } else { - distance_m = std::fmod(360.0 - a, 360.0); - if (distance_m == 0.0) { - distance_m = 0.0; - } else if (360.0 - a < 0.0) { - distance_m += 360.0; - } + R = std::fmod(360.0 - c_R, 360.0); } - if (a < distance_m) { - distance_m = -a; + if (c_R < R) { + R = -c_R; } - if (AutopilotStateMachine_U.in.input.Phi_loc_c < 0.0) { + if (R < 0.0) { high_i = -1; } else { - high_i = (AutopilotStateMachine_U.in.input.Phi_loc_c > 0.0); + high_i = (R > 0.0); } - if (distance_m < 0.0) { + if (AutopilotStateMachine_U.in.input.Phi_loc_c < 0.0) { low_i = -1; } else { - low_i = (distance_m > 0.0); + low_i = (AutopilotStateMachine_U.in.input.Phi_loc_c > 0.0); } - if (low_i == high_i) { - Phi2 = std::abs(AutopilotStateMachine_U.in.input.Phi_loc_c); + if (high_i == low_i) { + c_R = std::abs(AutopilotStateMachine_U.in.input.Phi_loc_c); guard1 = false; - if (Phi2 > 5.0) { + if (c_R > 5.0) { if (std::abs(rtb_GainTheta1) <= 5.0) { - state_d_tmp = true; + speedTargetChanged = true; } else { if (rtb_GainTheta1 < 0.0) { low_ip1 = -1; @@ -3201,8 +3161,8 @@ void AutopilotStateMachine::step() low_ip1 = (rtb_GainTheta1 > 0.0); } - if (high_i != low_ip1) { - state_d_tmp = true; + if (low_i != low_ip1) { + speedTargetChanged = true; } else { guard1 = true; } @@ -3218,24 +3178,25 @@ void AutopilotStateMachine::step() low_ip1 = (rtb_GainTheta1 > 0.0); } - state_d_tmp = ((Phi2 >= std::abs(rtb_GainTheta1)) && (high_i == low_ip1)); + speedTargetChanged = ((c_R >= std::abs(rtb_GainTheta1)) && (low_i == low_ip1)); } } else { - state_d_tmp = false; + speedTargetChanged = false; } if (AutopilotStateMachine_U.in.data.nav_valid && AutopilotStateMachine_U.in.data.nav_loc_valid) { - Phi2 = std::abs(distance_m); - if (Phi2 < 115.0) { - c_R = std::abs(AutopilotStateMachine_U.in.data.nav_loc_error_deg); + c_R = std::abs(R); + if (c_R < 115.0) { + R = std::abs(AutopilotStateMachine_U.in.data.nav_loc_error_deg); if (AutopilotStateMachine_U.in.data.nav_loc_error_deg < 0.0) { - high_i = -1; + low_i = -1; } else { - high_i = (AutopilotStateMachine_U.in.data.nav_loc_error_deg > 0.0); + low_i = (AutopilotStateMachine_U.in.data.nav_loc_error_deg > 0.0); } - if (((Phi2 > 25.0) && ((c_R < 10.0) && ((low_i != high_i) && state_d_tmp))) || (c_R < 1.92)) { - AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LOC_CPT = (state_d_tmp || ((Phi2 < 15.0) && (c_R < 1.1))); + if (((c_R > 25.0) && ((R < 10.0) && ((high_i != low_i) && speedTargetChanged))) || (R < 1.92)) { + AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LOC_CPT = (speedTargetChanged || ((c_R < 15.0) && (R < + 1.1))); } else { AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LOC_CPT = false; } @@ -3246,34 +3207,34 @@ void AutopilotStateMachine::step() AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LOC_CPT = false; } - if (!AutopilotStateMachine_DWork.eventTime_not_empty_l) { - AutopilotStateMachine_DWork.eventTime_ht = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_l = true; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_o) { + AutopilotStateMachine_DWork.eventTime_dp = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_o = true; } - state_d_tmp = !AutopilotStateMachine_U.in.data.nav_valid; - if (state_d_tmp || (!AutopilotStateMachine_U.in.data.nav_loc_valid) || ((std::abs + state_a_tmp = !AutopilotStateMachine_U.in.data.nav_valid; + if (state_a_tmp || (!AutopilotStateMachine_U.in.data.nav_loc_valid) || ((std::abs (AutopilotStateMachine_U.in.data.nav_loc_error_deg) >= 0.16) || ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK))) || - (AutopilotStateMachine_DWork.eventTime_ht == 0.0)) { - AutopilotStateMachine_DWork.eventTime_ht = AutopilotStateMachine_U.in.time.simulation_time; + (AutopilotStateMachine_DWork.eventTime_dp == 0.0)) { + AutopilotStateMachine_DWork.eventTime_dp = AutopilotStateMachine_U.in.time.simulation_time; } if (!AutopilotStateMachine_DWork.eventTime_not_empty_k) { - AutopilotStateMachine_DWork.eventTime_l = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_g = AutopilotStateMachine_U.in.time.simulation_time; AutopilotStateMachine_DWork.eventTime_not_empty_k = true; } - if ((AutopilotStateMachine_U.in.data.H_radio_ft >= 400.0) || (AutopilotStateMachine_DWork.eventTime_l == 0.0)) { - AutopilotStateMachine_DWork.eventTime_l = AutopilotStateMachine_U.in.time.simulation_time; + if ((AutopilotStateMachine_U.in.data.H_radio_ft >= 400.0) || (AutopilotStateMachine_DWork.eventTime_g == 0.0)) { + AutopilotStateMachine_DWork.eventTime_g = AutopilotStateMachine_U.in.time.simulation_time; } - rtb_cLAND = ((AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_l >= 1.2) && - ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND)) && - ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND))); + speedTargetChanged = ((AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_g >= + 1.2) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND)) && + ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::GS_TRACK) || + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::LAND))); rtb_cFLARE = (AutopilotStateMachine_U.in.input.condition_Flare && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE)) && @@ -3284,20 +3245,20 @@ void AutopilotStateMachine::step() } if (AutopilotStateMachine_U.in.data.V_gnd_kn >= 40.0) { - Phi2 = AutopilotStateMachine_U.in.data.Psi_magnetic_track_deg; + c_R = AutopilotStateMachine_U.in.data.Psi_magnetic_track_deg; } else { - Phi2 = AutopilotStateMachine_U.in.data.Psi_magnetic_deg; + c_R = AutopilotStateMachine_U.in.data.Psi_magnetic_deg; } - c_R = (AutopilotStateMachine_DWork.runwayHeadingStored - Phi2) + 180.0; + c_R = (AutopilotStateMachine_DWork.runwayHeadingStored - c_R) + 180.0; if (c_R == 0.0) { - Phi2 = 0.0; + R = 0.0; } else { - Phi2 = std::fmod(c_R, 360.0); - if (Phi2 == 0.0) { - Phi2 = 0.0; - } else if (c_R < 0.0) { - Phi2 += 360.0; + R = std::fmod(c_R, 360.0); + if (R == 0.0) { + R = 0.0; + } else if (R < 0.0) { + R += 360.0; } } @@ -3306,48 +3267,47 @@ void AutopilotStateMachine::step() ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT))) || AutopilotStateMachine_DWork.state); - state_k_tmp = (AutopilotStateMachine_DWork.sAP1 || AutopilotStateMachine_DWork.sAP2); - AutopilotStateMachine_DWork.state = ((std::abs(Phi2 - 180.0) <= 7.0) && ((state_k_tmp || - (AutopilotStateMachine_U.in.data.flight_phase != 7.0)) && (state_k_tmp || (rtb_dme <= 10.0) || rtb_Compare_c) && - ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT)) && + isGoAroundModeActive = (AutopilotStateMachine_DWork.sAP1 || AutopilotStateMachine_DWork.sAP2); + AutopilotStateMachine_DWork.state = ((std::abs(R - 180.0) <= 7.0) && ((isGoAroundModeActive || + (AutopilotStateMachine_U.in.data.flight_phase != 7.0)) && (isGoAroundModeActive || (rtb_dme <= 10.0) || + rtb_Compare_c) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE) || + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::ROLL_OUT)) && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FLARE) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ROLL_OUT)) && AutopilotStateMachine_DWork.state)); - state_k_tmp_0 = ((AutopilotStateMachine_U.in.data.throttle_lever_1_pos == 45.0) || + state_a_tmp_1 = ((AutopilotStateMachine_U.in.data.throttle_lever_1_pos == 45.0) || (AutopilotStateMachine_U.in.data.throttle_lever_2_pos == 45.0)); - state_k_tmp = ((!AutopilotStateMachine_DWork.sThrottleCondition) && state_k_tmp_0 && - (AutopilotStateMachine_U.in.data.flaps_handle_index >= 1.0) && ((rtb_on_ground == 0) || (rtb_dme < 30.0)) - && (AutopilotStateMachine_U.in.data.flight_phase >= 2.0) && - (AutopilotStateMachine_U.in.data.flight_phase <= 6.0) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::GA_TRACK) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA)); - AutopilotStateMachine_DWork.sThrottleCondition = state_k_tmp_0; + isGoAroundModeActive = ((!AutopilotStateMachine_DWork.sThrottleCondition) && state_a_tmp_1 && + (AutopilotStateMachine_U.in.data.flaps_handle_index >= 1.0) && ((rtb_on_ground == 0) || (rtb_dme < 30.0)) && + (AutopilotStateMachine_U.in.data.flight_phase >= 2.0) && (AutopilotStateMachine_U.in.data.flight_phase <= 6.0) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::GA_TRACK) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA)); + AutopilotStateMachine_DWork.sThrottleCondition = state_a_tmp_1; if (rtb_Compare_dl) { - AutopilotStateMachine_DWork.newFcuAltitudeSelected_j = true; + AutopilotStateMachine_DWork.newFcuAltitudeSelected_a = true; } else if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT) { - AutopilotStateMachine_DWork.newFcuAltitudeSelected_j = ((std::abs(AutopilotStateMachine_U.in.data.H_ind_ft - - AutopilotStateMachine_U.in.input.H_fcu_ft) >= 40.0) && AutopilotStateMachine_DWork.newFcuAltitudeSelected_j); + AutopilotStateMachine_DWork.newFcuAltitudeSelected_a = ((std::abs(AutopilotStateMachine_U.in.data.H_ind_ft - + AutopilotStateMachine_U.in.input.H_fcu_ft) >= 40.0) && AutopilotStateMachine_DWork.newFcuAltitudeSelected_a); } - distance_m = AutopilotStateMachine_U.in.input.H_fcu_ft - AutopilotStateMachine_U.in.data.H_ind_ft; - c_R = std::abs(distance_m); + rtb_dme_tmp = AutopilotStateMachine_U.in.input.H_fcu_ft - AutopilotStateMachine_U.in.data.H_ind_ft; + R = std::abs(rtb_dme_tmp); AutopilotStateMachine_DWork.was_TCAS_active = ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode:: - TCAS) || ((c_R <= 250.0) && AutopilotStateMachine_DWork.was_TCAS_active)); + TCAS) || ((R <= 250.0) && AutopilotStateMachine_DWork.was_TCAS_active)); if ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::CLB) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::OP_CLB) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::DES) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::OP_DES)) { - state_k_tmp_0 = true; + state_a_tmp_1 = true; } else { guard1 = false; guard2 = false; if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::VS) { - if (distance_m < 0.0) { + if (rtb_dme_tmp < 0.0) { high_i = -1; } else { - high_i = (distance_m > 0.0); + high_i = (rtb_dme_tmp > 0.0); } if (AutopilotStateMachine_U.in.input.H_dot_fcu_fpm < 0.0) { @@ -3357,7 +3317,7 @@ void AutopilotStateMachine::step() } if (high_i == low_i) { - state_k_tmp_0 = true; + state_a_tmp_1 = true; } else { guard2 = true; } @@ -3367,10 +3327,10 @@ void AutopilotStateMachine::step() if (guard2) { if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FPA) { - if (distance_m < 0.0) { + if (rtb_dme_tmp < 0.0) { high_i = -1; } else { - high_i = (distance_m > 0.0); + high_i = (rtb_dme_tmp > 0.0); } if (AutopilotStateMachine_U.in.input.FPA_fcu_deg < 0.0) { @@ -3380,7 +3340,7 @@ void AutopilotStateMachine::step() } if (high_i == low_i) { - state_k_tmp_0 = true; + state_a_tmp_1 = true; } else { guard1 = true; } @@ -3391,10 +3351,10 @@ void AutopilotStateMachine::step() if (guard1) { if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::TCAS) { - if (distance_m < 0.0) { + if (rtb_dme_tmp < 0.0) { high_i = -1; } else { - high_i = (distance_m > 0.0); + high_i = (rtb_dme_tmp > 0.0); } if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.H_dot_c_fpm < 0.0) { @@ -3404,44 +3364,44 @@ void AutopilotStateMachine::step() } if ((high_i == low_i) && AutopilotStateMachine_DWork.Delay1_DSTATE.output.TCAS_sub_mode_compatible) { - state_k_tmp_0 = true; + state_a_tmp_1 = true; } else { - state_k_tmp_0 = ((((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS) || + state_a_tmp_1 = ((((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA)) && - (distance_m > 250.0)) || (((AutopilotStateMachine_U.in.data.flight_phase == 0.0) || + (rtb_dme_tmp > 250.0)) || (((AutopilotStateMachine_U.in.data.flight_phase == 0.0) || (AutopilotStateMachine_U.in.data.flight_phase == 1.0) || (AutopilotStateMachine_U.in.data.flight_phase == 7.0)) && (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.CLB))); } } else { - state_k_tmp_0 = ((((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS) || + state_a_tmp_1 = ((((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA)) && - (distance_m > 250.0)) || (((AutopilotStateMachine_U.in.data.flight_phase == 0.0) || + (rtb_dme_tmp > 250.0)) || (((AutopilotStateMachine_U.in.data.flight_phase == 0.0) || (AutopilotStateMachine_U.in.data.flight_phase == 1.0) || (AutopilotStateMachine_U.in.data.flight_phase == 7.0)) && (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.CLB))); } } } - if (AutopilotStateMachine_DWork.newFcuAltitudeSelected_j && state_k_tmp_0) { - AutopilotStateMachine_DWork.canArm_i = 1.0; + if (AutopilotStateMachine_DWork.newFcuAltitudeSelected_a && state_a_tmp_1) { + AutopilotStateMachine_DWork.canArm_f = 1.0; } else if ((std::abs(AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft) > 250.0) && - state_k_tmp_0) { - AutopilotStateMachine_DWork.canArm_i = 1.0; + state_a_tmp_1) { + AutopilotStateMachine_DWork.canArm_f = 1.0; } else if ((AutopilotStateMachine_DWork.was_TCAS_active && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == - vertical_mode::VS) && state_k_tmp_0) || ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == - vertical_mode::TCAS) && state_k_tmp_0)) { - AutopilotStateMachine_DWork.canArm_i = 1.0; + vertical_mode::VS) && state_a_tmp_1) || ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == + vertical_mode::TCAS) && state_a_tmp_1)) { + AutopilotStateMachine_DWork.canArm_f = 1.0; } if (((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::VS) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::FPA) || - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::TCAS)) && (!state_k_tmp_0) && - (!AutopilotStateMachine_DWork.newFcuAltitudeSelected_j)) { - AutopilotStateMachine_DWork.canArm_i = 0.0; + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::TCAS)) && (!state_a_tmp_1) && + (!AutopilotStateMachine_DWork.newFcuAltitudeSelected_a)) { + AutopilotStateMachine_DWork.canArm_f = 0.0; } AutopilotStateMachine_B.BusAssignment_g.vertical.armed.ALT = ((AutopilotStateMachine_U.in.data.flight_phase <= 7.0) && - (AutopilotStateMachine_DWork.canArm_i != 0.0) && (((!rtb_Y_j) && + (AutopilotStateMachine_DWork.canArm_f != 0.0) && (((!rtb_Y_n) && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::CLB) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::DES))) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::OP_CLB) || @@ -3458,7 +3418,7 @@ void AutopilotStateMachine::step() if ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT_CPT) || ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT) && (std::abs (AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft) < 40.0))) { - AutopilotStateMachine_DWork.canArm_i = 0.0; + AutopilotStateMachine_DWork.canArm_f = 0.0; AutopilotStateMachine_DWork.was_TCAS_active = false; } @@ -3469,7 +3429,7 @@ void AutopilotStateMachine::step() } AutopilotStateMachine_B.BusAssignment_g.vertical.armed.ALT_CST = ((AutopilotStateMachine_U.in.data.flight_phase < 7.0) - && (AutopilotStateMachine_DWork.canArm != 0.0) && rtb_Y_j && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode + && (AutopilotStateMachine_DWork.canArm != 0.0) && rtb_Y_n && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::CLB) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::DES))); switch (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode) { case vertical_mode::ALT_CPT: @@ -3486,24 +3446,24 @@ void AutopilotStateMachine::step() if ((AutopilotStateMachine_U.in.data.flight_phase == 2.0) || (AutopilotStateMachine_U.in.data.flight_phase == 3.0) || (AutopilotStateMachine_U.in.data.flight_phase == 6.0)) { if (AutopilotStateMachine_U.in.input.H_fcu_ft < AutopilotStateMachine_U.in.data.H_ind_ft) { - inFlightDisarmCondition = true; - } else if (c_R < 50.0) { - inFlightDisarmCondition = true; + state_a_tmp_1 = true; + } else if (R < 50.0) { + state_a_tmp_1 = true; } else if ((AutopilotStateMachine_U.in.input.H_fcu_ft == AutopilotStateMachine_U.in.input.H_constraint_ft) && (std:: abs(AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft) < 50.0)) { - inFlightDisarmCondition = true; + state_a_tmp_1 = true; } else if ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST_CPT) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA)) { - inFlightDisarmCondition = true; + state_a_tmp_1 = true; } else { - inFlightDisarmCondition = ((AutopilotStateMachine_U.in.data.flight_phase == 4.0) || - (AutopilotStateMachine_U.in.data.flight_phase == 5.0)); + state_a_tmp_1 = ((AutopilotStateMachine_U.in.data.flight_phase == 4.0) || + (AutopilotStateMachine_U.in.data.flight_phase == 5.0)); } } else { - inFlightDisarmCondition = ((AutopilotStateMachine_U.in.data.flight_phase == 4.0) || - (AutopilotStateMachine_U.in.data.flight_phase == 5.0)); + state_a_tmp_1 = ((AutopilotStateMachine_U.in.data.flight_phase == 4.0) || + (AutopilotStateMachine_U.in.data.flight_phase == 5.0)); } sCLB_tmp = ((((AutopilotStateMachine_U.in.data.flight_phase == 0.0) || (AutopilotStateMachine_U.in.data.flight_phase == @@ -3515,99 +3475,98 @@ void AutopilotStateMachine::step() (AutopilotStateMachine_U.in.data.acceleration_altitude < AutopilotStateMachine_U.in.input.H_fcu_ft)) || (((AutopilotStateMachine_U.in.data.flight_phase == 2.0) || (AutopilotStateMachine_U.in.data.flight_phase == 3.0) || (AutopilotStateMachine_U.in.data.flight_phase == 6.0)) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV) && (distance_m > 50.0) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV) && (rtb_dme_tmp > 50.0) && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT_CST_CPT) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT_CST) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS_GA)))); AutopilotStateMachine_DWork.sCLB = (sCLB_tmp || AutopilotStateMachine_DWork.sCLB); - state_k_tmp_0 = ((!AutopilotStateMachine_DWork.DelayInput1_DSTATE_ib) && - (!AutopilotStateMachine_DWork.DelayInput1_DSTATE_bd) && - (!AutopilotStateMachine_DWork.DelayInput1_DSTATE_ah)); - AutopilotStateMachine_DWork.sCLB = (state_k_tmp_0 && (!inFlightDisarmCondition) && (sCLB_tmp && - AutopilotStateMachine_DWork.sCLB)); + sCLB_tmp_0 = ((!AutopilotStateMachine_DWork.DelayInput1_DSTATE_ib) && + (!AutopilotStateMachine_DWork.DelayInput1_DSTATE_bd) && + (!AutopilotStateMachine_DWork.DelayInput1_DSTATE_ah)); + AutopilotStateMachine_DWork.sCLB = (sCLB_tmp_0 && (!state_a_tmp_1) && (sCLB_tmp && AutopilotStateMachine_DWork.sCLB)); if (rtb_on_ground == 0) { if (AutopilotStateMachine_U.in.input.H_fcu_ft > AutopilotStateMachine_U.in.data.H_ind_ft) { - inFlightDisarmCondition = true; - } else if (c_R < 50.0) { - inFlightDisarmCondition = true; + state_a_tmp_1 = true; + } else if (R < 50.0) { + state_a_tmp_1 = true; } else if ((AutopilotStateMachine_U.in.input.H_fcu_ft == AutopilotStateMachine_U.in.input.H_constraint_ft) && (std:: abs(AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft) < 50.0)) { - inFlightDisarmCondition = true; + state_a_tmp_1 = true; } else { - inFlightDisarmCondition = (((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST_CPT)) || - ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) && - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK))); + state_a_tmp_1 = (((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::ALT_CST_CPT)) || + ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_CPT) && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::LOC_TRACK))); } } else { - inFlightDisarmCondition = false; + state_a_tmp_1 = false; } - AutopilotStateMachine_DWork.sDES = (((rtb_on_ground == 0) && (distance_m < -50.0) && + AutopilotStateMachine_DWork.sDES = (((rtb_on_ground == 0) && (rtb_dme_tmp < -50.0) && ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT_CST) || (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT_CST_CPT)) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK))) || AutopilotStateMachine_DWork.sDES); - AutopilotStateMachine_DWork.sDES = (state_k_tmp_0 && (!inFlightDisarmCondition) && AutopilotStateMachine_DWork.sDES); - AutopilotStateMachine_DWork.sFINAL_DES = (((AutopilotStateMachine_U.in.data.H_radio_ft >= 400.0) && state_d_tmp_0 && + AutopilotStateMachine_DWork.sDES = (sCLB_tmp_0 && (!state_a_tmp_1) && AutopilotStateMachine_DWork.sDES); + AutopilotStateMachine_DWork.sFINAL_DES = (((AutopilotStateMachine_U.in.data.H_radio_ft >= 400.0) && state_a_tmp_2 && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::FINAL_DES) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA) && rtb_BusAssignment1_input_APPR_push && AutopilotStateMachine_U.in.input.FM_rnav_appr_selected) || AutopilotStateMachine_DWork.sFINAL_DES); - state_k_tmp_0 = !AutopilotStateMachine_DWork.Delay1_DSTATE.condition.TCAS; - AutopilotStateMachine_DWork.sFINAL_DES = ((state_d_tmp_0 || rtb_Compare_c) && (engageCondition || state_d_tmp) && - state_d_tmp_1 && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA) && - (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::FINAL_DES) && state_k_tmp_0 && + sCLB_tmp = !AutopilotStateMachine_DWork.Delay1_DSTATE.condition.TCAS; + AutopilotStateMachine_DWork.sFINAL_DES = ((state_a_tmp_2 || rtb_Compare_c) && (state_e_tmp_0 || state_a_tmp) && + state_a_tmp_3 && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::SRS_GA) && + (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::FINAL_DES) && sCLB_tmp && AutopilotStateMachine_DWork.sFINAL_DES); - state_d_tmp_0 = ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_CPT) && + state_a_tmp_1 = ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_CPT) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_TRACK) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::LAND) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::FLARE)); - AutopilotStateMachine_DWork.state_j = (((AutopilotStateMachine_U.in.data.H_radio_ft > 400.0) && + AutopilotStateMachine_DWork.state_l = (((AutopilotStateMachine_U.in.data.H_radio_ft > 400.0) && AutopilotStateMachine_U.in.data.nav_valid && (AutopilotStateMachine_U.in.data.throttle_lever_1_pos < 45.0) && - (AutopilotStateMachine_U.in.data.throttle_lever_2_pos < 45.0) && rtb_BusAssignment1_input_APPR_push && - speedTargetChanged && state_d_tmp_0 && conditionSoftAlt) || AutopilotStateMachine_DWork.state_j); - AutopilotStateMachine_DWork.state_j = ((rtb_Compare_c || (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS)) && - engageCondition && (rtb_BusAssignment1_input_APPR_push || (AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC || + (AutopilotStateMachine_U.in.data.throttle_lever_2_pos < 45.0) && rtb_BusAssignment1_input_APPR_push && state_a_tmp_0 + && state_a_tmp_1 && state_e_tmp) || AutopilotStateMachine_DWork.state_l); + AutopilotStateMachine_DWork.state_l = ((rtb_Compare_c || (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.GS)) && + state_e_tmp_0 && (rtb_BusAssignment1_input_APPR_push || (AutopilotStateMachine_DWork.Delay_DSTATE.armed.LOC || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LAND) || - (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE))) && state_d_tmp_0 && + (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::FLARE))) && state_a_tmp_1 && (AutopilotStateMachine_U.in.data.throttle_lever_1_pos != 45.0) && - (AutopilotStateMachine_U.in.data.throttle_lever_2_pos != 45.0) && state_k_tmp_0 && conditionSoftAlt && - AutopilotStateMachine_DWork.state_j); - rtb_Compare_c = (AutopilotStateMachine_U.in.input.TCAS_mode_available && + (AutopilotStateMachine_U.in.data.throttle_lever_2_pos != 45.0) && sCLB_tmp && state_e_tmp && + AutopilotStateMachine_DWork.state_l); + state_a_tmp_0 = (AutopilotStateMachine_U.in.input.TCAS_mode_available && (!AutopilotStateMachine_U.in.input.TCAS_mode_fail)); - AutopilotStateMachine_DWork.sTCAS_l = ((rtb_Compare_c && (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.TCAS) && + AutopilotStateMachine_DWork.sTCAS_b = ((state_a_tmp_0 && (!AutopilotStateMachine_DWork.Delay1_DSTATE.armed.TCAS) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::TCAS) && (AutopilotStateMachine_U.in.input.TCAS_advisory_state == 1.0) && (AutopilotStateMachine_U.in.data.H_radio_ft >= - 900.0)) || AutopilotStateMachine_DWork.sTCAS_l); - AutopilotStateMachine_DWork.sTCAS_l = (rtb_Compare_c && (AutopilotStateMachine_U.in.input.TCAS_advisory_state != 0.0) && + 900.0)) || AutopilotStateMachine_DWork.sTCAS_b); + AutopilotStateMachine_DWork.sTCAS_b = (state_a_tmp_0 && (AutopilotStateMachine_U.in.input.TCAS_advisory_state != 0.0) && (AutopilotStateMachine_U.in.data.H_radio_ft >= 900.0) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != - vertical_mode::TCAS) && AutopilotStateMachine_DWork.sTCAS_l); - if (!AutopilotStateMachine_DWork.eventTime_not_empty_g) { - AutopilotStateMachine_DWork.eventTime_ec = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_g = true; + vertical_mode::TCAS) && AutopilotStateMachine_DWork.sTCAS_b); + if (!AutopilotStateMachine_DWork.eventTime_not_empty_kq) { + AutopilotStateMachine_DWork.eventTime_o0 = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_kq = true; } - if (c_R >= 40.0) { - AutopilotStateMachine_DWork.eventTime_ec = AutopilotStateMachine_U.in.time.simulation_time; - } else if (AutopilotStateMachine_DWork.eventTime_ec == 0.0) { - AutopilotStateMachine_DWork.eventTime_ec = AutopilotStateMachine_U.in.time.simulation_time; + if (R >= 40.0) { + AutopilotStateMachine_DWork.eventTime_o0 = AutopilotStateMachine_U.in.time.simulation_time; + } else if (AutopilotStateMachine_DWork.eventTime_o0 == 0.0) { + AutopilotStateMachine_DWork.eventTime_o0 = AutopilotStateMachine_U.in.time.simulation_time; } - Phi2 = std::abs(AutopilotStateMachine_U.in.data.H_dot_ft_min); + c_R = std::abs(AutopilotStateMachine_U.in.data.H_dot_ft_min); high_i = 7; low_i = 0; low_ip1 = 2; while (high_i > low_ip1) { mid_i = ((low_i + high_i) + 1) >> 1; - if (Phi2 >= b[mid_i - 1]) { + if (c_R >= b[mid_i - 1]) { low_i = mid_i - 1; low_ip1 = mid_i + 1; } else { @@ -3615,15 +3574,14 @@ void AutopilotStateMachine::step() } } - L = Phi2 - static_cast(b[low_i]); + xloc = c_R - static_cast(b[low_i]); a = AutopilotStateMachine_U.in.data.H_dot_ft_min * 0.00508; - a *= a; - if (c_R <= std::fmin(3000.0, std::fmax(80.0, a / ((((L * c[low_i] + c[low_i + 6]) * L + c[low_i + 12]) * L + c[low_i + - 18]) * 9.81) * 3.2808398950131235))) { - if (distance_m < 0.0) { + if (R <= std::fmin(3000.0, std::fmax(80.0, a * a / ((((xloc * c[low_i] + c[low_i + 6]) * xloc + c[low_i + 12]) * xloc + + c[low_i + 18]) * 9.81) * 3.2808398950131235))) { + if (rtb_dme_tmp < 0.0) { high_i = -1; } else { - high_i = (distance_m > 0.0); + high_i = (rtb_dme_tmp > 0.0); } if (AutopilotStateMachine_U.in.data.H_dot_ft_min < 0.0) { @@ -3633,22 +3591,22 @@ void AutopilotStateMachine::step() } if (high_i == low_i) { - if (Phi2 >= 100.0) { - if (!AutopilotStateMachine_DWork.eventTime_not_empty_ma) { - AutopilotStateMachine_DWork.eventTime_a2 = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_ma = true; + if (c_R >= 100.0) { + if (!AutopilotStateMachine_DWork.eventTime_not_empty_or) { + AutopilotStateMachine_DWork.eventTime_ch = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_or = true; } - if (rtb_Compare_dl || (AutopilotStateMachine_DWork.eventTime_a2 == 0.0)) { - AutopilotStateMachine_DWork.eventTime_a2 = AutopilotStateMachine_U.in.time.simulation_time; + if (rtb_Compare_dl || (AutopilotStateMachine_DWork.eventTime_ch == 0.0)) { + AutopilotStateMachine_DWork.eventTime_ch = AutopilotStateMachine_U.in.time.simulation_time; } - c_R = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_a2; - if (c_R > 0.0) { - c_R += 0.5; + R = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_ch; + if (R > 0.0) { + R += 0.5; } - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT = ((c_R >= 3.0) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT = ((R >= 3.0) && (AutopilotStateMachine_U.in.data.H_radio_ft > 400.0)); } else { AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT = false; @@ -3662,19 +3620,19 @@ void AutopilotStateMachine::step() if ((AutopilotStateMachine_U.in.input.H_constraint_ft != 0.0) && (AutopilotStateMachine_U.in.input.H_constraint_ft != AutopilotStateMachine_U.in.input.H_fcu_ft)) { - if (!AutopilotStateMachine_DWork.eventTime_not_empty_m) { - AutopilotStateMachine_DWork.eventTime_ae = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_m = true; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_av) { + AutopilotStateMachine_DWork.eventTime_nz = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_av = true; } if (std::abs(AutopilotStateMachine_U.in.input.H_constraint_ft - AutopilotStateMachine_U.in.data.H_ind_ft) >= 40.0) { - AutopilotStateMachine_DWork.eventTime_ae = AutopilotStateMachine_U.in.time.simulation_time; - } else if (AutopilotStateMachine_DWork.eventTime_ae == 0.0) { - AutopilotStateMachine_DWork.eventTime_ae = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_nz = AutopilotStateMachine_U.in.time.simulation_time; + } else if (AutopilotStateMachine_DWork.eventTime_nz == 0.0) { + AutopilotStateMachine_DWork.eventTime_nz = AutopilotStateMachine_U.in.time.simulation_time; } AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST = - ((AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_ae > 0.8) && + ((AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_nz > 0.8) && (!rtb_Compare_dl)); } else { AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST = false; @@ -3685,7 +3643,7 @@ void AutopilotStateMachine::step() low_ip1 = 2; while (high_i > low_ip1) { mid_i = ((low_i + high_i) + 1) >> 1; - if (Phi2 >= b[mid_i - 1]) { + if (c_R >= b[mid_i - 1]) { low_i = mid_i - 1; low_ip1 = mid_i + 1; } else { @@ -3693,12 +3651,12 @@ void AutopilotStateMachine::step() } } - L = Phi2 - static_cast(b[low_i]); + xloc = c_R - static_cast(b[low_i]); if ((AutopilotStateMachine_U.in.input.H_constraint_ft != 0.0) && (AutopilotStateMachine_U.in.input.H_constraint_ft != AutopilotStateMachine_U.in.input.H_fcu_ft)) { if (std::abs(AutopilotStateMachine_U.in.input.H_constraint_ft - AutopilotStateMachine_U.in.data.H_ind_ft) <= std:: - fmin(3000.0, std::fmax(80.0, a / ((((L * c[low_i] + c[low_i + 6]) * L + c[low_i + 12]) * L + c[low_i + 18]) * - 9.81) * 3.2808398950131235))) { + fmin(3000.0, std::fmax(80.0, a * a / ((((xloc * c[low_i] + c[low_i + 6]) * xloc + c[low_i + 12]) * xloc + + c[low_i + 18]) * 9.81) * 3.2808398950131235))) { a = AutopilotStateMachine_U.in.input.H_constraint_ft - AutopilotStateMachine_U.in.data.H_ind_ft; if (a < 0.0) { high_i = -1; @@ -3713,22 +3671,22 @@ void AutopilotStateMachine::step() } if (high_i == low_i) { - if (Phi2 >= 100.0) { - if (!AutopilotStateMachine_DWork.eventTime_not_empty_ow) { - AutopilotStateMachine_DWork.eventTime_a = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_ow = true; + if (c_R >= 100.0) { + if (!AutopilotStateMachine_DWork.eventTime_not_empty_p) { + AutopilotStateMachine_DWork.eventTime_j = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_p = true; } - if (rtb_Compare_dl || (AutopilotStateMachine_DWork.eventTime_a == 0.0)) { - AutopilotStateMachine_DWork.eventTime_a = AutopilotStateMachine_U.in.time.simulation_time; + if (rtb_Compare_dl || (AutopilotStateMachine_DWork.eventTime_j == 0.0)) { + AutopilotStateMachine_DWork.eventTime_j = AutopilotStateMachine_U.in.time.simulation_time; } - c_R = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_a; - if (c_R > 0.0) { - c_R += 0.5; + R = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_j; + if (R > 0.0) { + R += 0.5; } - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT = ((c_R >= 3.0) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT = ((R >= 3.0) && (AutopilotStateMachine_U.in.data.H_radio_ft > 400.0)); } else { AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CST_CPT = false; @@ -3747,77 +3705,76 @@ void AutopilotStateMachine::step() ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK)) && (AutopilotStateMachine_U.in.data.nav_gs_error_deg >= -0.1)) { - Phi2 = std::abs(AutopilotStateMachine_U.in.data.nav_gs_error_deg); - if ((Phi2 < 0.8) && rtb_FixPtRelationalOperator) { + c_R = std::abs(AutopilotStateMachine_U.in.data.nav_gs_error_deg); + if ((c_R < 0.8) && rtb_FixPtRelationalOperator) { AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT = true; } else { - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT = (Phi2 < 0.1333); + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT = (c_R < 0.1333); } } else { AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT = false; } - if (!AutopilotStateMachine_DWork.eventTime_not_empty_k5) { - AutopilotStateMachine_DWork.eventTime_i = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_k5 = true; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_jt) { + AutopilotStateMachine_DWork.eventTime_a = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_jt = true; } - if (state_d_tmp || (!AutopilotStateMachine_U.in.data.nav_gs_valid) || ((std::abs + if (state_a_tmp || (!AutopilotStateMachine_U.in.data.nav_gs_valid) || ((std::abs (AutopilotStateMachine_U.in.data.nav_gs_error_deg) >= 0.1333) || ((AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_CPT) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_TRACK))) || - (AutopilotStateMachine_DWork.eventTime_i == 0.0)) { - AutopilotStateMachine_DWork.eventTime_i = AutopilotStateMachine_U.in.time.simulation_time; + (AutopilotStateMachine_DWork.eventTime_a == 0.0)) { + AutopilotStateMachine_DWork.eventTime_a = AutopilotStateMachine_U.in.time.simulation_time; } if ((rtb_dme >= 30.0) && (AutopilotStateMachine_U.in.data.V2_kn >= 90.0) && (AutopilotStateMachine_U.in.data.flaps_handle_index > 0.0)) { - if (!AutopilotStateMachine_DWork.eventTime_not_empty_f) { - AutopilotStateMachine_DWork.eventTime_g = AutopilotStateMachine_U.in.time.simulation_time; - AutopilotStateMachine_DWork.eventTime_not_empty_f = true; + if (!AutopilotStateMachine_DWork.eventTime_not_empty_j) { + AutopilotStateMachine_DWork.eventTime_d = AutopilotStateMachine_U.in.time.simulation_time; + AutopilotStateMachine_DWork.eventTime_not_empty_j = true; } if ((((AutopilotStateMachine_U.in.data.throttle_lever_1_pos <= 35.0) || (AutopilotStateMachine_U.in.data.throttle_lever_2_pos <= 35.0)) && ((!AutopilotStateMachine_U.in.input.is_FLX_active) || (AutopilotStateMachine_U.in.data.throttle_lever_1_pos < 35.0) || (AutopilotStateMachine_U.in.data.throttle_lever_2_pos < 35.0))) || - (AutopilotStateMachine_DWork.eventTime_g == 0.0)) { - AutopilotStateMachine_DWork.eventTime_g = AutopilotStateMachine_U.in.time.simulation_time; + (AutopilotStateMachine_DWork.eventTime_d == 0.0)) { + AutopilotStateMachine_DWork.eventTime_d = AutopilotStateMachine_U.in.time.simulation_time; } - speedTargetChanged = (AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_g >= - 0.5); + rtb_Compare_c = (AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_d >= 0.5); } else { - speedTargetChanged = false; + rtb_Compare_c = false; } - AutopilotStateMachine_DWork.sSRS = (speedTargetChanged || (((!AutopilotStateMachine_DWork.sSRS) || + AutopilotStateMachine_DWork.sSRS = (rtb_Compare_c || (((!AutopilotStateMachine_DWork.sSRS) || (((AutopilotStateMachine_U.in.data.throttle_lever_1_pos != 0.0) || (AutopilotStateMachine_U.in.data.throttle_lever_2_pos != 0.0)) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::SRS))) && AutopilotStateMachine_DWork.sSRS)); if (rtb_Compare_dl) { AutopilotStateMachine_DWork.newFcuAltitudeSelected = true; } else { - Phi2 = std::abs(AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft); - if (Phi2 > 250.0) { + c_R = std::abs(AutopilotStateMachine_U.in.data.H_ind_ft - AutopilotStateMachine_U.in.input.H_fcu_ft); + if (c_R > 250.0) { AutopilotStateMachine_DWork.newFcuAltitudeSelected = true; } else if (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode == vertical_mode::ALT) { - AutopilotStateMachine_DWork.newFcuAltitudeSelected = ((Phi2 >= 40.0) && + AutopilotStateMachine_DWork.newFcuAltitudeSelected = ((c_R >= 40.0) && AutopilotStateMachine_DWork.newFcuAltitudeSelected); } } - if (rtb_Compare_c && (AutopilotStateMachine_U.in.input.TCAS_advisory_state >= 2.0) && + if (state_a_tmp_0 && (AutopilotStateMachine_U.in.input.TCAS_advisory_state >= 2.0) && (AutopilotStateMachine_U.in.data.H_radio_ft >= 900.0) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::TCAS) && (!AutopilotStateMachine_DWork.latch)) { AutopilotStateMachine_DWork.sTCAS = true; AutopilotStateMachine_DWork.latch = true; } - AutopilotStateMachine_DWork.sTCAS = (rtb_Compare_c && (AutopilotStateMachine_U.in.input.TCAS_advisory_state >= 2.0) && + AutopilotStateMachine_DWork.sTCAS = (state_a_tmp_0 && (AutopilotStateMachine_U.in.input.TCAS_advisory_state >= 2.0) && (AutopilotStateMachine_U.in.data.H_radio_ft >= 900.0) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::TCAS) && AutopilotStateMachine_DWork.sTCAS); - AutopilotStateMachine_DWork.latch = (rtb_Compare_c && (AutopilotStateMachine_U.in.data.H_radio_ft >= 900.0) && + AutopilotStateMachine_DWork.latch = (state_a_tmp_0 && (AutopilotStateMachine_U.in.data.H_radio_ft >= 900.0) && (AutopilotStateMachine_U.in.input.TCAS_advisory_state >= 2.0) && AutopilotStateMachine_DWork.latch); AutopilotStateMachine_B.BusAssignment_g.time = AutopilotStateMachine_U.in.time; AutopilotStateMachine_B.BusAssignment_g.data.aircraft_position = AutopilotStateMachine_U.in.data.aircraft_position; @@ -3903,11 +3860,11 @@ void AutopilotStateMachine::step() != AutopilotStateMachine_P.CompareToConstant_const_c); AutopilotStateMachine_B.BusAssignment_g.data.total_weight_kg = AutopilotStateMachine_U.in.data.total_weight_kg; AutopilotStateMachine_B.BusAssignment_g.data_computed.time_since_touchdown = rtb_dme; - AutopilotStateMachine_B.BusAssignment_g.data_computed.time_since_lift_off = rtb_Saturation1; + AutopilotStateMachine_B.BusAssignment_g.data_computed.time_since_lift_off = Phi2; AutopilotStateMachine_B.BusAssignment_g.data_computed.time_since_SRS = AutopilotStateMachine_U.in.time.simulation_time - AutopilotStateMachine_DWork.eventTime_n; AutopilotStateMachine_B.BusAssignment_g.data_computed.H_fcu_in_selection = rtb_Compare_dl; - AutopilotStateMachine_B.BusAssignment_g.data_computed.H_constraint_valid = rtb_Y_j; + AutopilotStateMachine_B.BusAssignment_g.data_computed.H_constraint_valid = rtb_Y_n; AutopilotStateMachine_B.BusAssignment_g.data_computed.Psi_fcu_in_selection = rtb_AND; AutopilotStateMachine_B.BusAssignment_g.data_computed.gs_convergent_towards_beam = rtb_FixPtRelationalOperator; AutopilotStateMachine_B.BusAssignment_g.data_computed.V_fcu_in_selection = (rtb_AND_j && @@ -4022,34 +3979,34 @@ void AutopilotStateMachine::step() AutopilotStateMachine_P.ap_sm_output_MATLABStruct.output.TCAS_message_RA_inhibit; AutopilotStateMachine_B.BusAssignment_g.output.TCAS_message_TRK_FPA_deselection = AutopilotStateMachine_P.ap_sm_output_MATLABStruct.output.TCAS_message_TRK_FPA_deselection; - AutopilotStateMachine_B.BusAssignment_g.lateral.armed.NAV = AutopilotStateMachine_DWork.state_d; - AutopilotStateMachine_B.BusAssignment_g.lateral.armed.LOC = AutopilotStateMachine_DWork.state_k; + AutopilotStateMachine_B.BusAssignment_g.lateral.armed.NAV = AutopilotStateMachine_DWork.state_a; + AutopilotStateMachine_B.BusAssignment_g.lateral.armed.LOC = AutopilotStateMachine_DWork.state_e; AutopilotStateMachine_B.BusAssignment_g.lateral.condition.NAV = ((AutopilotStateMachine_U.in.data.H_radio_ft >= 30.0) && AutopilotStateMachine_U.in.data.is_flight_plan_available && (AutopilotStateMachine_U.in.data.flight_guidance_xtk_nmi < 10.0)); AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LOC_TRACK = (AutopilotStateMachine_U.in.time.simulation_time - - AutopilotStateMachine_DWork.eventTime_ht >= 10.0); - AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LAND = rtb_cLAND; + - AutopilotStateMachine_DWork.eventTime_dp >= 10.0); + AutopilotStateMachine_B.BusAssignment_g.lateral.condition.LAND = speedTargetChanged; AutopilotStateMachine_B.BusAssignment_g.lateral.condition.FLARE = rtb_cFLARE; AutopilotStateMachine_B.BusAssignment_g.lateral.condition.ROLL_OUT = AutopilotStateMachine_DWork.state; - AutopilotStateMachine_B.BusAssignment_g.lateral.condition.GA_TRACK = (state_k_tmp && + AutopilotStateMachine_B.BusAssignment_g.lateral.condition.GA_TRACK = (isGoAroundModeActive && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::NAV) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::HDG) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode != lateral_mode::TRACK)); AutopilotStateMachine_B.BusAssignment_g.vertical.armed.CLB = AutopilotStateMachine_DWork.sCLB; AutopilotStateMachine_B.BusAssignment_g.vertical.armed.DES = AutopilotStateMachine_DWork.sDES; AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES = AutopilotStateMachine_DWork.sFINAL_DES; - AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS = AutopilotStateMachine_DWork.state_j; - AutopilotStateMachine_B.BusAssignment_g.vertical.armed.TCAS = AutopilotStateMachine_DWork.sTCAS_l; + AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS = AutopilotStateMachine_DWork.state_l; + AutopilotStateMachine_B.BusAssignment_g.vertical.armed.TCAS = AutopilotStateMachine_DWork.sTCAS_b; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT = ((AutopilotStateMachine_U.in.time.simulation_time - - AutopilotStateMachine_DWork.eventTime_ec > 0.8) && (!rtb_Compare_dl)); - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB = ((rtb_Saturation1 > 5.0) && (distance_m > 50.0) && + AutopilotStateMachine_DWork.eventTime_o0 > 0.8) && (!rtb_Compare_dl)); + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB = ((Phi2 > 5.0) && (rtb_dme_tmp > 50.0) && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_CPT) && (AutopilotStateMachine_DWork.Delay1_DSTATE.output.mode != vertical_mode::GS_TRACK) && (AutopilotStateMachine_U.in.data.flight_phase >= 2.0) && (AutopilotStateMachine_U.in.data.flight_phase != 4.0) && (AutopilotStateMachine_U.in.data.flight_phase != 5.0) && (AutopilotStateMachine_U.in.data.flight_phase != 6.0)); - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES = ((rtb_Saturation1 > 5.0) && (distance_m < -50.0) && + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES = ((Phi2 > 5.0) && (rtb_dme_tmp < -50.0) && ((AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_CPT) || (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::LOC_TRACK)) && @@ -4067,18 +4024,18 @@ void AutopilotStateMachine::step() (AutopilotStateMachine_U.in.input.FM_final_des_can_engage && (AutopilotStateMachine_DWork.Delay_DSTATE.output.mode == lateral_mode::NAV)); AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_TRACK = (AutopilotStateMachine_U.in.time.simulation_time - - AutopilotStateMachine_DWork.eventTime_i >= 15.0); - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.LAND = rtb_cLAND; + - AutopilotStateMachine_DWork.eventTime_a >= 15.0); + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.LAND = speedTargetChanged; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FLARE = rtb_cFLARE; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ROLL_OUT = AutopilotStateMachine_DWork.state; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.SRS = AutopilotStateMachine_DWork.sSRS; - AutopilotStateMachine_B.BusAssignment_g.vertical.condition.SRS_GA = state_k_tmp; + AutopilotStateMachine_B.BusAssignment_g.vertical.condition.SRS_GA = isGoAroundModeActive; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.THR_RED = (AutopilotStateMachine_U.in.data.H_ind_ft >= AutopilotStateMachine_U.in.data.thrust_reduction_altitude); AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active = AutopilotStateMachine_DWork.newFcuAltitudeSelected; AutopilotStateMachine_B.BusAssignment_g.vertical.condition.TCAS = AutopilotStateMachine_DWork.sTCAS; - if (AutopilotStateMachine_DWork.is_active_c1_AutopilotStateMachine == 0U) { + if (AutopilotStateMachine_DWork.is_active_c1_AutopilotStateMachine == 0) { AutopilotStateMachine_DWork.is_active_c1_AutopilotStateMachine = 1U; AutopilotStateMachine_DWork.is_c1_AutopilotStateMachine = AutopilotStateMachine_IN_OFF; AutopilotStateMachine_OFF_entry(); @@ -4105,7 +4062,7 @@ void AutopilotStateMachine::step() case AutopilotStateMachine_IN_OFF: if (AutopilotStateMachine_OFF_TO_HDG(&AutopilotStateMachine_B.BusAssignment_g)) { - AutopilotStateMachine_B.out_p.mode_reversion = true; + AutopilotStateMachine_B.out_g.mode_reversion = true; AutopilotStateMachine_DWork.is_c1_AutopilotStateMachine = AutopilotStateMachine_IN_ON; AutopilotStateMachine_DWork.is_ON_j = AutopilotStateMachine_IN_HDG; AutopilotStateMachine_HDG_entry(&AutopilotStateMachine_B.BusAssignment_g); @@ -4143,19 +4100,19 @@ void AutopilotStateMachine::step() } } - AutopilotStateMachine_B.BusAssignment_g.lateral.output = AutopilotStateMachine_B.out_p; - if (AutopilotStateMachine_DWork.is_active_c6_AutopilotStateMachine == 0U) { + AutopilotStateMachine_B.BusAssignment_g.lateral.output = AutopilotStateMachine_B.out_g; + if (AutopilotStateMachine_DWork.is_active_c6_AutopilotStateMachine == 0) { AutopilotStateMachine_DWork.is_active_c6_AutopilotStateMachine = 1U; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } else { guard1 = false; switch (AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine) { - case AutopilotStateMachine_IN_OFF_a: + case AutopilotStateMachine_IN_OFF_o: if (AutopilotStateMachine_B.BusAssignment_g.input.FD_active && (AutopilotStateMachine_B.BusAssignment_g.data.on_ground != 0.0) && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.SRS) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_SRS; AutopilotStateMachine_SRS_entry(); } else if (((AutopilotStateMachine_B.BusAssignment_g.input.FD_active && @@ -4171,17 +4128,17 @@ void AutopilotStateMachine::step() AutopilotStateMachine_B.out.mode_reversion = true; AutopilotStateMachine_B.out.mode_reversion_target_fpm = AutopilotStateMachine_B.BusAssignment_g.data.H_dot_ft_min; - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; AutopilotStateMachine_VS_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.CLB && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_CLB; AutopilotStateMachine_CLB_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.DES && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_DES; AutopilotStateMachine_DES_entry(); } else if (AutopilotStateMachine_X_TO_TCAS()) { @@ -4197,60 +4154,60 @@ void AutopilotStateMachine::step() } break; - case AutopilotStateMachine_IN_ON_b: - AutopilotStateMachine_ON_p(); + case AutopilotStateMachine_IN_ON_g: + AutopilotStateMachine_ON_i(); break; case AutopilotStateMachine_IN_SRS_GA: if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.GS_CPT) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_GS; AutopilotStateMachine_DWork.is_GS = AutopilotStateMachine_IN_GS_CPT; AutopilotStateMachine_GS_CPT_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.FINAL_DES) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_FINAL_DES; AutopilotStateMachine_FINAL_DES_entry(); } else { - Phi2 = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - + rtb_GainTheta = AutopilotStateMachine_B.BusAssignment_g.input.H_fcu_ft - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft; - state_d_tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || + state_a_tmp = ((AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull || AutopilotStateMachine_B.BusAssignment_g.input.EXPED_push) && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active); - if (state_d_tmp && (Phi2 < -40.0)) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + if (state_a_tmp && (rtb_GainTheta < -40.0)) { + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_DES; AutopilotStateMachine_OP_DES_entry(); - } else if (state_d_tmp && (Phi2 > 40.0)) { + } else if (state_a_tmp && (rtb_GainTheta > 40.0)) { guard1 = true; } else { - Phi2 = std::abs(AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft - - AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft); + c_R = std::abs(AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft - + AutopilotStateMachine_B.BusAssignment_g.data.H_ind_ft); if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.CLB && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && - ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (Phi2 > 40.0))) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (c_R > 40.0))) { + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_CLB; AutopilotStateMachine_CLB_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.input.ALT_push && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.DES && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.H_fcu_active && - ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (Phi2 > 40.0))) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + ((AutopilotStateMachine_B.BusAssignment_g.input.H_constraint_ft == 0.0) || (c_R > 40.0))) { + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_DES; AutopilotStateMachine_DES_entry(); } else if (AutopilotStateMachine_B.BusAssignment_g.input.VS_push || AutopilotStateMachine_B.BusAssignment_g.input.VS_pull) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_VS; AutopilotStateMachine_VS_entry(); } else if ((AutopilotStateMachine_B.BusAssignment_g.data.H_radio_ft > 400.0) && (AutopilotStateMachine_B.BusAssignment_g.vertical.armed.ALT && AutopilotStateMachine_B.BusAssignment_g.vertical.condition.ALT_CPT)) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_ALT_CPT; AutopilotStateMachine_ALT_CPT_entry(); } else if ((AutopilotStateMachine_B.BusAssignment_g.data_computed.V_fcu_in_selection && @@ -4266,8 +4223,8 @@ void AutopilotStateMachine::step() (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP1 == 0.0) && (AutopilotStateMachine_B.BusAssignment_g.output.enabled_AP2 == 0.0) && (!AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.FD_connect)) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_a; - AutopilotStateMachine_OFF_entry_m(); + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_OFF_o; + AutopilotStateMachine_OFF_entry_i(); } else { AutopilotStateMachine_SRS_GA_during(); } @@ -4281,7 +4238,7 @@ void AutopilotStateMachine::step() } if (guard1) { - AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_b; + AutopilotStateMachine_DWork.is_c6_AutopilotStateMachine = AutopilotStateMachine_IN_ON_g; AutopilotStateMachine_DWork.is_ON = AutopilotStateMachine_IN_OP_CLB; AutopilotStateMachine_OP_CLB_entry(); } @@ -4315,24 +4272,24 @@ void AutopilotStateMachine::step() Double2MultiWord(std::floor(rtb_GainTheta1), &tmp_8.chunks[0U], 2); MultiWordIor(&tmp_7.chunks[0U], &tmp_8.chunks[0U], &tmp_6.chunks[0U], 2); Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.CLB), - static_cast(AutopilotStateMachine_N_p)), &tmp_7.chunks[0U], 2); + static_cast(AutopilotStateMachine_N_c)), &tmp_7.chunks[0U], 2); MultiWordIor(&tmp_6.chunks[0U], &tmp_7.chunks[0U], &tmp_5.chunks[0U], 2); Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.DES), - static_cast(AutopilotStateMachine_N_l)), &tmp_6.chunks[0U], 2); + static_cast(AutopilotStateMachine_N_a)), &tmp_6.chunks[0U], 2); MultiWordIor(&tmp_5.chunks[0U], &tmp_6.chunks[0U], &tmp_4.chunks[0U], 2); Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.GS), static_cast(AutopilotStateMachine_N_j)), &tmp_5.chunks[0U], 2); MultiWordIor(&tmp_4.chunks[0U], &tmp_5.chunks[0U], &tmp_3.chunks[0U], 2); Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.FINAL_DES), - static_cast(AutopilotStateMachine_N_b)), &tmp_4.chunks[0U], 2); + static_cast(AutopilotStateMachine_N_k)), &tmp_4.chunks[0U], 2); MultiWordIor(&tmp_3.chunks[0U], &tmp_4.chunks[0U], &tmp_2.chunks[0U], 2); Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.TCAS), - static_cast(AutopilotStateMachine_N_h)), &tmp_3.chunks[0U], 2); + static_cast(AutopilotStateMachine_N_kp)), &tmp_3.chunks[0U], 2); MultiWordIor(&tmp_2.chunks[0U], &tmp_3.chunks[0U], &tmp_1.chunks[0U], 2); AutopilotStateMachine_Y.out.output.vertical_mode_armed = uMultiWord2Double(&tmp_1.chunks[0U], 2, 0); } else { Double2MultiWord(std::ldexp(static_cast(AutopilotStateMachine_B.BusAssignment_g.vertical.armed.TCAS), - static_cast(AutopilotStateMachine_N_h)), &tmp_0.chunks[0U], 2); + static_cast(AutopilotStateMachine_N_kp)), &tmp_0.chunks[0U], 2); AutopilotStateMachine_Y.out.output.vertical_mode_armed = uMultiWord2Double(&tmp_0.chunks[0U], 2, 0); } @@ -4362,13 +4319,13 @@ void AutopilotStateMachine::step() AutopilotStateMachine_DWork.eventTimeMR_not_empty = true; } - state_d_tmp = !AutopilotStateMachine_B.BusAssignment_g.input.VS_pull; + state_a_tmp = !AutopilotStateMachine_B.BusAssignment_g.input.VS_pull; if (AutopilotStateMachine_B.out.mode_reversion && (((AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::CLB) && (AutopilotStateMachine_B.out.mode == vertical_mode::OP_CLB)) || ((AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::DES) && (AutopilotStateMachine_B.out.mode == vertical_mode::VS))) && - (!AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull) && state_d_tmp) { + (!AutopilotStateMachine_B.BusAssignment_g.input.ALT_pull) && state_a_tmp) { AutopilotStateMachine_DWork.warningArmedNAV = true; AutopilotStateMachine_DWork.warningArmedVS = false; AutopilotStateMachine_DWork.eventTimeTC = AutopilotStateMachine_B.BusAssignment_g.time.simulation_time; @@ -4396,7 +4353,7 @@ void AutopilotStateMachine::step() ((AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::OP_CLB) || (AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::OP_DES) || (AutopilotStateMachine_B.BusAssignment_g.vertical_previous.output.mode == vertical_mode::ALT_CPT)) && - (!AutopilotStateMachine_B.BusAssignment_g.input.VS_push) && state_d_tmp) { + (!AutopilotStateMachine_B.BusAssignment_g.input.VS_push) && state_a_tmp) { AutopilotStateMachine_DWork.warningArmedVS = true; AutopilotStateMachine_DWork.warningArmedNAV = false; AutopilotStateMachine_DWork.eventTimeTC = AutopilotStateMachine_B.BusAssignment_g.time.simulation_time; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.h index 266a0b6412b..87b2ea43a8c 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_AutopilotStateMachine_h_ -#define RTW_HEADER_AutopilotStateMachine_h_ +#ifndef AutopilotStateMachine_h_ +#define AutopilotStateMachine_h_ #include "rtwtypes.h" #include "AutopilotStateMachine_types.h" @@ -9,7 +9,7 @@ class AutopilotStateMachine final struct BlockIO_AutopilotStateMachine_T { ap_sm_output BusAssignment_g; ap_vertical_output out; - ap_lateral_output out_p; + ap_lateral_output out_g; }; struct D_Work_AutopilotStateMachine_T { @@ -41,25 +41,25 @@ class AutopilotStateMachine final real_T nav_gs_deg; real_T eventTime; real_T eventTime_n; - real_T eventTime_e; - real_T eventTime_h; + real_T eventTime_c; + real_T eventTime_o; real_T pY; real_T pU; real_T lastTargetSpeed; real_T timeDeltaSpeed4; real_T timeDeltaSpeed10; real_T timeConditionSoftAlt; - real_T eventTime_g; + real_T eventTime_d; real_T runwayHeadingStored; - real_T eventTime_ht; - real_T eventTime_l; - real_T eventTime_i; + real_T eventTime_dp; + real_T eventTime_g; real_T eventTime_a; - real_T eventTime_ae; - real_T eventTime_a2; - real_T eventTime_ec; + real_T eventTime_j; + real_T eventTime_nz; + real_T eventTime_ch; + real_T eventTime_o0; real_T canArm; - real_T canArm_i; + real_T canArm_f; boolean_T DelayInput1_DSTATE_a; boolean_T DelayInput1_DSTATE_p; boolean_T DelayInput1_DSTATE_bo; @@ -89,8 +89,8 @@ class AutopilotStateMachine final boolean_T local_TCAS_is_corrective; boolean_T wereAllEnginesOperative; boolean_T wereAllEnginesOperative_not_empty; - boolean_T wereAllEnginesOperative_b; - boolean_T wereAllEnginesOperative_not_empty_p; + boolean_T wereAllEnginesOperative_o; + boolean_T wereAllEnginesOperative_not_empty_j; boolean_T prevNumberofAutopilotsEngaged_not_empty; boolean_T verticalSpeedCancelMode; boolean_T eventTimeTC_not_empty; @@ -108,9 +108,9 @@ class AutopilotStateMachine final boolean_T prev_FDES_active; boolean_T prev_FDES_armed; boolean_T eventTime_not_empty; - boolean_T eventTime_not_empty_i; boolean_T eventTime_not_empty_c; - boolean_T eventTime_not_empty_o; + boolean_T eventTime_not_empty_b; + boolean_T eventTime_not_empty_a; boolean_T pY_not_empty; boolean_T pU_not_empty; boolean_T lastTargetSpeed_not_empty; @@ -122,28 +122,28 @@ class AutopilotStateMachine final boolean_T sTCAS; boolean_T latch; boolean_T sSRS; - boolean_T eventTime_not_empty_f; + boolean_T eventTime_not_empty_j; boolean_T state; - boolean_T eventTime_not_empty_l; + boolean_T eventTime_not_empty_o; boolean_T eventTime_not_empty_k; - boolean_T eventTime_not_empty_k5; + boolean_T eventTime_not_empty_jt; boolean_T sThrottleCondition; - boolean_T eventTime_not_empty_ow; - boolean_T eventTime_not_empty_m; - boolean_T eventTime_not_empty_ma; - boolean_T eventTime_not_empty_g; - boolean_T sTCAS_l; + boolean_T eventTime_not_empty_p; + boolean_T eventTime_not_empty_av; + boolean_T eventTime_not_empty_or; + boolean_T eventTime_not_empty_kq; + boolean_T sTCAS_b; boolean_T wasFlightPlanAvailable; boolean_T wasFlightPlanAvailable_not_empty; boolean_T wasInSrsGa; - boolean_T state_d; - boolean_T state_k; - boolean_T state_j; + boolean_T state_a; + boolean_T state_e; + boolean_T state_l; boolean_T sFINAL_DES; boolean_T sDES; boolean_T sCLB; boolean_T was_TCAS_active; - boolean_T newFcuAltitudeSelected_j; + boolean_T newFcuAltitudeSelected_a; }; struct ExternalInputs_AutopilotStateMachine_T { @@ -308,7 +308,7 @@ class AutopilotStateMachine final boolean_T AutopilotStateMachine_getTcasSubModeCompatibility(void) const; void AutopilotStateMachine_TCAS_during(void); void AutopilotStateMachine_TCAS_exit(void); - void AutopilotStateMachine_OFF_entry_m(void); + void AutopilotStateMachine_OFF_entry_i(void); void AutopilotStateMachine_DES_entry(void); void AutopilotStateMachine_CLB_entry(void); void AutopilotStateMachine_OP_CLB_entry(void); @@ -338,8 +338,8 @@ class AutopilotStateMachine final void AutopilotStateMachine_ALT_CST_CPT(void); void AutopilotStateMachine_CLB_during(void); void AutopilotStateMachine_ALT_CST_CPT_entry(void); + void AutopilotStateMachine_CLB(void); void AutopilotStateMachine_DES_during(void); - void AutopilotStateMachine_DES(void); void AutopilotStateMachine_FINAL_DES_during(void); void AutopilotStateMachine_FLARE_during(void); void AutopilotStateMachine_ROLL_OUT_entry_e(void); @@ -347,8 +347,9 @@ class AutopilotStateMachine final boolean_T AutopilotStateMachine_GS_TO_X_MR(void) const; boolean_T AutopilotStateMachine_GS_TO_ALT(void) const; void AutopilotStateMachine_GS_TRACK_entry(void); - void AutopilotStateMachine_LAND_entry_b(void); - void AutopilotStateMachine_FLARE_entry_m(void); + void AutopilotStateMachine_LAND_entry_p(void); + void AutopilotStateMachine_GS_TRACK(void); + void AutopilotStateMachine_FLARE_entry_n(void); void AutopilotStateMachine_GS(void); void AutopilotStateMachine_OP_CLB_during(void); void AutopilotStateMachine_OP_CLB_exit(void); @@ -358,7 +359,7 @@ class AutopilotStateMachine final void AutopilotStateMachine_SRS_during(void); void AutopilotStateMachine_SRS(void); void AutopilotStateMachine_exit_internal_ON(void); - void AutopilotStateMachine_ON_p(void); + void AutopilotStateMachine_ON_i(void); void AutopilotStateMachine_SRS_GA_during(void); }; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_private.h index 74ca8376ad5..489caf43d4f 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_private.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_AutopilotStateMachine_private_h_ -#define RTW_HEADER_AutopilotStateMachine_private_h_ +#ifndef AutopilotStateMachine_private_h_ +#define AutopilotStateMachine_private_h_ #include "rtwtypes.h" #include "multiword_types.h" #include "AutopilotStateMachine_types.h" diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_types.h index 3d38398035a..37a3a718684 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/AutopilotStateMachine_types.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_AutopilotStateMachine_types_h_ -#define RTW_HEADER_AutopilotStateMachine_types_h_ +#ifndef AutopilotStateMachine_types_h_ +#define AutopilotStateMachine_types_h_ #include "rtwtypes.h" #ifndef DEFINED_TYPEDEF_FOR_ap_raw_time_ #define DEFINED_TYPEDEF_FOR_ap_raw_time_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.cpp index c3a8a415fe1..e05d8525bf1 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.cpp @@ -169,16 +169,16 @@ void Autothrust::Autothrust_TLAComputation1(const athr_out *rtu_in, real_T rtu_T real_T Autothrust::Autothrust_timeSinceConditionArmedActive(real_T in_time_simulation_time, athr_status status) { - if (!Autothrust_DWork.eventTime_not_empty_ac) { - Autothrust_DWork.eventTime_m = in_time_simulation_time; - Autothrust_DWork.eventTime_not_empty_ac = true; + if (!Autothrust_DWork.eventTime_not_empty_a) { + Autothrust_DWork.eventTime_f = in_time_simulation_time; + Autothrust_DWork.eventTime_not_empty_a = true; } - if ((status == athr_status::DISENGAGED) || (Autothrust_DWork.eventTime_m == 0.0)) { - Autothrust_DWork.eventTime_m = in_time_simulation_time; + if ((status == athr_status::DISENGAGED) || (Autothrust_DWork.eventTime_f == 0.0)) { + Autothrust_DWork.eventTime_f = in_time_simulation_time; } - return in_time_simulation_time - Autothrust_DWork.eventTime_m; + return in_time_simulation_time - Autothrust_DWork.eventTime_f; } void Autothrust::step() @@ -190,58 +190,58 @@ void Autothrust::step() real_T Phi_rad; real_T Theta_rad; real_T result_tmp; - real_T rtb_BusAssignment_e_output_N1_TLA_2_percent; - real_T rtb_BusAssignment_e_output_N1_TLA_3_percent; real_T rtb_BusAssignment_e_output_N1_TLA_4_percent; real_T rtb_Gain2; real_T rtb_Gain3; real_T rtb_Gain_m; real_T rtb_Saturation; real_T rtb_Switch_d; + real_T rtb_Switch_dx; + real_T rtb_Switch_ej; real_T rtb_Switch_f_idx_0; real_T rtb_Switch_f_idx_1; real_T rtb_Switch_f_idx_2; real_T rtb_Switch_f_idx_3; - real_T rtb_Switch_fs; - real_T rtb_y_hw; + real_T rtb_y_a; real_T rtb_y_p; + real_T tmp; int32_T i; int32_T rtb_on_ground; boolean_T ATHR_ENGAGED_tmp; - boolean_T condition02; + boolean_T ATHR_ENGAGED_tmp_0; boolean_T condition_AP_FD_ATHR_Specific; - boolean_T condition_AlphaFloor; - boolean_T condition_AlphaFloor_tmp; boolean_T condition_THR_LK_tmp; + boolean_T condition_THR_LK_tmp_0; boolean_T condition_TOGA; - boolean_T pThrustMemoActive_tmp; + boolean_T condition_TOGA_latch_tmp; boolean_T rtb_Compare; boolean_T rtb_NOT1_c; boolean_T rtb_out; - boolean_T rtb_r_e; - boolean_T rtb_r_i; - boolean_T rtb_r_n; - boolean_T rtb_y_o; - boolean_T tmp; + boolean_T rtb_r_a; + boolean_T rtb_r_g_tmp; + boolean_T rtb_r_h; + boolean_T rtb_r_he; + boolean_T rtb_y_f; + boolean_T tmp_0; athr_mode mode; athr_status status; rtb_Gain2 = Autothrust_P.Gain2_Gain * Autothrust_U.in.data.Theta_deg; rtb_Gain3 = Autothrust_P.Gain3_Gain_c * Autothrust_U.in.data.Phi_deg; Theta_rad = 0.017453292519943295 * rtb_Gain2; Phi_rad = 0.017453292519943295 * rtb_Gain3; - rtb_Saturation = std::cos(Theta_rad); - Theta_rad = std::sin(Theta_rad); + rtb_Saturation = std::sin(Theta_rad); + Theta_rad = std::cos(Theta_rad); result_tmp = std::sin(Phi_rad); Phi_rad = std::cos(Phi_rad); - result_tmp_0[0] = rtb_Saturation; + result_tmp_0[0] = Theta_rad; result_tmp_0[3] = 0.0; - result_tmp_0[6] = -Theta_rad; - result_tmp_0[1] = result_tmp * Theta_rad; + result_tmp_0[6] = -rtb_Saturation; + result_tmp_0[1] = result_tmp * rtb_Saturation; result_tmp_0[4] = Phi_rad; - result_tmp_0[7] = rtb_Saturation * result_tmp; - result_tmp_0[2] = Phi_rad * Theta_rad; + result_tmp_0[7] = Theta_rad * result_tmp; + result_tmp_0[2] = Phi_rad * rtb_Saturation; result_tmp_0[5] = 0.0 - result_tmp; - result_tmp_0[8] = Phi_rad * rtb_Saturation; + result_tmp_0[8] = Phi_rad * Theta_rad; for (i = 0; i < 3; i++) { result[i] = (result_tmp_0[i + 3] * Autothrust_U.in.data.by_m_s2 + result_tmp_0[i] * Autothrust_U.in.data.bx_m_s2) + result_tmp_0[i + 6] * Autothrust_U.in.data.bz_m_s2; @@ -262,7 +262,7 @@ void Autothrust::step() Phi_rad = Autothrust_P.Saturation1_LowerSat_o; } - if (Autothrust_DWork.is_active_c9_Autothrust == 0U) { + if (Autothrust_DWork.is_active_c9_Autothrust == 0) { Autothrust_DWork.is_active_c9_Autothrust = 1U; Autothrust_DWork.is_c9_Autothrust = Autothrust_IN_OnGround; rtb_on_ground = 1; @@ -282,15 +282,15 @@ void Autothrust::step() rtb_Saturation = (Autothrust_U.in.data.engine_N1_1_percent + Autothrust_U.in.data.commanded_engine_N1_1_percent) - Autothrust_U.in.data.corrected_engine_N1_1_percent; - Phi_rad = (Autothrust_U.in.data.engine_N1_2_percent + Autothrust_U.in.data.commanded_engine_N1_2_percent) - - Autothrust_U.in.data.corrected_engine_N1_2_percent; - rtb_Switch_d = (Autothrust_U.in.data.engine_N1_3_percent + Autothrust_U.in.data.commanded_engine_N1_3_percent) - - Autothrust_U.in.data.corrected_engine_N1_3_percent; - Theta_rad = (Autothrust_U.in.data.engine_N1_4_percent + Autothrust_U.in.data.commanded_engine_N1_4_percent) - - Autothrust_U.in.data.corrected_engine_N1_4_percent; - Autothrust_TimeSinceCondition(Autothrust_U.in.time.simulation_time, Autothrust_U.in.input.ATHR_disconnect, &rtb_y_p, + rtb_BusAssignment_n.data.commanded_engine_N1_2_percent = (Autothrust_U.in.data.engine_N1_2_percent + + Autothrust_U.in.data.commanded_engine_N1_2_percent) - Autothrust_U.in.data.corrected_engine_N1_2_percent; + rtb_BusAssignment_n.data.commanded_engine_N1_3_percent = (Autothrust_U.in.data.engine_N1_3_percent + + Autothrust_U.in.data.commanded_engine_N1_3_percent) - Autothrust_U.in.data.corrected_engine_N1_3_percent; + rtb_BusAssignment_n.data.commanded_engine_N1_4_percent = (Autothrust_U.in.data.engine_N1_4_percent + + Autothrust_U.in.data.commanded_engine_N1_4_percent) - Autothrust_U.in.data.corrected_engine_N1_4_percent; + Autothrust_TimeSinceCondition(Autothrust_U.in.time.simulation_time, Autothrust_U.in.input.ATHR_disconnect, &rtb_y_a, &Autothrust_DWork.sf_TimeSinceCondition_o); - Autothrust_DWork.Memory_PreviousInput = Autothrust_P.Logic_table[(((static_cast(rtb_y_p >= + Autothrust_DWork.Memory_PreviousInput = Autothrust_P.Logic_table[(((static_cast(rtb_y_a >= Autothrust_P.CompareToConstant_const) << 1) + Autothrust_U.in.input.ATHR_reset_disable) << 1) + Autothrust_DWork.Memory_PreviousInput]; if (Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2) { @@ -302,47 +302,48 @@ void Autothrust::step() (Autothrust_U.in.input.TLA_2_deg >= 0.0) && (Autothrust_U.in.input.TLA_2_deg <= 35.0))); } - rtb_r_e = ((Autothrust_U.in.input.flex_temperature_degC > Autothrust_U.in.data.TAT_degC) && - (Autothrust_U.in.input.flex_temperature_degC != 0.0) && (Autothrust_U.in.input.flight_phase < 3.0)); - Autothrust_DWork.latch = ((rtb_r_e && (rtb_on_ground != 0) && (Autothrust_U.in.input.TLA_1_deg == 35.0) && - (Autothrust_U.in.input.TLA_2_deg == 35.0)) || Autothrust_DWork.latch); + rtb_NOT1_c = ((Autothrust_U.in.input.flex_temperature_degC > Autothrust_U.in.data.TAT_degC) && + (Autothrust_U.in.input.flex_temperature_degC != 0.0) && (Autothrust_U.in.input.flight_phase < 3.0) && + (rtb_on_ground != 0)); + Autothrust_DWork.latch = ((rtb_NOT1_c && (Autothrust_U.in.input.TLA_1_deg == 35.0) && (Autothrust_U.in.input.TLA_2_deg + == 35.0)) || Autothrust_DWork.latch); Autothrust_DWork.latch = (((!Autothrust_DWork.latch) || (((Autothrust_U.in.input.TLA_1_deg != 25.0) || (Autothrust_U.in.input.TLA_2_deg != 25.0)) && ((Autothrust_U.in.input.TLA_1_deg != 45.0) || (Autothrust_U.in.input.TLA_2_deg != 45.0)))) && Autothrust_DWork.latch); - rtb_y_o = ((rtb_r_e && (rtb_on_ground != 0)) || ((rtb_on_ground == 0) && Autothrust_DWork.latch)); + rtb_y_f = (rtb_NOT1_c || ((rtb_on_ground == 0) && Autothrust_DWork.latch)); rtb_Compare = (static_cast(Autothrust_U.in.input.ATHR_push) > static_cast (Autothrust_P.CompareToConstant_const_j)); - if (!Autothrust_DWork.eventTime_not_empty_c) { - Autothrust_DWork.eventTime_jx = Autothrust_U.in.time.simulation_time; - Autothrust_DWork.eventTime_not_empty_c = true; + if (!Autothrust_DWork.eventTime_not_empty_d) { + Autothrust_DWork.eventTime_l = Autothrust_U.in.time.simulation_time; + Autothrust_DWork.eventTime_not_empty_d = true; } - if ((Autothrust_U.in.input.ATHR_push != Autothrust_P.CompareToConstant1_const) || (Autothrust_DWork.eventTime_jx == - 0.0)) { - Autothrust_DWork.eventTime_jx = Autothrust_U.in.time.simulation_time; + if ((Autothrust_U.in.input.ATHR_push != Autothrust_P.CompareToConstant1_const) || (Autothrust_DWork.eventTime_l == 0.0)) + { + Autothrust_DWork.eventTime_l = Autothrust_U.in.time.simulation_time; } - rtb_r_i = (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_jx >= - Autothrust_P.CompareToConstant2_const); + rtb_r_he = (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_l >= + Autothrust_P.CompareToConstant2_const); Autothrust_DWork.Memory_PreviousInput_m = Autothrust_P.Logic_table_m[(((static_cast - (Autothrust_DWork.Delay_DSTATE_as) << 1) + rtb_r_i) << 1) + Autothrust_DWork.Memory_PreviousInput_m]; - rtb_NOT1_c = (rtb_Compare && (!Autothrust_DWork.Memory_PreviousInput_m)); - Autothrust_TimeSinceCondition(Autothrust_U.in.time.simulation_time, rtb_on_ground != 0, &rtb_y_p, + (Autothrust_DWork.Delay_DSTATE_as) << 1) + rtb_r_he) << 1) + Autothrust_DWork.Memory_PreviousInput_m]; + rtb_BusAssignment_n.data_computed.ATHR_push = (rtb_Compare && (!Autothrust_DWork.Memory_PreviousInput_m)); + Autothrust_TimeSinceCondition(Autothrust_U.in.time.simulation_time, (rtb_on_ground != 0), &rtb_y_a, &Autothrust_DWork.sf_TimeSinceCondition1); - if (!Autothrust_DWork.eventTime_not_empty_p) { - Autothrust_DWork.eventTime_oa = Autothrust_U.in.time.simulation_time; - Autothrust_DWork.eventTime_not_empty_p = true; + if (!Autothrust_DWork.eventTime_not_empty_o) { + Autothrust_DWork.eventTime_b = Autothrust_U.in.time.simulation_time; + Autothrust_DWork.eventTime_not_empty_o = true; } - tmp = !Autothrust_U.in.input.is_TCAS_active; - if (tmp || (Autothrust_DWork.eventTime_oa == 0.0)) { - Autothrust_DWork.eventTime_oa = Autothrust_U.in.time.simulation_time; + tmp_0 = !Autothrust_U.in.input.is_TCAS_active; + if (tmp_0 || (Autothrust_DWork.eventTime_b == 0.0)) { + Autothrust_DWork.eventTime_b = Autothrust_U.in.time.simulation_time; } Autothrust_DWork.sInhibit = (((!Autothrust_DWork.prev_TCAS_active) && Autothrust_U.in.input.is_TCAS_active && (Autothrust_U.in.input.TLA_1_deg <= 25.0) && (Autothrust_U.in.input.TLA_2_deg <= 25.0)) || Autothrust_DWork.sInhibit); Autothrust_DWork.sInhibit = (((!Autothrust_DWork.sInhibit) || (Autothrust_U.in.time.simulation_time - - Autothrust_DWork.eventTime_oa <= 5.0) || ((Autothrust_U.in.input.TLA_1_deg >= 25.0) && + Autothrust_DWork.eventTime_b <= 5.0) || ((Autothrust_U.in.input.TLA_1_deg >= 25.0) && (Autothrust_U.in.input.TLA_2_deg >= 25.0))) && Autothrust_DWork.sInhibit); Autothrust_DWork.sInhibit = (Autothrust_U.in.input.is_TCAS_active && Autothrust_DWork.sInhibit); Autothrust_DWork.prev_TCAS_active = Autothrust_U.in.input.is_TCAS_active; @@ -374,17 +375,14 @@ void Autothrust::step() rtb_BusAssignment_n.data.is_engine_operative_3 = Autothrust_U.in.data.is_engine_operative_3; rtb_BusAssignment_n.data.is_engine_operative_4 = Autothrust_U.in.data.is_engine_operative_3; rtb_BusAssignment_n.data.commanded_engine_N1_1_percent = rtb_Saturation; - rtb_BusAssignment_n.data.commanded_engine_N1_2_percent = Phi_rad; - rtb_BusAssignment_n.data.commanded_engine_N1_3_percent = rtb_Switch_d; - rtb_BusAssignment_n.data.commanded_engine_N1_4_percent = Theta_rad; rtb_BusAssignment_n.data.engine_N1_1_percent = Autothrust_U.in.data.engine_N1_1_percent; rtb_BusAssignment_n.data.engine_N1_2_percent = Autothrust_U.in.data.engine_N1_2_percent; rtb_BusAssignment_n.data.engine_N1_3_percent = Autothrust_U.in.data.engine_N1_3_percent; rtb_BusAssignment_n.data.engine_N1_4_percent = Autothrust_U.in.data.engine_N1_4_percent; rtb_BusAssignment_n.data.TAT_degC = Autothrust_U.in.data.TAT_degC; rtb_BusAssignment_n.data.OAT_degC = Autothrust_U.in.data.OAT_degC; - result_tmp = std::fmax(15.0 - 0.0019812 * Autothrust_U.in.data.H_ft, -56.5); - rtb_BusAssignment_n.data.ISA_degC = result_tmp; + tmp = std::fmax(15.0 - 0.0019812 * Autothrust_U.in.data.H_ft, -56.5); + rtb_BusAssignment_n.data.ISA_degC = tmp; rtb_BusAssignment_n.data.ambient_density_kg_per_m3 = Autothrust_U.in.data.ambient_density_kg_per_m3; rtb_BusAssignment_n.input = Autothrust_U.in.input; rtb_BusAssignment_n.output = Autothrust_P.athr_out_MATLABStruct.output; @@ -399,61 +397,57 @@ void Autothrust::step() (Autothrust_U.in.input.TLA_2_deg <= 35.0))); } - rtb_BusAssignment_n.data_computed.is_FLX_active = ((rtb_r_e && (rtb_on_ground != 0)) || ((rtb_on_ground == 0) && - Autothrust_DWork.latch)); - rtb_BusAssignment_n.data_computed.ATHR_push = rtb_NOT1_c; + rtb_BusAssignment_n.data_computed.is_FLX_active = (rtb_NOT1_c || ((rtb_on_ground == 0) && Autothrust_DWork.latch)); rtb_BusAssignment_n.data_computed.ATHR_disabled = Autothrust_DWork.Memory_PreviousInput; - rtb_BusAssignment_n.data_computed.time_since_touchdown = rtb_y_p; + rtb_BusAssignment_n.data_computed.time_since_touchdown = rtb_y_a; rtb_BusAssignment_n.data_computed.alpha_floor_inhibited = Autothrust_DWork.sInhibit; - Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_1_deg, &Phi_rad, &rtb_r_e); - Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_2_deg, &rtb_Switch_d, &rtb_r_i); - Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_3_deg, &Theta_rad, + Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_1_deg, &Phi_rad, &rtb_r_h); + Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_2_deg, &Theta_rad, &rtb_r_he); + Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_3_deg, &result_tmp, &Autothrust_DWork.Delay_DSTATE_as); Autothrust_TLAComputation1(&rtb_BusAssignment_n, Autothrust_U.in.input.TLA_4_deg, &rtb_BusAssignment_e_output_N1_TLA_4_percent, &rtb_NOT1_c); condition_AP_FD_ATHR_Specific = !Autothrust_DWork.Memory_PreviousInput; - condition02 = (Autothrust_U.in.input.is_SRS_TO_mode_active || Autothrust_U.in.input.is_SRS_GA_mode_active); - Autothrust_DWork.condition_TOGA_latch = (((!Autothrust_DWork.prev_SRS_TO_GA_mode_active) && condition02) || + condition_TOGA_latch_tmp = (Autothrust_U.in.input.is_SRS_TO_mode_active || Autothrust_U.in.input.is_SRS_GA_mode_active); + Autothrust_DWork.condition_TOGA_latch = (((!Autothrust_DWork.prev_SRS_TO_GA_mode_active) && condition_TOGA_latch_tmp) || Autothrust_DWork.condition_TOGA_latch); - if (!Autothrust_DWork.eventTime_not_empty_a) { - Autothrust_DWork.eventTime_j1 = Autothrust_U.in.time.simulation_time; - Autothrust_DWork.eventTime_not_empty_a = true; + if (!Autothrust_DWork.eventTime_not_empty_l) { + Autothrust_DWork.eventTime_c = Autothrust_U.in.time.simulation_time; + Autothrust_DWork.eventTime_not_empty_l = true; } - if ((!Autothrust_DWork.condition_TOGA_latch) || (Autothrust_DWork.eventTime_j1 == 0.0)) { - Autothrust_DWork.eventTime_j1 = Autothrust_U.in.time.simulation_time; + if ((!Autothrust_DWork.condition_TOGA_latch) || (Autothrust_DWork.eventTime_c == 0.0)) { + Autothrust_DWork.eventTime_c = Autothrust_U.in.time.simulation_time; } - if (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_j1 >= 0.3) { + if (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_c >= 0.3) { condition_TOGA = true; Autothrust_DWork.condition_TOGA_latch = false; } else { condition_TOGA = false; } - condition_AlphaFloor_tmp = !Autothrust_DWork.sInhibit; - condition_AlphaFloor = (condition_AlphaFloor_tmp && Autothrust_U.in.input.alpha_floor_condition && - (!Autothrust_DWork.prev_condition_AlphaFloor)); - if (!Autothrust_DWork.eventTime_not_empty_b) { - Autothrust_DWork.eventTime_o = Autothrust_U.in.time.simulation_time; - Autothrust_DWork.eventTime_not_empty_b = true; + rtb_r_g_tmp = !Autothrust_DWork.sInhibit; + rtb_r_a = (rtb_r_g_tmp && Autothrust_U.in.input.alpha_floor_condition && (!Autothrust_DWork.prev_condition_AlphaFloor)); + if (!Autothrust_DWork.eventTime_not_empty_f) { + Autothrust_DWork.eventTime_p = Autothrust_U.in.time.simulation_time; + Autothrust_DWork.eventTime_not_empty_f = true; } if ((Autothrust_U.in.input.TLA_1_deg != 0.0) || (Autothrust_U.in.input.TLA_2_deg != 0.0) || - (Autothrust_DWork.eventTime_o == 0.0)) { - Autothrust_DWork.eventTime_o = Autothrust_U.in.time.simulation_time; + (Autothrust_DWork.eventTime_p == 0.0)) { + Autothrust_DWork.eventTime_p = Autothrust_U.in.time.simulation_time; } - rtb_y_p = Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_o; + rtb_y_a = Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_p; ATHR_ENGAGED_tmp = !Autothrust_DWork.ATHR_ENGAGED; - rtb_r_n = !Autothrust_U.in.input.ATHR_disconnect; + ATHR_ENGAGED_tmp_0 = !Autothrust_U.in.input.ATHR_disconnect; Autothrust_DWork.ATHR_ENGAGED = ((condition_AP_FD_ATHR_Specific && (((rtb_on_ground == 0) && ATHR_ENGAGED_tmp && - rtb_BusAssignment_n.data_computed.ATHR_push) || condition_TOGA || condition_AlphaFloor || - (Autothrust_U.in.input.is_TCAS_active && (!Autothrust_DWork.prev_condition_TCAS)))) || - (condition_AP_FD_ATHR_Specific && ((!rtb_BusAssignment_n.data_computed.ATHR_push) || ATHR_ENGAGED_tmp || - Autothrust_U.in.input.is_LAND_mode_active) && rtb_r_n && ((rtb_y_p < 0.3) || (rtb_y_p >= 0.5)) && - Autothrust_DWork.ATHR_ENGAGED)); - condition_AP_FD_ATHR_Specific = (Autothrust_DWork.ATHR_ENGAGED && (rtb_out || condition_AlphaFloor)); + rtb_BusAssignment_n.data_computed.ATHR_push) || condition_TOGA || rtb_r_a || (Autothrust_U.in.input.is_TCAS_active && + (!Autothrust_DWork.prev_condition_TCAS)))) || (condition_AP_FD_ATHR_Specific && + ((!rtb_BusAssignment_n.data_computed.ATHR_push) || ATHR_ENGAGED_tmp || Autothrust_U.in.input.is_LAND_mode_active) && + ATHR_ENGAGED_tmp_0 && ((rtb_y_a < 0.3) || (rtb_y_a >= 0.5)) && Autothrust_DWork.ATHR_ENGAGED)); + condition_AP_FD_ATHR_Specific = (Autothrust_DWork.ATHR_ENGAGED && (rtb_out || rtb_r_a)); if (Autothrust_DWork.ATHR_ENGAGED && condition_AP_FD_ATHR_Specific) { status = athr_status::ENGAGED_ACTIVE; } else if (Autothrust_DWork.ATHR_ENGAGED && (!condition_AP_FD_ATHR_Specific)) { @@ -462,10 +456,10 @@ void Autothrust::step() status = athr_status::DISENGAGED; } - Autothrust_DWork.prev_condition_AlphaFloor = (Autothrust_U.in.input.alpha_floor_condition && condition_AlphaFloor_tmp); + Autothrust_DWork.prev_condition_AlphaFloor = (Autothrust_U.in.input.alpha_floor_condition && rtb_r_g_tmp); Autothrust_DWork.prev_condition_TCAS = Autothrust_U.in.input.is_TCAS_active; - Autothrust_DWork.prev_SRS_TO_GA_mode_active = condition02; - rtb_y_p = std::fmax(Autothrust_U.in.input.TLA_1_deg, Autothrust_U.in.input.TLA_2_deg); + Autothrust_DWork.prev_SRS_TO_GA_mode_active = condition_TOGA_latch_tmp; + rtb_y_a = std::fmax(Autothrust_U.in.input.TLA_1_deg, Autothrust_U.in.input.TLA_2_deg); Autothrust_DWork.pConditionAlphaFloor = (Autothrust_DWork.prev_condition_AlphaFloor || ((status != athr_status:: DISENGAGED) && Autothrust_DWork.pConditionAlphaFloor)); if (status == athr_status::DISENGAGED) { @@ -477,34 +471,32 @@ void Autothrust::step() } else if ((status == athr_status::ENGAGED_ARMED) && ((Autothrust_U.in.input.TLA_1_deg == 45.0) || (Autothrust_U.in.input.TLA_2_deg == 45.0))) { Autothrust_DWork.pMode = athr_mode::MAN_TOGA; - } else if ((status == athr_status::ENGAGED_ARMED) && rtb_y_o && (rtb_y_p == 35.0)) { + } else if ((status == athr_status::ENGAGED_ARMED) && rtb_y_f && (rtb_y_a == 35.0)) { Autothrust_DWork.pMode = athr_mode::MAN_FLEX; } else if ((status == athr_status::ENGAGED_ARMED) && ((Autothrust_U.in.input.TLA_1_deg == 35.0) || (Autothrust_U.in.input.TLA_2_deg == 35.0))) { Autothrust_DWork.pMode = athr_mode::MAN_MCT; } else { - condition_AP_FD_ATHR_Specific = (Autothrust_U.in.data.is_engine_operative_1 && - (!Autothrust_U.in.data.is_engine_operative_2)); - condition_AlphaFloor_tmp = (Autothrust_U.in.data.is_engine_operative_2 && - (!Autothrust_U.in.data.is_engine_operative_1)); - if ((status == athr_status::ENGAGED_ACTIVE) && (Autothrust_U.in.input.mode_requested == 3.0) && - ((condition_AP_FD_ATHR_Specific && (Autothrust_U.in.input.TLA_1_deg == 35.0) && (Autothrust_U.in.input.TLA_2_deg - <= 35.0)) || (condition_AlphaFloor_tmp && (Autothrust_U.in.input.TLA_2_deg == 35.0) && - (Autothrust_U.in.input.TLA_1_deg <= 35.0)))) { + rtb_r_g_tmp = (Autothrust_U.in.data.is_engine_operative_1 && (!Autothrust_U.in.data.is_engine_operative_2)); + ATHR_ENGAGED_tmp = (Autothrust_U.in.data.is_engine_operative_2 && (!Autothrust_U.in.data.is_engine_operative_1)); + if ((status == athr_status::ENGAGED_ACTIVE) && (Autothrust_U.in.input.mode_requested == 3.0) && ((rtb_r_g_tmp && + (Autothrust_U.in.input.TLA_1_deg == 35.0) && (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || (ATHR_ENGAGED_tmp && + (Autothrust_U.in.input.TLA_2_deg == 35.0) && (Autothrust_U.in.input.TLA_1_deg <= 35.0)))) { Autothrust_DWork.pMode = athr_mode::THR_MCT; } else if ((status == athr_status::ENGAGED_ACTIVE) && (Autothrust_U.in.input.mode_requested == 3.0) && - Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2 && (rtb_y_p == + Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2 && (rtb_y_a == 25.0)) { Autothrust_DWork.pMode = athr_mode::THR_CLB; } else { - condition_TOGA = (Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2); - if ((status == athr_status::ENGAGED_ACTIVE) && (Autothrust_U.in.input.mode_requested == 3.0) && ((condition_TOGA && - (Autothrust_U.in.input.TLA_1_deg < 25.0) && (Autothrust_U.in.input.TLA_2_deg < 25.0)) || - (condition_AP_FD_ATHR_Specific && (Autothrust_U.in.input.TLA_1_deg < 35.0)) || (condition_AlphaFloor_tmp && - (Autothrust_U.in.input.TLA_2_deg < 35.0)))) { + condition_AP_FD_ATHR_Specific = (Autothrust_U.in.data.is_engine_operative_1 && + Autothrust_U.in.data.is_engine_operative_2); + if ((status == athr_status::ENGAGED_ACTIVE) && (Autothrust_U.in.input.mode_requested == 3.0) && + ((condition_AP_FD_ATHR_Specific && (Autothrust_U.in.input.TLA_1_deg < 25.0) && + (Autothrust_U.in.input.TLA_2_deg < 25.0)) || (rtb_r_g_tmp && (Autothrust_U.in.input.TLA_1_deg < 35.0)) || + (ATHR_ENGAGED_tmp && (Autothrust_U.in.input.TLA_2_deg < 35.0)))) { Autothrust_DWork.pMode = athr_mode::THR_LVR; - } else if ((status == athr_status::ENGAGED_ARMED) && ((condition_TOGA && (rtb_y_p > 25.0) && (rtb_y_p < 35.0)) || - ((rtb_y_p > 35.0) && (rtb_y_p < 45.0)))) { + } else if ((status == athr_status::ENGAGED_ARMED) && ((condition_AP_FD_ATHR_Specific && (rtb_y_a > 25.0) && + (rtb_y_a < 35.0)) || ((rtb_y_a > 35.0) && (rtb_y_a < 45.0)))) { Autothrust_DWork.pMode = athr_mode::MAN_THR; } else if ((status == athr_status::ENGAGED_ACTIVE) && ((Autothrust_U.in.input.mode_requested == 2.0) || (Autothrust_U.in.input.mode_requested == 4.0))) { @@ -529,15 +521,15 @@ void Autothrust::step() (!Autothrust_DWork.was_SRS_TO_active) && (Autothrust_U.in.data.H_ind_ft > Autothrust_U.in.input.thrust_reduction_altitude)) || (Autothrust_U.in.input.is_SRS_GA_mode_active && (!Autothrust_DWork.was_SRS_GA_active) && (Autothrust_U.in.data.H_ind_ft > - Autothrust_U.in.input.thrust_reduction_altitude_go_around)) || (condition02 && + Autothrust_U.in.input.thrust_reduction_altitude_go_around)) || (condition_TOGA_latch_tmp && Autothrust_DWork.inhibitAboveThrustReductionAltitude)); - condition_AlphaFloor = (Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2); - ATHR_ENGAGED_tmp = (Autothrust_U.in.data.is_engine_operative_1 && (!Autothrust_U.in.data.is_engine_operative_2)); - condition_THR_LK_tmp = (Autothrust_U.in.data.is_engine_operative_2 && (!Autothrust_U.in.data.is_engine_operative_1)); + condition_TOGA_latch_tmp = (Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2); + condition_THR_LK_tmp = (Autothrust_U.in.data.is_engine_operative_1 && (!Autothrust_U.in.data.is_engine_operative_2)); + condition_THR_LK_tmp_0 = (Autothrust_U.in.data.is_engine_operative_2 && (!Autothrust_U.in.data.is_engine_operative_1)); Autothrust_DWork.condition_THR_LK = (((status == athr_status::DISENGAGED) && (Autothrust_DWork.pStatus != athr_status:: - DISENGAGED) && rtb_r_n && ((condition_AlphaFloor && (Autothrust_U.in.input.TLA_1_deg == 25.0) && - (Autothrust_U.in.input.TLA_2_deg == 25.0)) || (ATHR_ENGAGED_tmp && (Autothrust_U.in.input.TLA_1_deg == 35.0) && - (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || (condition_THR_LK_tmp && (Autothrust_U.in.input.TLA_2_deg == 35.0) && + DISENGAGED) && ATHR_ENGAGED_tmp_0 && ((condition_TOGA_latch_tmp && (Autothrust_U.in.input.TLA_1_deg == 25.0) && + (Autothrust_U.in.input.TLA_2_deg == 25.0)) || (condition_THR_LK_tmp && (Autothrust_U.in.input.TLA_1_deg == 35.0) && + (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || (condition_THR_LK_tmp_0 && (Autothrust_U.in.input.TLA_2_deg == 35.0) && (Autothrust_U.in.input.TLA_1_deg <= 35.0)))) || (((!Autothrust_DWork.condition_THR_LK) || ((status == athr_status:: DISENGAGED) && ((Autothrust_U.in.input.TLA_1_deg == 25.0) || (Autothrust_U.in.input.TLA_2_deg == 25.0) || (Autothrust_U.in.input.TLA_1_deg == 35.0) || (Autothrust_U.in.input.TLA_2_deg == 35.0)))) && @@ -546,45 +538,45 @@ void Autothrust::step() Autothrust_DWork.was_SRS_TO_active = Autothrust_U.in.input.is_SRS_TO_mode_active; Autothrust_DWork.was_SRS_GA_active = Autothrust_U.in.input.is_SRS_GA_mode_active; if (rtb_on_ground == 0) { - rtb_y_p = std::fmax(0.0, rtb_y_p); + rtb_y_a = std::fmax(0.0, rtb_y_a); } - condition_AP_FD_ATHR_Specific = !Autothrust_U.in.data.is_engine_operative_1; - condition_AlphaFloor_tmp = !Autothrust_U.in.data.is_engine_operative_2; - if ((rtb_on_ground == 0) || (condition_AP_FD_ATHR_Specific && condition_AlphaFloor_tmp)) { + rtb_r_g_tmp = !Autothrust_U.in.data.is_engine_operative_1; + ATHR_ENGAGED_tmp = !Autothrust_U.in.data.is_engine_operative_2; + if ((rtb_on_ground == 0) || (rtb_r_g_tmp && ATHR_ENGAGED_tmp)) { if ((mode == athr_mode::A_FLOOR) || (mode == athr_mode::TOGA_LK)) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::TOGA; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_TOGA_percent; - } else if (rtb_y_p > 35.0) { + } else if (rtb_y_a > 35.0) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::TOGA; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_TOGA_percent; - } else if (rtb_y_p > 25.0) { - if (!rtb_y_o) { + } else if (rtb_y_a > 25.0) { + if (!rtb_y_f) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::MCT; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_MCT_percent; } else { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::FLEX; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_FLEX_percent; } - } else if (rtb_y_p >= 0.0) { + } else if (rtb_y_a >= 0.0) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::CLB; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_CLB_percent; - } else if (rtb_y_p < 0.0) { + } else if (rtb_y_a < 0.0) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::REVERSE; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_REV_percent; } else { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::NONE; Autothrust_Y.out.output.thrust_limit_percent = 0.0; } - } else if (rtb_y_p >= 0.0) { - if ((!rtb_y_o) || (rtb_y_p > 35.0)) { + } else if (rtb_y_a >= 0.0) { + if ((!rtb_y_f) || (rtb_y_a > 35.0)) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::TOGA; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_TOGA_percent; } else { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::FLEX; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_FLEX_percent; } - } else if (rtb_y_p < 0.0) { + } else if (rtb_y_a < 0.0) { Autothrust_Y.out.output.thrust_limit_type = athr_thrust_limit_type::REVERSE; Autothrust_Y.out.output.thrust_limit_percent = Autothrust_U.in.input.thrust_limit_REV_percent; } else { @@ -602,9 +594,9 @@ void Autothrust::step() Autothrust_DWork.eventTime = Autothrust_U.in.time.simulation_time; } - if (!Autothrust_DWork.eventTime_not_empty_j) { + if (!Autothrust_DWork.eventTime_not_empty_g) { Autothrust_DWork.eventTime_j = Autothrust_U.in.time.simulation_time; - Autothrust_DWork.eventTime_not_empty_j = true; + Autothrust_DWork.eventTime_not_empty_g = true; } if ((((Autothrust_U.in.input.TLA_1_deg < 25.0) || (Autothrust_U.in.input.TLA_1_deg >= 35.0)) && @@ -613,27 +605,25 @@ void Autothrust::step() Autothrust_DWork.eventTime_j = Autothrust_U.in.time.simulation_time; } - condition02 = (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_j >= 4.0); + condition_AP_FD_ATHR_Specific = (Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime_j >= 4.0); Autothrust_Y.out.output.N1_TLA_1_percent = Phi_rad; - rtb_BusAssignment_e_output_N1_TLA_2_percent = rtb_Switch_d; - rtb_BusAssignment_e_output_N1_TLA_3_percent = Theta_rad; - condition_TOGA = rtb_r_i; - rtb_r_i = ((status == athr_status::ENGAGED_ACTIVE) && (((Autothrust_U.in.input.TLA_1_deg <= 35.0) && + condition_TOGA = rtb_r_he; + rtb_r_he = ((status == athr_status::ENGAGED_ACTIVE) && (((Autothrust_U.in.input.TLA_1_deg <= 35.0) && (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || Autothrust_U.in.input.alpha_floor_condition)); - pThrustMemoActive_tmp = !rtb_r_i; + rtb_r_a = !rtb_r_he; Autothrust_DWork.pThrustMemoActive = ((((Autothrust_U.in.input.ATHR_push && (status != athr_status::DISENGAGED)) || - (pThrustMemoActive_tmp && Autothrust_DWork.pUseAutoThrustControl && rtb_r_n)) && ((condition_AlphaFloor && - (Autothrust_U.in.input.TLA_1_deg == 25.0) && (Autothrust_U.in.input.TLA_2_deg == 25.0)) || (ATHR_ENGAGED_tmp && - (Autothrust_U.in.input.TLA_1_deg == 35.0) && (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || (condition_THR_LK_tmp && - (Autothrust_U.in.input.TLA_2_deg == 35.0) && (Autothrust_U.in.input.TLA_1_deg <= 35.0)))) || (pThrustMemoActive_tmp && + (rtb_r_a && Autothrust_DWork.pUseAutoThrustControl && ATHR_ENGAGED_tmp_0)) && ((condition_TOGA_latch_tmp && + (Autothrust_U.in.input.TLA_1_deg == 25.0) && (Autothrust_U.in.input.TLA_2_deg == 25.0)) || (condition_THR_LK_tmp && + (Autothrust_U.in.input.TLA_1_deg == 35.0) && (Autothrust_U.in.input.TLA_2_deg <= 35.0)) || (condition_THR_LK_tmp_0 && + (Autothrust_U.in.input.TLA_2_deg == 35.0) && (Autothrust_U.in.input.TLA_1_deg <= 35.0)))) || (rtb_r_a && ((Autothrust_U.in.input.TLA_1_deg == 25.0) || (Autothrust_U.in.input.TLA_1_deg == 35.0) || (Autothrust_U.in.input.TLA_2_deg == 25.0) || (Autothrust_U.in.input.TLA_2_deg == 35.0)) && Autothrust_DWork.pThrustMemoActive)); - Autothrust_DWork.pUseAutoThrustControl = rtb_r_i; + Autothrust_DWork.pUseAutoThrustControl = rtb_r_he; if (Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2) { - Theta_rad = Autothrust_U.in.input.thrust_limit_CLB_percent; + rtb_Switch_dx = Autothrust_U.in.input.thrust_limit_CLB_percent; } else { - Theta_rad = Autothrust_U.in.input.thrust_limit_MCT_percent; + rtb_Switch_dx = Autothrust_U.in.input.thrust_limit_MCT_percent; } v[0] = Autothrust_U.in.input.V_LS_kn; @@ -656,7 +646,7 @@ void Autothrust::step() } rtb_Switch_d = v[i] - Autothrust_U.in.data.V_ias_kn; - rtb_Switch_fs = Autothrust_P.Gain1_Gain_ot * rtb_Gain3; + rtb_Switch_ej = Autothrust_P.Gain1_Gain_ot * rtb_Gain3; if (Autothrust_U.in.data.ambient_density_kg_per_m3 > Autothrust_P.Saturation2_UpperSat) { rtb_Switch_f_idx_0 = Autothrust_P.Saturation2_UpperSat; } else if (Autothrust_U.in.data.ambient_density_kg_per_m3 < Autothrust_P.Saturation2_LowerSat) { @@ -666,15 +656,15 @@ void Autothrust::step() } if (Autothrust_U.in.data.V_gnd_kn > Autothrust_P.Saturation_UpperSat_f) { - rtb_y_hw = Autothrust_P.Saturation_UpperSat_f; + rtb_y_p = Autothrust_P.Saturation_UpperSat_f; } else if (Autothrust_U.in.data.V_gnd_kn < Autothrust_P.Saturation_LowerSat_ev) { - rtb_y_hw = Autothrust_P.Saturation_LowerSat_ev; + rtb_y_p = Autothrust_P.Saturation_LowerSat_ev; } else { - rtb_y_hw = Autothrust_U.in.data.V_gnd_kn; + rtb_y_p = Autothrust_U.in.data.V_gnd_kn; } Autothrust_WashoutFilter(Autothrust_P._Gain * (1.0 / std::sqrt(rtb_Switch_f_idx_0) * (Autothrust_P.GStoGS_CAS_Gain * - (Autothrust_P.ktstomps_Gain * rtb_y_hw))), Autothrust_P.WashoutFilter_C1, Autothrust_U.in.time.dt, &rtb_y_p, + (Autothrust_P.ktstomps_Gain * rtb_y_p))), Autothrust_P.WashoutFilter_C1, Autothrust_U.in.time.dt, &rtb_y_a, &Autothrust_DWork.sf_WashoutFilter); rtb_Gain_m = Autothrust_P.kntoms_Gain * Autothrust_U.in.data.V_gnd_kn; if (rtb_Gain_m > Autothrust_P.Saturation_UpperSat_d) { @@ -683,13 +673,13 @@ void Autothrust::step() rtb_Gain_m = Autothrust_P.Saturation_LowerSat_e; } - Autothrust_LeadLagFilter(rtb_y_p - Autothrust_P.g_Gain * (Autothrust_P.Gain1_Gain_c * (Autothrust_P.Gain_Gain_j * + Autothrust_LeadLagFilter(rtb_y_a - Autothrust_P.g_Gain * (Autothrust_P.Gain1_Gain_c * (Autothrust_P.Gain_Gain_j * ((Autothrust_P.Gain1_Gain_n0 * rtb_Gain2 - Autothrust_P.Gain1_Gain_j * (Autothrust_P.Gain_Gain_c * std::atan (Autothrust_P.fpmtoms_Gain * Autothrust_U.in.data.H_dot_fpm / rtb_Gain_m))) * (Autothrust_P.Constant_Value - std:: - cos(rtb_Switch_fs)) + std::sin(rtb_Switch_fs) * std::sin(Autothrust_P.Gain1_Gain_d * + cos(rtb_Switch_ej)) + std::sin(rtb_Switch_ej) * std::sin(Autothrust_P.Gain1_Gain_d * Autothrust_U.in.data.Psi_magnetic_track_deg - Autothrust_P.Gain1_Gain_f * Autothrust_U.in.data.Psi_magnetic_deg)))), Autothrust_P.HighPassFilter_C1, Autothrust_P.HighPassFilter_C2, Autothrust_P.HighPassFilter_C3, - Autothrust_P.HighPassFilter_C4, Autothrust_U.in.time.dt, &rtb_y_hw, &Autothrust_DWork.sf_LeadLagFilter); + Autothrust_P.HighPassFilter_C4, Autothrust_U.in.time.dt, &rtb_y_p, &Autothrust_DWork.sf_LeadLagFilter); if (Autothrust_U.in.data.V_ias_kn > Autothrust_P.Saturation1_UpperSat_c) { rtb_Switch_f_idx_0 = Autothrust_P.Saturation1_UpperSat_c; } else if (Autothrust_U.in.data.V_ias_kn < Autothrust_P.Saturation1_LowerSat_g) { @@ -700,18 +690,18 @@ void Autothrust::step() Autothrust_LeadLagFilter(Autothrust_P.ktstomps_Gain_h * rtb_Switch_f_idx_0, Autothrust_P.LowPassFilter_C1, Autothrust_P.LowPassFilter_C2, Autothrust_P.LowPassFilter_C3, Autothrust_P.LowPassFilter_C4, Autothrust_U.in.time.dt, - &rtb_y_p, &Autothrust_DWork.sf_LeadLagFilter_h); - rtb_Switch_fs = (rtb_y_hw + rtb_y_p) * Autothrust_P.mpstokts_Gain * Autothrust_P.Gain4_Gain * look1_binlxpw + &rtb_y_a, &Autothrust_DWork.sf_LeadLagFilter_h); + rtb_Switch_ej = (rtb_y_p + rtb_y_a) * Autothrust_P.mpstokts_Gain * Autothrust_P.Gain4_Gain * look1_binlxpw (rtb_Switch_d, Autothrust_P.ScheduledGain1_BreakpointsForDimension1, Autothrust_P.ScheduledGain1_Table, 4U) + rtb_Switch_d; - rtb_Gain_m = Autothrust_P.DiscreteDerivativeVariableTs_Gain * rtb_Switch_fs; + rtb_Gain_m = Autothrust_P.DiscreteDerivativeVariableTs_Gain * rtb_Switch_ej; Autothrust_LagFilter((rtb_Gain_m - Autothrust_DWork.Delay_DSTATE) / Autothrust_U.in.time.dt, Autothrust_P.LagFilter_C1, Autothrust_U.in.time.dt, &rtb_Switch_d, &Autothrust_DWork.sf_LagFilter); - Autothrust_LagFilter(Autothrust_U.in.data.nz_g, Autothrust_P.LagFilter1_C1, Autothrust_U.in.time.dt, &rtb_y_hw, + Autothrust_LagFilter(Autothrust_U.in.data.nz_g, Autothrust_P.LagFilter1_C1, Autothrust_U.in.time.dt, &rtb_y_p, &Autothrust_DWork.sf_LagFilter_a); - rtb_y_hw -= std::cos(Autothrust_P.Gain1_Gain_p1 * rtb_Gain2) / std::cos(Autothrust_P.Gain1_Gain_di * rtb_Gain3); - Autothrust_WashoutFilter(Autothrust_P.Gain2_Gain_c * rtb_y_hw, Autothrust_P.WashoutFilter_C1_c, - Autothrust_U.in.time.dt, &rtb_y_p, &Autothrust_DWork.sf_WashoutFilter_h); + rtb_y_p -= std::cos(Autothrust_P.Gain1_Gain_p1 * rtb_Gain2) / std::cos(Autothrust_P.Gain1_Gain_di * rtb_Gain3); + Autothrust_WashoutFilter(Autothrust_P.Gain2_Gain_c * rtb_y_p, Autothrust_P.WashoutFilter_C1_c, Autothrust_U.in.time.dt, + &rtb_y_a, &Autothrust_DWork.sf_WashoutFilter_h); if (!Autothrust_DWork.pY_not_empty) { Autothrust_DWork.pY = Autothrust_P.RateLimiterVariableTs_InitialCondition; Autothrust_DWork.pY_not_empty = true; @@ -730,59 +720,59 @@ void Autothrust::step() switch (static_cast(rtb_Switch_f_idx_0)) { case 0: - rtb_Switch_fs = Autothrust_P.Constant1_Value; + rtb_Switch_ej = Autothrust_P.Constant1_Value; break; case 1: - rtb_Switch_fs = ((Autothrust_P.Gain_Gain * rtb_Switch_fs + rtb_Switch_d) + (Autothrust_P.Gain1_Gain * rtb_y_hw + - Autothrust_P.Gain3_Gain * rtb_y_p)) * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), + rtb_Switch_ej = ((Autothrust_P.Gain_Gain * rtb_Switch_ej + rtb_Switch_d) + (Autothrust_P.Gain1_Gain * rtb_y_p + + Autothrust_P.Gain3_Gain * rtb_y_a)) * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), Autothrust_P.ScheduledGain2_BreakpointsForDimension1, Autothrust_P.ScheduledGain2_Table, 3U) * look1_binlxpw (Autothrust_DWork.pY, Autothrust_P.ScheduledGain4_BreakpointsForDimension1, Autothrust_P.ScheduledGain4_Table, 1U); - if (rtb_Switch_fs > Autothrust_P.Saturation1_UpperSat) { - rtb_Switch_fs = Autothrust_P.Saturation1_UpperSat; - } else if (rtb_Switch_fs < Autothrust_P.Saturation1_LowerSat) { - rtb_Switch_fs = Autothrust_P.Saturation1_LowerSat; + if (rtb_Switch_ej > Autothrust_P.Saturation1_UpperSat) { + rtb_Switch_ej = Autothrust_P.Saturation1_UpperSat; + } else if (rtb_Switch_ej < Autothrust_P.Saturation1_LowerSat) { + rtb_Switch_ej = Autothrust_P.Saturation1_LowerSat; } break; case 2: - rtb_Switch_fs = Autothrust_P.Gain1_Gain_p * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), + rtb_Switch_ej = Autothrust_P.Gain1_Gain_p * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), Autothrust_P.uDLookupTable_bp01Data, Autothrust_P.uDLookupTable_tableData, 6U); - if (rtb_Switch_fs > Autothrust_P.Saturation_UpperSat) { - rtb_Switch_fs = Autothrust_P.Saturation_UpperSat; - } else if (rtb_Switch_fs < Autothrust_P.Saturation_LowerSat) { - rtb_Switch_fs = Autothrust_P.Saturation_LowerSat; + if (rtb_Switch_ej > Autothrust_P.Saturation_UpperSat) { + rtb_Switch_ej = Autothrust_P.Saturation_UpperSat; + } else if (rtb_Switch_ej < Autothrust_P.Saturation_LowerSat) { + rtb_Switch_ej = Autothrust_P.Saturation_LowerSat; } break; case 3: - rtb_Switch_fs = Autothrust_P.Gain1_Gain_o * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), + rtb_Switch_ej = Autothrust_P.Gain1_Gain_o * look1_binlxpw(std::fmin(rtb_Saturation, rtb_Saturation), Autothrust_P.uDLookupTable_bp01Data_b, Autothrust_P.uDLookupTable_tableData_o, 6U); - if (rtb_Switch_fs > Autothrust_P.Saturation_UpperSat_a) { - rtb_Switch_fs = Autothrust_P.Saturation_UpperSat_a; - } else if (rtb_Switch_fs < Autothrust_P.Saturation_LowerSat_a) { - rtb_Switch_fs = Autothrust_P.Saturation_LowerSat_a; + if (rtb_Switch_ej > Autothrust_P.Saturation_UpperSat_a) { + rtb_Switch_ej = Autothrust_P.Saturation_UpperSat_a; + } else if (rtb_Switch_ej < Autothrust_P.Saturation_LowerSat_a) { + rtb_Switch_ej = Autothrust_P.Saturation_LowerSat_a; } break; default: - rtb_Switch_fs = Autothrust_P.RETARD_Value; + rtb_Switch_ej = Autothrust_P.RETARD_Value; break; } - rtb_Switch_fs = Autothrust_P.DiscreteTimeIntegratorVariableTsLimit_Gain * rtb_Switch_fs * Autothrust_U.in.time.dt; - rtb_r_n = (mode == Autothrust_P.CompareToConstant2_const_c); - rtb_r_i = (mode == Autothrust_P.CompareToConstant3_const_k); - Autothrust_DWork.icLoad = ((status != Autothrust_P.CompareToConstant_const_d) || (rtb_r_n || rtb_r_i) || + rtb_Switch_ej = Autothrust_P.DiscreteTimeIntegratorVariableTsLimit_Gain * rtb_Switch_ej * Autothrust_U.in.time.dt; + rtb_r_a = (mode == Autothrust_P.CompareToConstant2_const_c); + rtb_r_he = (mode == Autothrust_P.CompareToConstant3_const_k); + Autothrust_DWork.icLoad = ((status != Autothrust_P.CompareToConstant_const_d) || (rtb_r_a || rtb_r_he) || Autothrust_DWork.icLoad); if (Autothrust_DWork.icLoad) { Autothrust_DWork.Delay_DSTATE_k = std::fmax(rtb_Saturation, rtb_BusAssignment_n.data.commanded_engine_N1_2_percent) - - rtb_Switch_fs; + - rtb_Switch_ej; } - Autothrust_DWork.Delay_DSTATE_k += rtb_Switch_fs; - if (Autothrust_DWork.Delay_DSTATE_k > Theta_rad) { - Autothrust_DWork.Delay_DSTATE_k = Theta_rad; + Autothrust_DWork.Delay_DSTATE_k += rtb_Switch_ej; + if (Autothrust_DWork.Delay_DSTATE_k > rtb_Switch_dx) { + Autothrust_DWork.Delay_DSTATE_k = rtb_Switch_dx; } else if (Autothrust_DWork.Delay_DSTATE_k < Autothrust_U.in.input.thrust_limit_IDLE_percent) { Autothrust_DWork.Delay_DSTATE_k = Autothrust_U.in.input.thrust_limit_IDLE_percent; } @@ -795,14 +785,14 @@ void Autothrust::step() rtb_Switch_f_idx_0 = Autothrust_U.in.input.thrust_limit_TOGA_percent; } - if (Autothrust_U.in.input.thrust_limit_TOGA_percent < rtb_BusAssignment_e_output_N1_TLA_2_percent) { - rtb_Switch_f_idx_1 = rtb_BusAssignment_e_output_N1_TLA_2_percent; + if (Autothrust_U.in.input.thrust_limit_TOGA_percent < Theta_rad) { + rtb_Switch_f_idx_1 = Theta_rad; } else { rtb_Switch_f_idx_1 = Autothrust_U.in.input.thrust_limit_TOGA_percent; } - if (Autothrust_U.in.input.thrust_limit_TOGA_percent < rtb_BusAssignment_e_output_N1_TLA_3_percent) { - rtb_Switch_f_idx_2 = rtb_BusAssignment_e_output_N1_TLA_3_percent; + if (Autothrust_U.in.input.thrust_limit_TOGA_percent < result_tmp) { + rtb_Switch_f_idx_2 = result_tmp; } else { rtb_Switch_f_idx_2 = Autothrust_U.in.input.thrust_limit_TOGA_percent; } @@ -821,16 +811,16 @@ void Autothrust::step() rtb_Switch_f_idx_0 = Autothrust_DWork.Delay_DSTATE_k; } - if (Autothrust_DWork.Delay_DSTATE_k > rtb_BusAssignment_e_output_N1_TLA_2_percent) { - rtb_Switch_f_idx_1 = rtb_BusAssignment_e_output_N1_TLA_2_percent; + if (Autothrust_DWork.Delay_DSTATE_k > Theta_rad) { + rtb_Switch_f_idx_1 = Theta_rad; } else if (Autothrust_DWork.Delay_DSTATE_k < Autothrust_U.in.input.thrust_limit_IDLE_percent) { rtb_Switch_f_idx_1 = Autothrust_U.in.input.thrust_limit_IDLE_percent; } else { rtb_Switch_f_idx_1 = Autothrust_DWork.Delay_DSTATE_k; } - if (Autothrust_DWork.Delay_DSTATE_k > rtb_BusAssignment_e_output_N1_TLA_3_percent) { - rtb_Switch_f_idx_2 = rtb_BusAssignment_e_output_N1_TLA_3_percent; + if (Autothrust_DWork.Delay_DSTATE_k > result_tmp) { + rtb_Switch_f_idx_2 = result_tmp; } else if (Autothrust_DWork.Delay_DSTATE_k < Autothrust_U.in.input.thrust_limit_IDLE_percent) { rtb_Switch_f_idx_2 = Autothrust_U.in.input.thrust_limit_IDLE_percent; } else { @@ -852,18 +842,18 @@ void Autothrust::step() rtb_Switch_f_idx_3 = rtb_BusAssignment_n.data.commanded_engine_N1_4_percent; } else { rtb_Switch_f_idx_0 = Phi_rad; - rtb_Switch_f_idx_1 = rtb_BusAssignment_e_output_N1_TLA_2_percent; - rtb_Switch_f_idx_2 = rtb_BusAssignment_e_output_N1_TLA_3_percent; + rtb_Switch_f_idx_1 = Theta_rad; + rtb_Switch_f_idx_2 = result_tmp; rtb_Switch_f_idx_3 = rtb_BusAssignment_e_output_N1_TLA_4_percent; } - Autothrust_Y.out.output.is_in_reverse_1 = rtb_r_e; - Autothrust_MATLABFunction(rtb_Switch_f_idx_0 - Autothrust_U.in.data.engine_N1_1_percent, &rtb_y_p, &rtb_r_i); - if (rtb_r_i) { + Autothrust_Y.out.output.is_in_reverse_1 = rtb_r_h; + Autothrust_MATLABFunction(rtb_Switch_f_idx_0 - Autothrust_U.in.data.engine_N1_1_percent, &rtb_y_a, &rtb_r_he); + if (rtb_r_he) { Autothrust_DWork.Delay_DSTATE_e = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition; } - Autothrust_DWork.Delay_DSTATE_e += Autothrust_P.Gain_Gain_l * rtb_y_p * + Autothrust_DWork.Delay_DSTATE_e += Autothrust_P.Gain_Gain_l * rtb_y_a * Autothrust_P.DiscreteTimeIntegratorVariableTs_Gain * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_e > Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit) { Autothrust_DWork.Delay_DSTATE_e = Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit; @@ -871,12 +861,12 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_e = Autothrust_P.DiscreteTimeIntegratorVariableTs_LowerLimit; } - rtb_Switch_fs = (rtb_Switch_f_idx_0 + Autothrust_DWork.Delay_DSTATE_e) - rtb_Saturation; - if (rtb_r_e) { + rtb_Switch_ej = (rtb_Switch_f_idx_0 + Autothrust_DWork.Delay_DSTATE_e) - rtb_Saturation; + if (rtb_r_h) { Autothrust_DWork.Delay_DSTATE_n = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition_p; } - Autothrust_DWork.Delay_DSTATE_n += Autothrust_P.Gain_Gain_d3 * rtb_Switch_fs * + Autothrust_DWork.Delay_DSTATE_n += Autothrust_P.Gain_Gain_d3 * rtb_Switch_ej * Autothrust_P.DiscreteTimeIntegratorVariableTs_Gain_l * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_n > Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_l) { Autothrust_DWork.Delay_DSTATE_n = Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_l; @@ -884,11 +874,12 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_n = Autothrust_P.DiscreteTimeIntegratorVariableTs_LowerLimit_d; } - if (!rtb_r_e) { + rtb_r_he = !rtb_r_h; + if (rtb_r_he) { Autothrust_DWork.Delay_DSTATE_l = Autothrust_P.DiscreteTimeIntegratorVariableTs1_InitialCondition; } - Autothrust_DWork.Delay_DSTATE_l += Autothrust_P.Gain1_Gain_h * rtb_Switch_fs * + Autothrust_DWork.Delay_DSTATE_l += Autothrust_P.Gain1_Gain_h * rtb_Switch_ej * Autothrust_P.DiscreteTimeIntegratorVariableTs1_Gain * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_l > Autothrust_P.DiscreteTimeIntegratorVariableTs1_UpperLimit) { Autothrust_DWork.Delay_DSTATE_l = Autothrust_P.DiscreteTimeIntegratorVariableTs1_UpperLimit; @@ -896,19 +887,19 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_l = Autothrust_P.DiscreteTimeIntegratorVariableTs1_LowerLimit; } - if (!rtb_r_e) { + if (rtb_r_he) { Autothrust_Y.out.output.sim_throttle_lever_1_pos = Autothrust_DWork.Delay_DSTATE_n; } else { Autothrust_Y.out.output.sim_throttle_lever_1_pos = Autothrust_DWork.Delay_DSTATE_l; } - Autothrust_ThrustMode1(Autothrust_U.in.input.TLA_1_deg, &rtb_y_p); - Autothrust_MATLABFunction(rtb_Switch_f_idx_1 - Autothrust_U.in.data.engine_N1_2_percent, &rtb_y_hw, &rtb_r_i); - if (rtb_r_i) { + Autothrust_ThrustMode1(Autothrust_U.in.input.TLA_1_deg, &rtb_y_a); + Autothrust_MATLABFunction(rtb_Switch_f_idx_1 - Autothrust_U.in.data.engine_N1_2_percent, &rtb_y_p, &rtb_r_he); + if (rtb_r_he) { Autothrust_DWork.Delay_DSTATE_a = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition_f; } - Autothrust_DWork.Delay_DSTATE_a += Autothrust_P.Gain_Gain_f * rtb_y_hw * + Autothrust_DWork.Delay_DSTATE_a += Autothrust_P.Gain_Gain_f * rtb_y_p * Autothrust_P.DiscreteTimeIntegratorVariableTs_Gain_b * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_a > Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_m) { Autothrust_DWork.Delay_DSTATE_a = Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_m; @@ -916,13 +907,13 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_a = Autothrust_P.DiscreteTimeIntegratorVariableTs_LowerLimit_i; } - Theta_rad = (rtb_Switch_f_idx_1 + Autothrust_DWork.Delay_DSTATE_a) - + rtb_Switch_dx = (rtb_Switch_f_idx_1 + Autothrust_DWork.Delay_DSTATE_a) - rtb_BusAssignment_n.data.commanded_engine_N1_2_percent; if (condition_TOGA) { Autothrust_DWork.Delay_DSTATE_lz = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition_n; } - Autothrust_DWork.Delay_DSTATE_lz += Autothrust_P.Gain_Gain_b * Theta_rad * + Autothrust_DWork.Delay_DSTATE_lz += Autothrust_P.Gain_Gain_b * rtb_Switch_dx * Autothrust_P.DiscreteTimeIntegratorVariableTs_Gain_k * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_lz > Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_p) { Autothrust_DWork.Delay_DSTATE_lz = Autothrust_P.DiscreteTimeIntegratorVariableTs_UpperLimit_p; @@ -930,11 +921,12 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_lz = Autothrust_P.DiscreteTimeIntegratorVariableTs_LowerLimit_e; } - if (!condition_TOGA) { + rtb_r_he = !condition_TOGA; + if (rtb_r_he) { Autothrust_DWork.Delay_DSTATE_h = Autothrust_P.DiscreteTimeIntegratorVariableTs1_InitialCondition_e; } - Autothrust_DWork.Delay_DSTATE_h += Autothrust_P.Gain1_Gain_g * Theta_rad * + Autothrust_DWork.Delay_DSTATE_h += Autothrust_P.Gain1_Gain_g * rtb_Switch_dx * Autothrust_P.DiscreteTimeIntegratorVariableTs1_Gain_l * Autothrust_U.in.time.dt; if (Autothrust_DWork.Delay_DSTATE_h > Autothrust_P.DiscreteTimeIntegratorVariableTs1_UpperLimit_o) { Autothrust_DWork.Delay_DSTATE_h = Autothrust_P.DiscreteTimeIntegratorVariableTs1_UpperLimit_o; @@ -942,9 +934,9 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_h = Autothrust_P.DiscreteTimeIntegratorVariableTs1_LowerLimit_h; } - Autothrust_ThrustMode1(Autothrust_U.in.input.TLA_2_deg, &rtb_y_hw); - Autothrust_MATLABFunction(rtb_Switch_f_idx_2 - Autothrust_U.in.data.engine_N1_3_percent, &rtb_Switch_d, &rtb_r_n); - if (rtb_r_n) { + Autothrust_ThrustMode1(Autothrust_U.in.input.TLA_2_deg, &rtb_y_p); + Autothrust_MATLABFunction(rtb_Switch_f_idx_2 - Autothrust_U.in.data.engine_N1_3_percent, &rtb_Switch_d, &rtb_r_a); + if (rtb_r_a) { Autothrust_DWork.Delay_DSTATE_au = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition_i; } @@ -972,7 +964,8 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_j = Phi_rad; } - if (!Autothrust_DWork.Delay_DSTATE_as) { + rtb_r_a = !Autothrust_DWork.Delay_DSTATE_as; + if (rtb_r_a) { Autothrust_DWork.Delay_DSTATE_o = Autothrust_P.DiscreteTimeIntegratorVariableTs1_InitialCondition_g; } @@ -985,8 +978,8 @@ void Autothrust::step() } Autothrust_ThrustMode1(Autothrust_U.in.input.TLA_3_deg, &rtb_Switch_d); - Autothrust_MATLABFunction(rtb_Switch_f_idx_3 - Autothrust_U.in.data.engine_N1_4_percent, &Phi_rad, &rtb_r_e); - if (rtb_r_e) { + Autothrust_MATLABFunction(rtb_Switch_f_idx_3 - Autothrust_U.in.data.engine_N1_4_percent, &Phi_rad, &rtb_r_h); + if (rtb_r_h) { Autothrust_DWork.Delay_DSTATE_e1 = Autothrust_P.DiscreteTimeIntegratorVariableTs_InitialCondition_fg; } @@ -1014,7 +1007,8 @@ void Autothrust::step() Autothrust_DWork.Delay_DSTATE_lr = rtb_Saturation; } - if (!rtb_NOT1_c) { + rtb_r_h = !rtb_NOT1_c; + if (rtb_r_h) { Autothrust_DWork.Delay_DSTATE_p = Autothrust_P.DiscreteTimeIntegratorVariableTs1_InitialCondition_d; } @@ -1064,39 +1058,39 @@ void Autothrust::step() Autothrust_Y.out.data.engine_N1_4_percent = Autothrust_U.in.data.engine_N1_4_percent; Autothrust_Y.out.data.TAT_degC = Autothrust_U.in.data.TAT_degC; Autothrust_Y.out.data.OAT_degC = Autothrust_U.in.data.OAT_degC; - Autothrust_Y.out.data.ISA_degC = result_tmp; + Autothrust_Y.out.data.ISA_degC = tmp; Autothrust_Y.out.data.ambient_density_kg_per_m3 = Autothrust_U.in.data.ambient_density_kg_per_m3; Autothrust_Y.out.data_computed.TLA_in_active_range = rtb_out; - Autothrust_Y.out.data_computed.is_FLX_active = rtb_y_o; + Autothrust_Y.out.data_computed.is_FLX_active = rtb_y_f; Autothrust_Y.out.data_computed.ATHR_push = rtb_BusAssignment_n.data_computed.ATHR_push; Autothrust_Y.out.data_computed.ATHR_disabled = Autothrust_DWork.Memory_PreviousInput; Autothrust_Y.out.data_computed.time_since_touchdown = rtb_BusAssignment_n.data_computed.time_since_touchdown; Autothrust_Y.out.data_computed.alpha_floor_inhibited = Autothrust_DWork.sInhibit; Autothrust_Y.out.input = Autothrust_U.in.input; - if (!condition_TOGA) { + if (rtb_r_he) { Autothrust_Y.out.output.sim_throttle_lever_2_pos = Autothrust_DWork.Delay_DSTATE_lz; } else { Autothrust_Y.out.output.sim_throttle_lever_2_pos = Autothrust_DWork.Delay_DSTATE_h; } - if (!Autothrust_DWork.Delay_DSTATE_as) { + if (rtb_r_a) { Autothrust_Y.out.output.sim_throttle_lever_3_pos = Autothrust_DWork.Delay_DSTATE_j; } else { Autothrust_Y.out.output.sim_throttle_lever_3_pos = Autothrust_DWork.Delay_DSTATE_o; } - if (!rtb_NOT1_c) { + if (rtb_r_h) { Autothrust_Y.out.output.sim_throttle_lever_4_pos = Autothrust_DWork.Delay_DSTATE_lr; } else { Autothrust_Y.out.output.sim_throttle_lever_4_pos = Autothrust_DWork.Delay_DSTATE_p; } - Autothrust_Y.out.output.sim_thrust_mode_1 = rtb_y_p; - Autothrust_Y.out.output.sim_thrust_mode_2 = rtb_y_hw; + Autothrust_Y.out.output.sim_thrust_mode_1 = rtb_y_a; + Autothrust_Y.out.output.sim_thrust_mode_2 = rtb_y_p; Autothrust_Y.out.output.sim_thrust_mode_3 = rtb_Switch_d; Autothrust_Y.out.output.sim_thrust_mode_4 = rtb_Saturation; - Autothrust_Y.out.output.N1_TLA_2_percent = rtb_BusAssignment_e_output_N1_TLA_2_percent; - Autothrust_Y.out.output.N1_TLA_3_percent = rtb_BusAssignment_e_output_N1_TLA_3_percent; + Autothrust_Y.out.output.N1_TLA_2_percent = Theta_rad; + Autothrust_Y.out.output.N1_TLA_3_percent = result_tmp; Autothrust_Y.out.output.N1_TLA_4_percent = rtb_BusAssignment_e_output_N1_TLA_4_percent; Autothrust_Y.out.output.is_in_reverse_2 = condition_TOGA; Autothrust_Y.out.output.is_in_reverse_3 = Autothrust_DWork.Delay_DSTATE_as; @@ -1108,14 +1102,14 @@ void Autothrust::step() Autothrust_Y.out.output.status = status; Autothrust_Y.out.output.mode = mode; rtb_out = !Autothrust_DWork.inhibitAboveThrustReductionAltitude; - condition_TOGA = (((!Autothrust_U.in.input.is_SRS_TO_mode_active) || ((Autothrust_U.in.data.H_ind_ft >= + rtb_r_he = (((!Autothrust_U.in.input.is_SRS_TO_mode_active) || ((Autothrust_U.in.data.H_ind_ft >= Autothrust_U.in.input.thrust_reduction_altitude) && rtb_out)) && ((!Autothrust_U.in.input.is_SRS_GA_mode_active) || ((Autothrust_U.in.data.H_ind_ft >= Autothrust_U.in.input.thrust_reduction_altitude_go_around) && rtb_out)) && - ((Autothrust_U.in.data.H_radio_ft > 400.0) || (Autothrust_U.in.input.flight_phase > 2.0)) && (tmp || + ((Autothrust_U.in.data.H_radio_ft > 400.0) || (Autothrust_U.in.input.flight_phase > 2.0)) && (tmp_0 || (Autothrust_U.in.input.target_TCAS_RA_rate_fpm <= 500.0) || (Autothrust_U.in.input.TLA_1_deg <= 25.0) || (Autothrust_U.in.input.TLA_2_deg <= 25.0))); if ((status != athr_status::DISENGAGED) && (Autothrust_DWork.pMode != athr_mode::A_FLOOR) && (Autothrust_DWork.pMode - != athr_mode::TOGA_LK) && (rtb_on_ground == 0) && (condition_TOGA || (Autothrust_U.in.input.is_TCAS_active && + != athr_mode::TOGA_LK) && (rtb_on_ground == 0) && (rtb_r_he || (Autothrust_U.in.input.is_TCAS_active && (Autothrust_U.in.data.H_ind_ft < Autothrust_U.in.input.thrust_reduction_altitude) && ((Autothrust_U.in.data.V_ias_kn > Autothrust_U.in.input.V_MAX_kn - 20.0) || (Autothrust_U.in.input.target_TCAS_RA_rate_fpm <= 500.0)))) && Autothrust_U.in.data.is_engine_operative_1 && @@ -1124,9 +1118,9 @@ void Autothrust::step() (Autothrust_U.in.input.TLA_2_deg > 25.0))) { Autothrust_Y.out.output.mode_message = athr_mode_message::LVR_CLB; } else if ((status != athr_status::DISENGAGED) && (Autothrust_DWork.pMode != athr_mode::A_FLOOR) && - (Autothrust_DWork.pMode != athr_mode::TOGA_LK) && (rtb_on_ground == 0) && condition_TOGA && - (condition_AP_FD_ATHR_Specific || condition_AlphaFloor_tmp) && (Autothrust_U.in.input.TLA_1_deg != 35.0) && - (Autothrust_U.in.input.TLA_2_deg != 35.0)) { + (Autothrust_DWork.pMode != athr_mode::TOGA_LK) && (rtb_on_ground == 0) && rtb_r_he && (rtb_r_g_tmp || + ATHR_ENGAGED_tmp) && (Autothrust_U.in.input.TLA_1_deg != 35.0) && (Autothrust_U.in.input.TLA_2_deg != 35.0)) + { Autothrust_Y.out.output.mode_message = athr_mode_message::LVR_MCT; } else if ((status == athr_status::ENGAGED_ACTIVE) && Autothrust_U.in.data.is_engine_operative_1 && Autothrust_U.in.data.is_engine_operative_2 && (((Autothrust_U.in.input.TLA_1_deg == 25.0) && @@ -1139,9 +1133,10 @@ void Autothrust::step() Autothrust_Y.out.output.mode_message = athr_mode_message::NONE; } - Autothrust_Y.out.output.thrust_lever_warning_flex = (rtb_BusAssignment_n.data_computed.is_FLX_active && condition02); + Autothrust_Y.out.output.thrust_lever_warning_flex = (rtb_BusAssignment_n.data_computed.is_FLX_active && + condition_AP_FD_ATHR_Specific); Autothrust_Y.out.output.thrust_lever_warning_toga = ((!rtb_BusAssignment_n.data_computed.is_FLX_active) && - ((Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime >= 3.0) || condition02)); + ((Autothrust_U.in.time.simulation_time - Autothrust_DWork.eventTime >= 3.0) || condition_AP_FD_ATHR_Specific)); Autothrust_DWork.Delay_DSTATE_as = rtb_Compare; Autothrust_DWork.Delay_DSTATE = rtb_Gain_m; Autothrust_DWork.icLoad = false; @@ -1179,6 +1174,4 @@ Autothrust::Autothrust(): { } -Autothrust::~Autothrust() -{ -} +Autothrust::~Autothrust() = default; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.h b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.h index eb9436715a4..f79c3b0b1f4 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_Autothrust_h_ -#define RTW_HEADER_Autothrust_h_ +#ifndef Autothrust_h_ +#define Autothrust_h_ #include "rtwtypes.h" #include "Autothrust_types.h" @@ -49,12 +49,12 @@ class Autothrust final real_T Delay_DSTATE_p; real_T eventTime; real_T eventTime_j; - real_T eventTime_j1; - real_T eventTime_o; - real_T eventTime_m; + real_T eventTime_c; + real_T eventTime_p; + real_T eventTime_f; real_T pY; - real_T eventTime_oa; - real_T eventTime_jx; + real_T eventTime_b; + real_T eventTime_l; athr_mode pMode; athr_status pStatus; boolean_T Delay_DSTATE_as; @@ -64,28 +64,28 @@ class Autothrust final boolean_T Memory_PreviousInput_m; boolean_T icLoad; boolean_T eventTime_not_empty; - boolean_T eventTime_not_empty_j; + boolean_T eventTime_not_empty_g; boolean_T ATHR_ENGAGED; boolean_T prev_condition_AlphaFloor; boolean_T prev_condition_TCAS; boolean_T prev_SRS_TO_GA_mode_active; boolean_T condition_TOGA_latch; - boolean_T eventTime_not_empty_a; - boolean_T eventTime_not_empty_b; + boolean_T eventTime_not_empty_l; + boolean_T eventTime_not_empty_f; boolean_T pConditionAlphaFloor; boolean_T was_SRS_TO_active; boolean_T was_SRS_GA_active; boolean_T inhibitAboveThrustReductionAltitude; boolean_T condition_THR_LK; - boolean_T eventTime_not_empty_ac; + boolean_T eventTime_not_empty_a; boolean_T pThrustMemoActive; boolean_T pUseAutoThrustControl; boolean_T pY_not_empty; boolean_T latch; boolean_T sInhibit; boolean_T prev_TCAS_active; - boolean_T eventTime_not_empty_p; - boolean_T eventTime_not_empty_c; + boolean_T eventTime_not_empty_o; + boolean_T eventTime_not_empty_d; rtDW_WashoutFilter_Autothrust_T sf_WashoutFilter_h; rtDW_LagFilter_Autothrust_T sf_LagFilter_a; rtDW_LagFilter_Autothrust_T sf_LagFilter; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_private.h index ce3b3a5bdb8..059f3cf2616 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_private.h @@ -1,5 +1,6 @@ -#ifndef RTW_HEADER_Autothrust_private_h_ -#define RTW_HEADER_Autothrust_private_h_ +#ifndef Autothrust_private_h_ +#define Autothrust_private_h_ #include "rtwtypes.h" +#include "Autothrust_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_types.h index 48a56d25ae8..e9e132df048 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Autothrust_types.h @@ -1,7 +1,6 @@ -#ifndef RTW_HEADER_Autothrust_types_h_ -#define RTW_HEADER_Autothrust_types_h_ +#ifndef Autothrust_types_h_ +#define Autothrust_types_h_ #include "rtwtypes.h" - #ifndef DEFINED_TYPEDEF_FOR_athr_mode_ #define DEFINED_TYPEDEF_FOR_athr_mode_ diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.cpp index f59eceaf0ac..937d2afd25c 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.cpp @@ -1,28 +1,26 @@ -#include "rtwtypes.h" -#include -#include #include "Double2MultiWord.h" +#include +#include "rtwtypes.h" void Double2MultiWord(real_T u1, uint32_T y[], int32_T n) { real_T yn; int32_T currExp; - int32_T i; int32_T msl; int32_T prevExp; uint32_T cb; boolean_T isNegative; isNegative = (u1 < 0.0); - yn = frexp(u1, &currExp); + yn = std::frexp(u1, &currExp); msl = currExp <= 0 ? -1 : (currExp - 1) / 32; cb = 1U; - for (i = msl + 1; i < n; i++) { + for (int32_T i{msl + 1}; i < n; i++) { y[i] = 0U; } yn = isNegative ? -yn : yn; - prevExp = 32 * msl; - for (i = msl; i >= 0; i--) { + prevExp = msl << 5; + for (int32_T i{msl}; i >= 0; i--) { real_T yd; yn = std::ldexp(yn, currExp - prevExp); yd = std::floor(yn); @@ -36,7 +34,7 @@ void Double2MultiWord(real_T u1, uint32_T y[], int32_T n) } if (isNegative) { - for (i = 0; i < n; i++) { + for (int32_T i{0}; i < n; i++) { uint32_T u1i; u1i = ~y[i]; cb += u1i; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.h b/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.h index b5bf79e9921..f0643b1d109 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/Double2MultiWord.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_Double2MultiWord_h_ -#define RTW_HEADER_Double2MultiWord_h_ +#ifndef Double2MultiWord_h_ +#define Double2MultiWord_h_ #include "rtwtypes.h" extern void Double2MultiWord(real_T u1, uint32_T y[], int32_T n); diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.cpp index 765cf3d35cd..664feb47693 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.cpp @@ -21,7 +21,7 @@ void FacComputer::FacComputer_MATLABFunction(const base_arinc_429 *rtu_u, boolea *rty_y = (rtu_u->SSM != static_cast(SignStatusMatrix::FailureWarning)); } -void FacComputer::FacComputer_MATLABFunction_f(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y) +void FacComputer::FacComputer_MATLABFunction_g(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y) { real32_T tmp; uint32_T a; @@ -76,26 +76,6 @@ void FacComputer::FacComputer_LagFilter(real_T rtu_U, real_T rtu_C1, real_T rtu_ localDW->pU = rtu_U; } -void FacComputer::FacComputer_MATLABFunction_d(boolean_T rtu_bit1, boolean_T rtu_bit2, boolean_T rtu_bit3, boolean_T - rtu_bit4, boolean_T rtu_bit5, boolean_T rtu_bit6, real_T *rty_handleIndex) -{ - if (rtu_bit1) { - *rty_handleIndex = 0.0; - } else if (rtu_bit2 && rtu_bit6) { - *rty_handleIndex = 1.0; - } else if (rtu_bit2 && (!rtu_bit6)) { - *rty_handleIndex = 2.0; - } else if (rtu_bit3) { - *rty_handleIndex = 3.0; - } else if (rtu_bit4) { - *rty_handleIndex = 4.0; - } else if (rtu_bit5) { - *rty_handleIndex = 5.0; - } else { - *rty_handleIndex = 0.0; - } -} - void FacComputer::FacComputer_RateLimiter_Reset(rtDW_RateLimiter_FacComputer_T *localDW) { localDW->pY_not_empty = false; @@ -229,7 +209,7 @@ void FacComputer::FacComputer_MATLABFunction_p(boolean_T rtu_u, real_T rtu_Ts, b *rty_y = localDW->output; } -void FacComputer::FacComputer_MATLABFunction_g(const boolean_T rtu_u[19], real32_T *rty_y) +void FacComputer::FacComputer_MATLABFunction_g3(const boolean_T rtu_u[19], real32_T *rty_y) { uint32_T out; out = 0U; @@ -242,109 +222,110 @@ void FacComputer::FacComputer_MATLABFunction_g(const boolean_T rtu_u[19], real32 void FacComputer::step() { - real_T rtb_Switch1_a; + real_T Vcas; + real_T rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg; + real_T rtb_BusAssignment_dj_flight_envelope_v_stall_warn_kn; + real_T rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn; + real_T rtb_BusAssignment_f_flight_envelope_v_fe_next_kn; + real_T rtb_BusAssignment_g5_flight_envelope_v_stall_kn; + real_T rtb_Gain; + real_T rtb_Gain_n; + real_T rtb_Switch; + real_T rtb_Switch1; real_T rtb_Switch4_f; - real_T rtb_Y_d; - real_T rtb_Y_f; - real_T rtb_Y_i; - real32_T rtb_y_b4; - real32_T rtb_y_d; - real32_T rtb_y_f; - real32_T rtb_y_h; - real32_T rtb_y_hz; - uint32_T rtb_y_b; - uint32_T rtb_y_bm; - uint32_T rtb_y_c; - uint32_T rtb_y_k; - uint32_T rtb_y_la; - uint32_T rtb_y_p; - uint32_T rtb_y_pj; + real_T rtb_Switch4_j; + real_T rtb_Switch_b; + real_T rtb_Switch_o; + real_T rtb_Y_br; + real_T rtb_Y_g4; + real_T rtb_Y_l; + real_T rtb_beta; + real_T rtb_v_gd; + real_T u0; + int32_T rtb_alpha_floor_inhib; + int32_T rtb_speed_trend_kn_SSM; + int32_T rtb_v_3_kn_SSM; + int32_T rtb_v_4_kn_SSM; + int32_T rtb_v_alpha_prot_kn_SSM; + int32_T rtb_v_ls_kn_SSM; + int32_T rtb_v_man_kn_SSM; + int32_T rtb_v_stall_kn_SSM; + int32_T rtb_v_stall_warn_kn_SSM; + real32_T rtb_DataTypeConversion2; + real32_T rtb_Switch_i_idx_0; + real32_T rtb_Switch_i_idx_1; + real32_T rtb_Switch_i_idx_2; + real32_T rtb_Switch_i_idx_3; + real32_T rtb_V_ias; + real32_T rtb_V_tas; + real32_T rtb_alpha; + real32_T rtb_alt; + real32_T rtb_mach; + real32_T rtb_n_x; + real32_T rtb_n_y; + real32_T rtb_n_z; + real32_T rtb_p_s_c; + real32_T rtb_phi; + real32_T rtb_phi_dot; + real32_T rtb_q; + real32_T rtb_r; + real32_T rtb_theta; + real32_T rtb_theta_dot; + real32_T rtb_y_hb; + real32_T rtb_y_na; + uint32_T rtb_y_a; + uint32_T rtb_y_dq; + uint32_T rtb_y_e; + uint32_T rtb_y_ey; + uint32_T rtb_y_fn; + uint32_T rtb_y_l5; + uint32_T rtb_y_n; boolean_T rtb_VectorConcatenate[19]; + boolean_T rtb_VectorConcatenate_i[19]; + boolean_T guard1; + boolean_T rtb_AND; + boolean_T rtb_AND1; + boolean_T rtb_AND1_d; + boolean_T rtb_AND1_f; + boolean_T rtb_BusAssignment_f_flight_envelope_v_4_visible; + boolean_T rtb_BusAssignment_h_logic_on_ground; + boolean_T rtb_BusAssignment_h_logic_speed_scale_visible; + boolean_T rtb_BusAssignment_logic_lgciu_own_valid; + boolean_T rtb_BusAssignment_m_logic_sfcc_own_valid; + boolean_T rtb_DataTypeConversion_f5; + boolean_T rtb_DataTypeConversion_gi; boolean_T rtb_DataTypeConversion_kr; + boolean_T rtb_DataTypeConversion_l3; + boolean_T rtb_DataTypeConversion_l5; + boolean_T rtb_DataTypeConversion_o; boolean_T rtb_Memory; - boolean_T rtb_OR1; - boolean_T rtb_y_j; - boolean_T rtb_y_pg; + boolean_T rtb_Switch_io_idx_1; + boolean_T rtb_Switch_io_idx_2; + boolean_T rtb_rudderTravelLimEngaged; + boolean_T rtb_rudderTrimEngaged; + boolean_T rtb_y_gg; + boolean_T rtb_y_h; + boolean_T rtb_y_k5; + boolean_T rtb_yawDamperEngaged; + boolean_T rudderTravelLimCanEngage; + boolean_T rudderTravelLimHasPriority; + boolean_T rudderTrimCanEngage; + boolean_T rudderTrimHasPriority; + boolean_T yawDamperCanEngage; + boolean_T yawDamperHasPriority; if (FacComputer_U.in.sim_data.computer_running) { - real_T rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg; - real_T rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn; - real_T rtb_BusAssignment_f_flight_envelope_v_fe_next_kn; - real_T rtb_BusAssignment_g5_flight_envelope_v_3_kn; - real_T rtb_BusAssignment_g5_flight_envelope_v_stall_kn; - real_T rtb_BusAssignment_kv_flight_envelope_v_stall_warn_kn; - real_T rtb_Gain_a; - real_T rtb_Gain_f; - real_T rtb_Switch; - real_T rtb_Switch4_a_0; - real_T rtb_beDot; - real_T rtb_v_gd; - real_T rtb_y_f5; - real_T u0; - real_T y_value; - int32_T rtb_Switch4_a; - int32_T rtb_alpha_floor_inhib; - int32_T rtb_speed_trend_kn_SSM; - int32_T rtb_v_3_kn_SSM; - int32_T rtb_v_4_kn_SSM; - int32_T rtb_v_alpha_prot_kn_SSM; - int32_T rtb_v_ls_kn_SSM; - int32_T rtb_v_man_kn_SSM; - int32_T rtb_v_stall_kn_SSM; - int32_T rtb_v_stall_warn_kn_SSM; - real32_T rtb_DataTypeConversion2; - real32_T rtb_V_ias; - real32_T rtb_V_tas; - real32_T rtb_alpha; - real32_T rtb_alt; - real32_T rtb_mach; - real32_T rtb_n_x; - real32_T rtb_n_y; - real32_T rtb_n_z; - real32_T rtb_p_s_c; - real32_T rtb_phi; - real32_T rtb_phi_dot; - real32_T rtb_q; - real32_T rtb_r; - real32_T rtb_theta; - real32_T rtb_theta_dot; - boolean_T guard1{ false }; - - boolean_T rtb_AND1; - boolean_T rtb_BusAssignment_h_logic_on_ground; - boolean_T rtb_BusAssignment_h_logic_speed_scale_visible; - boolean_T rtb_BusAssignment_m_logic_lgciu_own_valid; - boolean_T rtb_DataTypeConversion_e0; - boolean_T rtb_DataTypeConversion_he; - boolean_T rtb_DataTypeConversion_jc; - boolean_T rtb_DataTypeConversion_ml; - boolean_T rtb_Switch_i_idx_1; - boolean_T rtb_Switch_i_idx_2; - boolean_T rtb_adr3Invalid; - boolean_T rtb_adrOppInvalid; - boolean_T rtb_adrOwnInvalid; - boolean_T rtb_ir3Invalid; - boolean_T rtb_irOppInvalid; - boolean_T rtb_irOwnInvalid; - boolean_T rtb_rudderTravelLimEngaged; - boolean_T rtb_rudderTrimEngaged; - boolean_T rtb_yawDamperEngaged; - boolean_T rudderTravelLimCanEngage; - boolean_T rudderTrimCanEngage; - boolean_T rudderTrimHasPriority; - boolean_T yawDamperCanEngage; - boolean_T yawDamperHasPriority; - boolean_T yawDamperHasPriority_tmp; if (!FacComputer_DWork.Runtime_MODE) { FacComputer_DWork.Delay_DSTATE = FacComputer_P.DiscreteDerivativeVariableTs_InitialCondition; FacComputer_DWork.Delay_DSTATE_d = FacComputer_P.DiscreteDerivativeVariableTs_InitialCondition_l; FacComputer_DWork.Memory_PreviousInput = FacComputer_P.SRFlipFlop_initial_condition; FacComputer_DWork.icLoad = true; - FacComputer_MATLABFunction_i_Reset(&FacComputer_DWork.sf_MATLABFunction_ax); - FacComputer_MATLABFunction_i_Reset(&FacComputer_DWork.sf_MATLABFunction_p4); - FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter_b); + FacComputer_MATLABFunction_i_Reset(&FacComputer_DWork.sf_MATLABFunction_a); + FacComputer_MATLABFunction_i_Reset(&FacComputer_DWork.sf_MATLABFunction_jf); + FacComputer_MATLABFunction_i_Reset(&FacComputer_DWork.sf_MATLABFunction_p); + FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter_d); FacComputer_LagFilter_n_Reset(&FacComputer_DWork.sf_LagFilter_k); FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter_f); - FacComputer_LagFilter_n_Reset(&FacComputer_DWork.sf_LagFilter_d); + FacComputer_LagFilter_n_Reset(&FacComputer_DWork.sf_LagFilter_d5); FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter_c); FacComputer_RateLimiter_Reset(&FacComputer_DWork.sf_RateLimiter); FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter); @@ -361,7 +342,7 @@ void FacComputer::step() FacComputer_LagFilter_Reset(&FacComputer_DWork.sf_LagFilter_i); FacComputer_RateLimiter_o_Reset(&FacComputer_DWork.sf_RateLimiter_f); FacComputer_DWork.previousInput_not_empty = false; - FacComputer_RateLimiter_ot_Reset(&FacComputer_DWork.sf_RateLimiter_b); + FacComputer_RateLimiter_ot_Reset(&FacComputer_DWork.sf_RateLimiter_l); FacComputer_DWork.pY_not_empty = false; FacComputer_DWork.pU_not_empty = false; FacComputer_RateLimiter_ot_Reset(&FacComputer_DWork.sf_RateLimiter_fu); @@ -369,77 +350,162 @@ void FacComputer::step() FacComputer_DWork.Runtime_MODE = true; } - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, - FacComputer_P.BitfromLabel1_bit, &rtb_y_c); - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, &rtb_y_j); - rtb_AND1 = ((rtb_y_c != 0U) && rtb_y_j); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, - FacComputer_P.BitfromLabel4_bit, &rtb_y_bm); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, - FacComputer_P.BitfromLabel3_bit, &rtb_y_la); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, - FacComputer_P.BitfromLabel2_bit, &rtb_y_c); - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_1, &rtb_DataTypeConversion_kr); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, - FacComputer_P.BitfromLabel_bit, &rtb_y_pj); - FacComputer_MATLABFunction_p(FacComputer_U.in.discrete_inputs.nose_gear_pressed == (rtb_y_pj != 0U), - FacComputer_U.in.time.dt, FacComputer_P.ConfirmNode_isRisingEdge, FacComputer_P.ConfirmNode_timeDelay, &rtb_OR1, - &FacComputer_DWork.sf_MATLABFunction_ax); - rtb_Memory = (rtb_DataTypeConversion_kr && rtb_OR1); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, - FacComputer_P.BitfromLabel5_bit, &rtb_y_pj); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, - FacComputer_P.BitfromLabel6_bit, &rtb_y_k); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_3, - FacComputer_P.BitfromLabel7_bit, &rtb_y_p); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_3, - FacComputer_P.BitfromLabel8_bit, &rtb_y_b); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_1, &rtb_y_k5); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, + FacComputer_P.BitfromLabel_bit, &rtb_y_a); + FacComputer_MATLABFunction_p((FacComputer_U.in.discrete_inputs.nose_gear_pressed == (rtb_y_a != 0U)), + FacComputer_U.in.time.dt, FacComputer_P.ConfirmNode_isRisingEdge, FacComputer_P.ConfirmNode_timeDelay, &rtb_y_gg, + &FacComputer_DWork.sf_MATLABFunction_a); + rtb_Memory = (rtb_y_k5 && rtb_y_gg); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, + FacComputer_P.BitfromLabel5_bit, &rtb_y_ey); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_2, + FacComputer_P.BitfromLabel6_bit, &rtb_y_l5); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_3, + FacComputer_P.BitfromLabel7_bit, &rtb_y_fn); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.lgciu_own_bus.discrete_word_3, + FacComputer_P.BitfromLabel8_bit, &rtb_y_dq); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel1_bit, &rtb_y_a); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, &rtb_y_k5); + rtb_AND1 = ((rtb_y_a != 0U) && rtb_y_k5); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel4_bit, &rtb_y_n); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel3_bit, &rtb_y_e); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel2_bit, &rtb_y_a); if (rtb_Memory) { - rtb_y_j = (rtb_y_pj != 0U); - rtb_Switch_i_idx_1 = (rtb_y_k != 0U); - rtb_Switch_i_idx_2 = ((rtb_y_p != 0U) || (rtb_y_b != 0U)); + rtb_y_k5 = (rtb_y_ey != 0U); + rtb_Switch_io_idx_1 = (rtb_y_l5 != 0U); + rtb_Switch_io_idx_2 = ((rtb_y_fn != 0U) || (rtb_y_dq != 0U)); } else if (rtb_AND1) { - rtb_y_j = (rtb_y_bm != 0U); - rtb_Switch_i_idx_1 = (rtb_y_la != 0U); - rtb_Switch_i_idx_2 = (rtb_y_c != 0U); + rtb_y_k5 = (rtb_y_n != 0U); + rtb_Switch_io_idx_1 = (rtb_y_e != 0U); + rtb_Switch_io_idx_2 = (rtb_y_a != 0U); + } else { + rtb_y_k5 = FacComputer_P.Constant_Value_c; + rtb_Switch_io_idx_1 = FacComputer_P.Constant_Value_c; + rtb_Switch_io_idx_2 = FacComputer_P.Constant_Value_c; + } + + rtb_BusAssignment_logic_lgciu_own_valid = rtb_Memory; + rtb_AND1 = ((!rtb_Memory) && (!rtb_AND1)); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel1_bit_d, &rtb_y_a); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, &rtb_y_gg); + rtb_AND1_d = ((rtb_y_a != 0U) && rtb_y_gg); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel8_bit_i, &rtb_y_ey); + rtb_DataTypeConversion_gi = (rtb_y_ey != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel9_bit, &rtb_y_l5); + rtb_DataTypeConversion_l5 = (rtb_y_l5 != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel10_bit, &rtb_y_fn); + rtb_DataTypeConversion_o = (rtb_y_fn != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel11_bit, &rtb_y_dq); + rtb_DataTypeConversion_f5 = (rtb_y_dq != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_5, + FacComputer_P.BitfromLabel12_bit, &rtb_y_a); + rtb_DataTypeConversion_l3 = (rtb_y_a != 0U); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, &rtb_Memory); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_actual_position_word, + FacComputer_P.BitfromLabel_bit_m, &rtb_y_a); + FacComputer_MATLABFunction_p((FacComputer_U.in.discrete_inputs.slats_extended != (rtb_y_a != 0U)), + FacComputer_U.in.time.dt, FacComputer_P.ConfirmNode_isRisingEdge_a, FacComputer_P.ConfirmNode_timeDelay_m, + &rtb_y_gg, &FacComputer_DWork.sf_MATLABFunction_jf); + rtb_DataTypeConversion_kr = (rtb_Memory && rtb_y_gg); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel2_bit_n, &rtb_y_a); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel3_bit_i, &rtb_y_dq); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel4_bit_p, &rtb_y_fn); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel5_bit_g, &rtb_y_n); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel6_bit_n, &rtb_y_ey); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, + FacComputer_P.BitfromLabel7_bit_p, &rtb_y_l5); + if (rtb_DataTypeConversion_kr) { + if (rtb_y_a != 0U) { + rtb_Switch_i_idx_0 = 0.0F; + } else if ((rtb_y_dq != 0U) && (rtb_y_l5 != 0U)) { + rtb_Switch_i_idx_0 = 1.0F; + } else if ((rtb_y_dq != 0U) && (rtb_y_l5 == 0U)) { + rtb_Switch_i_idx_0 = 2.0F; + } else if (rtb_y_fn != 0U) { + rtb_Switch_i_idx_0 = 3.0F; + } else if (rtb_y_n != 0U) { + rtb_Switch_i_idx_0 = 4.0F; + } else if (rtb_y_ey != 0U) { + rtb_Switch_i_idx_0 = 5.0F; + } else { + rtb_Switch_i_idx_0 = 0.0F; + } + + rtb_Switch_i_idx_1 = FacComputer_U.in.bus_inputs.sfcc_own_bus.flap_actual_position_deg.Data; + rtb_Switch_i_idx_2 = FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_actual_position_deg.Data; + rtb_Switch_i_idx_3 = FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_actual_position_word.Data; + } else if (rtb_AND1_d) { + if (rtb_DataTypeConversion_gi) { + rtb_Switch_i_idx_0 = 1.0F; + } else if (rtb_DataTypeConversion_l5) { + rtb_Switch_i_idx_0 = 2.0F; + } else if (rtb_DataTypeConversion_o) { + rtb_Switch_i_idx_0 = 3.0F; + } else if (rtb_DataTypeConversion_f5) { + rtb_Switch_i_idx_0 = 4.0F; + } else if (rtb_DataTypeConversion_l3) { + rtb_Switch_i_idx_0 = 5.0F; + } else { + rtb_Switch_i_idx_0 = 0.0F; + } + + rtb_Switch_i_idx_1 = FacComputer_U.in.bus_inputs.fac_opp_bus.fac_flap_angle_deg.Data; + rtb_Switch_i_idx_2 = FacComputer_U.in.bus_inputs.fac_opp_bus.fac_slat_angle_deg.Data; + rtb_Switch_i_idx_3 = FacComputer_U.in.bus_inputs.fac_opp_bus.discrete_word_1.Data; + } else if (rtb_Switch_io_idx_2) { + rtb_Switch_i_idx_0 = FacComputer_P.Constant2_Value_k; + rtb_Switch_i_idx_1 = FacComputer_P.Constant3_Value_d; + rtb_Switch_i_idx_2 = FacComputer_P.Constant6_Value; + rtb_Switch_i_idx_3 = FacComputer_P.Constant4_Value_j; } else { - rtb_y_j = FacComputer_P.Constant_Value_c; - rtb_Switch_i_idx_1 = FacComputer_P.Constant_Value_c; - rtb_Switch_i_idx_2 = FacComputer_P.Constant_Value_c; + rtb_Switch_i_idx_0 = FacComputer_P.Constant1_Value_c; + rtb_Switch_i_idx_1 = FacComputer_P.Constant1_Value_c; + rtb_Switch_i_idx_2 = FacComputer_P.Constant1_Value_c; + rtb_Switch_i_idx_3 = FacComputer_P.Constant1_Value_c; } - rtb_adrOwnInvalid = ((FacComputer_U.in.bus_inputs.adr_own_bus.airspeed_computed_kn.SSM == static_cast - (SignStatusMatrix::FailureWarning)) || - (FacComputer_U.in.bus_inputs.adr_own_bus.aoa_corrected_deg.SSM == static_cast - (SignStatusMatrix::FailureWarning))); - rtb_adrOppInvalid = ((FacComputer_U.in.bus_inputs.adr_opp_bus.airspeed_computed_kn.SSM == static_cast - (SignStatusMatrix::FailureWarning)) || - (FacComputer_U.in.bus_inputs.adr_opp_bus.aoa_corrected_deg.SSM == static_cast - (SignStatusMatrix::FailureWarning))); - rtb_adr3Invalid = ((FacComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.SSM == static_cast - (SignStatusMatrix::FailureWarning)) || - (FacComputer_U.in.bus_inputs.adr_3_bus.aoa_corrected_deg.SSM == static_cast - (SignStatusMatrix::FailureWarning))); - rtb_irOwnInvalid = ((FacComputer_U.in.bus_inputs.ir_own_bus.body_yaw_rate_deg_s.SSM != static_cast - (SignStatusMatrix::NormalOperation)) || - (FacComputer_U.in.bus_inputs.ir_own_bus.body_lat_accel_g.SSM != static_cast - (SignStatusMatrix::NormalOperation))); - rtb_irOppInvalid = ((FacComputer_U.in.bus_inputs.ir_opp_bus.body_yaw_rate_deg_s.SSM != static_cast - (SignStatusMatrix::NormalOperation)) || - (FacComputer_U.in.bus_inputs.ir_opp_bus.body_lat_accel_g.SSM != static_cast - (SignStatusMatrix::NormalOperation))); - rtb_ir3Invalid = ((FacComputer_U.in.bus_inputs.ir_3_bus.body_yaw_rate_deg_s.SSM != static_cast - (SignStatusMatrix::NormalOperation)) || - (FacComputer_U.in.bus_inputs.ir_3_bus.body_lat_accel_g.SSM != static_cast - (SignStatusMatrix::NormalOperation))); - if (!rtb_adrOwnInvalid) { + rtb_Memory = ((FacComputer_U.in.bus_inputs.adr_own_bus.airspeed_computed_kn.SSM == static_cast + (SignStatusMatrix::FailureWarning)) || (FacComputer_U.in.bus_inputs.adr_own_bus.aoa_corrected_deg.SSM + == static_cast(SignStatusMatrix::FailureWarning))); + rtb_DataTypeConversion_gi = ((FacComputer_U.in.bus_inputs.adr_opp_bus.airspeed_computed_kn.SSM == + static_cast(SignStatusMatrix::FailureWarning)) || + (FacComputer_U.in.bus_inputs.adr_opp_bus.aoa_corrected_deg.SSM == static_cast(SignStatusMatrix:: + FailureWarning))); + rtb_DataTypeConversion_l5 = ((FacComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.SSM == static_cast + (SignStatusMatrix::FailureWarning)) || (FacComputer_U.in.bus_inputs.adr_3_bus.aoa_corrected_deg.SSM == + static_cast(SignStatusMatrix::FailureWarning))); + rtb_DataTypeConversion_o = ((FacComputer_U.in.bus_inputs.ir_own_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || (FacComputer_U.in.bus_inputs.ir_own_bus.body_lat_accel_g.SSM != + static_cast(SignStatusMatrix::NormalOperation))); + rtb_DataTypeConversion_f5 = ((FacComputer_U.in.bus_inputs.ir_opp_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || (FacComputer_U.in.bus_inputs.ir_opp_bus.body_lat_accel_g.SSM != + static_cast(SignStatusMatrix::NormalOperation))); + rtb_DataTypeConversion_l3 = ((FacComputer_U.in.bus_inputs.ir_3_bus.body_yaw_rate_deg_s.SSM != static_cast + (SignStatusMatrix::NormalOperation)) || (FacComputer_U.in.bus_inputs.ir_3_bus.body_lat_accel_g.SSM != static_cast< + uint32_T>(SignStatusMatrix::NormalOperation))); + if (!rtb_Memory) { rtb_V_ias = FacComputer_U.in.bus_inputs.adr_own_bus.airspeed_computed_kn.Data; rtb_V_tas = FacComputer_U.in.bus_inputs.adr_own_bus.airspeed_true_kn.Data; rtb_mach = FacComputer_U.in.bus_inputs.adr_own_bus.mach.Data; rtb_alpha = FacComputer_U.in.bus_inputs.adr_own_bus.aoa_corrected_deg.Data; rtb_p_s_c = FacComputer_U.in.bus_inputs.adr_own_bus.corrected_average_static_pressure.Data; rtb_alt = FacComputer_U.in.bus_inputs.adr_own_bus.altitude_corrected_ft.Data; - } else if (!rtb_adr3Invalid) { + } else if (!rtb_DataTypeConversion_l5) { rtb_V_ias = FacComputer_U.in.bus_inputs.adr_3_bus.airspeed_computed_kn.Data; rtb_V_tas = FacComputer_U.in.bus_inputs.adr_3_bus.airspeed_true_kn.Data; rtb_mach = FacComputer_U.in.bus_inputs.adr_3_bus.mach.Data; @@ -455,7 +521,7 @@ void FacComputer::step() rtb_alt = 0.0F; } - if (!rtb_irOwnInvalid) { + if (!rtb_DataTypeConversion_o) { rtb_theta = FacComputer_U.in.bus_inputs.ir_own_bus.pitch_angle_deg.Data; rtb_phi = FacComputer_U.in.bus_inputs.ir_own_bus.roll_angle_deg.Data; rtb_q = FacComputer_U.in.bus_inputs.ir_own_bus.body_pitch_rate_deg_s.Data; @@ -465,7 +531,7 @@ void FacComputer::step() rtb_n_z = FacComputer_U.in.bus_inputs.ir_own_bus.body_normal_accel_g.Data; rtb_theta_dot = FacComputer_U.in.bus_inputs.ir_own_bus.pitch_att_rate_deg_s.Data; rtb_phi_dot = FacComputer_U.in.bus_inputs.ir_own_bus.roll_att_rate_deg_s.Data; - } else if (!rtb_ir3Invalid) { + } else if (!rtb_DataTypeConversion_l3) { rtb_theta = FacComputer_U.in.bus_inputs.ir_3_bus.pitch_angle_deg.Data; rtb_phi = FacComputer_U.in.bus_inputs.ir_3_bus.roll_angle_deg.Data; rtb_q = FacComputer_U.in.bus_inputs.ir_3_bus.body_pitch_rate_deg_s.Data; @@ -487,128 +553,95 @@ void FacComputer::step() rtb_phi_dot = 0.0F; } - rtb_Y_f = rtb_theta; - rtb_Y_i = rtb_phi; - rtb_Switch1_a = rtb_theta_dot; - rtb_BusAssignment_m_logic_lgciu_own_valid = rtb_Memory; - rtb_AND1 = ((!rtb_Memory) && (!rtb_AND1)); - rtb_DataTypeConversion_kr = (rtb_y_j || rtb_Switch_i_idx_1); + rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn = rtb_phi; + rtb_Switch1 = rtb_theta_dot; + rtb_BusAssignment_m_logic_sfcc_own_valid = rtb_DataTypeConversion_kr; + rtb_AND1_d = ((!rtb_DataTypeConversion_kr) && (!rtb_AND1_d)); + rtb_DataTypeConversion_kr = (rtb_y_k5 || rtb_Switch_io_idx_1); yawDamperCanEngage = (FacComputer_U.in.discrete_inputs.yaw_damper_has_hyd_press && FacComputer_U.in.discrete_inputs.fac_engaged_from_switch); - yawDamperHasPriority_tmp = !FacComputer_U.in.discrete_inputs.is_unit_1; - yawDamperHasPriority = (FacComputer_U.in.discrete_inputs.is_unit_1 || (yawDamperHasPriority_tmp && + rtb_y_gg = !FacComputer_U.in.discrete_inputs.is_unit_1; + yawDamperHasPriority = (FacComputer_U.in.discrete_inputs.is_unit_1 || (rtb_y_gg && (!FacComputer_U.in.discrete_inputs.yaw_damper_opp_engaged))); rtb_yawDamperEngaged = (yawDamperCanEngage && yawDamperHasPriority); rudderTrimCanEngage = (FacComputer_U.in.discrete_inputs.rudder_trim_actuator_healthy && FacComputer_U.in.discrete_inputs.fac_engaged_from_switch); - rudderTrimHasPriority = (FacComputer_U.in.discrete_inputs.is_unit_1 || (yawDamperHasPriority_tmp && + rudderTrimHasPriority = (FacComputer_U.in.discrete_inputs.is_unit_1 || (rtb_y_gg && (!FacComputer_U.in.discrete_inputs.rudder_trim_opp_engaged))); rtb_rudderTrimEngaged = (rudderTrimCanEngage && rudderTrimHasPriority); rudderTravelLimCanEngage = (FacComputer_U.in.discrete_inputs.rudder_travel_lim_actuator_healthy && FacComputer_U.in.discrete_inputs.fac_engaged_from_switch); - yawDamperHasPriority_tmp = (FacComputer_U.in.discrete_inputs.is_unit_1 || (yawDamperHasPriority_tmp && + rudderTravelLimHasPriority = (FacComputer_U.in.discrete_inputs.is_unit_1 || (rtb_y_gg && (!FacComputer_U.in.discrete_inputs.rudder_travel_lim_opp_engaged))); - rtb_rudderTravelLimEngaged = (rudderTravelLimCanEngage && yawDamperHasPriority_tmp); - FacComputer_MATLABFunction_p(!rtb_DataTypeConversion_kr, FacComputer_U.in.time.dt, - FacComputer_P.ConfirmNode_isRisingEdge_o, FacComputer_P.ConfirmNode_timeDelay_l, &rtb_OR1, - &FacComputer_DWork.sf_MATLABFunction_p4); + rtb_rudderTravelLimEngaged = (rudderTravelLimCanEngage && rudderTravelLimHasPriority); + rtb_AND1_f = !rtb_DataTypeConversion_kr; + FacComputer_MATLABFunction_p(rtb_AND1_f, FacComputer_U.in.time.dt, FacComputer_P.ConfirmNode_isRisingEdge_o, + FacComputer_P.ConfirmNode_timeDelay_l, &rtb_y_gg, &FacComputer_DWork.sf_MATLABFunction_p); rtb_BusAssignment_h_logic_on_ground = rtb_DataTypeConversion_kr; - rtb_BusAssignment_h_logic_speed_scale_visible = rtb_OR1; - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.elac_1_bus.rudder_pedal_position_deg, &rtb_y_pg); - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.elac_2_bus.rudder_pedal_position_deg, &rtb_Memory); - rtb_Switch4_f = std::fmax(rtb_V_tas * 0.5144, 60.0); - rtb_beDot = rtb_V_ias * 0.5144; - if (rtb_V_ias >= 60.0F) { - if (rtb_y_pg) { - rtb_y_f5 = FacComputer_U.in.bus_inputs.elac_1_bus.rudder_pedal_position_deg.Data; - } else if (rtb_Memory) { - rtb_y_f5 = FacComputer_U.in.bus_inputs.elac_2_bus.rudder_pedal_position_deg.Data; - } else { - rtb_y_f5 = FacComputer_P.Constant_Value_n; - } - - rtb_beDot = (rtb_beDot * rtb_beDot * 0.6125 * 122.0 / (70000.0 * rtb_Switch4_f) * 3.172 * - (FacComputer_P.Gain_Gain_h * rtb_y_f5) * 3.1415926535897931 / 180.0 + (rtb_phi * 3.1415926535897931 / - 180.0 * (9.81 / rtb_Switch4_f) + -(rtb_r * 3.1415926535897931 / 180.0))) * 180.0 / 3.1415926535897931; + rtb_BusAssignment_h_logic_speed_scale_visible = rtb_y_gg; + Vcas = rtb_V_ias * 0.5144; + if (rtb_V_ias >= 30.0F) { + rtb_beta = rtb_n_y * 9.81 / (Vcas * Vcas * 0.6125 * 122.0 / (70000.0 * Vcas) * -0.62 * Vcas) * 180.0 / + 3.1415926535897931; } else { - rtb_beDot = 0.0; + rtb_beta = 0.0; } - FacComputer_LagFilter(rtb_beDot, FacComputer_P.LagFilter_C1, FacComputer_U.in.time.dt, &rtb_Switch4_f, - &FacComputer_DWork.sf_LagFilter_b); + FacComputer_LagFilter(rtb_beta, FacComputer_P.LagFilter1_C1, FacComputer_U.in.time.dt, &Vcas, + &FacComputer_DWork.sf_LagFilter_d); FacComputer_LagFilter_k(FacComputer_U.in.bus_inputs.fmgc_own_bus.n1_right_percent.Data - - FacComputer_U.in.bus_inputs.fmgc_own_bus.n1_left_percent.Data, FacComputer_P.LagFilter1_C1, - FacComputer_U.in.time.dt, &rtb_y_hz, &FacComputer_DWork.sf_LagFilter_k); - if (rtb_alpha > FacComputer_P.Saturation_UpperSat) { - rtb_beDot = FacComputer_P.Saturation_UpperSat; - } else if (rtb_alpha < FacComputer_P.Saturation_LowerSat) { - rtb_beDot = FacComputer_P.Saturation_LowerSat; + FacComputer_U.in.bus_inputs.fmgc_own_bus.n1_left_percent.Data, FacComputer_P.LagFilter1_C1_d, + FacComputer_U.in.time.dt, &rtb_y_hb, &FacComputer_DWork.sf_LagFilter_k); + if (rtb_alpha > FacComputer_P.Saturation_UpperSat_a) { + u0 = FacComputer_P.Saturation_UpperSat_a; + } else if (rtb_alpha < FacComputer_P.Saturation_LowerSat_l) { + u0 = FacComputer_P.Saturation_LowerSat_l; } else { - rtb_beDot = rtb_alpha; + u0 = rtb_alpha; } - FacComputer_LagFilter(rtb_beDot, FacComputer_P.LagFilter2_C1, FacComputer_U.in.time.dt, &rtb_Switch1_a, + FacComputer_LagFilter(u0, FacComputer_P.LagFilter2_C1, FacComputer_U.in.time.dt, &rtb_Switch1, &FacComputer_DWork.sf_LagFilter_f); FacComputer_LagFilter_k(FacComputer_U.in.bus_inputs.fmgc_own_bus.n1_left_percent.Data - FacComputer_U.in.bus_inputs.fmgc_own_bus.n1_right_percent.Data, FacComputer_P.LagFilter3_C1, - FacComputer_U.in.time.dt, &rtb_y_h, &FacComputer_DWork.sf_LagFilter_d); + FacComputer_U.in.time.dt, &rtb_y_na, &FacComputer_DWork.sf_LagFilter_d5); if (rtb_V_ias > FacComputer_P.Saturation1_UpperSat_o) { - rtb_Y_d = FacComputer_P.Saturation1_UpperSat_o; + rtb_Y_g4 = FacComputer_P.Saturation1_UpperSat_o; } else if (rtb_V_ias < FacComputer_P.Saturation1_LowerSat_n) { - rtb_Y_d = FacComputer_P.Saturation1_LowerSat_n; + rtb_Y_g4 = FacComputer_P.Saturation1_LowerSat_n; } else { - rtb_Y_d = rtb_V_ias; + rtb_Y_g4 = rtb_V_ias; } - rtb_Y_d = (rtb_Switch1_a * rtb_y_h * FacComputer_P.Gain5_Gain + FacComputer_P.Gain4_Gain * rtb_y_hz) / rtb_Y_d / - rtb_Y_d * FacComputer_P.Gain_Gain_k; - rtb_beDot = rtb_Y_d; - FacComputer_LagFilter(static_cast(rtb_alpha), FacComputer_P.LagFilter_C1_f, FacComputer_U.in.time.dt, - &rtb_Y_d, &FacComputer_DWork.sf_LagFilter_c); - rtb_y_f5 = rtb_Switch4_f; - rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg = rtb_Y_d; - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_2, - FacComputer_P.BitfromLabel6_bit_m, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_2, - FacComputer_P.BitfromLabel7_bit_i, &rtb_y_c); - rtb_Memory = (rtb_OR1 || (rtb_y_c != 0U)); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel_bit_i, &rtb_y_c); - rtb_y_pg = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel1_bit_b, &rtb_y_c); - rtb_DataTypeConversion_ml = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel2_bit_d, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel3_bit_n, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel4_bit_c, &rtb_y_c); - rtb_DataTypeConversion_he = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel5_bit_g, &rtb_y_c); - FacComputer_MATLABFunction_d(rtb_y_pg, rtb_DataTypeConversion_ml, rtb_OR1, rtb_DataTypeConversion_kr, - rtb_DataTypeConversion_he, rtb_y_c != 0U, &rtb_Switch4_f); - FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), rtb_Switch4_f, + rtb_beta = (rtb_Switch1 * rtb_y_na * FacComputer_P.Gain5_Gain + FacComputer_P.Gain4_Gain * rtb_y_hb) / rtb_Y_g4 / + rtb_Y_g4 * FacComputer_P.Gain_Gain_k; + FacComputer_LagFilter(static_cast(rtb_alpha), FacComputer_P.LagFilter_C1, FacComputer_U.in.time.dt, + &rtb_Y_g4, &FacComputer_DWork.sf_LagFilter_c); + rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg = rtb_Y_g4; + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_2, + FacComputer_P.BitfromLabel6_bit_m, &rtb_y_a); + rtb_y_gg = (rtb_y_a != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_2, + FacComputer_P.BitfromLabel7_bit_i, &rtb_y_a); + rtb_DataTypeConversion_kr = (rtb_y_a != 0U); + rtb_y_gg = (rtb_y_gg || (rtb_y_a != 0U)); + FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), static_cast(rtb_Switch_i_idx_0), FacComputer_P.alphafloor_bp01Data, FacComputer_P.alphafloor_bp02Data, FacComputer_P.alphafloor_tableData, FacComputer_P.alphafloor_maxIndex, 4U), FacComputer_P.RateLimiterGenericVariableTs1_up, - FacComputer_P.RateLimiterGenericVariableTs1_lo, FacComputer_U.in.time.dt, FacComputer_P.reset_Value, - &rtb_Switch1_a, &FacComputer_DWork.sf_RateLimiter); - rtb_Gain_f = FacComputer_P.DiscreteDerivativeVariableTs_Gain * rtb_V_ias; - rtb_Y_d = rtb_Gain_f - FacComputer_DWork.Delay_DSTATE; - FacComputer_LagFilter(rtb_Y_d / FacComputer_U.in.time.dt, FacComputer_P.LagFilter_C1_k, FacComputer_U.in.time.dt, - &rtb_Y_d, &FacComputer_DWork.sf_LagFilter); - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.fmgc_own_bus.fg_radio_height_ft, &rtb_y_pg); - if (rtb_y_pg) { + FacComputer_P.RateLimiterGenericVariableTs1_lo, FacComputer_U.in.time.dt, FacComputer_P.reset_Value, &rtb_Switch1, + &FacComputer_DWork.sf_RateLimiter); + rtb_Gain = FacComputer_P.DiscreteDerivativeVariableTs_Gain * rtb_V_ias; + rtb_Y_g4 = rtb_Gain - FacComputer_DWork.Delay_DSTATE; + FacComputer_LagFilter(rtb_Y_g4 / FacComputer_U.in.time.dt, FacComputer_P.LagFilter_C1_k, FacComputer_U.in.time.dt, + &rtb_Y_g4, &FacComputer_DWork.sf_LagFilter); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.fmgc_own_bus.fg_radio_height_ft, &rtb_DataTypeConversion_kr); + if (rtb_DataTypeConversion_kr) { rtb_Switch = FacComputer_U.in.bus_inputs.fmgc_own_bus.fg_radio_height_ft.Data; } else { rtb_Switch = FacComputer_P.Constant_Value; } - if (FacComputer_DWork.is_active_c15_FacComputer == 0U) { + if (FacComputer_DWork.is_active_c15_FacComputer == 0) { FacComputer_DWork.is_active_c15_FacComputer = 1U; FacComputer_DWork.is_c15_FacComputer = FacComputer_IN_Landed; rtb_alpha_floor_inhib = 1; @@ -627,7 +660,7 @@ void FacComputer::step() break; case FacComputer_IN_Landed: - if (!rtb_BusAssignment_h_logic_on_ground) { + if (rtb_AND1_f) { FacComputer_DWork.is_c15_FacComputer = FacComputer_IN_Takeoff100ft; rtb_alpha_floor_inhib = 0; } else { @@ -663,23 +696,24 @@ void FacComputer::step() FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, &rtb_DataTypeConversion_kr); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel9_bit, &rtb_y_c); - rtb_DataTypeConversion_ml = ((rtb_y_c != 0U) && rtb_DataTypeConversion_kr); - FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, &rtb_y_pg); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel8_bit_i, &rtb_y_c); - rtb_y_pg = (rtb_DataTypeConversion_ml || ((rtb_y_c != 0U) && rtb_y_pg)); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel9_bit_l, &rtb_y_a); + rtb_AND1_f = ((rtb_y_a != 0U) && rtb_DataTypeConversion_kr); + FacComputer_MATLABFunction(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, + &rtb_DataTypeConversion_kr); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel8_bit_ip, &rtb_y_a); + rtb_DataTypeConversion_kr = (rtb_AND1_f || ((rtb_y_a != 0U) && rtb_DataTypeConversion_kr)); guard1 = false; if ((rtb_alpha_floor_inhib == 0) && (rtb_mach < 0.6)) { - if (rtb_Switch4_f >= 4.0) { - rtb_Switch4_a = -3; + if (rtb_Switch_i_idx_0 >= 4.0F) { + rtb_v_ls_kn_SSM = -3; } else { - rtb_Switch4_a = 0; + rtb_v_ls_kn_SSM = 0; } - if ((rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg > rtb_Switch1_a + std::fmin(std::fmax(rtb_Y_d, - static_cast(rtb_Switch4_a)), 0.0)) && rtb_y_pg) { + if ((rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg > rtb_Switch1 + std::fmin(std::fmax(rtb_Y_g4, + static_cast(rtb_v_ls_kn_SSM)), 0.0)) && rtb_DataTypeConversion_kr) { FacComputer_DWork.sAlphaFloor = 1.0; } else { guard1 = true; @@ -689,105 +723,73 @@ void FacComputer::step() } if (guard1) { - if ((rtb_alpha_floor_inhib != 0) || (!rtb_Memory) || (!rtb_y_pg)) { + if ((rtb_alpha_floor_inhib != 0) || (!rtb_y_gg) || (!rtb_DataTypeConversion_kr)) { FacComputer_DWork.sAlphaFloor = 0.0; } } - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel_bit_a, &rtb_y_c); - rtb_Memory = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel1_bit_i, &rtb_y_c); - rtb_y_pg = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel2_bit_di, &rtb_y_c); - rtb_DataTypeConversion_ml = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel3_bit_g, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel4_bit_f, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel5_bit_g3, &rtb_y_c); - FacComputer_MATLABFunction_d(rtb_Memory, rtb_y_pg, rtb_DataTypeConversion_ml, rtb_OR1, rtb_DataTypeConversion_kr, - rtb_y_c != 0U, &rtb_Switch4_f); - FacComputer_RateLimiter(look1_binlxpw(rtb_Switch4_f, FacComputer_P.alpha0_bp01Data, FacComputer_P.alpha0_tableData, - 5U), FacComputer_P.RateLimiterGenericVariableTs1_up_g, FacComputer_P.RateLimiterGenericVariableTs1_lo_n, - FacComputer_U.in.time.dt, FacComputer_P.reset_Value_k, &rtb_Switch1_a, &FacComputer_DWork.sf_RateLimiter_c); - FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), rtb_Switch4_f, FacComputer_P.alphamax_bp01Data, - FacComputer_P.alphamax_bp02Data, FacComputer_P.alphamax_tableData, FacComputer_P.alphamax_maxIndex, 4U), - FacComputer_P.RateLimiterGenericVariableTs4_up, FacComputer_P.RateLimiterGenericVariableTs4_lo, - FacComputer_U.in.time.dt, FacComputer_P.reset_Value_o, &rtb_Y_d, &FacComputer_DWork.sf_RateLimiter_a); + rtb_y_gg = (FacComputer_DWork.sAlphaFloor != 0.0); + rtb_Y_g4 = rtb_Switch_i_idx_0; + FacComputer_RateLimiter(look1_binlxpw(static_cast(rtb_Switch_i_idx_0), FacComputer_P.alpha0_bp01Data, + FacComputer_P.alpha0_tableData, 5U), FacComputer_P.RateLimiterGenericVariableTs1_up_g, + FacComputer_P.RateLimiterGenericVariableTs1_lo_n, FacComputer_U.in.time.dt, FacComputer_P.reset_Value_k, + &rtb_Switch4_f, &FacComputer_DWork.sf_RateLimiter_c); + FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), static_cast(rtb_Switch_i_idx_0), + FacComputer_P.alphamax_bp01Data, FacComputer_P.alphamax_bp02Data, FacComputer_P.alphamax_tableData, + FacComputer_P.alphamax_maxIndex, 4U), FacComputer_P.RateLimiterGenericVariableTs4_up, + FacComputer_P.RateLimiterGenericVariableTs4_lo, FacComputer_U.in.time.dt, FacComputer_P.reset_Value_o, + &rtb_Switch1, &FacComputer_DWork.sf_RateLimiter_a); FacComputer_CalculateV_alpha_max(static_cast(rtb_V_ias), - rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch1_a, rtb_Y_d, &rtb_Y_i); - FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), rtb_Switch4_f, + rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch4_f, rtb_Switch1, + &rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn); + FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), static_cast(rtb_Switch_i_idx_0), FacComputer_P.alphaprotection_bp01Data, FacComputer_P.alphaprotection_bp02Data, FacComputer_P.alphaprotection_tableData, FacComputer_P.alphaprotection_maxIndex, 4U), FacComputer_P.RateLimiterGenericVariableTs3_up, FacComputer_P.RateLimiterGenericVariableTs3_lo, - FacComputer_U.in.time.dt, FacComputer_P.reset_Value_a, &rtb_Y_d, &FacComputer_DWork.sf_RateLimiter_n); + FacComputer_U.in.time.dt, FacComputer_P.reset_Value_a, &rtb_Switch1, &FacComputer_DWork.sf_RateLimiter_n); FacComputer_CalculateV_alpha_max(static_cast(rtb_V_ias), - rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch1_a, rtb_Y_d, &rtb_Y_f); - FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), rtb_Switch4_f, + rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch4_f, rtb_Switch1, &rtb_Switch); + FacComputer_RateLimiter(look2_binlxpw(static_cast(rtb_mach), static_cast(rtb_Switch_i_idx_0), FacComputer_P.alphastallwarn_bp01Data, FacComputer_P.alphastallwarn_bp02Data, FacComputer_P.alphastallwarn_tableData, FacComputer_P.alphastallwarn_maxIndex, 4U), FacComputer_P.RateLimiterGenericVariableTs2_up, FacComputer_P.RateLimiterGenericVariableTs2_lo, - FacComputer_U.in.time.dt, FacComputer_P.reset_Value_i, &rtb_Y_d, &FacComputer_DWork.sf_RateLimiter_j); + FacComputer_U.in.time.dt, FacComputer_P.reset_Value_i, &rtb_Y_g4, &FacComputer_DWork.sf_RateLimiter_j); FacComputer_CalculateV_alpha_max(static_cast(rtb_V_ias), - rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch1_a, rtb_Y_d, &rtb_Switch4_f); - FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_weight_lbs, &rtb_OR1); - if (rtb_OR1) { + rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg, rtb_Switch4_f, rtb_Y_g4, &rtb_Switch1); + rtb_BusAssignment_dj_flight_envelope_v_stall_warn_kn = rtb_Switch1; + FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_weight_lbs, &rtb_y_gg); + if (rtb_y_gg) { rtb_DataTypeConversion2 = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_weight_lbs.Data; - rtb_Y_d = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_weight_lbs.Data; + rtb_Y_g4 = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_weight_lbs.Data; } else { rtb_DataTypeConversion2 = FacComputer_U.in.bus_inputs.fmgc_own_bus.fac_weight_lbs.Data; - rtb_Y_d = FacComputer_U.in.bus_inputs.fmgc_own_bus.fac_weight_lbs.Data; + rtb_Y_g4 = FacComputer_U.in.bus_inputs.fmgc_own_bus.fac_weight_lbs.Data; } - rtb_Switch = rtb_Y_f; - rtb_BusAssignment_kv_flight_envelope_v_stall_warn_kn = rtb_Switch4_f; - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel_bit_k, &rtb_y_c); - rtb_Memory = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel1_bit_c, &rtb_y_c); - rtb_y_pg = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel2_bit_g, &rtb_y_c); - rtb_DataTypeConversion_ml = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel3_bit_d, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel4_bit_a, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel5_bit_j, &rtb_y_c); - FacComputer_MATLABFunction_d(rtb_Memory, rtb_y_pg, rtb_DataTypeConversion_ml, rtb_OR1, rtb_DataTypeConversion_kr, - rtb_y_c != 0U, &rtb_Switch4_f); - FacComputer_MATLABFunction2(look1_binlxpw(rtb_Switch4_f, FacComputer_P.uDLookupTable3_bp01Data, - FacComputer_P.uDLookupTable3_tableData, 5U), look1_binlxpw(rtb_Switch4_f, FacComputer_P.uDLookupTable2_bp01Data, - FacComputer_P.uDLookupTable2_tableData, 5U), static_cast(rtb_DataTypeConversion2), &rtb_Y_d); - FacComputer_RateLimiter_f(rtb_Y_d, FacComputer_P.RateLimiterGenericVariableTs1_up_d, + FacComputer_MATLABFunction2(look1_binlxpw(static_cast(rtb_Switch_i_idx_0), + FacComputer_P.uDLookupTable3_bp01Data, FacComputer_P.uDLookupTable3_tableData, 5U), look1_binlxpw + (static_cast(rtb_Switch_i_idx_0), FacComputer_P.uDLookupTable2_bp01Data, + FacComputer_P.uDLookupTable2_tableData, 5U), static_cast(rtb_DataTypeConversion2), &rtb_Y_g4); + FacComputer_RateLimiter_f(rtb_Y_g4, FacComputer_P.RateLimiterGenericVariableTs1_up_d, FacComputer_P.RateLimiterGenericVariableTs1_lo_f, FacComputer_U.in.time.dt, - FacComputer_P.RateLimiterGenericVariableTs1_InitialCondition, FacComputer_P.reset_Value_k5, &rtb_Y_f, + FacComputer_P.RateLimiterGenericVariableTs1_InitialCondition, FacComputer_P.reset_Value_k5, &rtb_Y_br, &FacComputer_DWork.sf_RateLimiter_g0); - FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.elac_1_bus.speedbrake_extension_deg, &rtb_y_pg); - FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.elac_2_bus.speedbrake_extension_deg, &rtb_OR1); - if (rtb_y_pg || rtb_OR1) { - if (rtb_y_pg) { - rtb_Y_d = FacComputer_U.in.bus_inputs.elac_1_bus.speedbrake_extension_deg.Data; + FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.elac_1_bus.speedbrake_extension_deg, + &rtb_DataTypeConversion_kr); + FacComputer_MATLABFunction_l(&FacComputer_U.in.bus_inputs.elac_2_bus.speedbrake_extension_deg, &rtb_y_gg); + if (rtb_DataTypeConversion_kr || rtb_y_gg) { + if (rtb_DataTypeConversion_kr) { + rtb_Y_g4 = FacComputer_U.in.bus_inputs.elac_1_bus.speedbrake_extension_deg.Data; } else { - rtb_Y_d = FacComputer_U.in.bus_inputs.elac_2_bus.speedbrake_extension_deg.Data; + rtb_Y_g4 = FacComputer_U.in.bus_inputs.elac_2_bus.speedbrake_extension_deg.Data; } } else { - rtb_Y_d = FacComputer_P.Constant1_Value; + rtb_Y_g4 = FacComputer_P.Constant1_Value_e; } - rtb_Switch1_a = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_cg_percent.Data * 100.0; - rtb_v_gd = rtb_DataTypeConversion2 / 2205.0; - y_value = (rtb_v_gd * 0.19807001167721894 - 0.0347376119873668) * 1.3 + -5.9; + rtb_Switch1 = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_cg_percent.Data * 100.0; + rtb_Gain_n = rtb_DataTypeConversion2 / 2205.0; + rtb_Switch4_f = (rtb_Gain_n * 0.19807001167721894 - 0.0347376119873668) * 1.3 - 5.9; u0 = FacComputer_P.Gain_Gain_km * rtb_alt; if (u0 > FacComputer_P.Saturation2_UpperSat) { u0 = FacComputer_P.Saturation2_UpperSat; @@ -795,216 +797,182 @@ void FacComputer::step() u0 = FacComputer_P.Saturation2_LowerSat; } - rtb_Switch1_a = look2_pbinlxpw(std::fmax(y_value - (y_value - -6.5) / (rtb_Switch1_a - -405.0) * (rtb_Switch1_a - - 25.0), 1.0), u0, FacComputer_P.uDLookupTable_bp01Data_g, FacComputer_P.uDLookupTable_bp02Data, + rtb_Switch1 = look2_pbinlxpw(std::fmax(rtb_Switch4_f - (rtb_Switch4_f - -6.5) / (rtb_Switch1 - -405.0) * + (rtb_Switch1 - 25.0), 1.0), u0, FacComputer_P.uDLookupTable_bp01Data_g, FacComputer_P.uDLookupTable_bp02Data, FacComputer_P.uDLookupTable_tableData_c, FacComputer_DWork.m_bpIndex, FacComputer_P.uDLookupTable_maxIndex, 45U); - if (rtb_Switch1_a > FacComputer_P.Saturation1_UpperSat_ok) { - rtb_Switch1_a = FacComputer_P.Saturation1_UpperSat_ok; - } else if (rtb_Switch1_a < FacComputer_P.Saturation1_LowerSat_o) { - rtb_Switch1_a = FacComputer_P.Saturation1_LowerSat_o; + if (rtb_Switch1 > FacComputer_P.Saturation1_UpperSat_ok) { + rtb_Switch1 = FacComputer_P.Saturation1_UpperSat_ok; + } else if (rtb_Switch1 < FacComputer_P.Saturation1_LowerSat_o) { + rtb_Switch1 = FacComputer_P.Saturation1_LowerSat_o; } - if ((!rtb_AND1) && rtb_y_j && rtb_Switch_i_idx_1) { - FacComputer_DWork.takeoff_config = rtb_Switch4_f; - } else if (FacComputer_DWork.takeoff_config != rtb_Switch4_f) { + if ((!rtb_AND1) && rtb_y_k5 && rtb_Switch_io_idx_1) { + FacComputer_DWork.takeoff_config = rtb_Switch_i_idx_0; + } else if (FacComputer_DWork.takeoff_config != rtb_Switch_i_idx_0) { FacComputer_DWork.takeoff_config = -1.0; } - if (rtb_Switch4_f == 0.0) { - rtb_Switch4_a_0 = 1.28; + if (rtb_Switch_i_idx_0 == 0.0F) { + u0 = 1.28; } else if (FacComputer_DWork.takeoff_config != -1.0) { - rtb_Switch4_a_0 = 1.13; + u0 = 1.13; } else { - rtb_Switch4_a_0 = 1.23; + u0 = 1.23; } - FacComputer_RateLimiter_f(rtb_Switch4_a_0, FacComputer_P.RateLimiterGenericVariableTs_up, + FacComputer_RateLimiter_f(u0, FacComputer_P.RateLimiterGenericVariableTs_up, FacComputer_P.RateLimiterGenericVariableTs_lo, FacComputer_U.in.time.dt, FacComputer_P.RateLimiterGenericVariableTs_InitialCondition, FacComputer_P.reset_Value_m, &rtb_Switch4_f, &FacComputer_DWork.sf_RateLimiter_g); - rtb_Switch4_f *= rtb_Y_f; + rtb_Switch4_f *= rtb_Y_br; if (rtb_alt >= FacComputer_P.CompareToConstant_const) { - rtb_Switch1_a = std::sqrt(std::pow((std::pow(rtb_Switch1_a * rtb_Switch1_a * 0.2 + 1.0, 3.5) - 1.0) * (rtb_p_s_c / - 1013.25) + 1.0, 0.2857142857142857) - 1.0) * 1479.1; + u0 = std::sqrt(std::pow((std::pow(rtb_Switch1 * rtb_Switch1 * 0.2 + 1.0, 3.5) - 1.0) * (rtb_p_s_c / 1013.25) + 1.0, + 0.2857142857142857) - 1.0) * 1479.1; } else { - rtb_Switch1_a = FacComputer_P.Constant_Value_l; + u0 = FacComputer_P.Constant_Value_l; } - rtb_Switch1_a = std::fmax(std::fmax(rtb_Switch1_a, FacComputer_P.Vmcl_Value), rtb_Switch4_f); - if (rtb_Y_d > FacComputer_P.Saturation_UpperSat_o) { - rtb_Y_d = FacComputer_P.Saturation_UpperSat_o; - } else if (rtb_Y_d < FacComputer_P.Saturation_LowerSat_b) { - rtb_Y_d = FacComputer_P.Saturation_LowerSat_b; + rtb_Switch1 = std::fmax(std::fmax(u0, FacComputer_P.Vmcl_Value), rtb_Switch4_f); + if (rtb_Y_g4 > FacComputer_P.Saturation_UpperSat_o) { + rtb_Y_g4 = FacComputer_P.Saturation_UpperSat_o; + } else if (rtb_Y_g4 < FacComputer_P.Saturation_LowerSat_b) { + rtb_Y_g4 = FacComputer_P.Saturation_LowerSat_b; } - y_value = look1_binlxpw(rtb_Y_d, FacComputer_P.uDLookupTable_bp01Data, FacComputer_P.uDLookupTable_tableData, 1U) + - rtb_Switch1_a; + rtb_Switch_b = look1_binlxpw(rtb_Y_g4, FacComputer_P.uDLookupTable_bp01Data, FacComputer_P.uDLookupTable_tableData, + 1U) + rtb_Switch1; FacComputer_MATLABFunction2(look1_binlxpw(FacComputer_P.Constant_Value_k, FacComputer_P.uDLookupTable6_bp01Data, FacComputer_P.uDLookupTable6_tableData, 5U), look1_binlxpw(FacComputer_P.Constant_Value_k, FacComputer_P.uDLookupTable5_bp01Data, FacComputer_P.uDLookupTable5_tableData, 5U), static_cast - (rtb_DataTypeConversion2), &rtb_Switch1_a); - rtb_Switch1_a = std::fmax(FacComputer_P.Gain1_Gain * rtb_Switch1_a, FacComputer_P.Vmcl_Value_a + - FacComputer_P.Bias_Bias); - rtb_Y_d = FacComputer_P.Vmcl_Value_a + FacComputer_P.Bias2_Bias; + (rtb_DataTypeConversion2), &rtb_Switch1); + rtb_Switch1 = std::fmax(FacComputer_P.Gain1_Gain * rtb_Switch1, FacComputer_P.Vmcl_Value_a + FacComputer_P.Bias_Bias); FacComputer_MATLABFunction2(look1_binlxpw(FacComputer_P.Constant1_Value_h, FacComputer_P.uDLookupTable8_bp01Data, FacComputer_P.uDLookupTable8_tableData, 5U), look1_binlxpw(FacComputer_P.Constant1_Value_h, FacComputer_P.uDLookupTable7_bp01Data, FacComputer_P.uDLookupTable7_tableData, 5U), static_cast (rtb_DataTypeConversion2), &rtb_Switch4_f); - rtb_Switch4_f = std::fmax(FacComputer_P.Gain_Gain_o * rtb_Switch4_f, rtb_Y_d); - rtb_v_gd = (rtb_v_gd * 2.0 + 85.0) + std::fmax(rtb_alt - 20000.0, 0.0) / 1000.0; - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel_bit_b, &rtb_y_c); - rtb_Memory = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel1_bit_ca, &rtb_y_c); - rtb_y_pg = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel2_bit_b, &rtb_y_c); - rtb_DataTypeConversion_ml = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel3_bit_l, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel4_bit_l, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel5_bit_j4, &rtb_y_c); - FacComputer_MATLABFunction_d(rtb_Memory, rtb_y_pg, rtb_DataTypeConversion_ml, rtb_OR1, rtb_DataTypeConversion_kr, - rtb_y_c != 0U, &rtb_Y_d); - rtb_y_pg = ((rtb_Y_d == FacComputer_P.CompareToConstant3_const) || (rtb_Y_d == - FacComputer_P.CompareToConstant1_const)); - rtb_Memory = (rtb_Y_d == FacComputer_P.CompareToConstant_const_k); - rtb_BusAssignment_g5_flight_envelope_v_stall_kn = rtb_Y_f; - rtb_BusAssignment_g5_flight_envelope_v_3_kn = rtb_Switch1_a; - rtb_DataTypeConversion_ml = ((rtb_Y_d == FacComputer_P.CompareToConstant4_const) || (rtb_Y_d == + rtb_Switch4_f = std::fmax(FacComputer_P.Gain_Gain_o * rtb_Switch4_f, FacComputer_P.Vmcl_Value_a + + FacComputer_P.Bias2_Bias); + rtb_v_gd = (rtb_Gain_n * 2.0 + 85.0) + std::fmax(rtb_alt - 20000.0, 0.0) / 1000.0; + rtb_BusAssignment_g5_flight_envelope_v_stall_kn = rtb_Y_br; + rtb_DataTypeConversion_kr = ((rtb_Switch_i_idx_0 == FacComputer_P.CompareToConstant4_const) || (rtb_Switch_i_idx_0 == FacComputer_P.CompareToConstant2_const)); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel_bit_g, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel1_bit_j, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel2_bit_n, &rtb_y_c); - rtb_DataTypeConversion_he = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel3_bit_h, &rtb_y_c); - rtb_DataTypeConversion_e0 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel4_bit_l5, &rtb_y_c); - rtb_DataTypeConversion_jc = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.sfcc_own_bus.slat_flap_system_status_word, - FacComputer_P.BitfromLabel5_bit_c, &rtb_y_c); - FacComputer_MATLABFunction_d(rtb_OR1, rtb_DataTypeConversion_kr, rtb_DataTypeConversion_he, - rtb_DataTypeConversion_e0, rtb_DataTypeConversion_jc, rtb_y_c != 0U, &rtb_Switch1_a); - rtb_BusAssignment_f_flight_envelope_v_fe_next_kn = look1_binlxpw(rtb_Switch1_a, - FacComputer_P.uDLookupTable1_bp01Data, FacComputer_P.uDLookupTable1_tableData, 5U); - rtb_DataTypeConversion_he = ((rtb_Switch1_a < FacComputer_P.CompareToConstant_const_i) && (rtb_alt <= + rtb_AND1_f = ((rtb_Switch_i_idx_0 < FacComputer_P.CompareToConstant_const_i) && (rtb_alt <= FacComputer_P.CompareToConstant1_const_i)); - if (rtb_Switch_i_idx_2) { - rtb_Y_d = FacComputer_P.Constant2_Value; + if (rtb_Switch_io_idx_2) { + u0 = FacComputer_P.Constant2_Value; } else { - rtb_Y_d = FacComputer_P.Constant3_Value; + u0 = FacComputer_P.Constant3_Value; } - rtb_Switch4_a_0 = std::fmin(std::fmin(rtb_Y_d, std::sqrt(std::pow((std::pow(FacComputer_P.Constant1_Value_p * + rtb_Switch4_j = std::fmin(std::fmin(u0, std::sqrt(std::pow((std::pow(FacComputer_P.Constant1_Value_p * FacComputer_P.Constant1_Value_p * 0.2 + 1.0, 3.5) - 1.0) * (rtb_p_s_c / 1013.25) + 1.0, 0.2857142857142857) - 1.0) - * 1479.1), look1_binlxpw(rtb_Switch1_a, FacComputer_P.uDLookupTable_bp01Data_a, + * 1479.1), look1_binlxpw(static_cast(rtb_Switch_i_idx_0), FacComputer_P.uDLookupTable_bp01Data_a, FacComputer_P.uDLookupTable_tableData_a, 5U)); if (rtb_V_ias > FacComputer_P.Saturation_UpperSat_j) { - rtb_Switch1_a = FacComputer_P.Saturation_UpperSat_j; + u0 = FacComputer_P.Saturation_UpperSat_j; } else if (rtb_V_ias < FacComputer_P.Saturation_LowerSat_c) { - rtb_Switch1_a = FacComputer_P.Saturation_LowerSat_c; + u0 = FacComputer_P.Saturation_LowerSat_c; } else { - rtb_Switch1_a = rtb_V_ias; + u0 = rtb_V_ias; } - rtb_Gain_a = FacComputer_P.DiscreteDerivativeVariableTs_Gain_l * rtb_Switch1_a; - rtb_Switch1_a = rtb_Gain_a - FacComputer_DWork.Delay_DSTATE_d; - FacComputer_LagFilter(rtb_Switch1_a / FacComputer_U.in.time.dt, FacComputer_P.LagFilter_C1_fa, - FacComputer_U.in.time.dt, &rtb_Y_f, &FacComputer_DWork.sf_LagFilter_i); - FacComputer_RateLimiter_f(rtb_Y_f, FacComputer_P.RateLimiterGenericVariableTs_up_g, + rtb_Gain_n = FacComputer_P.DiscreteDerivativeVariableTs_Gain_l * u0; + rtb_Y_g4 = rtb_Gain_n - FacComputer_DWork.Delay_DSTATE_d; + FacComputer_LagFilter(rtb_Y_g4 / FacComputer_U.in.time.dt, FacComputer_P.LagFilter_C1_f, FacComputer_U.in.time.dt, + &rtb_Y_br, &FacComputer_DWork.sf_LagFilter_i); + FacComputer_RateLimiter_f(rtb_Y_br, FacComputer_P.RateLimiterGenericVariableTs_up_g, FacComputer_P.RateLimiterGenericVariableTs_lo_e, FacComputer_U.in.time.dt, - FacComputer_P.RateLimiterGenericVariableTs_InitialCondition_o, FacComputer_P.reset_Value_i3, &rtb_Switch1_a, + FacComputer_P.RateLimiterGenericVariableTs_InitialCondition_o, FacComputer_P.reset_Value_i3, &rtb_Y_g4, &FacComputer_DWork.sf_RateLimiter_f); - rtb_Switch1_a *= FacComputer_P.Gain_Gain_j; - rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn = rtb_Y_i; - rtb_OR1 = (FacComputer_U.in.discrete_inputs.ap_own_engaged || FacComputer_U.in.discrete_inputs.ap_opp_engaged); - rtb_DataTypeConversion_kr = (FacComputer_U.in.discrete_inputs.rudder_trim_reset_button && (!rtb_OR1)); + rtb_Switch_o = FacComputer_P.Gain_Gain_j * rtb_Y_g4; + rtb_BusAssignment_f_flight_envelope_v_4_visible = ((rtb_Switch_i_idx_0 == FacComputer_P.CompareToConstant3_const) || + (rtb_Switch_i_idx_0 == FacComputer_P.CompareToConstant1_const)); + rtb_BusAssignment_f_flight_envelope_v_fe_next_kn = look1_binlxpw(static_cast(rtb_Switch_i_idx_0), + FacComputer_P.uDLookupTable1_bp01Data, FacComputer_P.uDLookupTable1_tableData, 5U); + rtb_y_gg = (FacComputer_U.in.discrete_inputs.ap_own_engaged || FacComputer_U.in.discrete_inputs.ap_opp_engaged); + rtb_AND = (FacComputer_U.in.discrete_inputs.rudder_trim_reset_button && (!rtb_y_gg)); if (!FacComputer_DWork.previousInput_not_empty) { FacComputer_DWork.previousInput = FacComputer_P.PulseNode_isRisingEdge; FacComputer_DWork.previousInput_not_empty = true; } if (FacComputer_P.PulseNode_isRisingEdge) { - rtb_DataTypeConversion_e0 = (rtb_DataTypeConversion_kr && (!FacComputer_DWork.previousInput)); + rtb_y_h = (rtb_AND && (!FacComputer_DWork.previousInput)); } else { - rtb_DataTypeConversion_e0 = ((!rtb_DataTypeConversion_kr) && FacComputer_DWork.previousInput); + rtb_y_h = ((!rtb_AND) && FacComputer_DWork.previousInput); } - FacComputer_DWork.previousInput = rtb_DataTypeConversion_kr; + FacComputer_DWork.previousInput = rtb_AND; FacComputer_DWork.Memory_PreviousInput = FacComputer_P.Logic_table [(((FacComputer_U.in.discrete_inputs.rudder_trim_switch_left || - FacComputer_U.in.discrete_inputs.rudder_trim_switch_right || rtb_OR1) + (static_cast - (rtb_DataTypeConversion_e0) << 1)) << 1) + FacComputer_DWork.Memory_PreviousInput]; - rtb_DataTypeConversion_kr = !rtb_rudderTrimEngaged; - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel_bit_j, &rtb_y_c); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel1_bit_e, &rtb_y_bm); - if (rtb_OR1) { - if ((rtb_y_c != 0U) && FacComputer_U.in.discrete_inputs.elac_1_healthy) { - rtb_Y_i = FacComputer_U.in.bus_inputs.elac_1_bus.yaw_damper_command_deg.Data; - } else if ((rtb_y_bm != 0U) && FacComputer_U.in.discrete_inputs.elac_2_healthy) { - rtb_Y_i = FacComputer_U.in.bus_inputs.elac_1_bus.yaw_damper_command_deg.Data; + FacComputer_U.in.discrete_inputs.rudder_trim_switch_right || rtb_y_gg) + (static_cast(rtb_y_h) << 1)) + << 1) + FacComputer_DWork.Memory_PreviousInput]; + rtb_AND = !rtb_rudderTrimEngaged; + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel_bit_j, &rtb_y_fn); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel1_bit_e, &rtb_y_dq); + if (rtb_y_gg) { + if (FacComputer_U.in.bus_inputs.fmgc_own_bus.fg_radio_height_ft.Data >= FacComputer_P.Switch6_Threshold_n) { + if ((rtb_y_fn != 0U) && FacComputer_U.in.discrete_inputs.elac_1_healthy) { + u0 = FacComputer_U.in.bus_inputs.elac_1_bus.yaw_damper_command_deg.Data; + } else if ((rtb_y_dq != 0U) && FacComputer_U.in.discrete_inputs.elac_2_healthy) { + u0 = FacComputer_U.in.bus_inputs.elac_2_bus.yaw_damper_command_deg.Data; + } else { + u0 = FacComputer_P.Constant1_Value_m; + } + + rtb_Y_g4 = FacComputer_P.Gain2_Gain * u0; } else { - rtb_Y_i = FacComputer_P.Constant1_Value_m; + rtb_Y_g4 = FacComputer_P.Constant2_Value_m; } - rtb_Y_d = FacComputer_P.Gain2_Gain * rtb_Y_i; + if (rtb_Y_g4 > FacComputer_P.Saturation_UpperSat) { + rtb_Y_g4 = FacComputer_P.Saturation_UpperSat; + } else if (rtb_Y_g4 < FacComputer_P.Saturation_LowerSat) { + rtb_Y_g4 = FacComputer_P.Saturation_LowerSat; + } } else if (FacComputer_U.in.discrete_inputs.rudder_trim_switch_left) { - rtb_Y_d = 1.0; + rtb_Y_g4 = 1.0; } else if (FacComputer_U.in.discrete_inputs.rudder_trim_switch_right) { - rtb_Y_d = -1.0; + rtb_Y_g4 = -1.0; } else { - rtb_Y_d = 0.0; + rtb_Y_g4 = 0.0; } - rtb_Y_d = FacComputer_P.DiscreteTimeIntegratorVariableTs_Gain * rtb_Y_d * FacComputer_U.in.time.dt; - FacComputer_DWork.icLoad = (FacComputer_DWork.Memory_PreviousInput || rtb_DataTypeConversion_kr || - FacComputer_DWork.icLoad); + rtb_Y_g4 = FacComputer_P.DiscreteTimeIntegratorVariableTs_Gain * rtb_Y_g4 * FacComputer_U.in.time.dt; + FacComputer_DWork.icLoad = (FacComputer_DWork.Memory_PreviousInput || rtb_AND || FacComputer_DWork.icLoad); if (FacComputer_DWork.icLoad) { - if (rtb_DataTypeConversion_kr) { - rtb_Y_i = FacComputer_U.in.analog_inputs.rudder_trim_position_deg; + if (rtb_AND) { + u0 = FacComputer_U.in.analog_inputs.rudder_trim_position_deg; } else { - rtb_Y_i = FacComputer_P.Constant_Value_g; + u0 = FacComputer_P.Constant_Value_g; } - FacComputer_DWork.Delay_DSTATE_dc = rtb_Y_i - rtb_Y_d; + FacComputer_DWork.Delay_DSTATE_dc = u0 - rtb_Y_g4; } - FacComputer_DWork.Delay_DSTATE_dc += rtb_Y_d; + FacComputer_DWork.Delay_DSTATE_dc += rtb_Y_g4; if (FacComputer_DWork.Delay_DSTATE_dc > FacComputer_P.DiscreteTimeIntegratorVariableTs_UpperLimit) { FacComputer_DWork.Delay_DSTATE_dc = FacComputer_P.DiscreteTimeIntegratorVariableTs_UpperLimit; } else if (FacComputer_DWork.Delay_DSTATE_dc < FacComputer_P.DiscreteTimeIntegratorVariableTs_LowerLimit) { FacComputer_DWork.Delay_DSTATE_dc = FacComputer_P.DiscreteTimeIntegratorVariableTs_LowerLimit; } - FacComputer_RateLimiter_p(FacComputer_DWork.Delay_DSTATE_dc, FacComputer_P.RateLimiterGenericVariableTs_up_e, - FacComputer_P.RateLimiterGenericVariableTs_lo_p, FacComputer_U.in.time.dt, - FacComputer_U.in.analog_inputs.rudder_trim_position_deg, !rtb_rudderTrimEngaged, &rtb_Y_i, - &FacComputer_DWork.sf_RateLimiter_b); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel_bit_c, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel1_bit_n, &rtb_y_c); - rtb_DataTypeConversion_kr = (rtb_OR1 && FacComputer_U.in.discrete_inputs.elac_1_healthy && (rtb_y_c != 0U)); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel3_bit_k, &rtb_y_c); - rtb_OR1 = (rtb_y_c != 0U); - FacComputer_MATLABFunction_f(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, - FacComputer_P.BitfromLabel4_bit_k, &rtb_y_c); + FacComputer_RateLimiter_p(FacComputer_DWork.Delay_DSTATE_dc, FacComputer_P.RateLimiterGenericVariableTs_up_l, + FacComputer_P.RateLimiterGenericVariableTs_lo_d, FacComputer_U.in.time.dt, + FacComputer_U.in.analog_inputs.rudder_trim_position_deg, rtb_AND, &rtb_Y_l, &FacComputer_DWork.sf_RateLimiter_l); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel_bit_c, &rtb_y_a); + rtb_y_gg = (rtb_y_a != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_1_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel1_bit_n, &rtb_y_a); + rtb_AND = (rtb_y_gg && FacComputer_U.in.discrete_inputs.elac_1_healthy && (rtb_y_a != 0U)); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel3_bit_k, &rtb_y_a); + rtb_y_gg = (rtb_y_a != 0U); + FacComputer_MATLABFunction_g(&FacComputer_U.in.bus_inputs.elac_2_bus.discrete_status_word_1, + FacComputer_P.BitfromLabel4_bit_k, &rtb_y_a); if ((!FacComputer_DWork.pY_not_empty) || (!FacComputer_DWork.pU_not_empty)) { FacComputer_DWork.pU = rtb_r; FacComputer_DWork.pU_not_empty = true; @@ -1012,35 +980,35 @@ void FacComputer::step() FacComputer_DWork.pY_not_empty = true; } - rtb_Y_d = FacComputer_U.in.time.dt * FacComputer_P.WashoutFilter_C1; - rtb_Y_f = 2.0 / (rtb_Y_d + 2.0); - FacComputer_DWork.pY = (2.0 - rtb_Y_d) / (rtb_Y_d + 2.0) * FacComputer_DWork.pY + (rtb_r * rtb_Y_f - - FacComputer_DWork.pU * rtb_Y_f); + u0 = FacComputer_U.in.time.dt * FacComputer_P.WashoutFilter_C1; + rtb_Y_br = 2.0 / (u0 + 2.0); + FacComputer_DWork.pY = (2.0 - u0) / (u0 + 2.0) * FacComputer_DWork.pY + (rtb_r * rtb_Y_br - FacComputer_DWork.pU * + rtb_Y_br); FacComputer_DWork.pU = rtb_r; - if (rtb_DataTypeConversion_kr || (rtb_OR1 && FacComputer_U.in.discrete_inputs.elac_2_healthy && (rtb_y_c != 0U))) { - if (rtb_DataTypeConversion_kr) { - rtb_Y_d = FacComputer_U.in.bus_inputs.elac_1_bus.yaw_damper_command_deg.Data; + if (rtb_AND || (rtb_y_gg && FacComputer_U.in.discrete_inputs.elac_2_healthy && (rtb_y_a != 0U))) { + if (rtb_AND) { + rtb_Y_g4 = FacComputer_U.in.bus_inputs.elac_1_bus.yaw_damper_command_deg.Data; } else { - rtb_Y_d = FacComputer_U.in.bus_inputs.elac_2_bus.yaw_damper_command_deg.Data; + rtb_Y_g4 = FacComputer_U.in.bus_inputs.elac_2_bus.yaw_damper_command_deg.Data; } } else { - rtb_Y_d = FacComputer_P.Gain_Gain * FacComputer_DWork.pY; - if (rtb_Y_d > FacComputer_P.Saturation1_UpperSat) { - rtb_Y_d = FacComputer_P.Saturation1_UpperSat; - } else if (rtb_Y_d < FacComputer_P.Saturation1_LowerSat) { - rtb_Y_d = FacComputer_P.Saturation1_LowerSat; + rtb_Y_g4 = FacComputer_P.Gain_Gain * FacComputer_DWork.pY; + if (rtb_Y_g4 > FacComputer_P.Saturation1_UpperSat) { + rtb_Y_g4 = FacComputer_P.Saturation1_UpperSat; + } else if (rtb_Y_g4 < FacComputer_P.Saturation1_LowerSat) { + rtb_Y_g4 = FacComputer_P.Saturation1_LowerSat; } } - if (rtb_Y_d > FacComputer_P.Saturation_UpperSat_e) { - rtb_Y_d = FacComputer_P.Saturation_UpperSat_e; - } else if (rtb_Y_d < FacComputer_P.Saturation_LowerSat_o) { - rtb_Y_d = FacComputer_P.Saturation_LowerSat_o; + if (rtb_Y_g4 > FacComputer_P.Saturation_UpperSat_e) { + rtb_Y_g4 = FacComputer_P.Saturation_UpperSat_e; + } else if (rtb_Y_g4 < FacComputer_P.Saturation_LowerSat_o) { + rtb_Y_g4 = FacComputer_P.Saturation_LowerSat_o; } - FacComputer_RateLimiter_p(rtb_Y_d, FacComputer_P.RateLimiterGenericVariableTs_up_a, + FacComputer_RateLimiter_p(rtb_Y_g4, FacComputer_P.RateLimiterGenericVariableTs_up_a, FacComputer_P.RateLimiterGenericVariableTs_lo_f, FacComputer_U.in.time.dt, - FacComputer_U.in.analog_inputs.yaw_damper_position_deg, !rtb_yawDamperEngaged, &rtb_Y_f, + FacComputer_U.in.analog_inputs.yaw_damper_position_deg, !rtb_yawDamperEngaged, &rtb_Y_br, &FacComputer_DWork.sf_RateLimiter_fu); u0 = look1_binlxpw(static_cast(rtb_V_ias), FacComputer_P.uDLookupTable_bp01Data_i, FacComputer_P.uDLookupTable_tableData_j, 6U); @@ -1051,30 +1019,10 @@ void FacComputer::step() } FacComputer_RateLimiter_p(u0, FacComputer_P.RateLimiterGenericVariableTs_up_c, - FacComputer_P.RateLimiterGenericVariableTs_lo_pn, FacComputer_U.in.time.dt, - FacComputer_U.in.analog_inputs.rudder_travel_lim_position_deg, !rtb_rudderTravelLimEngaged, &rtb_Y_d, + FacComputer_P.RateLimiterGenericVariableTs_lo_p, FacComputer_U.in.time.dt, + FacComputer_U.in.analog_inputs.rudder_travel_lim_position_deg, !rtb_rudderTravelLimEngaged, &rtb_Y_g4, &FacComputer_DWork.sf_RateLimiter_p); - rtb_VectorConcatenate[0] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[1] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[2] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[3] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[4] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[5] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[6] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[7] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[8] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[9] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[10] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[11] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[12] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[13] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[14] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[15] = FacComputer_U.in.discrete_inputs.nose_gear_pressed; - rtb_VectorConcatenate[16] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[17] = FacComputer_P.Constant20_Value; - rtb_VectorConcatenate[18] = FacComputer_P.Constant20_Value; - FacComputer_MATLABFunction_g(rtb_VectorConcatenate, &rtb_y_f); - rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant2_Value); + FacComputer_Y.out.bus_outputs.v_fe_next_kn.SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_VectorConcatenate[0] = rtb_yawDamperEngaged; rtb_VectorConcatenate[1] = FacComputer_U.in.discrete_inputs.yaw_damper_opp_engaged; rtb_VectorConcatenate[2] = rtb_rudderTrimEngaged; @@ -1094,9 +1042,9 @@ void FacComputer::step() rtb_VectorConcatenate[16] = FacComputer_P.Constant10_Value; rtb_VectorConcatenate[17] = FacComputer_P.Constant10_Value; rtb_VectorConcatenate[18] = FacComputer_P.Constant10_Value; - FacComputer_MATLABFunction_g(rtb_VectorConcatenate, &rtb_y_h); + FacComputer_MATLABFunction_g3(rtb_VectorConcatenate, &rtb_y_na); if (FacComputer_P.Constant_Value_b5) { - rtb_Switch4_a = static_cast(FacComputer_P.EnumeratedConstant2_Value); + rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_v_ls_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_v_stall_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_v_alpha_prot_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); @@ -1105,13 +1053,13 @@ void FacComputer::step() rtb_v_3_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_v_4_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); rtb_v_man_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); - rtb_y_c = static_cast(FacComputer_P.EnumeratedConstant2_Value); + FacComputer_Y.out.bus_outputs.v_max_kn.SSM = static_cast(FacComputer_P.EnumeratedConstant2_Value); } else { if (rtb_BusAssignment_h_logic_speed_scale_visible) { - rtb_Switch4_a = static_cast(FacComputer_P.EnumeratedConstant1_Value); + rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant1_Value); rtb_v_ls_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); } else { - rtb_Switch4_a = static_cast(FacComputer_P.EnumeratedConstant_Value); + rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant_Value); rtb_v_ls_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); } @@ -1125,29 +1073,30 @@ void FacComputer::step() } rtb_speed_trend_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_DataTypeConversion_ml) { + if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_DataTypeConversion_kr) { rtb_v_3_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); } else { rtb_v_3_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); } - if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_y_pg) { + if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_BusAssignment_f_flight_envelope_v_4_visible) { rtb_v_4_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); } else { rtb_v_4_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); } - if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_Memory) { + if (rtb_BusAssignment_h_logic_speed_scale_visible && (rtb_Switch_i_idx_0 == + FacComputer_P.CompareToConstant_const_k)) { rtb_v_man_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); } else { rtb_v_man_kn_SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); } - rtb_y_c = static_cast(FacComputer_P.EnumeratedConstant1_Value); - if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_DataTypeConversion_he) { - rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant1_Value); + FacComputer_Y.out.bus_outputs.v_max_kn.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); + if (rtb_BusAssignment_h_logic_speed_scale_visible && rtb_AND1_f) { + FacComputer_Y.out.bus_outputs.v_fe_next_kn.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); } else { - rtb_alpha_floor_inhib = static_cast(FacComputer_P.EnumeratedConstant_Value); + FacComputer_Y.out.bus_outputs.v_fe_next_kn.SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); } } @@ -1170,7 +1119,7 @@ void FacComputer::step() rtb_VectorConcatenate[16] = FacComputer_P.Constant18_Value; rtb_VectorConcatenate[17] = FacComputer_P.Constant18_Value; rtb_VectorConcatenate[18] = FacComputer_P.Constant18_Value; - FacComputer_MATLABFunction_g(rtb_VectorConcatenate, &rtb_y_hz); + FacComputer_MATLABFunction_g3(rtb_VectorConcatenate, &rtb_y_hb); rtb_VectorConcatenate[0] = FacComputer_P.Constant9_Value; rtb_VectorConcatenate[1] = FacComputer_P.Constant9_Value; rtb_VectorConcatenate[2] = FacComputer_P.Constant9_Value; @@ -1190,43 +1139,49 @@ void FacComputer::step() rtb_VectorConcatenate[16] = FacComputer_P.Constant9_Value; rtb_VectorConcatenate[17] = FacComputer_P.Constant9_Value; rtb_VectorConcatenate[18] = FacComputer_P.Constant9_Value; - FacComputer_MATLABFunction_g(rtb_VectorConcatenate, &rtb_y_d); - rtb_VectorConcatenate[0] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[1] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[2] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[3] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[4] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[5] = rtb_BusAssignment_m_logic_lgciu_own_valid; - rtb_VectorConcatenate[6] = rtb_AND1; - rtb_VectorConcatenate[7] = rtb_y_j; - rtb_VectorConcatenate[8] = rtb_Switch_i_idx_1; - rtb_VectorConcatenate[9] = rtb_Switch_i_idx_2; - rtb_VectorConcatenate[10] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[11] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[12] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[13] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[14] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[15] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[16] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[17] = FacComputer_P.Constant19_Value; - rtb_VectorConcatenate[18] = (FacComputer_DWork.sAlphaFloor != 0.0); - FacComputer_MATLABFunction_g(rtb_VectorConcatenate, &rtb_y_b4); + FacComputer_MATLABFunction_g3(rtb_VectorConcatenate, &FacComputer_Y.out.bus_outputs.discrete_word_4.Data); + rtb_VectorConcatenate_i[0] = (rtb_Switch_i_idx_0 == 1.0F); + rtb_VectorConcatenate_i[1] = (rtb_Switch_i_idx_0 == 2.0F); + rtb_VectorConcatenate_i[2] = (rtb_Switch_i_idx_0 == 3.0F); + rtb_VectorConcatenate_i[3] = (rtb_Switch_i_idx_0 == 4.0F); + rtb_VectorConcatenate_i[4] = (rtb_Switch_i_idx_0 == 5.0F); + rtb_VectorConcatenate_i[5] = rtb_BusAssignment_logic_lgciu_own_valid; + rtb_VectorConcatenate_i[6] = rtb_AND1; + rtb_VectorConcatenate_i[7] = rtb_y_k5; + rtb_VectorConcatenate_i[8] = rtb_Switch_io_idx_1; + rtb_VectorConcatenate_i[9] = rtb_Switch_io_idx_2; + rtb_VectorConcatenate_i[10] = rtb_BusAssignment_m_logic_sfcc_own_valid; + rtb_VectorConcatenate_i[11] = rtb_AND1_d; + rtb_VectorConcatenate_i[12] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[13] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[14] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[15] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[16] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[17] = FacComputer_P.Constant19_Value; + rtb_VectorConcatenate_i[18] = (FacComputer_DWork.sAlphaFloor != 0.0); + FacComputer_MATLABFunction_g3(rtb_VectorConcatenate_i, &FacComputer_Y.out.bus_outputs.discrete_word_5.Data); FacComputer_Y.out.data = FacComputer_U.in; - FacComputer_Y.out.laws.yaw_damper_command_deg = rtb_Y_f; - FacComputer_Y.out.laws.rudder_trim_command_deg = rtb_Y_i; - FacComputer_Y.out.laws.rudder_travel_lim_command_deg = rtb_Y_d; - FacComputer_Y.out.logic.lgciu_own_valid = rtb_BusAssignment_m_logic_lgciu_own_valid; + FacComputer_Y.out.laws.yaw_damper_command_deg = rtb_Y_br; + FacComputer_Y.out.laws.rudder_trim_command_deg = rtb_Y_l; + FacComputer_Y.out.laws.rudder_travel_lim_command_deg = rtb_Y_g4; + FacComputer_Y.out.logic.lgciu_own_valid = rtb_BusAssignment_logic_lgciu_own_valid; FacComputer_Y.out.logic.all_lgciu_lost = rtb_AND1; - FacComputer_Y.out.logic.left_main_gear_pressed = rtb_y_j; - FacComputer_Y.out.logic.right_main_gear_pressed = rtb_Switch_i_idx_1; - FacComputer_Y.out.logic.main_gear_out = rtb_Switch_i_idx_2; + FacComputer_Y.out.logic.left_main_gear_pressed = rtb_y_k5; + FacComputer_Y.out.logic.right_main_gear_pressed = rtb_Switch_io_idx_1; + FacComputer_Y.out.logic.main_gear_out = rtb_Switch_io_idx_2; + FacComputer_Y.out.logic.sfcc_own_valid = rtb_BusAssignment_m_logic_sfcc_own_valid; + FacComputer_Y.out.logic.all_sfcc_lost = rtb_AND1_d; + FacComputer_Y.out.logic.flap_handle_index = rtb_Switch_i_idx_0; + FacComputer_Y.out.logic.flap_angle_deg = rtb_Switch_i_idx_1; + FacComputer_Y.out.logic.slat_angle_deg = rtb_Switch_i_idx_2; + FacComputer_Y.out.logic.slat_flap_actual_pos = rtb_Switch_i_idx_3; FacComputer_Y.out.logic.on_ground = rtb_BusAssignment_h_logic_on_ground; FacComputer_Y.out.logic.tracking_mode_on = (FacComputer_U.in.sim_data.slew_on || FacComputer_U.in.sim_data.pause_on || FacComputer_U.in.sim_data.tracking_mode_on_override); - FacComputer_Y.out.logic.double_self_detected_adr_failure = ((rtb_adrOwnInvalid && rtb_adrOppInvalid) || - (rtb_adrOwnInvalid && rtb_adr3Invalid) || (rtb_adrOppInvalid && rtb_adr3Invalid)); - FacComputer_Y.out.logic.double_self_detected_ir_failure = ((rtb_irOwnInvalid && rtb_irOppInvalid) || - (rtb_irOwnInvalid && rtb_ir3Invalid) || (rtb_irOppInvalid && rtb_ir3Invalid)); + FacComputer_Y.out.logic.double_self_detected_adr_failure = ((rtb_Memory && rtb_DataTypeConversion_gi) || (rtb_Memory + && rtb_DataTypeConversion_l5) || (rtb_DataTypeConversion_gi && rtb_DataTypeConversion_l5)); + FacComputer_Y.out.logic.double_self_detected_ir_failure = ((rtb_DataTypeConversion_o && rtb_DataTypeConversion_f5) || + (rtb_DataTypeConversion_o && rtb_DataTypeConversion_l3) || (rtb_DataTypeConversion_f5 && rtb_DataTypeConversion_l3)); FacComputer_Y.out.logic.double_not_self_detected_adr_failure = FacComputer_P.Constant_Value_h; FacComputer_Y.out.logic.double_not_self_detected_ir_failure = FacComputer_P.Constant_Value_h; FacComputer_Y.out.logic.adr_computation_data.V_ias_kn = rtb_V_ias; @@ -1252,11 +1207,11 @@ void FacComputer::step() FacComputer_Y.out.logic.rudder_trim_has_priority = rudderTrimHasPriority; FacComputer_Y.out.logic.rudder_travel_lim_engaged = rtb_rudderTravelLimEngaged; FacComputer_Y.out.logic.rudder_travel_lim_can_engage = rudderTravelLimCanEngage; - FacComputer_Y.out.logic.rudder_travel_lim_has_priority = yawDamperHasPriority_tmp; + FacComputer_Y.out.logic.rudder_travel_lim_has_priority = rudderTravelLimHasPriority; FacComputer_Y.out.logic.speed_scale_lost = FacComputer_P.Constant_Value_b5; FacComputer_Y.out.logic.speed_scale_visible = rtb_BusAssignment_h_logic_speed_scale_visible; - FacComputer_Y.out.flight_envelope.estimated_beta_deg = rtb_y_f5; - FacComputer_Y.out.flight_envelope.beta_target_deg = rtb_beDot; + FacComputer_Y.out.flight_envelope.estimated_beta_deg = Vcas; + FacComputer_Y.out.flight_envelope.beta_target_deg = rtb_beta; FacComputer_Y.out.flight_envelope.beta_target_visible = false; FacComputer_Y.out.flight_envelope.alpha_floor_condition = (FacComputer_DWork.sAlphaFloor != 0.0); FacComputer_Y.out.flight_envelope.alpha_filtered_deg = rtb_BusAssignment_d_flight_envelope_alpha_filtered_deg; @@ -1264,19 +1219,19 @@ void FacComputer::step() FacComputer_Y.out.flight_envelope.computed_cg_percent = FacComputer_U.in.bus_inputs.fmgc_own_bus.fm_cg_percent.Data; FacComputer_Y.out.flight_envelope.v_alpha_max_kn = rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn; FacComputer_Y.out.flight_envelope.v_alpha_prot_kn = rtb_Switch; - FacComputer_Y.out.flight_envelope.v_stall_warn_kn = rtb_BusAssignment_kv_flight_envelope_v_stall_warn_kn; - FacComputer_Y.out.flight_envelope.v_ls_kn = y_value; + FacComputer_Y.out.flight_envelope.v_stall_warn_kn = rtb_BusAssignment_dj_flight_envelope_v_stall_warn_kn; + FacComputer_Y.out.flight_envelope.v_ls_kn = rtb_Switch_b; FacComputer_Y.out.flight_envelope.v_stall_kn = rtb_BusAssignment_g5_flight_envelope_v_stall_kn; - FacComputer_Y.out.flight_envelope.v_3_kn = rtb_BusAssignment_g5_flight_envelope_v_3_kn; - FacComputer_Y.out.flight_envelope.v_3_visible = rtb_DataTypeConversion_ml; + FacComputer_Y.out.flight_envelope.v_3_kn = rtb_Switch1; + FacComputer_Y.out.flight_envelope.v_3_visible = rtb_DataTypeConversion_kr; FacComputer_Y.out.flight_envelope.v_4_kn = rtb_Switch4_f; - FacComputer_Y.out.flight_envelope.v_4_visible = rtb_y_pg; + FacComputer_Y.out.flight_envelope.v_4_visible = rtb_BusAssignment_f_flight_envelope_v_4_visible; FacComputer_Y.out.flight_envelope.v_man_kn = rtb_v_gd; - FacComputer_Y.out.flight_envelope.v_man_visible = rtb_Memory; - FacComputer_Y.out.flight_envelope.v_max_kn = rtb_Switch4_a_0; + FacComputer_Y.out.flight_envelope.v_man_visible = (rtb_Switch_i_idx_0 == FacComputer_P.CompareToConstant_const_k); + FacComputer_Y.out.flight_envelope.v_max_kn = rtb_Switch4_j; FacComputer_Y.out.flight_envelope.v_fe_next_kn = rtb_BusAssignment_f_flight_envelope_v_fe_next_kn; - FacComputer_Y.out.flight_envelope.v_fe_next_visible = rtb_DataTypeConversion_he; - FacComputer_Y.out.flight_envelope.v_c_trend_kn = rtb_Switch1_a; + FacComputer_Y.out.flight_envelope.v_fe_next_visible = rtb_AND1_f; + FacComputer_Y.out.flight_envelope.v_c_trend_kn = rtb_Switch_o; FacComputer_Y.out.discrete_outputs.fac_healthy = FacComputer_P.Constant2_Value_o; FacComputer_Y.out.discrete_outputs.yaw_damper_engaged = rtb_yawDamperEngaged; FacComputer_Y.out.discrete_outputs.rudder_trim_engaged = rtb_rudderTrimEngaged; @@ -1284,25 +1239,30 @@ void FacComputer::step() FacComputer_Y.out.discrete_outputs.rudder_travel_lim_emergency_reset = FacComputer_P.Constant1_Value_d; FacComputer_Y.out.discrete_outputs.yaw_damper_avail_for_norm_law = yawDamperCanEngage; if (rtb_yawDamperEngaged) { - FacComputer_Y.out.analog_outputs.yaw_damper_order_deg = rtb_Y_f; + FacComputer_Y.out.analog_outputs.yaw_damper_order_deg = rtb_Y_br; } else { FacComputer_Y.out.analog_outputs.yaw_damper_order_deg = FacComputer_P.Constant_Value_b; } if (rtb_rudderTrimEngaged) { - FacComputer_Y.out.analog_outputs.rudder_trim_order_deg = rtb_Y_i; + FacComputer_Y.out.analog_outputs.rudder_trim_order_deg = rtb_Y_l; } else { FacComputer_Y.out.analog_outputs.rudder_trim_order_deg = FacComputer_P.Constant_Value_b; } if (rtb_rudderTravelLimEngaged) { - FacComputer_Y.out.analog_outputs.rudder_travel_limit_order_deg = rtb_Y_d; + FacComputer_Y.out.analog_outputs.rudder_travel_limit_order_deg = rtb_Y_g4; } else { FacComputer_Y.out.analog_outputs.rudder_travel_limit_order_deg = FacComputer_P.Constant_Value_b; } - FacComputer_Y.out.bus_outputs.discrete_word_1.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.discrete_word_1.Data = rtb_y_f; + if (rtb_BusAssignment_m_logic_sfcc_own_valid) { + FacComputer_Y.out.bus_outputs.discrete_word_1.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); + } else { + FacComputer_Y.out.bus_outputs.discrete_word_1.SSM = static_cast(FacComputer_P.EnumeratedConstant_Value); + } + + FacComputer_Y.out.bus_outputs.discrete_word_1.Data = rtb_Switch_i_idx_3; FacComputer_Y.out.bus_outputs.gamma_a_deg.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); FacComputer_Y.out.bus_outputs.gamma_a_deg.Data = FacComputer_P.Constant28_Value; FacComputer_Y.out.bus_outputs.gamma_t_deg.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); @@ -1320,13 +1280,27 @@ void FacComputer::step() (FacComputer_P.EnumeratedConstant_Value); } - FacComputer_Y.out.bus_outputs.sideslip_target_deg.Data = static_cast(rtb_beDot); - FacComputer_Y.out.bus_outputs.fac_slat_angle_deg.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.fac_slat_angle_deg.Data = FacComputer_P.Constant2_Value_b; - FacComputer_Y.out.bus_outputs.fac_flap_angle.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.fac_flap_angle.Data = FacComputer_P.Constant1_Value_k; + FacComputer_Y.out.bus_outputs.sideslip_target_deg.Data = static_cast(rtb_beta); + if (rtb_BusAssignment_m_logic_sfcc_own_valid) { + FacComputer_Y.out.bus_outputs.fac_slat_angle_deg.SSM = static_cast + (FacComputer_P.EnumeratedConstant1_Value); + } else { + FacComputer_Y.out.bus_outputs.fac_slat_angle_deg.SSM = static_cast + (FacComputer_P.EnumeratedConstant_Value); + } + + FacComputer_Y.out.bus_outputs.fac_slat_angle_deg.Data = rtb_Switch_i_idx_2; + if (rtb_BusAssignment_m_logic_sfcc_own_valid) { + FacComputer_Y.out.bus_outputs.fac_flap_angle_deg.SSM = static_cast + (FacComputer_P.EnumeratedConstant1_Value); + } else { + FacComputer_Y.out.bus_outputs.fac_flap_angle_deg.SSM = static_cast + (FacComputer_P.EnumeratedConstant_Value); + } + + FacComputer_Y.out.bus_outputs.fac_flap_angle_deg.Data = rtb_Switch_i_idx_1; FacComputer_Y.out.bus_outputs.discrete_word_2.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.discrete_word_2.Data = rtb_y_h; + FacComputer_Y.out.bus_outputs.discrete_word_2.Data = rtb_y_na; FacComputer_Y.out.bus_outputs.rudder_travel_limit_command_deg.SSM = static_cast (FacComputer_P.EnumeratedConstant1_Value); FacComputer_Y.out.bus_outputs.rudder_travel_limit_command_deg.Data = static_cast @@ -1342,12 +1316,12 @@ void FacComputer::step() (FacComputer_P.EnumeratedConstant1_Value); } - FacComputer_Y.out.bus_outputs.estimated_sideslip_deg.Data = static_cast(rtb_y_f5); - FacComputer_Y.out.bus_outputs.v_alpha_lim_kn.SSM = static_cast(rtb_Switch4_a); + FacComputer_Y.out.bus_outputs.estimated_sideslip_deg.Data = static_cast(Vcas); + FacComputer_Y.out.bus_outputs.v_alpha_lim_kn.SSM = static_cast(rtb_alpha_floor_inhib); FacComputer_Y.out.bus_outputs.v_alpha_lim_kn.Data = static_cast (rtb_BusAssignment_f_flight_envelope_v_alpha_max_kn); FacComputer_Y.out.bus_outputs.v_ls_kn.SSM = static_cast(rtb_v_ls_kn_SSM); - FacComputer_Y.out.bus_outputs.v_ls_kn.Data = static_cast(y_value); + FacComputer_Y.out.bus_outputs.v_ls_kn.Data = static_cast(rtb_Switch_b); FacComputer_Y.out.bus_outputs.v_stall_kn.SSM = static_cast(rtb_v_stall_kn_SSM); FacComputer_Y.out.bus_outputs.v_stall_kn.Data = static_cast (rtb_BusAssignment_g5_flight_envelope_v_stall_kn); @@ -1355,35 +1329,31 @@ void FacComputer::step() FacComputer_Y.out.bus_outputs.v_alpha_prot_kn.Data = static_cast(rtb_Switch); FacComputer_Y.out.bus_outputs.v_stall_warn_kn.SSM = static_cast(rtb_v_stall_warn_kn_SSM); FacComputer_Y.out.bus_outputs.v_stall_warn_kn.Data = static_cast - (rtb_BusAssignment_kv_flight_envelope_v_stall_warn_kn); + (rtb_BusAssignment_dj_flight_envelope_v_stall_warn_kn); FacComputer_Y.out.bus_outputs.speed_trend_kn.SSM = static_cast(rtb_speed_trend_kn_SSM); - FacComputer_Y.out.bus_outputs.speed_trend_kn.Data = static_cast(rtb_Switch1_a); + FacComputer_Y.out.bus_outputs.speed_trend_kn.Data = static_cast(rtb_Switch_o); FacComputer_Y.out.bus_outputs.v_3_kn.SSM = static_cast(rtb_v_3_kn_SSM); - FacComputer_Y.out.bus_outputs.v_3_kn.Data = static_cast(rtb_BusAssignment_g5_flight_envelope_v_3_kn); + FacComputer_Y.out.bus_outputs.v_3_kn.Data = static_cast(rtb_Switch1); FacComputer_Y.out.bus_outputs.v_4_kn.SSM = static_cast(rtb_v_4_kn_SSM); FacComputer_Y.out.bus_outputs.v_4_kn.Data = static_cast(rtb_Switch4_f); FacComputer_Y.out.bus_outputs.v_man_kn.SSM = static_cast(rtb_v_man_kn_SSM); FacComputer_Y.out.bus_outputs.v_man_kn.Data = static_cast(rtb_v_gd); - FacComputer_Y.out.bus_outputs.v_max_kn.SSM = rtb_y_c; - FacComputer_Y.out.bus_outputs.v_max_kn.Data = static_cast(rtb_Switch4_a_0); - FacComputer_Y.out.bus_outputs.v_fe_next_kn.SSM = static_cast(rtb_alpha_floor_inhib); + FacComputer_Y.out.bus_outputs.v_max_kn.Data = static_cast(rtb_Switch4_j); FacComputer_Y.out.bus_outputs.v_fe_next_kn.Data = static_cast (rtb_BusAssignment_f_flight_envelope_v_fe_next_kn); FacComputer_Y.out.bus_outputs.discrete_word_3.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.discrete_word_3.Data = rtb_y_hz; + FacComputer_Y.out.bus_outputs.discrete_word_3.Data = rtb_y_hb; FacComputer_Y.out.bus_outputs.discrete_word_4.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.discrete_word_4.Data = rtb_y_d; FacComputer_Y.out.bus_outputs.discrete_word_5.SSM = static_cast(FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.discrete_word_5.Data = rtb_y_b4; FacComputer_Y.out.bus_outputs.delta_r_rudder_trim_deg.SSM = static_cast (FacComputer_P.EnumeratedConstant1_Value); - FacComputer_Y.out.bus_outputs.delta_r_rudder_trim_deg.Data = static_cast(rtb_Y_i); + FacComputer_Y.out.bus_outputs.delta_r_rudder_trim_deg.Data = static_cast(rtb_Y_l); FacComputer_Y.out.bus_outputs.rudder_trim_pos_deg.SSM = static_cast (FacComputer_P.EnumeratedConstant1_Value); FacComputer_Y.out.bus_outputs.rudder_trim_pos_deg.Data = static_cast (FacComputer_U.in.analog_inputs.rudder_trim_position_deg); - FacComputer_DWork.Delay_DSTATE = rtb_Gain_f; - FacComputer_DWork.Delay_DSTATE_d = rtb_Gain_a; + FacComputer_DWork.Delay_DSTATE = rtb_Gain; + FacComputer_DWork.Delay_DSTATE_d = rtb_Gain_n; FacComputer_DWork.icLoad = false; } else { FacComputer_DWork.Runtime_MODE = false; @@ -1410,6 +1380,4 @@ FacComputer::FacComputer(): { } -FacComputer::~FacComputer() -{ -} +FacComputer::~FacComputer() = default; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.h b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.h index dee0e46b216..3c32a95323b 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_FacComputer_h_ -#define RTW_HEADER_FacComputer_h_ +#ifndef FacComputer_h_ +#define FacComputer_h_ #include "rtwtypes.h" #include "FacComputer_types.h" @@ -58,20 +58,21 @@ class FacComputer final boolean_T previousInput; boolean_T previousInput_not_empty; boolean_T Runtime_MODE; - rtDW_MATLABFunction_FacComputer_f_T sf_MATLABFunction_ax; - rtDW_MATLABFunction_FacComputer_f_T sf_MATLABFunction_p4; + rtDW_MATLABFunction_FacComputer_f_T sf_MATLABFunction_jf; + rtDW_MATLABFunction_FacComputer_f_T sf_MATLABFunction_a; + rtDW_MATLABFunction_FacComputer_f_T sf_MATLABFunction_p; rtDW_RateLimiter_FacComputer_d_T sf_RateLimiter_fu; - rtDW_RateLimiter_FacComputer_d_T sf_RateLimiter_b; + rtDW_RateLimiter_FacComputer_d_T sf_RateLimiter_l; rtDW_RateLimiter_FacComputer_d_T sf_RateLimiter_p; rtDW_RateLimiter_FacComputer_b_T sf_RateLimiter_g0; rtDW_RateLimiter_FacComputer_b_T sf_RateLimiter_g; rtDW_RateLimiter_FacComputer_b_T sf_RateLimiter_f; rtDW_LagFilter_FacComputer_T sf_LagFilter_i; rtDW_LagFilter_FacComputer_T sf_LagFilter_c; - rtDW_LagFilter_FacComputer_g_T sf_LagFilter_d; + rtDW_LagFilter_FacComputer_g_T sf_LagFilter_d5; rtDW_LagFilter_FacComputer_T sf_LagFilter_f; rtDW_LagFilter_FacComputer_g_T sf_LagFilter_k; - rtDW_LagFilter_FacComputer_T sf_LagFilter_b; + rtDW_LagFilter_FacComputer_T sf_LagFilter_d; rtDW_RateLimiter_FacComputer_T sf_RateLimiter_a; rtDW_RateLimiter_FacComputer_T sf_RateLimiter_n; rtDW_RateLimiter_FacComputer_T sf_RateLimiter_j; @@ -89,17 +90,16 @@ class FacComputer final }; struct Parameters_FacComputer_T { - base_fac_logic_outputs fac_logic_output_MATLABStruct; base_fac_analog_outputs fac_analog_output_MATLABStruct; base_fac_laws_outputs fac_laws_output_MATLABStruct; base_fac_discrete_outputs fac_discrete_output_MATLABStruct; - real_T LagFilter_C1; real_T LagFilter1_C1; + real_T LagFilter1_C1_d; real_T LagFilter2_C1; real_T LagFilter3_C1; - real_T LagFilter_C1_f; + real_T LagFilter_C1; real_T LagFilter_C1_k; - real_T LagFilter_C1_fa; + real_T LagFilter_C1_f; real_T WashoutFilter_C1; real_T DiscreteDerivativeVariableTs_Gain; real_T DiscreteDerivativeVariableTs_Gain_l; @@ -111,49 +111,32 @@ class FacComputer final real_T RateLimiterGenericVariableTs_InitialCondition_o; real_T DiscreteTimeIntegratorVariableTs_LowerLimit; real_T DiscreteTimeIntegratorVariableTs_UpperLimit; - real_T BitfromLabel1_bit; - real_T BitfromLabel4_bit; - real_T BitfromLabel3_bit; - real_T BitfromLabel2_bit; real_T BitfromLabel_bit; real_T BitfromLabel5_bit; real_T BitfromLabel6_bit; real_T BitfromLabel7_bit; real_T BitfromLabel8_bit; - real_T BitfromLabel6_bit_m; - real_T BitfromLabel7_bit_i; - real_T BitfromLabel_bit_i; - real_T BitfromLabel1_bit_b; - real_T BitfromLabel2_bit_d; - real_T BitfromLabel3_bit_n; - real_T BitfromLabel4_bit_c; - real_T BitfromLabel5_bit_g; - real_T BitfromLabel9_bit; + real_T BitfromLabel1_bit; + real_T BitfromLabel4_bit; + real_T BitfromLabel3_bit; + real_T BitfromLabel2_bit; + real_T BitfromLabel1_bit_d; real_T BitfromLabel8_bit_i; - real_T BitfromLabel_bit_a; - real_T BitfromLabel1_bit_i; - real_T BitfromLabel2_bit_di; - real_T BitfromLabel3_bit_g; - real_T BitfromLabel4_bit_f; - real_T BitfromLabel5_bit_g3; - real_T BitfromLabel_bit_k; - real_T BitfromLabel1_bit_c; - real_T BitfromLabel2_bit_g; - real_T BitfromLabel3_bit_d; - real_T BitfromLabel4_bit_a; - real_T BitfromLabel5_bit_j; - real_T BitfromLabel_bit_b; - real_T BitfromLabel1_bit_ca; - real_T BitfromLabel2_bit_b; - real_T BitfromLabel3_bit_l; - real_T BitfromLabel4_bit_l; - real_T BitfromLabel5_bit_j4; - real_T BitfromLabel_bit_g; - real_T BitfromLabel1_bit_j; + real_T BitfromLabel9_bit; + real_T BitfromLabel10_bit; + real_T BitfromLabel11_bit; + real_T BitfromLabel12_bit; + real_T BitfromLabel_bit_m; real_T BitfromLabel2_bit_n; - real_T BitfromLabel3_bit_h; - real_T BitfromLabel4_bit_l5; - real_T BitfromLabel5_bit_c; + real_T BitfromLabel3_bit_i; + real_T BitfromLabel4_bit_p; + real_T BitfromLabel5_bit_g; + real_T BitfromLabel6_bit_n; + real_T BitfromLabel7_bit_p; + real_T BitfromLabel6_bit_m; + real_T BitfromLabel7_bit_i; + real_T BitfromLabel9_bit_l; + real_T BitfromLabel8_bit_ip; real_T BitfromLabel_bit_j; real_T BitfromLabel1_bit_e; real_T BitfromLabel_bit_c; @@ -176,10 +159,11 @@ class FacComputer final real_T RateLimiterGenericVariableTs1_lo_f; real_T RateLimiterGenericVariableTs_lo; real_T RateLimiterGenericVariableTs_lo_e; - real_T RateLimiterGenericVariableTs_lo_p; + real_T RateLimiterGenericVariableTs_lo_d; real_T RateLimiterGenericVariableTs_lo_f; - real_T RateLimiterGenericVariableTs_lo_pn; + real_T RateLimiterGenericVariableTs_lo_p; real_T ConfirmNode_timeDelay; + real_T ConfirmNode_timeDelay_m; real_T ConfirmNode_timeDelay_l; real_T RateLimiterGenericVariableTs1_up; real_T RateLimiterGenericVariableTs1_up_g; @@ -189,37 +173,40 @@ class FacComputer final real_T RateLimiterGenericVariableTs1_up_d; real_T RateLimiterGenericVariableTs_up; real_T RateLimiterGenericVariableTs_up_g; - real_T RateLimiterGenericVariableTs_up_e; + real_T RateLimiterGenericVariableTs_up_l; real_T RateLimiterGenericVariableTs_up_a; real_T RateLimiterGenericVariableTs_up_c; SignStatusMatrix EnumeratedConstant1_Value; - SignStatusMatrix EnumeratedConstant2_Value; SignStatusMatrix EnumeratedConstant_Value; + SignStatusMatrix EnumeratedConstant2_Value; real32_T CompareToConstant_const_f; real32_T CompareToConstant1_const_l; real32_T CompareToConstant2_const_i; boolean_T SRFlipFlop_initial_condition; boolean_T ConfirmNode_isRisingEdge; + boolean_T ConfirmNode_isRisingEdge_a; boolean_T ConfirmNode_isRisingEdge_o; boolean_T PulseNode_isRisingEdge; fac_outputs out_Y0; base_fac_bus Constant4_Value; base_fac_flight_envelope_outputs Constant5_Value; + base_fac_logic_outputs Constant1_Value; real_T Constant_Value; - real_T Constant_Value_n; real_T Constant2_Value; real_T Constant3_Value; - real_T Constant1_Value; + real_T Constant1_Value_e; real_T Constant_Value_l; real_T Constant1_Value_m; real_T Gain2_Gain; + real_T Constant2_Value_m; + real_T Saturation_UpperSat; + real_T Saturation_LowerSat; real_T Constant_Value_g; real_T Gain_Gain; real_T Saturation1_UpperSat; real_T Saturation1_LowerSat; - real_T Gain_Gain_h; - real_T Saturation_UpperSat; - real_T Saturation_LowerSat; + real_T Saturation_UpperSat_a; + real_T Saturation_LowerSat_l; real_T Gain5_Gain; real_T Saturation1_UpperSat_o; real_T Saturation1_LowerSat_n; @@ -287,13 +274,17 @@ class FacComputer final real_T Constant_Value_b; real_T Switch7_Threshold; real_T Switch6_Threshold; + real32_T Switch6_Threshold_n; + real32_T Constant2_Value_k; + real32_T Constant3_Value_d; + real32_T Constant6_Value; + real32_T Constant4_Value_j; + real32_T Constant1_Value_c; real32_T Gain4_Gain; real32_T Constant28_Value; real32_T Constant22_Value; real32_T Constant21_Value; real32_T Constant4_Value_b; - real32_T Constant2_Value_b; - real32_T Constant1_Value_k; real32_T Constant26_Value; uint32_T alphafloor_maxIndex[2]; uint32_T alphamax_maxIndex[2]; @@ -314,7 +305,6 @@ class FacComputer final boolean_T Logic_table[16]; boolean_T Constant2_Value_o; boolean_T Constant1_Value_d; - boolean_T Constant20_Value; boolean_T Constant10_Value; boolean_T Constant18_Value; boolean_T Constant9_Value; @@ -346,12 +336,10 @@ class FacComputer final D_Work_FacComputer_T FacComputer_DWork; static Parameters_FacComputer_T FacComputer_P; static void FacComputer_MATLABFunction(const base_arinc_429 *rtu_u, boolean_T *rty_y); - static void FacComputer_MATLABFunction_f(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y); + static void FacComputer_MATLABFunction_g(const base_arinc_429 *rtu_u, real_T rtu_bit, uint32_T *rty_y); static void FacComputer_LagFilter_Reset(rtDW_LagFilter_FacComputer_T *localDW); static void FacComputer_LagFilter(real_T rtu_U, real_T rtu_C1, real_T rtu_dt, real_T *rty_Y, rtDW_LagFilter_FacComputer_T *localDW); - static void FacComputer_MATLABFunction_d(boolean_T rtu_bit1, boolean_T rtu_bit2, boolean_T rtu_bit3, boolean_T - rtu_bit4, boolean_T rtu_bit5, boolean_T rtu_bit6, real_T *rty_handleIndex); static void FacComputer_RateLimiter_Reset(rtDW_RateLimiter_FacComputer_T *localDW); static void FacComputer_RateLimiter(real_T rtu_u, real_T rtu_up, real_T rtu_lo, real_T rtu_Ts, boolean_T rtu_reset, real_T *rty_Y, rtDW_RateLimiter_FacComputer_T *localDW); @@ -371,7 +359,7 @@ class FacComputer final static void FacComputer_MATLABFunction_i_Reset(rtDW_MATLABFunction_FacComputer_f_T *localDW); static void FacComputer_MATLABFunction_p(boolean_T rtu_u, real_T rtu_Ts, boolean_T rtu_isRisingEdge, real_T rtu_timeDelay, boolean_T *rty_y, rtDW_MATLABFunction_FacComputer_f_T *localDW); - static void FacComputer_MATLABFunction_g(const boolean_T rtu_u[19], real32_T *rty_y); + static void FacComputer_MATLABFunction_g3(const boolean_T rtu_u[19], real32_T *rty_y); }; #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_data.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_data.cpp index a01fb711acf..5e49873a9b3 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_data.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_data.cpp @@ -1,52 +1,6 @@ #include "FacComputer.h" FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ - { - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - - { - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - }, - - { - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - }, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - }, - { 0.0, 0.0, @@ -67,7 +21,7 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ false, false }, - 0.2, + 4.0, 0.5, 0.5, 0.5, @@ -85,48 +39,31 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ 0.0, -20.0, 20.0, - 16.0, - 18.0, - 19.0, - 20.0, 12.0, 13.0, 14.0, 11.0, 12.0, - 23.0, - 23.0, - 17.0, - 18.0, - 19.0, - 20.0, - 21.0, - 26.0, - 26.0, - 26.0, - 17.0, + 16.0, 18.0, 19.0, 20.0, 21.0, - 26.0, + 11.0, + 12.0, + 13.0, + 14.0, + 15.0, + 12.0, 17.0, 18.0, 19.0, 20.0, 21.0, 26.0, - 17.0, - 18.0, - 19.0, - 20.0, - 21.0, + 23.0, + 23.0, 26.0, - 17.0, - 18.0, - 19.0, - 20.0, - 21.0, 26.0, 26.0, 26.0, @@ -154,6 +91,7 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ -40.0, -1.0, 1.0, + 1.0, 10.0, 1.0, 1.0, @@ -167,13 +105,14 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ 40.0, 1.0, SignStatusMatrix::NormalOperation, - SignStatusMatrix::FailureWarning, SignStatusMatrix::NoComputedData, + SignStatusMatrix::FailureWarning, 35.0F, 80.0F, 80.0F, false, false, + false, true, true, @@ -1387,6 +1326,12 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ false, false, false, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + false, + false, false, false, false, @@ -1774,8 +1719,59 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ false, 0.0 }, + + { + false, + false, + false, + false, + false, + false, + false, + 0.0F, + 0.0F, + 0.0F, + 0.0F, + false, + false, + false, + false, + false, + false, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + + { + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + }, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + }, 200.0, - 0.0, 250.0, 340.0, 0.0, @@ -1783,10 +1779,12 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ 0.0, 0.066666666666666666, 0.0, + 1.7, + -1.7, + 0.0, 1.0, 5.0, -5.0, - 0.033333333333333333, 5.0, -5.0, 0.0302, @@ -1928,9 +1926,13 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ 0.0, 0.0, 0.0, - 0.1101F, + 200.0F, + 5.0F, + 40.0F, + 27.0F, 0.0F, 0.0F, + 0.1101F, 0.0F, 0.0F, 0.0F, @@ -1964,6 +1966,5 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{ false, false, false, - false, false }; diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_private.h b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_private.h index 794bda4217a..e599224b2ad 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_private.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_private.h @@ -1,5 +1,6 @@ -#ifndef RTW_HEADER_FacComputer_private_h_ -#define RTW_HEADER_FacComputer_private_h_ +#ifndef FacComputer_private_h_ +#define FacComputer_private_h_ #include "rtwtypes.h" +#include "FacComputer_types.h" #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_types.h b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_types.h index 53c02d535ac..21f11ac0531 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_types.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/FacComputer_types.h @@ -1,7 +1,6 @@ -#ifndef RTW_HEADER_FacComputer_types_h_ -#define RTW_HEADER_FacComputer_types_h_ +#ifndef FacComputer_types_h_ +#define FacComputer_types_h_ #include "rtwtypes.h" - #ifndef DEFINED_TYPEDEF_FOR_SignStatusMatrix_ #define DEFINED_TYPEDEF_FOR_SignStatusMatrix_ @@ -15,6 +14,81 @@ enum class SignStatusMatrix #endif +#ifndef DEFINED_TYPEDEF_FOR_base_arinc_429_ +#define DEFINED_TYPEDEF_FOR_base_arinc_429_ + +struct base_arinc_429 +{ + uint32_T SSM; + real32_T Data; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fac_bus_ +#define DEFINED_TYPEDEF_FOR_base_fac_bus_ + +struct base_fac_bus +{ + base_arinc_429 discrete_word_1; + base_arinc_429 gamma_a_deg; + base_arinc_429 gamma_t_deg; + base_arinc_429 total_weight_lbs; + base_arinc_429 center_of_gravity_pos_percent; + base_arinc_429 sideslip_target_deg; + base_arinc_429 fac_slat_angle_deg; + base_arinc_429 fac_flap_angle_deg; + base_arinc_429 discrete_word_2; + base_arinc_429 rudder_travel_limit_command_deg; + base_arinc_429 delta_r_yaw_damper_deg; + base_arinc_429 estimated_sideslip_deg; + base_arinc_429 v_alpha_lim_kn; + base_arinc_429 v_ls_kn; + base_arinc_429 v_stall_kn; + base_arinc_429 v_alpha_prot_kn; + base_arinc_429 v_stall_warn_kn; + base_arinc_429 speed_trend_kn; + base_arinc_429 v_3_kn; + base_arinc_429 v_4_kn; + base_arinc_429 v_man_kn; + base_arinc_429 v_max_kn; + base_arinc_429 v_fe_next_kn; + base_arinc_429 discrete_word_3; + base_arinc_429 discrete_word_4; + base_arinc_429 discrete_word_5; + base_arinc_429 delta_r_rudder_trim_deg; + base_arinc_429 rudder_trim_pos_deg; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fac_discrete_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fac_discrete_outputs_ + +struct base_fac_discrete_outputs +{ + boolean_T fac_healthy; + boolean_T yaw_damper_engaged; + boolean_T rudder_trim_engaged; + boolean_T rudder_travel_lim_engaged; + boolean_T rudder_travel_lim_emergency_reset; + boolean_T yaw_damper_avail_for_norm_law; +}; + +#endif + +#ifndef DEFINED_TYPEDEF_FOR_base_fac_analog_outputs_ +#define DEFINED_TYPEDEF_FOR_base_fac_analog_outputs_ + +struct base_fac_analog_outputs +{ + real_T yaw_damper_order_deg; + real_T rudder_trim_order_deg; + real_T rudder_travel_limit_order_deg; +}; + +#endif + #ifndef DEFINED_TYPEDEF_FOR_base_time_ #define DEFINED_TYPEDEF_FOR_base_time_ @@ -84,54 +158,6 @@ struct base_fac_analog_inputs #endif -#ifndef DEFINED_TYPEDEF_FOR_base_arinc_429_ -#define DEFINED_TYPEDEF_FOR_base_arinc_429_ - -struct base_arinc_429 -{ - uint32_T SSM; - real32_T Data; -}; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_base_fac_bus_ -#define DEFINED_TYPEDEF_FOR_base_fac_bus_ - -struct base_fac_bus -{ - base_arinc_429 discrete_word_1; - base_arinc_429 gamma_a_deg; - base_arinc_429 gamma_t_deg; - base_arinc_429 total_weight_lbs; - base_arinc_429 center_of_gravity_pos_percent; - base_arinc_429 sideslip_target_deg; - base_arinc_429 fac_slat_angle_deg; - base_arinc_429 fac_flap_angle; - base_arinc_429 discrete_word_2; - base_arinc_429 rudder_travel_limit_command_deg; - base_arinc_429 delta_r_yaw_damper_deg; - base_arinc_429 estimated_sideslip_deg; - base_arinc_429 v_alpha_lim_kn; - base_arinc_429 v_ls_kn; - base_arinc_429 v_stall_kn; - base_arinc_429 v_alpha_prot_kn; - base_arinc_429 v_stall_warn_kn; - base_arinc_429 speed_trend_kn; - base_arinc_429 v_3_kn; - base_arinc_429 v_4_kn; - base_arinc_429 v_man_kn; - base_arinc_429 v_max_kn; - base_arinc_429 v_fe_next_kn; - base_arinc_429 discrete_word_3; - base_arinc_429 discrete_word_4; - base_arinc_429 discrete_word_5; - base_arinc_429 delta_r_rudder_trim_deg; - base_arinc_429 rudder_trim_pos_deg; -}; - -#endif - #ifndef DEFINED_TYPEDEF_FOR_base_adr_bus_ #define DEFINED_TYPEDEF_FOR_base_adr_bus_ @@ -360,6 +386,12 @@ struct base_fac_logic_outputs boolean_T left_main_gear_pressed; boolean_T right_main_gear_pressed; boolean_T main_gear_out; + boolean_T sfcc_own_valid; + boolean_T all_sfcc_lost; + real32_T flap_handle_index; + real32_T flap_angle_deg; + real32_T slat_angle_deg; + real32_T slat_flap_actual_pos; boolean_T on_ground; boolean_T tracking_mode_on; boolean_T double_self_detected_adr_failure; @@ -414,33 +446,6 @@ struct base_fac_flight_envelope_outputs #endif -#ifndef DEFINED_TYPEDEF_FOR_base_fac_discrete_outputs_ -#define DEFINED_TYPEDEF_FOR_base_fac_discrete_outputs_ - -struct base_fac_discrete_outputs -{ - boolean_T fac_healthy; - boolean_T yaw_damper_engaged; - boolean_T rudder_trim_engaged; - boolean_T rudder_travel_lim_engaged; - boolean_T rudder_travel_lim_emergency_reset; - boolean_T yaw_damper_avail_for_norm_law; -}; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_base_fac_analog_outputs_ -#define DEFINED_TYPEDEF_FOR_base_fac_analog_outputs_ - -struct base_fac_analog_outputs -{ - real_T yaw_damper_order_deg; - real_T rudder_trim_order_deg; - real_T rudder_travel_limit_order_deg; -}; - -#endif - #ifndef DEFINED_TYPEDEF_FOR_fac_outputs_ #define DEFINED_TYPEDEF_FOR_fac_outputs_ @@ -455,85 +460,6 @@ struct fac_outputs base_fac_bus bus_outputs; }; -#endif - -#ifndef DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ -#define DEFINED_TYPEDEF_FOR_struct_2OohiAWrazWy5wDS5iisgF_ - -struct struct_2OohiAWrazWy5wDS5iisgF -{ - real_T SSM; - real_T Data; -}; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_struct_fAEsrEZhvvruiP1ICEwvRC_ -#define DEFINED_TYPEDEF_FOR_struct_fAEsrEZhvvruiP1ICEwvRC_ - -struct struct_fAEsrEZhvvruiP1ICEwvRC -{ - struct_2OohiAWrazWy5wDS5iisgF discrete_word_1; - struct_2OohiAWrazWy5wDS5iisgF gamma_a_deg; - struct_2OohiAWrazWy5wDS5iisgF gamma_t_deg; - struct_2OohiAWrazWy5wDS5iisgF total_weight_lbs; - struct_2OohiAWrazWy5wDS5iisgF center_of_gravity_pos_percent; - struct_2OohiAWrazWy5wDS5iisgF sideslip_target_deg; - struct_2OohiAWrazWy5wDS5iisgF fac_slat_angle_deg; - struct_2OohiAWrazWy5wDS5iisgF fac_flap_angle; - struct_2OohiAWrazWy5wDS5iisgF discrete_word_2; - struct_2OohiAWrazWy5wDS5iisgF rudder_travel_limit_command_deg; - struct_2OohiAWrazWy5wDS5iisgF delta_r_yaw_damper_deg; - struct_2OohiAWrazWy5wDS5iisgF estimated_sideslip_deg; - struct_2OohiAWrazWy5wDS5iisgF v_alpha_lim_kn; - struct_2OohiAWrazWy5wDS5iisgF v_ls_kn; - struct_2OohiAWrazWy5wDS5iisgF v_stall_kn; - struct_2OohiAWrazWy5wDS5iisgF v_alpha_prot_kn; - struct_2OohiAWrazWy5wDS5iisgF v_stall_warn_kn; - struct_2OohiAWrazWy5wDS5iisgF speed_trend_kn; - struct_2OohiAWrazWy5wDS5iisgF v_3_kn; - struct_2OohiAWrazWy5wDS5iisgF v_4_kn; - struct_2OohiAWrazWy5wDS5iisgF v_man_kn; - struct_2OohiAWrazWy5wDS5iisgF v_max_kn; - struct_2OohiAWrazWy5wDS5iisgF v_fe_next_kn; - struct_2OohiAWrazWy5wDS5iisgF discrete_word_3; - struct_2OohiAWrazWy5wDS5iisgF discrete_word_4; - struct_2OohiAWrazWy5wDS5iisgF discrete_word_5; - struct_2OohiAWrazWy5wDS5iisgF delta_r_rudder_trim_deg; - struct_2OohiAWrazWy5wDS5iisgF rudder_trim_pos_deg; -}; - -#endif - -#ifndef DEFINED_TYPEDEF_FOR_struct_NHciy9HFthvyJ1C8wWfWlB_ -#define DEFINED_TYPEDEF_FOR_struct_NHciy9HFthvyJ1C8wWfWlB_ - -struct struct_NHciy9HFthvyJ1C8wWfWlB -{ - real_T estimated_beta_deg; - real_T beta_target_deg; - boolean_T beta_target_visible; - boolean_T alpha_floor_condition; - real_T alpha_filtered_deg; - real_T computed_weight_lbs; - real_T computed_cg_percent; - real_T v_alpha_max_kn; - real_T v_alpha_prot_kn; - real_T v_stall_warn_kn; - real_T v_ls_kn; - real_T v_stall_kn; - real_T v_3_kn; - boolean_T v_3_visible; - real_T v_4_kn; - boolean_T v_4_visible; - real_T v_man_kn; - boolean_T v_man_visible; - real_T v_max_kn; - real_T v_fe_next_kn; - real_T v_fe_next_visible; - real_T v_c_trend_kn; -}; - #endif #endif diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.cpp index ce98d6491a6..1370b130410 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.cpp @@ -1,5 +1,5 @@ -#include "rtwtypes.h" #include "MultiWordIor.h" +#include "rtwtypes.h" void MultiWordIor(const uint32_T u1[], const uint32_T u2[], uint32_T y[], int32_T n) { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.h b/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.h index 48e346a0cf2..78b8899cc7a 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/MultiWordIor.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_MultiWordIor_h_ -#define RTW_HEADER_MultiWordIor_h_ +#ifndef MultiWordIor_h_ +#define MultiWordIor_h_ #include "rtwtypes.h" extern void MultiWordIor(const uint32_T u1[], const uint32_T u2[], uint32_T y[], int32_T n); diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.cpp index cf4666dd07a..afd78398e1e 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.cpp @@ -1,5 +1,5 @@ -#include "rtwtypes.h" #include "look1_binlxpw.h" +#include "rtwtypes.h" real_T look1_binlxpw(real_T u0, const real_T bp0[], const real_T table[], uint32_T maxIndex) { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.h index 49ba439a1c0..6281c9346ae 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/look1_binlxpw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_look1_binlxpw_h_ -#define RTW_HEADER_look1_binlxpw_h_ +#ifndef look1_binlxpw_h_ +#define look1_binlxpw_h_ #include "rtwtypes.h" extern real_T look1_binlxpw(real_T u0, const real_T bp0[], const real_T table[], uint32_T maxIndex); diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.cpp deleted file mode 100644 index cb83c6fa9ca..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "rtwtypes.h" -#include "look2_binlcpw.h" - -real_T look2_binlcpw(real_T u0, real_T u1, const real_T bp0[], const real_T bp1[], const real_T table[], const uint32_T - maxIndex[], uint32_T stride) -{ - real_T fractions[2]; - real_T frac; - real_T yL_0d0; - real_T yL_0d1; - uint32_T bpIndices[2]; - uint32_T bpIdx; - uint32_T iLeft; - uint32_T iRght; - if (u0 <= bp0[0U]) { - iLeft = 0U; - frac = 0.0; - } else if (u0 < bp0[maxIndex[0U]]) { - bpIdx = maxIndex[0U] >> 1U; - iLeft = 0U; - iRght = maxIndex[0U]; - while (iRght - iLeft > 1U) { - if (u0 < bp0[bpIdx]) { - iRght = bpIdx; - } else { - iLeft = bpIdx; - } - - bpIdx = (iRght + iLeft) >> 1U; - } - - frac = (u0 - bp0[iLeft]) / (bp0[iLeft + 1U] - bp0[iLeft]); - } else { - iLeft = maxIndex[0U] - 1U; - frac = 1.0; - } - - fractions[0U] = frac; - bpIndices[0U] = iLeft; - if (u1 <= bp1[0U]) { - iLeft = 0U; - frac = 0.0; - } else if (u1 < bp1[maxIndex[1U]]) { - bpIdx = maxIndex[1U] >> 1U; - iLeft = 0U; - iRght = maxIndex[1U]; - while (iRght - iLeft > 1U) { - if (u1 < bp1[bpIdx]) { - iRght = bpIdx; - } else { - iLeft = bpIdx; - } - - bpIdx = (iRght + iLeft) >> 1U; - } - - frac = (u1 - bp1[iLeft]) / (bp1[iLeft + 1U] - bp1[iLeft]); - } else { - iLeft = maxIndex[1U] - 1U; - frac = 1.0; - } - - bpIdx = iLeft * stride + bpIndices[0U]; - yL_0d0 = table[bpIdx]; - yL_0d0 += (table[bpIdx + 1U] - yL_0d0) * fractions[0U]; - bpIdx += stride; - yL_0d1 = table[bpIdx]; - return (((table[bpIdx + 1U] - yL_0d1) * fractions[0U] + yL_0d1) - yL_0d0) * frac + yL_0d0; -} diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.h deleted file mode 100644 index f4da7baf515..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlcpw.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RTW_HEADER_look2_binlcpw_h_ -#define RTW_HEADER_look2_binlcpw_h_ -#include "rtwtypes.h" - -extern real_T look2_binlcpw(real_T u0, real_T u1, const real_T bp0[], const real_T bp1[], const real_T table[], const - uint32_T maxIndex[], uint32_T stride); - -#endif - diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.cpp index 10d1500d6c9..5ff8aaf1c94 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.cpp @@ -1,5 +1,5 @@ -#include "rtwtypes.h" #include "look2_binlxpw.h" +#include "rtwtypes.h" real_T look2_binlxpw(real_T u0, real_T u1, const real_T bp0[], const real_T bp1[], const real_T table[], const uint32_T maxIndex[], uint32_T stride) diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.h index 9b38d8b28df..1ccbd48f07e 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_binlxpw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_look2_binlxpw_h_ -#define RTW_HEADER_look2_binlxpw_h_ +#ifndef look2_binlxpw_h_ +#define look2_binlxpw_h_ #include "rtwtypes.h" extern real_T look2_binlxpw(real_T u0, real_T u1, const real_T bp0[], const real_T bp1[], const real_T table[], const diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_pbinlxpw.h b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_pbinlxpw.h index 88e1c526822..7b297d3c7f9 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/look2_pbinlxpw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/look2_pbinlxpw.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_look2_pbinlxpw_h_ -#define RTW_HEADER_look2_pbinlxpw_h_ +#ifndef look2_pbinlxpw_h_ +#define look2_pbinlxpw_h_ #include "rtwtypes.h" extern real_T look2_pbinlxpw(real_T u0, real_T u1, const real_T bp0[], const real_T bp1[], const real_T table[], diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.cpp deleted file mode 100644 index a4081d61bd0..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "rtwtypes.h" -#include "mod_2RcCQkwc.h" -#include - -real_T mod_2RcCQkwc(real_T x) -{ - real_T r; - if (x == 0.0) { - r = 0.0; - } else { - r = std::fmod(x, 360.0); - if (r == 0.0) { - r = 0.0; - } else if (x < 0.0) { - r += 360.0; - } - } - - return r; -} diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.h b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.h deleted file mode 100644 index 94ca3e7af80..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_2RcCQkwc.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef RTW_HEADER_mod_2RcCQkwc_h_ -#define RTW_HEADER_mod_2RcCQkwc_h_ -#include "rtwtypes.h" - -extern real_T mod_2RcCQkwc(real_T x); - -#endif - diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.cpp similarity index 71% rename from fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.cpp rename to fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.cpp index 860c4df0ff2..b1629e45df4 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.cpp @@ -1,8 +1,8 @@ #include "rtwtypes.h" +#include "mod_OlzklkXq.h" #include -#include "mod_mvZvttxs.h" -real_T mod_mvZvttxs(real_T x) +real_T mod_OlzklkXq(real_T x) { real_T r; if (x == 0.0) { @@ -11,7 +11,7 @@ real_T mod_mvZvttxs(real_T x) r = std::fmod(x, 360.0); if (r == 0.0) { r = 0.0; - } else if (x < 0.0) { + } else if (r < 0.0) { r += 360.0; } } diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.h b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.h new file mode 100644 index 00000000000..2820aa670af --- /dev/null +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_OlzklkXq.h @@ -0,0 +1,8 @@ +#ifndef mod_OlzklkXq_h_ +#define mod_OlzklkXq_h_ +#include "rtwtypes.h" + +extern real_T mod_OlzklkXq(real_T x); + +#endif + diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.h b/fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.h deleted file mode 100644 index d62ce49ddca..00000000000 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/mod_mvZvttxs.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef RTW_HEADER_mod_mvZvttxs_h_ -#define RTW_HEADER_mod_mvZvttxs_h_ -#include "rtwtypes.h" - -extern real_T mod_mvZvttxs(real_T x); - -#endif - diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.cpp index 971c9ccb0d9..76772030c0e 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.cpp @@ -1,7 +1,7 @@ #include "rtwtypes.h" -#include -#include #include "rt_modd.h" +#include +#include real_T rt_modd(real_T u0, real_T u1) { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.h b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.h index eca4783670a..de7a1a33e70 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_modd.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_rt_modd_h_ -#define RTW_HEADER_rt_modd_h_ +#ifndef rt_modd_h_ +#define rt_modd_h_ #include "rtwtypes.h" extern real_T rt_modd(real_T u0, real_T u1); diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.cpp index 7763380cd9e..b2a657b0892 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.cpp @@ -1,7 +1,7 @@ #include "rtwtypes.h" -#include -#include #include "rt_remd.h" +#include +#include real_T rt_remd(real_T u0, real_T u1) { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.h b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.h index b4bc18fbaf0..666b3eddd05 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/rt_remd.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_rt_remd_h_ -#define RTW_HEADER_rt_remd_h_ +#ifndef rt_remd_h_ +#define rt_remd_h_ #include "rtwtypes.h" extern real_T rt_remd(real_T u0, real_T u1); diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.cpp b/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.cpp index f9fd20b23cf..b07e4e02e0d 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.cpp @@ -1,6 +1,6 @@ -#include "rtwtypes.h" -#include #include "uMultiWord2Double.h" +#include +#include "rtwtypes.h" real_T uMultiWord2Double(const uint32_T u1[], int32_T n1, int32_T e1) { diff --git a/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.h b/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.h index fefbe578ec4..3d16ea2ead2 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/uMultiWord2Double.h @@ -1,5 +1,5 @@ -#ifndef RTW_HEADER_uMultiWord2Double_h_ -#define RTW_HEADER_uMultiWord2Double_h_ +#ifndef uMultiWord2Double_h_ +#define uMultiWord2Double_h_ #include "rtwtypes.h" extern real_T uMultiWord2Double(const uint32_T u1[], int32_T n1, int32_T e1);