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(RA): RA model based on a probe mesh implementation #7807

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

Conversation

Taz5150
Copy link
Contributor

@Taz5150 Taz5150 commented Feb 19, 2023

Fixes #[issue_no]

Summary of Changes

This PR features a new Radio-Altimeter model based on the implementation of a pseudo-random probe mesh mimicking its radio beam, given the specs of the Honeywell ALA-52B:

  • Maximum Altitude AGL: 8,192 feet
  • Roll limits: +/- 40º
  • Pitch limits: +/- 20º

Description
The algorithm will set a mesh of 15 artificial probes with an aperture of +/- 40º horizontally and +/- 20º vertically. When the aircraft is closer to ground, the mesh will be compacted; while when the aircraft gains altitude, the mesh spreads out.

At every Sim frame, the code will read the distance from the aircraft to the ground probe. The probe with minimum estimated received power will be taken as the RA reading (considering to be the first beam signal to be received).

Two new LVars A32NX_RA_1_RAW and A32NX_RA_2_RAW One new LVar A32NX_RA_RAW has been created to obtain the best RA reading from all the probes in the mess. Each of them RA will be activated/ deactivated as a function of AC bus status.

The source code has a debug variable which is set to false by default. If set to true, the console will show received data from the winning probe, as well as other debug messages. For easiness in reading this data, use radalt as a filter within the console. The console will output:

  • Probe (x), where 'x' is the winning probe (shortest distance)
  • Plane_Alt, being the MSL plane altitude
  • Probe_Alt, being the MSL probe altitude
  • Plane_AltAbv, is the plane altitude AGL
  • Prx, is estimated power received in dBm from Probe(x)
  • RA, being the radio-altimeter reading for the winning probe
  • pct_diff, gives a % difference between plane AGL and RA reading

If the spec limits are surpassed (altitude, roll or pitch), or the the AC Bus is not powered, the corresponding RA will read 99999.

Performance wise, this new model has no perceivable impact on FPS.

TODO List

  • 1. New algorithm to improve performance
  • 2. Integrate RA system electrically: on/ off will depend on AC power in its corresponding bus
  • 3. Implement signal attenuation (non-surface related)
  • 4. Solve TCAS issue where probes are detected as aircraft

1. New algorithm to improve performance

A new algorithm has been coded and tested. Instead of using a fixed mesh of 100 probes, an adaptive sampling technique has been used to bring down the probe count to just 15 probes.
The algorithm runs in two frames: during the first frame, a coarse mesh of 3 x 5 probes with a rectangular shape is placed on ground. The probe with the highest return power is pre-selected. During the second frame, a new 3 x 5 mesh is created compacted around the selected probe. The probe with the highest received power is the one giving the RA reading.

Blue: Frame 1 Orange: Frame 2
image

Performance wise, this new algorithm does not seem to have a measurable degradation in FPS as shown below:

image

2. Integrate RA system electrically

RA1 and RA2 become active/ inactive as a function of A32NX_ELEC_AC_1_BUS_IS_POWERED and A32NX_ELEC_AC_2_BUS_IS_POWERED respectively.

3. Implementation of signal attenuation

As of today, there is no way to obtain surface type to calculate ground attenuation and backscattering. The SURFACE TYPE SimVar only applies to the User, and not to other SimObjects; and nevertheless, it defines "surface type" as a function of the ground texture color, which is not precise at all.

The signal attenuation does take into account distance from the probe to the aircraft, as well as atmospheric attenuation. Also, the specs for the Radio Altimeter specify maximum errors of MAX(1.5ft, 2%). The error has been statistically implemented as a function of probe distance.

4. TCAS issue where probes are detected as aircraft

Probes are filtered out and will not appear anymore on TCAS as traffic. A new LVar has been created (A32NX_RA_PROBE_ZERO): if RA is on, the uID of the first probe will be set. If RA is off, the LVar will be set to zero. Since the mesh is created on the same frame sequentially, every probe's uID after the first one will be increase by 1 for a total of 15. The TcasComputer.ts has been updated to filter out every probe within the traffic.

Screenshots (if necessary)

landing

Sample probe mesh representation and console output. Please check the Testing Instructions to understand the different options on probe models.

References

Additional context

Discord username (if different from GitHub): TazX [Z+2]

Testing instructions

For testing purposes within this draft, I have implemented the option of a visual model based on the marshaller stick. You can use the Developer State LVar to control which model to use:

- A32NX_DEVELOPER_STATE = 3, will give you the visual (marshaller stick) model.
- A32NX_DEVELOPER_STATE != 3, will give you a one point triangular model (invisible)

For testing purposes, you can use the Developer State LVar (A32NX_DEVELOPER_STATE) set to '3' to manually activate/ deactivate the RA ('z' to activate the probe mess and 'c' to deactivate it).

How to download the PR for QA

Every new commit to this PR will cause a new A32NX artifact 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, click on the bottom PR tab
  4. Click on the A32NX download link at the bottom of the page

@Taz5150
Copy link
Contributor Author

Taz5150 commented Feb 22, 2023

Note: Added Solve TCAS issue where probes are detected as aircraft on the top (highest priority) of the TODO list

@Taz5150
Copy link
Contributor Author

Taz5150 commented Mar 7, 2023

Note: Added Solve TCAS issue where probes are detected as aircraft on the top (highest priority) of the TODO list

Will put this issue at the end of the TODO list until a viable solution is found. Opened an issue in Asobo's Dev Support:

https://devsupport.flightsimulator.com/questions/15251/get-air-traffic-returns-non-aircraft-generated-obj.html

@Taz5150
Copy link
Contributor Author

Taz5150 commented Mar 20, 2023

Introducing new features to the radio altimeter code to make it ready for ground attenuation effects and noisy environments. Instead of directly reading the altitude from the minimum slant probe on ground, I will be calculating the corresponding SNR (dBm) at each probe and read the RA from the highest returned value.

This is a summary of how the new implementation works:

  • ALA-52B system and antennas have been modeled:
    - Transmit power ($P_{t}$) of +20 dBm (0.1 Wats) at the antenna (takes into account transmission line attenuation of around 6dB)
    - Transmit/ Receive antenna gains ($G_{t/r}$) 10 dB each
    - Noise floor ($P_{noise}$) of -140 dBm

  • The following radio & environmental constants and assumptions have been defined
    - Signal frequency: 4.3 GHz ($\frac{1}{\lambda}$)
    - Radar cross-section: 16.7 $Km^2$, assuming an effective area of 1 $m^2$

  • Received power calculated as a function of slant range (h) and taking into account free-path loss:

$$P_{r} = \frac{P_{t}\cdot G_{t}\cdot G_{r}\cdot \lambda \cdot \sigma}{4\cdot \pi ^3\cdot h^4}$$

  • SNR is then calculated as $10 \cdot log \frac{P_{r}}{P_{noise}}$ in dBm

@Taz5150
Copy link
Contributor Author

Taz5150 commented Apr 18, 2023

First item in the TODO list "New algorithm to improve performance" done and ready for testing. PR description updated and new info included.

@Taz5150
Copy link
Contributor Author

Taz5150 commented Apr 27, 2023

Update - winning probe is driven by received power in dBm (-14 to -112 dBm) to make the system ready for ground attenuation and scattering. Received power is within the ALA-52B specs:

image
Source: ALA-52B Component Maintenance Manual (googled online)

@Taz5150 Taz5150 marked this pull request as ready for review May 11, 2023 16:11
@Taz5150 Taz5150 requested a review from beheh May 12, 2023 07:29
2hwk
2hwk previously requested changes Jun 29, 2023
fbw-a32nx/src/wasm/radalt_a320/src/radaltControl.h Outdated Show resolved Hide resolved
fbw-a32nx/src/wasm/radalt_a320/src/radaltControl.h Outdated Show resolved Hide resolved
fbw-a32nx/src/wasm/radalt_a320/src/radaltControl.h Outdated Show resolved Hide resolved
@Benjozork Benjozork self-requested a review July 5, 2023 15:23
@2hwk 2hwk dismissed their stale review July 6, 2023 00:41

Outdated

@2hwk 2hwk added the QA Tier 2 label Sep 7, 2023
@2hwk
Copy link
Member

2hwk commented Sep 7, 2023

@Taz5150 this probably needs more detailed test instructions for testers

@beheh
Copy link
Member

beheh commented Sep 7, 2023

Well for one this needs to be hooked up the the RA simulation before it has any effect. That's probably one me.

@Taz5150
Copy link
Contributor Author

Taz5150 commented Sep 10, 2023

@Taz5150 this probably needs more detailed test instructions for testers

As @beheh comments, this needs to be hooked to the whole RA module to be eligible for end-to-end testing. I will support @beheh once we are ready to do so.

@2hwk
Copy link
Member

2hwk commented Sep 16, 2023

Alright, noted. I will add a not ready for testing tag, remove it whenever ready

@2hwk 2hwk added the Not Ready For Testing Not ready for testing as still being discussed or developed. label Sep 16, 2023
@tracernz tracernz modified the milestones: v0.11.0, v0.12.0 Oct 24, 2023
@flogross89 flogross89 removed this from the v0.12.0 milestone Oct 26, 2024
@@ -7,6 +7,8 @@

## 0.12.0

1. [RA] Realistic RA model based on a probe mesh implementation - @Taz5150 (TazX [Z+2]#0405)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase/merge and move to 0.13.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not Ready For Testing Not ready for testing as still being discussed or developed. QA Tier 2
Projects
Status: 🔴 Code Review: In progress
Development

Successfully merging this pull request may close these issues.

5 participants