Skip to content

Commit

Permalink
feat(eng): 380X reversers (flybywiresim#8613)
Browse files Browse the repository at this point in the history

Co-authored-by: Saschl <[email protected]>
Co-authored-by: flogross89 <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2024
1 parent 5d35148 commit e0dbfda
Show file tree
Hide file tree
Showing 12 changed files with 913 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fuel_flow_gain = 1 ; Gain on fuel flow
inlet_area = 29 ; Square Feet, engine nacelle inlet area
rated_N2_rpm = 12200 ; RPM, third stage compressor rated value
static_thrust = 80213 ; Lbs, max rated static thrust at Sea Level
reverser_available = 0.5
reverser_available = 0
reverser_mach_controlled = 0
afterburner_available = 0
afterburner_throttle_threshold = 0.011
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,17 +768,17 @@
</UseTemplate>

<!-- Reversers -->

<!-- 2 -->
<UseTemplate Name="FBW_ENGINE_Turbine_ReverseThrust_Template">
<ID>2</ID>
<UseTemplate Name="ASOBO_GT_Anim">
<ANIM_NAME>thrust_rev_1</ANIM_NAME>
<ANIM_CODE>(L:A32NX_REVERSER_2_POSITION) 100 *</ANIM_CODE>
<ANIM_LENGTH>100</ANIM_LENGTH>
</UseTemplate>

<!-- 3 -->
<UseTemplate Name="FBW_ENGINE_Turbine_ReverseThrust_Template">
<ID>3</ID>
<UseTemplate Name="ASOBO_GT_Anim">
<ANIM_NAME>thrust_rev_2</ANIM_NAME>
<ANIM_CODE>(L:A32NX_REVERSER_3_POSITION) 100 *</ANIM_CODE>
<ANIM_LENGTH>100</ANIM_LENGTH>
</UseTemplate>
</Component>

Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion fbw-a380x/src/systems/instruments/src/Common/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useUpdate = (handler: (deltaTime: number) => void) => {
return () => {
getRootElement().removeEventListener('update', wrappedHandler);
};
});
}, []);
};

export const useInteractionEvent = (event: string, handler: (any?) => void): void => {
Expand Down
20 changes: 11 additions & 9 deletions fbw-a380x/src/systems/instruments/src/EWD/elements/ThrustGauge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const ThrustGauge: React.FC<Position & EngineNumber & FadecActive & n1Degraded>
// const [thrustLimit] = useSimVar('L:A32NX_AUTOTHRUST_THRUST_LIMIT', 'number', 100);
// const [thrustLimitIdle] = useSimVar('L:A32NX_AUTOTHRUST_THRUST_LIMIT_IDLE', 'number', 100);


const availVisible = !!(N1Percent > Math.floor(N1Idle) && engineState === 2); // N1Percent sometimes does not reach N1Idle by .005 or so
const [revVisible] = useSimVar(`L:A32NX_AUTOTHRUST_REVERSE:${engine}`, 'bool', 500);
// Reverse cowl > 5% is treated like fully open, otherwise REV will not turn green for idle reverse
const [revDoorOpenPercentage] = useSimVar(`A:TURB ENG REVERSE NOZZLE PERCENT:${engine}`, 'percent', 100);
const [revDoorOpened] = useSimVar(`L:A32NX_REVERSER_${engine}_DEPLOYED`, 'bool', 100);
const [revDoorTransittt] = useSimVar(`L:A32NX_REVERSER_${engine}_DEPLOYING`, 'bool', 100);
const [revAthr] = useSimVar(`L:A32NX_AUTOTHRUST_REVERSE:${engine}`, 'bool', 100);
const revVisible = revDoorTransittt || revDoorOpened || revAthr;
const availRevVisible = availVisible || (revVisible && [2, 3].includes(engine));
const availRevText = availVisible ? 'AVAIL' : 'REV';

Expand Down Expand Up @@ -70,7 +72,7 @@ const ThrustGauge: React.FC<Position & EngineNumber & FadecActive & n1Degraded>
visible={availVisible || engineState === 1}
className='GaugeComponent GaugeThrustFill'
/>
<AvailRev x={x - 18} y={y - 14} mesg={availRevText} visible={availRevVisible} revDoorOpen={revDoorOpenPercentage} />
<AvailRev x={x - 18} y={y - 14} mesg={availRevText} visible={availRevVisible} revDoorOpen={revDoorOpened} />
<ThrottlePositionDonutComponent
value={throttlePosition < 3 ? 3 / 10 : throttlePosition / 10}
x={x}
Expand Down Expand Up @@ -198,7 +200,7 @@ const ThrustGauge: React.FC<Position & EngineNumber & FadecActive & n1Degraded>
/>
{/* reverse */}
<GaugeComponent x={x} y={y} radius={revRadius} startAngle={revStartAngle} endAngle={revEndAngle} visible className='GaugeComponent Gauge'>
<AvailRev x={x - 18} y={y - 14} mesg={availRevText} visible={availRevVisible} revDoorOpen={revDoorOpenPercentage} />
<AvailRev x={x - 18} y={y - 14} mesg={availRevText} visible={availRevVisible} revDoorOpen={revDoorOpened} />
<GaugeMarkerComponent
value={0}
x={x}
Expand All @@ -214,7 +216,7 @@ const ThrustGauge: React.FC<Position & EngineNumber & FadecActive & n1Degraded>
multiplierInner={1.1}
/>
<GaugeMarkerComponent
value={ThrustPercent / 10}
value={-ThrustPercent / 10}
x={x}
y={y}
min={revMin}
Expand All @@ -229,7 +231,7 @@ const ThrustGauge: React.FC<Position & EngineNumber & FadecActive & n1Degraded>
/>
</GaugeComponent>
<ThrottlePositionDonutComponent
value={throttlePosition / 10}
value={(throttlePosition / 8)+2.5}
x={x}
y={y}
min={revMin}
Expand All @@ -254,15 +256,15 @@ type AvailRevProps = {
y: number,
mesg: string,
visible: boolean,
revDoorOpen: number,
revDoorOpen: boolean,
};

const AvailRev: React.FC<AvailRevProps> = ({ x, y, mesg, visible, revDoorOpen }) => (
<>
<g className={visible ? 'Show' : 'Hide'}>
<rect x={x - 28} y={y - 13} width={90} height={24} className='DarkGreyBox BackgroundFill' />
{mesg === 'REV'
&& <text className={`F26 Spread Centre ${Math.round(revDoorOpen) > 5 ? 'Green' : 'Amber'}`} x={x - 8} y={y + 9}>REV</text>}
&& <text className={`F26 Spread Centre ${revDoorOpen ? 'Green' : 'Amber'}`} x={x - 8} y={y + 9}>REV</text>}
{mesg === 'AVAIL'
&& <text className='F26 Spread Centre Green' x={x - 26} y={y + 9}>AVAIL</text>}
</g>
Expand Down
39 changes: 38 additions & 1 deletion fbw-a380x/src/wasm/systems/a380_systems/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod navigation;
mod payload;
mod pneumatic;
mod power_consumption;
mod reverser;
mod structural_flex;

use self::{
Expand All @@ -34,6 +35,8 @@ use icing::Icing;
use navigation::A380RadioAltimeters;
use payload::A380Payload;
use power_consumption::A380PowerConsumption;
use reverser::{A380ReverserController, A380Reversers};

use uom::si::{f64::Length, length::nautical_mile, quantities::Velocity, velocity::knot};

use systems::{
Expand All @@ -43,7 +46,7 @@ use systems::{
AuxiliaryPowerUnitOverheadPanel, Pw980ApuGenerator, Pw980Constants, Pw980StartMotor,
},
electrical::{Electricity, ElectricitySource, ExternalPowerSource},
engine::{trent_engine::TrentEngine, EngineFireOverheadPanel},
engine::{reverser_thrust::ReverserForce, trent_engine::TrentEngine, EngineFireOverheadPanel},
enhanced_gpwc::EnhancedGroundProximityWarningComputer,
landing_gear::{LandingGear, LandingGearControlInterfaceUnitSet},
navigation::adirs::{
Expand Down Expand Up @@ -90,6 +93,10 @@ pub struct A380 {
egpwc: EnhancedGroundProximityWarningComputer,
icing_simulation: Icing,
structural_flex: A380StructuralFlex,

engine_reverser_control: [A380ReverserController; 2],
reversers_assembly: A380Reversers,
reverse_thrust: ReverserForce,
}
impl A380 {
pub fn new(context: &mut InitContext) -> A380 {
Expand Down Expand Up @@ -159,6 +166,12 @@ impl A380 {

icing_simulation: Icing::new(context),
structural_flex: A380StructuralFlex::new(context),
engine_reverser_control: [
A380ReverserController::new(context, 2),
A380ReverserController::new(context, 3),
],
reversers_assembly: A380Reversers::new(context),
reverse_thrust: ReverserForce::new(context),
}
}
}
Expand Down Expand Up @@ -316,6 +329,26 @@ impl Aircraft for A380 {

self.egpwc.update(&self.adirs, self.lgcius.lgciu1());
self.fuel.update(context);

self.engine_reverser_control[0].update(
&self.engine_2,
self.lgcius.lgciu1(),
self.reversers_assembly.reverser_feedback(0),
);
self.engine_reverser_control[1].update(
&self.engine_3,
self.lgcius.lgciu2(),
self.reversers_assembly.reverser_feedback(1),
);

self.reversers_assembly
.update(context, &self.engine_reverser_control);

self.reverse_thrust.update(
context,
[&self.engine_2, &self.engine_3],
self.reversers_assembly.reversers_position(),
);
}
}
impl SimulationElement for A380 {
Expand Down Expand Up @@ -355,6 +388,10 @@ impl SimulationElement for A380 {
self.icing_simulation.accept(visitor);
self.structural_flex.accept(visitor);

accept_iterable!(self.engine_reverser_control, visitor);
self.reversers_assembly.accept(visitor);
self.reverse_thrust.accept(visitor);

visitor.visit(self);
}
}
Loading

0 comments on commit e0dbfda

Please sign in to comment.