Skip to content

Commit

Permalink
fix(a380x): fixed strange behaviors in FBW computers (#9105)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1be7fd7)
  • Loading branch information
aguther authored and FoxtrotSierra6829 committed Oct 21, 2024
1 parent e04b280 commit 65eaab3
Show file tree
Hide file tree
Showing 19 changed files with 2,323 additions and 2,373 deletions.
1 change: 0 additions & 1 deletion fbw-a380x/src/wasm/fbw_a380/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ add_executable(flybywire-a380x-fbw
src/model/intrp3d_l_pw.cpp
src/model/look1_binlxpw.cpp
src/model/look2_binlxpw.cpp
src/model/look2_pbinlxpw.cpp
src/model/maximum_Abpa9SzA.cpp
src/model/mod_OlzklkXq.cpp
src/model/MultiWordIor.cpp
Expand Down
1 change: 0 additions & 1 deletion fbw-a380x/src/wasm/fbw_a380/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ clang++ \
"${DIR}/src/model/intrp3d_l_pw.cpp" \
"${DIR}/src/model/look1_binlxpw.cpp" \
"${DIR}/src/model/look2_binlxpw.cpp" \
"${DIR}/src/model/look2_pbinlxpw.cpp" \
"${DIR}/src/model/maximum_Abpa9SzA.cpp" \
"${DIR}/src/model/mod_OlzklkXq.cpp" \
"${DIR}/src/model/MultiWordIor.cpp" \
Expand Down
36 changes: 18 additions & 18 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_g = false;
A380LateralNormalLaw_DWork.pY_not_empty_m = false;
A380LateralNormalLaw_DWork.pY_not_empty_j = false;
A380LateralNormalLaw_DWork.pY_not_empty_a = 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);
Expand Down Expand Up @@ -598,20 +598,20 @@ 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_g) {
A380LateralNormalLaw_DWork.pY_f = A380LateralNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition;
A380LateralNormalLaw_DWork.pY_not_empty_g = true;
if (!A380LateralNormalLaw_DWork.pY_not_empty_j) {
A380LateralNormalLaw_DWork.pY_m = A380LateralNormalLaw_rtP.RateLimiterVariableTs2_InitialCondition;
A380LateralNormalLaw_DWork.pY_not_empty_j = true;
}

A380LateralNormalLaw_DWork.pY_f += std::fmax(std::fmin(static_cast<real_T>(*rtu_In_on_ground) -
A380LateralNormalLaw_DWork.pY_f, std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs2_up) * *rtu_In_time_dt),
A380LateralNormalLaw_DWork.pY_m += std::fmax(std::fmin(static_cast<real_T>(*rtu_In_on_ground) -
A380LateralNormalLaw_DWork.pY_m, std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs2_up) * *rtu_In_time_dt),
-std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs2_lo) * *rtu_In_time_dt);
if (A380LateralNormalLaw_DWork.pY_f > A380LateralNormalLaw_rtP.Saturation_UpperSat_l) {
if (A380LateralNormalLaw_DWork.pY_m > A380LateralNormalLaw_rtP.Saturation_UpperSat_l) {
rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_UpperSat_l;
} else if (A380LateralNormalLaw_DWork.pY_f < A380LateralNormalLaw_rtP.Saturation_LowerSat_j) {
} else if (A380LateralNormalLaw_DWork.pY_m < A380LateralNormalLaw_rtP.Saturation_LowerSat_j) {
rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_LowerSat_j;
} else {
rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_f;
rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_m;
}

denom = (A380LateralNormalLaw_rtP.Constant_Value_o - rtb_Limiterxi) * A380LateralNormalLaw_DWork.Delay_DSTATE;
Expand All @@ -637,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_m) {
A380LateralNormalLaw_DWork.pY_f5 = A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_m;
A380LateralNormalLaw_DWork.pY_not_empty_m = true;
if (!A380LateralNormalLaw_DWork.pY_not_empty_a) {
A380LateralNormalLaw_DWork.pY_a = A380LateralNormalLaw_rtP.RateLimiterVariableTs1_InitialCondition_m;
A380LateralNormalLaw_DWork.pY_not_empty_a = true;
}

A380LateralNormalLaw_DWork.pY_f5 += std::fmax(std::fmin(static_cast<real_T>(rtb_NOT_h_tmp) -
A380LateralNormalLaw_DWork.pY_f5, std::abs(A380LateralNormalLaw_rtP.RateLimiterVariableTs1_up_j) * *rtu_In_time_dt),
A380LateralNormalLaw_DWork.pY_a += std::fmax(std::fmin(static_cast<real_T>(rtb_NOT_h_tmp) -
A380LateralNormalLaw_DWork.pY_a, 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_f5 > A380LateralNormalLaw_rtP.Saturation_UpperSat_n) {
if (A380LateralNormalLaw_DWork.pY_a > A380LateralNormalLaw_rtP.Saturation_UpperSat_n) {
rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_UpperSat_n;
} else if (A380LateralNormalLaw_DWork.pY_f5 < A380LateralNormalLaw_rtP.Saturation_LowerSat_b) {
} else if (A380LateralNormalLaw_DWork.pY_a < A380LateralNormalLaw_rtP.Saturation_LowerSat_b) {
rtb_Limiterxi = A380LateralNormalLaw_rtP.Saturation_LowerSat_b;
} else {
rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_f5;
rtb_Limiterxi = A380LateralNormalLaw_DWork.pY_a;
}

Vtas = A380LateralNormalLaw_DWork.Delay_DSTATE * rtb_Limiterxi;
Expand Down
8 changes: 4 additions & 4 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class A380LateralNormalLaw final
real_T Delay_DSTATE_o;
real_T pY;
real_T pU;
real_T pY_f;
real_T pY_f5;
real_T pY_m;
real_T pY_a;
boolean_T icLoad;
boolean_T pY_not_empty;
boolean_T pU_not_empty;
boolean_T pY_not_empty_g;
boolean_T pY_not_empty_m;
boolean_T pY_not_empty_j;
boolean_T pY_not_empty_a;
rtDW_TransportDelay_A380LateralNormalLaw_T sf_TransportDelay_p;
rtDW_TransportDelay_A380LateralNormalLaw_T sf_TransportDelay;
rtDW_RateLimiter_A380LateralNormalLaw_T sf_RateLimiter_go;
Expand Down
Loading

0 comments on commit 65eaab3

Please sign in to comment.