From f0ad5ecb411624a5dd335d049b5e8ccdbe532eeb Mon Sep 17 00:00:00 2001 From: Andreas Guther Date: Wed, 6 Nov 2024 22:24:12 +0100 Subject: [PATCH] feat(a380x/ap): improved support of 4x simulation rate (#9374) * feat(a380x/ap): improved support of 4x simulation rate * Update CHANGELOG.md * relax performance requirements due to improved tuning in AP * fix changelog * further improved performance monitoring for A380X --- .github/CHANGELOG.md | 1 + fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.h | 4 ++-- .../src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp | 2 +- .../src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp | 6 +++--- fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h | 4 ++-- large-files | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 16278feb1d8..619cd16a9fe 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -10,6 +10,7 @@ 1. [ND] Fix memory leak when using TERR ON ND - @Nufflee (nufflee) 1. [A380X/OVHD] Fix RCDR GND CTL button/logic - @flogross89 (floridude) 1. [A380X] Various fixes in FMS and ECL - @flogross89 (floridude) +1. [A380X/AP] Improved support of simulation rate 4x - @aguther (Andreas Guther) ## 0.12.1 diff --git a/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.h b/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.h index eaf5bca7f4a..bd01e49fe5c 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/FlyByWireInterface.h @@ -35,8 +35,8 @@ class FlyByWireInterface { private: const std::string CONFIGURATION_FILEPATH = "\\work\\ModelConfiguration.ini"; - static constexpr double MAX_ACCEPTABLE_SAMPLE_TIME = 0.11; - static constexpr uint32_t LOW_PERFORMANCE_TIMER_THRESHOLD = 10; + static constexpr double MAX_ACCEPTABLE_SAMPLE_TIME = (1.0 / 6.0); + static constexpr uint32_t LOW_PERFORMANCE_TIMER_THRESHOLD = (3 * 6); uint32_t lowPerformanceTimer = 0; double previousSimulationTime = 0; 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 7dbb1b958f3..9cfa56df610 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/interface/SimConnectInterface.cpp @@ -3330,7 +3330,7 @@ void SimConnectInterface::processEventWithOneParam(const DWORD eventId, const DW // calculate frame rate that will be seen by FBW / AP double theoreticalFrameRate = (1 / sampleTime) / (simData.simulation_rate * 2); // determine if an increase of simulation rate can be allowed - if ((simData.simulation_rate < maxSimulationRate && theoreticalFrameRate >= 8) || simData.simulation_rate < 1 || + if ((simData.simulation_rate < maxSimulationRate && theoreticalFrameRate >= 6) || simData.simulation_rate < 1 || !limitSimulationRateByPerformance) { sendEvent(Events::SIM_RATE_INCR, 0, SIMCONNECT_GROUP_PRIORITY_DEFAULT); std::cout << "WASM: Simulation rate " << simData.simulation_rate; 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 b72daa42cdd..41ec0e05051 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.cpp @@ -63,7 +63,7 @@ A380PitchNormalLaw::Parameters_A380PitchNormalLaw_T A380PitchNormalLaw::A380Pitc { 0.0, 163.0, 243.0, 344.0, 400.0 }, - { 0.0, 0.06, 0.1, 0.2, 1.0 }, + { 0.0, 0.06, 0.1, 0.13, 0.26, 1.0 }, { 0.0, 163.0, 243.0, 344.0, 400.0 }, @@ -246,7 +246,7 @@ A380PitchNormalLaw::Parameters_A380PitchNormalLaw_T A380PitchNormalLaw::A380Pitc { 1.0, 1.0, 0.5, 0.3, 0.3 }, - { 1.0, 1.0, 0.5, 0.3, 0.3 }, + { 1.0, 1.0, 1.0, 1.0, 1.0, 0.25 }, { 1.0, 1.0, 0.5, 0.3, 0.3 }, @@ -1866,7 +1866,7 @@ void A380PitchNormalLaw::step(const real_T *rtu_In_time_dt, const real_T *rtu_In A380PitchNormalLaw_rtP.ScheduledGain1_Table, 4U); rtb_Y_a = 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); + A380PitchNormalLaw_rtP.ScheduledGain_Table_hh, 5U); rtb_Sum_ma = rtb_Y_a * rtb_Sum_ma * A380PitchNormalLaw_rtP.DiscreteTimeIntegratorVariableTs_Gain * *rtu_In_time_dt; rtb_Y_a = *rtu_In_eta_deg - rtb_Sum_ma; rtb_AND = ((rtb_Y_pa == 0.0) || (rtb_ManualSwitch == A380PitchNormalLaw_rtP.CompareToConstant_const) || 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 1e01e0475b3..9c2a3290e7d 100644 --- a/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h +++ b/fbw-a380x/src/wasm/fbw_a380/src/model/A380PitchNormalLaw.h @@ -131,7 +131,7 @@ class A380PitchNormalLaw final real_T ScheduledGain_BreakpointsForDimension1_f[4]; real_T ScheduledGain_BreakpointsForDimension1_b[4]; real_T ScheduledGain1_BreakpointsForDimension1[5]; - real_T ScheduledGain_BreakpointsForDimension1_d[5]; + real_T ScheduledGain_BreakpointsForDimension1_d[6]; real_T ScheduledGain1_BreakpointsForDimension1_h[5]; real_T LagFilter_C1; real_T WashoutFilter_C1; @@ -218,7 +218,7 @@ class A380PitchNormalLaw final real_T ScheduledGain_Table_h[4]; real_T ScheduledGain_Table_e[4]; real_T ScheduledGain1_Table[5]; - real_T ScheduledGain_Table_hh[5]; + real_T ScheduledGain_Table_hh[6]; real_T ScheduledGain1_Table_c[5]; real_T DiscreteTimeIntegratorVariableTs_UpperLimit; real_T DiscreteTimeIntegratorVariableTs_UpperLimit_p; diff --git a/large-files b/large-files index 4c20577ff2d..894066d6dab 160000 --- a/large-files +++ b/large-files @@ -1 +1 @@ -Subproject commit 4c20577ff2dcf2ec42a003a65127e2ea3b097bd8 +Subproject commit 894066d6dab08cb96cd8fc7c7b69dc14e2b2e80c