diff --git a/fbw-a32nx/src/wasm/extra-backend-a32nx/src/AircraftPresets/AircraftPresetProcedures_A32NX.h b/fbw-a32nx/src/wasm/extra-backend-a32nx/src/AircraftPresets/AircraftPresetProcedures_A32NX.h index dbc976988376..7fcd17eaa0d1 100644 --- a/fbw-a32nx/src/wasm/extra-backend-a32nx/src/AircraftPresets/AircraftPresetProcedures_A32NX.h +++ b/fbw-a32nx/src/wasm/extra-backend-a32nx/src/AircraftPresets/AircraftPresetProcedures_A32NX.h @@ -89,10 +89,17 @@ class AircraftPresetProcedures_A32NX { "(L:A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON) ||", "1 (>L:A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON)"}, // To allow slats/flaps to retract in expedited mode when engines were running before and slats/flaps were out - // TODO: Check if the flaps are actually out - ProcedureStep{"Yellow Elec Pump On", EXON, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 0 == " - "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 0 == && " + ProcedureStep{"Yellow Elec Pump On", STEP, 200, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 1 <= && " + "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 1 <= && " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 1 <= && " "(L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO) 0 == ||", "0 (>L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO)"}, + ProcedureStep{"Await Flaps 0", COND, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 1 <= &&", ""}, + ProcedureStep{"Await Slats 0", COND, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 1 <= &&", ""}, + ProcedureStep{"Yellow Elec Pump Off", STEP, 200, "(L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO) 1 ==", "1 (>L:A32NX_OVHD_HYD_EPUMPY_PB_IS_AUTO)"}, + //WORKAROUND for intermittent HOT AIR PB Fault when using expedited mode ProcedureStep{"HOT AIR PB Reset", STEP, 0, "(L:A32NX_OVHD_COND_HOT_AIR_PB_HAS_FAULT) 0 ==", "0 (>L:A32NX_OVHD_COND_HOT_AIR_PB_IS_ON) "}, @@ -186,6 +193,12 @@ class AircraftPresetProcedures_A32NX { ProcedureStep{"TCAS TRAFFIC Abv", STEP, 2000, "(L:A32NX_SWITCH_TCAS_TRAFFIC_POSITION) 2 ==", "2 (>L:A32NX_SWITCH_TCAS_TRAFFIC_POSITION)"}, ProcedureStep{"Autobrake Max", STEP, 2000, "(L:A32NX_AUTOBRAKES_ARMED_MODE) 3 ==", "3 (>L:A32NX_AUTOBRAKES_ARMED_MODE_SET)"}, ProcedureStep{"TERR ON ND Capt. On", STEP, 2000, "(L:A32NX_EFIS_TERR_L_ACTIVE) 1 ==", "1 (>L:A32NX_EFIS_TERR_L_ACTIVE)"}, + + ProcedureStep{"Await Flaps 1+F", COND, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 24 >= " + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 24 >= &&", ""}, + ProcedureStep{"Await Slats 1+F", COND, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 66 >= " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 66 >= &&", ""}, + ProcedureStep{"T.O Config", STEP, 200, "", "1 (>L:A32NX_BTN_TOCONFIG)"}, ProcedureStep{"T.O Config", STEP, 2000, "", "0 (>L:A32NX_BTN_TOCONFIG)"}, }, @@ -203,10 +216,11 @@ class AircraftPresetProcedures_A32NX { ProcedureStep{"Flaps 0", STEP, 2000, "(L:A32NX_FLAPS_HANDLE_INDEX) 0 ==", "0 (>L:A32NX_FLAPS_HANDLE_INDEX)"}, ProcedureStep{"Rudder Trim Reset", STEP, 2000, "(A:RUDDER TRIM, Radians) 0 ==", "0 (>K:RUDDER_TRIM_SET)"}, ProcedureStep{"Spoiler Disarm", STEP, 2000, "(L:A32NX_SPOILERS_ARMED) 0 ==", "0 (>K:SPOILERS_ARM_SET)"}, - ProcedureStep{"Await Flaps 0", NCON, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 0 ==" - "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 0 == &&", ""}, - ProcedureStep{"Await Slats 0", NCON, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 0 == " - "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 0 == &&", ""}, + + ProcedureStep{"Await Flaps 0", COND, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 1 <=" + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 1 <= &&", ""}, + ProcedureStep{"Await Slats 0", COND, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 1 <= &&", ""}, ProcedureStep{"ENG 1 Off", STEP, 2000, "(A:FUELSYSTEM VALVE OPEN:1, Bool) !", "1 (>K:FUELSYSTEM_VALVE_CLOSE)"}, ProcedureStep{"ENG 2 Off", STEP, 2000, "(A:FUELSYSTEM VALVE OPEN:2, Bool) !", "2 (>K:FUELSYSTEM_VALVE_CLOSE)"}, diff --git a/fbw-a380x/src/wasm/extra-backend-a380x/src/AircraftPresets/AircraftPresetProcedures_A380X.h b/fbw-a380x/src/wasm/extra-backend-a380x/src/AircraftPresets/AircraftPresetProcedures_A380X.h index 5f90c613c402..bcf9580b6e17 100644 --- a/fbw-a380x/src/wasm/extra-backend-a380x/src/AircraftPresets/AircraftPresetProcedures_A380X.h +++ b/fbw-a380x/src/wasm/extra-backend-a380x/src/AircraftPresets/AircraftPresetProcedures_A380X.h @@ -221,6 +221,11 @@ class AircraftPresetProcedures_A380X { ProcedureStep{"Autobrake RTO", STEP, 200, "(L:A32NX_AUTOBRAKES_RTO_ARMED) 1 ==", "1 (>L:A32NX_OVHD_AUTOBRK_RTO_ARM_IS_PRESSED)"}, ProcedureStep{"TERR ON ND Capt. On", STEP, 2000, "(L:A32NX_EFIS_TERR_L_ACTIVE) 1 ==", "1 (>L:A32NX_EFIS_TERR_L_ACTIVE)"}, + ProcedureStep{"Await Flaps 1+F", COND, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 24 >= " + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 24 >= &&", ""}, + ProcedureStep{"Await Slats 1+F", COND, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 66 >= " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 66 >= &&", ""}, + ProcedureStep{"T.O. Config", STEP, 2000, "", "1 (>L:A32NX_TO_CONFIG_NORMAL)"}, }, @@ -241,10 +246,11 @@ class AircraftPresetProcedures_A380X { ProcedureStep{"Flaps 0", STEP, 2000, "(L:A32NX_FLAPS_HANDLE_INDEX) 0 ==", "0 (>L:A32NX_FLAPS_HANDLE_INDEX)"}, ProcedureStep{"Rudder Trim Reset", STEP, 2000, "(A:RUDDER TRIM, Radians) 0 ==", "0 (>K:RUDDER_TRIM_SET)"}, ProcedureStep{"Spoiler Disarm", STEP, 2000, "(L:A32NX_SPOILERS_ARMED) 0 ==", "0 (>K:SPOILERS_ARM_SET)"}, - ProcedureStep{"Await Flaps 0", NCON, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 0 ==" - "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 0 == &&", ""}, - ProcedureStep{"Await Slats 0", NCON, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 0 == " - "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 0 == &&", ""}, + + ProcedureStep{"Await Flaps 0", COND, 1000, "(L:A32NX_LEFT_FLAPS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_FLAPS_POSITION_PERCENT) 1 <= &&", ""}, + ProcedureStep{"Await Slats 0", COND, 1000, "(L:A32NX_LEFT_SLATS_POSITION_PERCENT) 1 <= " + "(L:A32NX_RIGHT_SLATS_POSITION_PERCENT) 1 <= &&", ""}, ProcedureStep{"ENG 4 Off", STEP, 2000, "(A:FUELSYSTEM VALVE OPEN:4, Bool) !", "4 (>K:FUELSYSTEM_VALVE_CLOSE)"}, ProcedureStep{"ENG 3 Off", STEP, 2000, "(A:FUELSYSTEM VALVE OPEN:3, Bool) !", "3 (>K:FUELSYSTEM_VALVE_CLOSE)"}, diff --git a/fbw-common/src/wasm/systems/systems/src/hydraulic/flap_slat.rs b/fbw-common/src/wasm/systems/systems/src/hydraulic/flap_slat.rs index 9e8b3692f22c..7afc6fe4925a 100644 --- a/fbw-common/src/wasm/systems/systems/src/hydraulic/flap_slat.rs +++ b/fbw-common/src/wasm/systems/systems/src/hydraulic/flap_slat.rs @@ -18,6 +18,7 @@ use uom::si::{ }; use std::time::Duration; +use uom::si::time::second; /// Simple hydraulic motor directly driven with a speed. /// Speed is smoothly rising or lowering to simulate transients states @@ -53,7 +54,12 @@ impl FlapSlatHydraulicMotor { fn update_speed(&mut self, context: &UpdateContext, speed: AngularVelocity) { // Low pass filter to simulate motors spool up and down. Will ease pressure impact on transients - self.speed.update(context.delta(), speed); + if !context.aircraft_preset_quick_mode() { + self.speed.update(context.delta(), speed); + } else { + // This is for the Aircraft Presets to expedite the setting of a preset. + self.speed.update(Duration::from_secs(2), speed); + } // Forcing 0 speed at low speed to avoid endless spool down due to low pass filter if self.speed.output().get::() < Self::MIN_MOTOR_RPM @@ -71,8 +77,14 @@ impl FlapSlatHydraulicMotor { / 231., ); - self.total_volume_to_actuator += self.current_flow * context.delta_as_time(); - self.total_volume_returned_to_reservoir += self.current_flow * context.delta_as_time(); + if !context.aircraft_preset_quick_mode() { + self.total_volume_to_actuator += self.current_flow * context.delta_as_time(); + self.total_volume_returned_to_reservoir += self.current_flow * context.delta_as_time(); + } else { + // This is for the Aircraft Presets to expedite the setting of a preset. + self.total_volume_to_actuator += self.current_flow * Time::new::(2.); + self.total_volume_returned_to_reservoir += self.current_flow * Time::new::(2.); + } } fn torque(&self, pressure: Pressure) -> Torque { @@ -234,14 +246,26 @@ impl FlapSlatAssembly { fn update_speed_and_position(&mut self, context: &UpdateContext) { if self.final_requested_synchro_gear_position > self.position_feedback() { - self.surface_control_arm_position += Angle::new::( - self.max_speed().get::() * context.delta_as_secs_f64(), - ); + if !context.aircraft_preset_quick_mode() { + self.surface_control_arm_position += Angle::new::( + self.max_speed().get::() * context.delta_as_secs_f64(), + ); + } else { + // This is for the Aircraft Presets to expedite the setting of a preset. + self.surface_control_arm_position += + Angle::new::(self.max_speed().get::() * 2.); + } self.speed = self.max_speed(); } else if self.final_requested_synchro_gear_position < self.position_feedback() { - self.surface_control_arm_position -= Angle::new::( - self.max_speed().get::() * context.delta_as_secs_f64(), - ); + if !context.aircraft_preset_quick_mode() { + self.surface_control_arm_position -= Angle::new::( + self.max_speed().get::() * context.delta_as_secs_f64(), + ); + } else { + // This is for the Aircraft Presets to expedite the setting of a preset. + self.surface_control_arm_position -= + Angle::new::(self.max_speed().get::() * 2.); + } self.speed = -self.max_speed(); } else { self.speed = AngularVelocity::new::(0.); @@ -318,8 +342,14 @@ impl FlapSlatAssembly { } // Final max speed filtered to simulate smooth movements - self.current_max_speed - .update(context.delta(), new_theoretical_max_speed); + if !context.aircraft_preset_quick_mode() { + self.current_max_speed + .update(context.delta(), new_theoretical_max_speed); + } else { + // This is for the Aircraft Presets to expedite the setting of a preset. + self.current_max_speed + .update(Duration::from_secs(2), new_theoretical_max_speed); + } } fn max_speed_factor_from_pressure( diff --git a/fbw-common/src/wasm/systems/systems/src/simulation/update_context.rs b/fbw-common/src/wasm/systems/systems/src/simulation/update_context.rs index ca21647584b1..20d84f7a4d42 100644 --- a/fbw-common/src/wasm/systems/systems/src/simulation/update_context.rs +++ b/fbw-common/src/wasm/systems/systems/src/simulation/update_context.rs @@ -704,27 +704,15 @@ impl UpdateContext { } pub fn delta(&self) -> Duration { - if !self.aircraft_preset_quick_mode { - self.delta.into() - } else { - Duration::from_secs(1).into() - } + self.delta.into() } pub fn delta_as_secs_f64(&self) -> f64 { - if !self.aircraft_preset_quick_mode { - self.delta.into() - } else { - 1. - } + self.delta.into() } pub fn delta_as_time(&self) -> Time { - if !self.aircraft_preset_quick_mode { - self.delta.into() - } else { - Time::new::(1.) - } + self.delta.into() } pub fn simulation_time(&self) -> f64 {