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

feat: Arinc429-LVar-Bridge #8631

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

frankkopp
Copy link
Member

@frankkopp frankkopp commented Apr 20, 2024

Summary of Changes

As the goal for the internal systems of the A32NX (and also the A380X) is to use data exchange protocols and formats as in the real aircraft it might become necessary to introduce a way to still expose the raw values of these LVars to 3rd parties (e.g. cockpit builders, 3rd party add-ons/applications) .

This PR is a proof of concept for such a arinc429-to-raw-lvar-bridge.

One of the main concern is the impact on performance (fps) of the simulator.
Another aspect is how to make this configurable for end users.

Discord username (if different from GitHub): cdr_maverick

Current Version

image
This now uses a list of LVars maintained by devs which will be copied into a list of vars in the "work" folder.
This work list can be edited by the user to add a "-" in front of a LVar to not convert it.
The user could add variables to it and and any missing variables will be re-added from the default list.
These few hundred vars have barely any impact as can be seen in the screen shot - 219 vars in 8 microsecs

Preliminary PoC findings

Performance without any special optimizations:
image
That is ~62microsecs (trimmed average) per tick with 1768 LVars per tick and this code:

 // check if the bridge is activated
  if (get_named_variable_value(isLvarBridgeOnID)) {
    // process vars
    for (std::pair<int, int>& ids : arinc429Vars) {
      auto value = get_named_variable_value(ids.first);

      Arinc429NumericWord arinc429NumericWord{value};
      arinc429NumericWord.setSsm(Arinc429SignStatus::FunctionalTest);
      float rawValue = arinc429NumericWord.valueOr(0.0f);

      set_named_variable_value(ids.second, rawValue ? rawValue : -1.0f);

      // DEBUG
      if (tickCounter % 100 == 0 && rawValue != 0.0f && get_named_variable_value(isLvarBridgeVerbose)) {
        PCSTRINGZ firstName  = get_name_of_named_variable(ids.first);
        PCSTRINGZ secondName = get_name_of_named_variable(ids.second);
        std::cout << "LVar: " << firstName << " = " << value << " Raw Value: " << secondName << " = " << rawValue << std::endl;
      }
    }

    // DEBUG
    if (tickCounter % 100 == 0) {
      std::cout << "Processed " << arinc429Vars.size() << " vars per tick" << std::endl;
    }
  }

Testing instructions

TBD

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo or flybywire-aircraft-a380-842 download link at the bottom of the page

@frankkopp frankkopp self-assigned this Apr 20, 2024
@frankkopp frankkopp added the Not Ready For Review Still draft but needs a GitHub build label Apr 20, 2024
@frankkopp frankkopp marked this pull request as ready for review April 20, 2024 20:27
@github-actions github-actions bot added this to 🟡 Code Review: Ready for Review in Quality Assurance Apr 20, 2024
@frankkopp frankkopp force-pushed the lvar-api-provider branch 3 times, most recently from 7cf33e9 to d9918ba Compare April 25, 2024 21:40
# Conflicts:
#	.gitignore
#	fbw-common/src/wasm/cpp-msfs-framework/CMakeLists.txt
#	fbw-common/src/wasm/cpp-msfs-framework/lib/SimpleProfiler.hpp
#	fbw-common/src/wasm/cpp-msfs-framework/lib/string_utils.hpp
#	package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not Ready For Review Still draft but needs a GitHub build
Projects
Quality Assurance
🟡 Code Review: Ready for Review
Development

Successfully merging this pull request may close these issues.

None yet

1 participant