Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FAC to use new buffet margin #78

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 28 additions & 43 deletions hdw-a339x/src/wasm/fbw_a320/src/model/FacComputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "rt_remd.h"
#include "look2_binlxpw.h"
#include "look1_binlxpw.h"
#include "look2_pbinlxpw.h"
#include "plook_binx.h"
#include "intrp3d_l_pw.h"

Expand Down Expand Up @@ -835,42 +834,29 @@ void FacComputer::step()
}

if (rtb_alt >= FacComputer_P.CompareToConstant_const) {
if (rtb_alt >= FacComputer_P.CompareToConstant1_const) {
u0 = FacComputer_P.Gain1_Gain * rtb_alt;
if (u0 > FacComputer_P.Saturation1_UpperSat) {
u0 = FacComputer_P.Saturation1_UpperSat;
} else if (u0 < FacComputer_P.Saturation1_LowerSat) {
u0 = FacComputer_P.Saturation1_LowerSat;
}

bpIndices[0U] = plook_binx(u0, FacComputer_P.uDLookupTable_bp01Data, 7U, &absx);
fractions[0U] = absx;
bpIndices[1U] = plook_binx(static_cast<real_T>(rtb_DataTypeConversion2), FacComputer_P.uDLookupTable_bp02Data,
5U, &absx);
fractions[1U] = absx;
u0 = 1.0 / rtb_Switch1_a;
if (u0 > FacComputer_P.Saturation3_UpperSat) {
u0 = FacComputer_P.Saturation3_UpperSat;
} else if (u0 < FacComputer_P.Saturation3_LowerSat) {
u0 = FacComputer_P.Saturation3_LowerSat;
}

bpIndices[2U] = plook_binx(u0, FacComputer_P.uDLookupTable_bp03Data, 2U, &absx);
fractions[2U] = absx;
rtb_Switch1_a = intrp3d_l_pw(bpIndices, fractions, FacComputer_P.uDLookupTable_tableData,
FacComputer_P.uDLookupTable_dimSizes);
} else {
u0 = FacComputer_P.Gain_Gain * rtb_alt;
if (u0 > FacComputer_P.Saturation2_UpperSat) {
u0 = FacComputer_P.Saturation2_UpperSat;
} else if (u0 < FacComputer_P.Saturation2_LowerSat) {
u0 = FacComputer_P.Saturation2_LowerSat;
}
bpIndices[0U] = plook_binx(static_cast<real_T>(rtb_DataTypeConversion2), FacComputer_P.uDLookupTable_bp01Data, 5U,
&absx);
fractions[0U] = absx;
u0 = FacComputer_P.Gain_Gain * rtb_alt;
if (u0 > FacComputer_P.Saturation2_UpperSat) {
u0 = FacComputer_P.Saturation2_UpperSat;
} else if (u0 < FacComputer_P.Saturation2_LowerSat) {
u0 = FacComputer_P.Saturation2_LowerSat;
}

rtb_Switch1_a = look2_pbinlxpw(rtb_DataTypeConversion2 / 2205.0, u0, FacComputer_P.uDLookupTable1_bp01Data,
FacComputer_P.uDLookupTable1_bp02Data, FacComputer_P.uDLookupTable1_tableData, FacComputer_DWork.m_bpIndex,
FacComputer_P.uDLookupTable1_maxIndex, 9U);
bpIndices[1U] = plook_binx(u0, FacComputer_P.uDLookupTable_bp02Data, 7U, &absx);
fractions[1U] = absx;
u0 = 1.0 / rtb_Switch1_a;
if (u0 > FacComputer_P.Saturation3_UpperSat) {
u0 = FacComputer_P.Saturation3_UpperSat;
} else if (u0 < FacComputer_P.Saturation3_LowerSat) {
u0 = FacComputer_P.Saturation3_LowerSat;
}

bpIndices[2U] = plook_binx(u0, FacComputer_P.uDLookupTable_bp03Data, 2U, &absx);
fractions[2U] = absx;
rtb_Switch1_a = intrp3d_l_pw(bpIndices, fractions, FacComputer_P.uDLookupTable_tableData,
FacComputer_P.uDLookupTable_dimSizes);
} else {
rtb_Switch1_a = FacComputer_P.Constant_Value_l;
}
Expand Down Expand Up @@ -907,7 +893,7 @@ void FacComputer::step()
FacComputer_P.uDLookupTable6_tableData, 5U), look1_binlxpw(FacComputer_P.Constant_Value_k,
FacComputer_P.uDLookupTable5_bp01Data, FacComputer_P.uDLookupTable5_tableData, 5U), static_cast<real_T>
(rtb_DataTypeConversion2), &rtb_Switch1_a);
rtb_BusAssignment_g5_flight_envelope_v_3_kn = std::fmax(FacComputer_P.Gain1_Gain_l * rtb_Switch1_a,
rtb_BusAssignment_g5_flight_envelope_v_3_kn = 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;
FacComputer_MATLABFunction2(look1_binlxpw(FacComputer_P.Constant1_Value_h, FacComputer_P.uDLookupTable8_bp01Data,
Expand Down Expand Up @@ -935,8 +921,7 @@ void FacComputer::step()
FacComputer_P.BitfromLabel5_bit_j4, &rtb_y_c);
FacComputer_MATLABFunction_d(rtb_Memory, rtb_y_i, rtb_DataTypeConversion_ml, rtb_OR1, rtb_DataTypeConversion_kr,
rtb_y_c != 0U, &rtb_Y_d);
rtb_y_i = ((rtb_Y_d == FacComputer_P.CompareToConstant3_const) || (rtb_Y_d ==
FacComputer_P.CompareToConstant1_const_n));
rtb_y_i = ((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_DataTypeConversion_ml = ((rtb_Y_d == FacComputer_P.CompareToConstant4_const) || (rtb_Y_d ==
Expand All @@ -961,7 +946,7 @@ void FacComputer::step()
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_p, FacComputer_P.uDLookupTable1_tableData_o, 5U);
FacComputer_P.uDLookupTable1_bp01Data, FacComputer_P.uDLookupTable1_tableData, 5U);
rtb_DataTypeConversion_he = ((rtb_Switch1_a < FacComputer_P.CompareToConstant_const_i) && (rtb_alt <=
FacComputer_P.CompareToConstant1_const_i));
if (rtb_Switch_i_idx_2) {
Expand Down Expand Up @@ -1087,10 +1072,10 @@ void FacComputer::step()
}
} else {
rtb_Y_d = FacComputer_P.Gain_Gain_p * FacComputer_DWork.pY;
if (rtb_Y_d > FacComputer_P.Saturation1_UpperSat_e) {
rtb_Y_d = FacComputer_P.Saturation1_UpperSat_e;
} else if (rtb_Y_d < FacComputer_P.Saturation1_LowerSat_c) {
rtb_Y_d = FacComputer_P.Saturation1_LowerSat_c;
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;
}
}

Expand Down
31 changes: 11 additions & 20 deletions hdw-a339x/src/wasm/fbw_a320/src/model/FacComputer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ class FacComputer final
real_T pU;
real_T takeoff_config;
real_T sAlphaFloor;
uint32_T m_bpIndex[2];
uint8_T is_active_c15_FacComputer;
uint8_T is_c15_FacComputer;
uint8_T is_active_c15_FacComputer;
boolean_T Memory_PreviousInput;
boolean_T icLoad;
boolean_T pY_not_empty;
Expand Down Expand Up @@ -160,12 +159,11 @@ class FacComputer final
real_T BitfromLabel1_bit_n;
real_T BitfromLabel3_bit_k;
real_T BitfromLabel4_bit_k;
real_T CompareToConstant1_const;
real_T CompareToConstant_const;
real_T CompareToConstant4_const;
real_T CompareToConstant2_const;
real_T CompareToConstant3_const;
real_T CompareToConstant1_const_n;
real_T CompareToConstant1_const;
real_T CompareToConstant_const_k;
real_T CompareToConstant_const_i;
real_T CompareToConstant1_const_i;
Expand Down Expand Up @@ -213,26 +211,20 @@ class FacComputer final
real_T Constant1_Value;
real_T Saturation3_UpperSat;
real_T Saturation3_LowerSat;
real_T Gain1_Gain;
real_T Saturation1_UpperSat;
real_T Saturation1_LowerSat;
real_T uDLookupTable_tableData[144];
real_T uDLookupTable_bp01Data[8];
real_T uDLookupTable_bp02Data[6];
real_T uDLookupTable_bp03Data[3];
real_T Gain_Gain;
real_T Saturation2_UpperSat;
real_T Saturation2_LowerSat;
real_T uDLookupTable1_tableData[45];
real_T uDLookupTable1_bp01Data[9];
real_T uDLookupTable1_bp02Data[5];
real_T uDLookupTable_tableData[144];
real_T uDLookupTable_bp01Data[6];
real_T uDLookupTable_bp02Data[8];
real_T uDLookupTable_bp03Data[3];
real_T Constant_Value_l;
real_T Constant1_Value_m;
real_T Gain2_Gain;
real_T Constant_Value_g;
real_T Gain_Gain_p;
real_T Saturation1_UpperSat_e;
real_T Saturation1_LowerSat_c;
real_T Saturation1_UpperSat;
real_T Saturation1_LowerSat;
real_T Gain_Gain_h;
real_T Saturation_UpperSat;
real_T Saturation_LowerSat;
Expand Down Expand Up @@ -270,16 +262,16 @@ class FacComputer final
real_T uDLookupTable5_bp01Data[6];
real_T uDLookupTable6_tableData[6];
real_T uDLookupTable6_bp01Data[6];
real_T Gain1_Gain_l;
real_T Gain1_Gain;
real_T Bias2_Bias;
real_T Constant1_Value_h;
real_T uDLookupTable7_tableData[6];
real_T uDLookupTable7_bp01Data[6];
real_T uDLookupTable8_tableData[6];
real_T uDLookupTable8_bp01Data[6];
real_T Gain_Gain_o;
real_T uDLookupTable1_tableData_o[6];
real_T uDLookupTable1_bp01Data_p[6];
real_T uDLookupTable1_tableData[6];
real_T uDLookupTable1_bp01Data[6];
real_T uDLookupTable_tableData_a[6];
real_T uDLookupTable_bp01Data_a[6];
real_T Constant1_Value_p;
Expand All @@ -305,7 +297,6 @@ class FacComputer final
real32_T Constant26_Value;
uint32_T uDLookupTable_maxIndex[3];
uint32_T uDLookupTable_dimSizes[3];
uint32_T uDLookupTable1_maxIndex[2];
uint32_T alphafloor_maxIndex[2];
uint32_T alphamax_maxIndex[2];
uint32_T alphaprotection_maxIndex[2];
Expand Down
58 changes: 20 additions & 38 deletions hdw-a339x/src/wasm/fbw_a320/src/model/FacComputer_data.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "FacComputer.h"

FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{

{
false,
false,
Expand Down Expand Up @@ -47,18 +48,21 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{
false
},


{
0.0,
0.0,
0.0
},


{
0.0,
0.0,
0.0
},


{
false,
false,
Expand Down Expand Up @@ -202,9 +206,7 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{

26.0,

29000.0,

12000.0,
15000.0,

3.0,

Expand Down Expand Up @@ -1905,47 +1907,30 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{

0.01,

415.0,
410.0,

290.0,
150.0,


{ 141.0, 145.0, 149.0, 154.0, 160.0, 163.0, 163.0, 166.0, 154.0, 158.0, 163.0, 169.0, 173.0, 175.0, 175.0, 179.0,
184.0, 189.0, 192.0, 195.0, 198.0, 201.0, 201.0, 202.0, 198.0, 201.0, 204.0, 207.0, 210.0, 211.0, 211.0, 211.0,
209.0, 212.0, 216.0, 219.0, 220.0, 220.0, 220.0, 219.0, 220.0, 223.0, 227.0, 229.0, 229.0, 228.0, 228.0, 233.0,
174.0, 181.0, 185.0, 188.0, 190.0, 194.0, 194.0, 196.0, 192.0, 196.0, 198.0, 201.0, 205.0, 207.0, 207.0, 207.0,
221.0, 225.0, 228.0, 230.0, 229.0, 229.0, 229.0, 238.0, 235.0, 238.0, 240.0, 240.0, 239.0, 240.0, 240.0, 238.0,
248.0, 250.0, 250.0, 249.0, 249.0, 240.0, 240.0, 238.0, 259.0, 260.0, 259.0, 259.0, 249.0, 240.0, 240.0, 238.0,
196.0, 200.0, 203.0, 203.0, 209.0, 210.0, 210.0, 210.0, 211.0, 214.0, 218.0, 246.0, 222.0, 221.0, 221.0, 221.0,
243.0, 246.0, 246.0, 256.0, 245.0, 240.0, 240.0, 238.0, 257.0, 257.0, 257.0, 259.0, 249.0, 240.0, 240.0, 238.0,
268.0, 267.0, 267.0, 259.0, 249.0, 240.0, 240.0, 238.0, 278.0, 277.0, 283.0, 259.0, 249.0, 240.0, 240.0, 238.0 },
{ 141.0, 154.0, 184.0, 198.0, 209.0, 220.0, 145.0, 158.0, 189.0, 201.0, 212.0, 223.0, 149.0, 163.0, 192.0, 204.0,
216.0, 227.0, 154.0, 169.0, 195.0, 207.0, 219.0, 227.0, 160.0, 173.0, 198.0, 210.0, 220.0, 229.0, 163.0, 175.0,
201.0, 211.0, 220.0, 228.0, 166.0, 178.0, 202.0, 211.0, 220.0, 229.0, 166.0, 179.0, 202.0, 211.0, 219.0, 233.0,
174.0, 192.0, 221.0, 235.0, 248.0, 259.0, 181.0, 196.0, 225.0, 238.0, 250.0, 260.0, 185.0, 198.0, 228.0, 240.0,
250.0, 259.0, 188.0, 201.0, 230.0, 240.0, 249.0, 259.0, 190.0, 205.0, 229.0, 239.0, 249.0, 249.0, 194.0, 207.0,
229.0, 240.0, 240.0, 240.0, 196.0, 207.0, 230.0, 230.0, 230.0, 230.0, 196.0, 207.0, 238.0, 238.0, 238.0, 238.0,
196.0, 211.0, 243.0, 257.0, 268.0, 278.0, 200.0, 214.0, 246.0, 257.0, 267.0, 277.0, 203.0, 218.0, 246.0, 257.0,
267.0, 283.0, 246.0, 256.0, 256.0, 256.0, 256.0, 256.0, 209.0, 222.0, 245.0, 245.0, 245.0, 245.0, 210.0, 221.0,
221.0, 221.0, 221.0, 221.0, 210.0, 221.0, 221.0, 221.0, 221.0, 221.0, 210.0, 221.0, 221.0, 221.0, 221.0, 221.0 },


{ 290.0, 310.0, 330.0, 350.0, 370.0, 390.0, 410.0, 415.0 },
{ 300000.0, 335000.0, 415000.0, 445000.0, 495000.0, 535000.0 },


{ 300000.0, 335000.0, 415000.0, 455000.0, 495000.0, 535000.0 },
{ 290.0, 310.0, 330.0, 350.0, 370.0, 390.0, 410.0, 415.0 },


{ 1.0, 1.3, 1.5 },

0.01,

410.0,

120.0,


{ 150.0, 161.0, 173.0, 183.0, 193.0, 203.0, 212.0, 217.0, 217.0, 150.0, 162.0, 174.0, 185.0, 197.0, 208.0, 223.0,
231.0, 232.0, 151.0, 166.0, 183.0, 200.0, 215.0, 229.0, 242.0, 248.0, 249.0, 164.0, 183.0, 199.0, 212.0, 226.0,
240.0, 253.0, 259.0, 259.0, 174.0, 192.0, 208.0, 221.0, 239.0, 267.0, 292.0, 304.0, 304.0 },


{ 120.0, 140.0, 160.0, 180.0, 200.0, 220.0, 240.0, 250.0, 260.0 },


{ 0.0, 100.0, 200.0, 300.0, 400.0 },

0.0,

0.0,
Expand Down Expand Up @@ -2139,13 +2124,10 @@ FacComputer::Parameters_FacComputer_T FacComputer::FacComputer_P{
0.0F,


{ 7U, 5U, 2U },


{ 1U, 8U, 48U },
{ 5U, 7U, 2U },


{ 8U, 4U },
{ 1U, 6U, 48U },


{ 3U, 5U },
Expand Down
Loading