Skip to content

Commit

Permalink
feat(hyd): bigger planes may have tilting gears (#7608)
Browse files Browse the repository at this point in the history
  • Loading branch information
crocket63 authored Dec 14, 2022
1 parent d309745 commit 33ef173
Show file tree
Hide file tree
Showing 5 changed files with 552 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
1. [FAC] Move Speedscale computation to FAC - @lukecologne (luke)
1. [EFB] Added deboarding button to flyPad Payload - @frankkopp (Frank Kopp)
1. [EFB] Improved simbridge-client connection handling - @frankkopp (Frank Kopp)
1. [HYD] Tilting gear mechanism - @Crocket63 (crocket)

## 0.8.0

Expand Down
102 changes: 101 additions & 1 deletion src/systems/a380_systems/src/hydraulic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use systems::{
ElectricPump, EngineDrivenPump, HydraulicCircuit, HydraulicCircuitController,
HydraulicPressureSensors, PressureSwitch, PressureSwitchType, PumpController, Reservoir,
},
landing_gear::{GearSystemSensors, LandingGearControlInterfaceUnitSet},
landing_gear::{GearSystemSensors, LandingGearControlInterfaceUnitSet, TiltingGear},
overhead::{AutoOffFaultPushButton, AutoOnFaultPushButton},
shared::{
interpolation,
Expand All @@ -67,6 +67,59 @@ use flaps_computer::SlatFlapComplex;
#[cfg(test)]
use systems::hydraulic::PressureSwitchState;

struct A380TiltingGearsFactory {}
impl A380TiltingGearsFactory {
fn new_a380_body_gear(context: &mut InitContext, is_left: bool) -> TiltingGear {
let mut x_offset_meters = 2.85569;
let y_offset_meters = -5.04847;
let z_offset_meters = -0.235999;

if is_left {
x_offset_meters *= -1.;
}

TiltingGear::new(
context,
Length::new::<meter>(0.280065),
if is_left { 1 } else { 2 },
Vector3::new(x_offset_meters, y_offset_meters, z_offset_meters),
Angle::new::<degree>(9.89),
)
}

fn new_a380_wing_gear(context: &mut InitContext, is_left: bool) -> TiltingGear {
let mut x_offset_meters = 6.18848;
let y_offset_meters = -4.86875;
let z_offset_meters = 2.6551;

if is_left {
x_offset_meters *= -1.;
}

TiltingGear::new(
context,
Length::new::<meter>(0.134608),
if is_left { 3 } else { 4 },
Vector3::new(x_offset_meters, y_offset_meters, z_offset_meters),
Angle::new::<degree>(9.),
)
}

fn new_a380_tilt_assembly(context: &mut InitContext) -> A380TiltingGears {
let left_body_gear = Self::new_a380_body_gear(context, true);
let right_body_gear = Self::new_a380_body_gear(context, false);
let left_wing_gear = Self::new_a380_wing_gear(context, true);
let right_wing_gear = Self::new_a380_wing_gear(context, false);

A380TiltingGears::new(
left_body_gear,
right_body_gear,
left_wing_gear,
right_wing_gear,
)
}
}

struct A380HydraulicReservoirFactory {}
impl A380HydraulicReservoirFactory {
fn new_green_reservoir(context: &mut InitContext) -> Reservoir {
Expand Down Expand Up @@ -1232,6 +1285,8 @@ pub(super) struct A380Hydraulic {
trim_assembly: TrimmableHorizontalStabilizerAssembly,

epump_auto_logic: A380ElectricPumpAutoLogic,

tilting_gears: A380TiltingGears,
}
impl A380Hydraulic {
const FLAP_FPPU_TO_SURFACE_ANGLE_BREAKPTS: [f64; 12] = [
Expand Down Expand Up @@ -1539,6 +1594,8 @@ impl A380Hydraulic {
),

epump_auto_logic: A380ElectricPumpAutoLogic::default(),

tilting_gears: A380TiltingGearsFactory::new_a380_tilt_assembly(context),
}
}

Expand Down Expand Up @@ -1754,6 +1811,8 @@ impl A380Hydraulic {
engine1: &impl Engine,
engine2: &impl Engine,
) {
self.tilting_gears.update(context);

self.nose_steering.update(
context,
self.yellow_circuit.system_section(),
Expand Down Expand Up @@ -2285,6 +2344,8 @@ impl SimulationElement for A380Hydraulic {
self.trim_controller.accept(visitor);
self.trim_assembly.accept(visitor);

self.tilting_gears.accept(visitor);

visitor.visit(self);
}
}
Expand Down Expand Up @@ -5329,6 +5390,45 @@ impl SimulationElement for A380TrimInputController {
}
}

struct A380TiltingGears {
left_body_gear: TiltingGear,
right_body_gear: TiltingGear,
left_wing_gear: TiltingGear,
right_wing_gear: TiltingGear,
}
impl A380TiltingGears {
fn new(
left_body_gear: TiltingGear,
right_body_gear: TiltingGear,
left_wing_gear: TiltingGear,
right_wing_gear: TiltingGear,
) -> Self {
Self {
left_body_gear,
right_body_gear,
left_wing_gear,
right_wing_gear,
}
}

fn update(&mut self, context: &UpdateContext) {
self.left_body_gear.update(context);
self.right_body_gear.update(context);
self.left_wing_gear.update(context);
self.right_wing_gear.update(context);
}
}
impl SimulationElement for A380TiltingGears {
fn accept<T: SimulationElementVisitor>(&mut self, visitor: &mut T) {
self.left_body_gear.accept(visitor);
self.right_body_gear.accept(visitor);
self.left_wing_gear.accept(visitor);
self.right_wing_gear.accept(visitor);

visitor.visit(self);
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading

0 comments on commit 33ef173

Please sign in to comment.