Skip to content

Commit

Permalink
PRIM: New alpha prot/max LUTs
Browse files Browse the repository at this point in the history
  • Loading branch information
flogross89 committed Jan 2, 2025
1 parent a8ea288 commit 287cd2e
Show file tree
Hide file tree
Showing 7 changed files with 628 additions and 738 deletions.
13 changes: 5 additions & 8 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralDirectLaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,16 @@ void A380LateralDirectLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_
*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)
{
real_T rtb_Gain1;
*rty_Out_xi_spoiler_deg = A380LateralDirectLaw_rtP.Constant_Value;
rtb_Gain1 = A380LateralDirectLaw_rtP.Gain1_Gain * *rtu_In_delta_xi_pos;
A380LateralDirectLaw_RateLimiter(rtb_Gain1, A380LateralDirectLaw_rtP.RateLimiterVariableTs_up,
A380LateralDirectLaw_rtP.RateLimiterVariableTs_lo, rtu_In_time_dt,
A380LateralDirectLaw_RateLimiter(A380LateralDirectLaw_rtP.Gain1_Gain * *rtu_In_delta_xi_pos,
A380LateralDirectLaw_rtP.RateLimiterVariableTs_up, A380LateralDirectLaw_rtP.RateLimiterVariableTs_lo, rtu_In_time_dt,
A380LateralDirectLaw_rtP.RateLimiterVariableTs_InitialCondition, rty_Out_xi_outboard_deg,
&A380LateralDirectLaw_DWork.sf_RateLimiter);
*rty_Out_xi_inboard_deg = *rty_Out_xi_outboard_deg;
*rty_Out_xi_midboard_deg = *rty_Out_xi_outboard_deg;
rtb_Gain1 = A380LateralDirectLaw_rtP.Gain2_Gain * *rtu_In_delta_zeta_pos;
A380LateralDirectLaw_RateLimiter(rtb_Gain1, A380LateralDirectLaw_rtP.RateLimiterVariableTs1_up,
A380LateralDirectLaw_rtP.RateLimiterVariableTs1_lo, rtu_In_time_dt,
A380LateralDirectLaw_rtP.RateLimiterVariableTs1_InitialCondition, rty_Out_zeta_lower_deg,
A380LateralDirectLaw_RateLimiter(A380LateralDirectLaw_rtP.Gain2_Gain * *rtu_In_delta_zeta_pos,
A380LateralDirectLaw_rtP.RateLimiterVariableTs1_up, A380LateralDirectLaw_rtP.RateLimiterVariableTs1_lo,
rtu_In_time_dt, A380LateralDirectLaw_rtP.RateLimiterVariableTs1_InitialCondition, rty_Out_zeta_lower_deg,
&A380LateralDirectLaw_DWork.sf_RateLimiter_n);
*rty_Out_zeta_upper_deg = *rty_Out_zeta_lower_deg;
}
Expand Down
178 changes: 82 additions & 96 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380LateralNormalLaw.cpp

Large diffs are not rendered by default.

249 changes: 112 additions & 137 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchAlternateLaw.cpp

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchDirectLaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ void A380PitchDirectLaw::reset(void)
void A380PitchDirectLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In_delta_eta_pos, real_T *rty_Out_eta_deg,
real_T *rty_Out_eta_trim_dot_deg_s, real_T *rty_Out_eta_trim_limit_lo, real_T *rty_Out_eta_trim_limit_up)
{
real_T rtb_Gain;
real_T u0;
*rty_Out_eta_trim_dot_deg_s = A380PitchDirectLaw_rtP.Constant_Value;
*rty_Out_eta_trim_limit_up = A380PitchDirectLaw_rtP.Constant2_Value;
*rty_Out_eta_trim_limit_lo = A380PitchDirectLaw_rtP.Constant3_Value;
rtb_Gain = A380PitchDirectLaw_rtP.Gain_Gain * *rtu_In_delta_eta_pos;
if (!A380PitchDirectLaw_DWork.pY_not_empty) {
A380PitchDirectLaw_DWork.pY = A380PitchDirectLaw_rtP.RateLimitereta_InitialCondition;
A380PitchDirectLaw_DWork.pY_not_empty = true;
}

if (rtb_Gain > A380PitchDirectLaw_rtP.Saturation_UpperSat) {
rtb_Gain = A380PitchDirectLaw_rtP.Saturation_UpperSat;
} else if (rtb_Gain < A380PitchDirectLaw_rtP.Saturation_LowerSat) {
rtb_Gain = A380PitchDirectLaw_rtP.Saturation_LowerSat;
u0 = A380PitchDirectLaw_rtP.Gain_Gain * *rtu_In_delta_eta_pos;
if (u0 > A380PitchDirectLaw_rtP.Saturation_UpperSat) {
u0 = A380PitchDirectLaw_rtP.Saturation_UpperSat;
} else if (u0 < A380PitchDirectLaw_rtP.Saturation_LowerSat) {
u0 = A380PitchDirectLaw_rtP.Saturation_LowerSat;
}

A380PitchDirectLaw_DWork.pY += std::fmax(std::fmin(rtb_Gain - A380PitchDirectLaw_DWork.pY, std::abs
A380PitchDirectLaw_DWork.pY += std::fmax(std::fmin(u0 - A380PitchDirectLaw_DWork.pY, std::abs
(A380PitchDirectLaw_rtP.RateLimitereta_up) * *rtu_In_time_dt), -std::abs(A380PitchDirectLaw_rtP.RateLimitereta_lo) *
*rtu_In_time_dt);
*rty_Out_eta_deg = A380PitchDirectLaw_DWork.pY;
Expand Down
Loading

0 comments on commit 287cd2e

Please sign in to comment.