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(bleed): Implement wing anti ice system #2

Open
wants to merge 59 commits into
base: bleed
Choose a base branch
from

Conversation

omrygin
Copy link

@omrygin omrygin commented Aug 31, 2021

Fixes #[issue_no]

Summary of Changes

This PR tracks the implementation of the wing anti ice consumer.

  • Pneumatic & thermodynamic logic:

    • Controlled valve and container for the slat pipes
    • Valve connected to the precooler
    • Valve pressure regulation to 22 PSI (source needed for NEO)
    • Static exhaust to the ambient atmosphere
    • Valves operate pneumatically
    • WAI correct pressure
      • When valve is closed
      • When valve is open
  • Misc:

    • Ground 30 seconds test logic
    • Simvars documented

Even though some tests are not checked, it doesn't necessarily mean no tests were run on that particular subject. It just means that I am still running tests.

  • Tests:
    • Unit tests:
      • WAI valves normal operation
      • WAI consumer pressure
      • Ground 30 seconds test logic
      • Simvars
    • In-sim tests:
      • Ground 30 seconds test
      • WAI valve normal operation
      • WAI consumer pressure
      • Simvars

Screenshots (if necessary)

References

Additional context

Discord username (if different from GitHub):

Testing instructions

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

@BlueberryKing
Copy link
Owner

Great work so far! I really like this StaticExhaust concept and want to be able to use it in my code, so I suggest focussing on the physical aspects of the system for now and leaving out the ECAM logic. Some basic overhead pushbutton interaction logic is obviously needed, but let's leave out the FAULT light logic in this first step, so I can merge this soon.

Also, you don't have to invest too much time into tuning parameters. I think we should wait with this until most of the system is complete to avoid having to re-tune the entire system.

Let me know when you think the fundamentals are in with some unit tests, so I can review the system as a whole. I want to avoid leaving feedback on stuff you're still working on. Of course, you can always ask if you need an opinion on something. :)

@omrygin
Copy link
Author

omrygin commented Aug 31, 2021

Thanks for the comments.
I agree with what you said, and removed the ECAM and FAULT off the checklist. I unticked the Static Exhaust implementation, as there is a conceptual issue with the temperature when it reaches a pressure equilibrium.
I'll think and come up with a solution, and then we can discuss this.

@omrygin
Copy link
Author

omrygin commented Aug 31, 2021

There was a conceptual issue with the StaticExhaust that I have a way around, though it is not totally self consistent physically.
What I did so far was to move air from the consumer to the ambient atmosphere via method change_volume, which assumes an isentropic process.
When applying it to the exhaust when the valve is closed, the anti ice and the ambient atmosphere reached pressure equilibrium, however their temperatures were different. This of course cannot be true as the ambient atmosphere is a huge thermal bath.

This happens because the exhaustion is not isentropic, as the air must lose heat to reach temperature balance.

So I had to model the cooling of the air inside the WAI container, separately from how the pressure change. This is not totally self consistent.

I used Newton's cooling law as presented here, with a heat transfer rate (tau in wikipedia) which will need to be tweaked.

@BlueberryKing
Copy link
Owner

This sounds good to me. The whole isentropic idea is mostly just so we can use simple formulae for the transfer of air between containers. We might even want to apply Newton's cooling to all containers at some point.

@omrygin
Copy link
Author

omrygin commented Sep 7, 2021

It's been a productive couple of days!
I think basic unit tests are done. The valves are now pneumatically operated, meaning that if the precooler is not pressurized, the valves won't open and the pushbutton will light FAULT.
This is noisy (i.e. the FAULT light flashes in-sim) due to the unstable PID. Perhaps when moving to Davy's mod it will be better. But this is easily fixed.

I have noticed that the precoolers are not symmetric - have you noticed that?

Also, I commented out the pressure change for temperature change. We need to discuss this as I think there is an error there that causes my pressure values to be NaNs

@BlueberryKing
Copy link
Owner

Awesome! Really great to see it. I think it's realistic anyways to use some sort of latching logic for the fault light to prevent the flickering.

I have noticed that the precoolers are not symmetric - have you noticed that?

Oh really? In what way do you mean not symmetric? Not the same for both engines somehow?

Also, I commented out the pressure change for temperature change. We need to discuss this as I think there is an error there that causes my pressure values to be NaNs

Sure! I don't actually think this issue was introduced with my "pressure change for temperature change" commit, but is an issue caused by the update_temperature_for_volume_change method. Namely this happens because we try to remove more volume from the pipe than is actually in it, meaning we are raising a negative number to a rational power, which causes the NaN. This happens while the system is still stabilising in the simulator. I have actually introduced a workaround/fix for this, but have unfortunately not pushed this yet. The fix is just to move the volume incrementally in a while loop, moving at most the volume of the pipe in each step. The underlying issue, in my eyes, is that we are treating volume as an "amount of fluid", which is - as you have previously pointed out - not ideal, as we can see here. This is why I've introduced this fix for now.

@omrygin
Copy link
Author

omrygin commented Sep 9, 2021

A couple of things:

  1. If we look at update_move_fluid, then the way volume is moved is
self.move_volume(
         from,
         to,
         self.open_amount()
             * equalization_volume
             * (1. - (-Self::TRANSFER_SPEED * context.delta_as_secs_f64()).exp()),
);

If context.delta_as_secs_f64() is small, then the amount of fluid moves in a single tick is approximately self.open_amount() * equalization_volume * (Self::TRANSFER_SPEED * context.delta_as_secs_f64()))
Which is already small, so I wonder how different that would be with the while loop. Or perhaps I misunderstood you.

  1. In update_pressure_for_temperature_change, you basically wrote
P_new = P_old * (T_old/T_new) ^ (gamma / (gamma-1))

However, from here, it seems that the exponent should be gamma / (1-gamma), i.e. negative what you wrote. High temperature should correspond to a higher pressure due to the frequent collisions of the particles with the wall. Since gamma is always greater than unity, in the formula you have used as T_new gets bigger, P_new gets smaller.
Do you agree?

omrygin and others added 26 commits September 24, 2021 07:31
BlueberryKing pushed a commit that referenced this pull request Aug 29, 2022
* fix: RMP behavior and lights [issue 344]

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/Common/EWDMessages.tsx

Requested changes: code and VHF3 VOICE format

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update RadioPanelDisplay.tsx

Requested changes: textDataModeVHF3 to TEXT_DATA_MODE_VHF3

* Fix bug with ANN LT involved

* Added comments about commented out code

* Fix RMPs elec buses

* add of SEL word backlight

* Default init of transmit and volume buttons

* fix SEL light behavior

* fix SEL light behavior #2

* Removal of commented out code

* SEL backlight code

* Changelog

* Fix for vPilot

* Changelog update

Removal of useless changelogs

* Changelog from 0.4.0 to 0.9.0 as requested

From 0.4.0 to 0.8.0 for another one

* Fix COM3 Transmit + it is now possible to transmit on no COM

* Fix knob animation

* Fix simvars when switching between CALLS p/b

* Comment

Co-authored-by: Benedict Etzel <[email protected]>
Co-authored-by: Saschl <[email protected]>
BlueberryKing pushed a commit that referenced this pull request Dec 29, 2022
* fix: RMP behavior and lights [issue 344]

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/Common/EWDMessages.tsx

Requested changes: code and VHF3 VOICE format

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update src/instruments/src/EWD/elements/PseudoFWC.tsx

Requested changes: code VHF3 voice

Co-authored-by: Benedict Etzel <[email protected]>

* Update RadioPanelDisplay.tsx

Requested changes: textDataModeVHF3 to TEXT_DATA_MODE_VHF3

* Fix bug with ANN LT involved

* Added comments about commented out code

* Fix RMPs elec buses

* add of SEL word backlight

* Default init of transmit and volume buttons

* fix SEL light behavior

* fix SEL light behavior #2

* Removal of commented out code

* SEL backlight code

* VOR, ILS, ADF tunable. MLS missing. Logic with NAV button

* Add of files

* ILS standby frequency to active

* Instruments knobs are now pushable

* VORs ident

* Fix due to double comment in the xml

* MKR ident

* ADF ident

* RADNAV page blank once NAV button pushed

* AUTO/MAN/RMP status in Navaids page

* Fix switch between NAV backup and radio tuning

* VOICE button

* fix: inhibit auto-tuning

* Changelog

* Changelog

* NAV 1/2 ADF 1 default volume set to 0

* NAV 3/4 ADF 2 (not existing yet) default volume set to 0

* Fix ILS and default values

* ILS/MLS DME distance not displayed if RMP tuned

* Display of M/R if manual/rmp tuned

* Display of M/R if manual/rmp tuned

* Revert "Display of M/R if manual/rmp tuned"

This reverts commit ec363f6.

* Reset of all nav frequencies when RMP tuning is cancelled

* Removal of MLS + somes fixes for ADF and tuning based on real life

* Change of default course value

* Removal of useless code

* Fix of display flickering when switching between ADF and VOR/ILS

* ILS/MLS volume knobs + fix

* Management greatest volume within pair of knobs

* Fix previous commit

* Fix previous commit

* Revert "Revert commit by mistake"

This reverts commit 556f5ac.

* Removal of useless newlines

* Table separator

* Merge similar simvars as requested

* French tooltips for knobs and voice button

* Use of default tooltips + update homemade ones + english tooltips

* Use of default tooltips + update homemade ones + english tooltips

* Revert "Revert commit pushed my mistake"

This reverts commit d61e0d5.

* Dim light

* ILS tunable only if both RMPs in nav backup mode. FCOM compliant

* Back to frequency mode when switching between receivers

* Fix for vPilot

* Changelog update

Removal of useless changelogs

* Changelog from 0.4.0 to 0.9.0 as requested

From 0.4.0 to 0.8.0 for another one

* Fix COM3 Transmit + it is now possible to transmit on no COM

* Fix knob animation

* Revert "Merge branch 'RMP_fix_behavior_lights'"

This reverts commit b21b690, reversing
changes made to b71ebfb.

* Reorder Changelog

* Fix simvars when switching between CALLS p/b

* Comment

* MLS disabled

* Fix bad merge

* Fix bad merge

* A32NX_RMP_ILS_MLS_TUNED to A32NX_RMP_ILS_TUNED

* Update a320-simvars.md

* Fix for vPilot

* Comment

* Inhibit at low altitude

* Knobs lights

* Revert on Rust files due to bad merge

* Copy changelog from master and add of my line

* Fix ILS tuning

* Comment

* Comment

* Fix knobs lit when cold & dark

Co-authored-by: Benedict Etzel <[email protected]>
Co-authored-by: Michael Corcoran <[email protected]>
Co-authored-by: Saschl <[email protected]>
Co-authored-by: Benjamin Dupont <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants