From 0ece12a6dd9f2b44654bfbf7a40076217bff9eb8 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Tue, 29 Nov 2022 14:34:44 +0100 Subject: [PATCH 01/10] faster core hyds simpler hyd solve loop --- src/systems/a380_systems/src/hydraulic/mod.rs | 53 ++++++------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/src/systems/a380_systems/src/hydraulic/mod.rs b/src/systems/a380_systems/src/hydraulic/mod.rs index db5d09066a2..7eb223f1f45 100644 --- a/src/systems/a380_systems/src/hydraulic/mod.rs +++ b/src/systems/a380_systems/src/hydraulic/mod.rs @@ -46,14 +46,11 @@ use systems::{ landing_gear::{GearSystemSensors, LandingGearControlInterfaceUnitSet}, overhead::{AutoOffFaultPushButton, AutoOnFaultPushButton}, shared::{ - interpolation, - low_pass_filter::LowPassFilter, - random_from_range, - update_iterator::{FixedStepLoop, MaxStepLoop}, - AdirsDiscreteOutputs, DelayedFalseLogicGate, DelayedPulseTrueLogicGate, - DelayedTrueLogicGate, ElectricalBusType, ElectricalBuses, EngineFirePushButtons, GearWheel, - HydraulicColor, LandingGearHandle, LgciuInterface, LgciuWeightOnWheels, - ReservoirAirPressure, SectionPressure, + interpolation, low_pass_filter::LowPassFilter, random_from_range, + update_iterator::MaxStepLoop, AdirsDiscreteOutputs, DelayedFalseLogicGate, + DelayedPulseTrueLogicGate, DelayedTrueLogicGate, ElectricalBusType, ElectricalBuses, + EngineFirePushButtons, GearWheel, HydraulicColor, LandingGearHandle, LgciuInterface, + LgciuWeightOnWheels, ReservoirAirPressure, SectionPressure, }, simulation::{ InitContext, Read, Reader, SimulationElement, SimulationElementVisitor, SimulatorReader, @@ -1147,9 +1144,7 @@ impl A380GearSystemFactory { pub(super) struct A380Hydraulic { nose_steering: SteeringActuator, - core_hydraulic_updater: FixedStepLoop, - physics_updater: MaxStepLoop, - ultra_fast_physics_updater: MaxStepLoop, + core_hydraulic_updater: MaxStepLoop, brake_steer_computer: A380HydraulicBrakeSteerComputerUnit, @@ -1261,13 +1256,7 @@ impl A380Hydraulic { const EDP_CONTROL_POWER_BUS1: ElectricalBusType = ElectricalBusType::DirectCurrentEssential; // Refresh rate of core hydraulic simulation - const HYDRAULIC_SIM_TIME_STEP: Duration = Duration::from_millis(33); - // Refresh rate of max fixed step loop for fast physics - const HYDRAULIC_SIM_MAX_TIME_STEP_MILLISECONDS: Duration = Duration::from_millis(33); - // Refresh rate of max fixed step loop for fastest flight controls physics needing super stability - // and fast reacting time - const HYDRAULIC_SIM_FLIGHT_CONTROLS_MAX_TIME_STEP_MILLISECONDS: Duration = - Duration::from_millis(10); + const HYDRAULIC_SIM_TIME_STEP: Duration = Duration::from_millis(10); pub fn new(context: &mut InitContext) -> A380Hydraulic { A380Hydraulic { @@ -1279,11 +1268,7 @@ impl A380Hydraulic { Ratio::new::(0.18), ), - core_hydraulic_updater: FixedStepLoop::new(Self::HYDRAULIC_SIM_TIME_STEP), - physics_updater: MaxStepLoop::new(Self::HYDRAULIC_SIM_MAX_TIME_STEP_MILLISECONDS), - ultra_fast_physics_updater: MaxStepLoop::new( - Self::HYDRAULIC_SIM_FLIGHT_CONTROLS_MAX_TIME_STEP_MILLISECONDS, - ), + core_hydraulic_updater: MaxStepLoop::new(Self::HYDRAULIC_SIM_TIME_STEP), brake_steer_computer: A380HydraulicBrakeSteerComputerUnit::new(context), @@ -1554,17 +1539,6 @@ impl A380Hydraulic { adirs: &impl AdirsDiscreteOutputs, ) { self.core_hydraulic_updater.update(context); - self.physics_updater.update(context); - self.ultra_fast_physics_updater.update(context); - - for cur_time_step in self.physics_updater { - self.update_fast_physics( - &context.with_delta(cur_time_step), - lgcius.lgciu1(), - lgcius.lgciu2(), - adirs, - ); - } self.update_with_sim_rate( context, @@ -1576,11 +1550,16 @@ impl A380Hydraulic { engines[1], ); - for cur_time_step in self.ultra_fast_physics_updater { + for cur_time_step in self.core_hydraulic_updater { + self.update_fast_physics( + &context.with_delta(cur_time_step), + lgcius.lgciu1(), + lgcius.lgciu2(), + adirs, + ); + self.update_ultra_fast_physics(&context.with_delta(cur_time_step), lgcius); - } - for cur_time_step in self.core_hydraulic_updater { self.update_core_hydraulics( &context.with_delta(cur_time_step), engines, From b6c26bdb384a84a7bb3d6a792f15f5077cb5fde3 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:13:17 +0100 Subject: [PATCH 02/10] core hyd to 100hz --- .github/CHANGELOG.md | 1 + src/systems/a320_systems/src/hydraulic/mod.rs | 170 ++++++++---------- src/systems/a380_systems/src/hydraulic/mod.rs | 87 ++++----- src/systems/systems/src/hydraulic/mod.rs | 11 +- 4 files changed, 117 insertions(+), 152 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index ef85c014418..7efed97ba34 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -8,6 +8,7 @@ ## 0.10.0 1. [ADIRU] Implemented wind speed computation from TAS/GS/HDG - @tracernz (Mike) +1. [HYD] Faster Core hydraulics solver - @Crocket63 (crocket) ## 0.9.0 diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs index 8fa75123b15..77fc524adc1 100644 --- a/src/systems/a320_systems/src/hydraulic/mod.rs +++ b/src/systems/a320_systems/src/hydraulic/mod.rs @@ -1342,9 +1342,7 @@ pub(super) struct A320Hydraulic { nose_steering: SteeringActuator, - core_hydraulic_updater: FixedStepLoop, - physics_updater: MaxStepLoop, - ultra_fast_physics_updater: MaxStepLoop, + core_hydraulic_updater: MaxStepLoop, brake_steer_computer: A320HydraulicBrakeSteerComputerUnit, @@ -1461,13 +1459,7 @@ impl A320Hydraulic { ElectricalBusType::DirectCurrentHot(2); // Refresh rate of core hydraulic simulation - const HYDRAULIC_SIM_TIME_STEP: Duration = Duration::from_millis(33); - // Refresh rate of max fixed step loop for fast physics - const HYDRAULIC_SIM_MAX_TIME_STEP_MILLISECONDS: Duration = Duration::from_millis(33); - // Refresh rate of max fixed step loop for fastest flight controls physics needing super stability - // and fast reacting time - const HYDRAULIC_SIM_FLIGHT_CONTROLS_MAX_TIME_STEP_MILLISECONDS: Duration = - Duration::from_millis(10); + const HYDRAULIC_SIM_TIME_STEP: Duration = Duration::from_millis(10); pub(super) fn new(context: &mut InitContext) -> A320Hydraulic { A320Hydraulic { @@ -1483,11 +1475,7 @@ impl A320Hydraulic { Ratio::new::(0.18), ), - core_hydraulic_updater: FixedStepLoop::new(Self::HYDRAULIC_SIM_TIME_STEP), - physics_updater: MaxStepLoop::new(Self::HYDRAULIC_SIM_MAX_TIME_STEP_MILLISECONDS), - ultra_fast_physics_updater: MaxStepLoop::new( - Self::HYDRAULIC_SIM_FLIGHT_CONTROLS_MAX_TIME_STEP_MILLISECONDS, - ), + core_hydraulic_updater: MaxStepLoop::new(Self::HYDRAULIC_SIM_TIME_STEP), brake_steer_computer: A320HydraulicBrakeSteerComputerUnit::new(context), @@ -1704,19 +1692,6 @@ impl A320Hydraulic { adirs: &impl AdirsDiscreteOutputs, ) { self.core_hydraulic_updater.update(context); - self.physics_updater.update(context); - self.ultra_fast_physics_updater.update(context); - - for cur_time_step in self.physics_updater { - self.update_fast_physics( - &context.with_delta(cur_time_step), - rat_and_emer_gen_man_on, - emergency_elec, - lgcius.lgciu1(), - lgcius.lgciu2(), - adirs, - ); - } self.update_with_sim_rate( context, @@ -1730,11 +1705,15 @@ impl A320Hydraulic { engine2, ); - for cur_time_step in self.ultra_fast_physics_updater { - self.update_ultra_fast_physics(&context.with_delta(cur_time_step), lgcius); - } - for cur_time_step in self.core_hydraulic_updater { + self.update_physics( + &context.with_delta(cur_time_step), + rat_and_emer_gen_man_on, + emergency_elec, + lgcius, + adirs, + ); + self.update_core_hydraulics( &context.with_delta(cur_time_step), engine1, @@ -1830,11 +1809,70 @@ impl A320Hydraulic { self.yellow_circuit.system_section_pressure_switch() == PressureSwitchState::Pressurised } - fn update_ultra_fast_physics( + // Updates at the same rate as the sim or at a fixed maximum time step if sim rate is too slow + fn update_physics( &mut self, context: &UpdateContext, + rat_and_emer_gen_man_on: &impl EmergencyElectricalRatPushButton, + emergency_elec: &(impl EmergencyElectricalState + EmergencyGeneratorPower), lgcius: &LandingGearControlInterfaceUnitSet, + adirs: &impl AdirsDiscreteOutputs, ) { + self.forward_cargo_door.update( + context, + &self.forward_cargo_door_controller, + self.yellow_circuit.system_section(), + ); + + self.aft_cargo_door.update( + context, + &self.aft_cargo_door_controller, + self.yellow_circuit.system_section(), + ); + + self.ram_air_turbine.update_physics( + &context.delta(), + context.indicated_airspeed(), + self.blue_circuit.system_section(), + ); + + self.gcu.update( + context, + &self.emergency_gen, + self.blue_circuit.system_section(), + emergency_elec, + rat_and_emer_gen_man_on, + lgcius.lgciu1(), + ); + + self.emergency_gen.update( + context, + self.blue_circuit.system_section(), + &self.gcu, + emergency_elec, + ); + + self.gear_system_hydraulic_controller.update( + adirs, + lgcius.lgciu1(), + lgcius.lgciu2(), + &self.gear_system_gravity_extension_controller, + ); + + self.trim_assembly.update( + context, + &self.trim_controller, + &self.trim_controller, + [ + self.green_circuit + .system_section() + .pressure_downstream_leak_valve(), + self.yellow_circuit + .system_section() + .pressure_downstream_leak_valve(), + ], + ); + self.left_aileron.update( context, self.aileron_system_controller.left_controllers(), @@ -1893,72 +1931,6 @@ impl A320Hydraulic { ); } - // Updates at the same rate as the sim or at a fixed maximum time step if sim rate is too slow - fn update_fast_physics( - &mut self, - context: &UpdateContext, - rat_and_emer_gen_man_on: &impl EmergencyElectricalRatPushButton, - emergency_elec: &(impl EmergencyElectricalState + EmergencyGeneratorPower), - lgciu1: &impl LgciuInterface, - lgciu2: &impl LgciuInterface, - adirs: &impl AdirsDiscreteOutputs, - ) { - self.forward_cargo_door.update( - context, - &self.forward_cargo_door_controller, - self.yellow_circuit.system_section(), - ); - - self.aft_cargo_door.update( - context, - &self.aft_cargo_door_controller, - self.yellow_circuit.system_section(), - ); - - self.ram_air_turbine.update_physics( - &context.delta(), - context.indicated_airspeed(), - self.blue_circuit.system_section(), - ); - - self.gcu.update( - context, - &self.emergency_gen, - self.blue_circuit.system_section(), - emergency_elec, - rat_and_emer_gen_man_on, - lgciu1, - ); - - self.emergency_gen.update( - context, - self.blue_circuit.system_section(), - &self.gcu, - emergency_elec, - ); - - self.gear_system_hydraulic_controller.update( - adirs, - lgciu1, - lgciu2, - &self.gear_system_gravity_extension_controller, - ); - - self.trim_assembly.update( - context, - &self.trim_controller, - &self.trim_controller, - [ - self.green_circuit - .system_section() - .pressure_downstream_leak_valve(), - self.yellow_circuit - .system_section() - .pressure_downstream_leak_valve(), - ], - ); - } - fn update_with_sim_rate( &mut self, context: &UpdateContext, diff --git a/src/systems/a380_systems/src/hydraulic/mod.rs b/src/systems/a380_systems/src/hydraulic/mod.rs index 7eb223f1f45..361f5088f5c 100644 --- a/src/systems/a380_systems/src/hydraulic/mod.rs +++ b/src/systems/a380_systems/src/hydraulic/mod.rs @@ -1551,14 +1551,7 @@ impl A380Hydraulic { ); for cur_time_step in self.core_hydraulic_updater { - self.update_fast_physics( - &context.with_delta(cur_time_step), - lgcius.lgciu1(), - lgcius.lgciu2(), - adirs, - ); - - self.update_ultra_fast_physics(&context.with_delta(cur_time_step), lgcius); + self.update_physics(&context.with_delta(cur_time_step), lgcius, adirs); self.update_core_hydraulics( &context.with_delta(cur_time_step), @@ -1618,11 +1611,45 @@ impl A380Hydraulic { self.yellow_circuit.system_section_pressure_switch() == PressureSwitchState::Pressurised } - fn update_ultra_fast_physics( + fn update_physics( &mut self, context: &UpdateContext, lgcius: &LandingGearControlInterfaceUnitSet, + adirs: &impl AdirsDiscreteOutputs, ) { + self.forward_cargo_door.update( + context, + &self.forward_cargo_door_controller, + self.green_circuit.auxiliary_section(), + ); + + self.aft_cargo_door.update( + context, + &self.aft_cargo_door_controller, + self.green_circuit.auxiliary_section(), + ); + + self.gear_system_hydraulic_controller.update( + adirs, + lgcius.lgciu1(), + lgcius.lgciu2(), + &self.gear_system_gravity_extension_controller, + ); + + self.trim_assembly.update( + context, + &self.trim_controller, + &self.trim_controller, + [ + self.green_circuit + .system_section() + .pressure_downstream_leak_valve(), + self.yellow_circuit + .system_section() + .pressure_downstream_leak_valve(), + ], + ); + self.left_aileron.update( context, self.aileron_system_controller.left_controllers(), @@ -1681,48 +1708,6 @@ impl A380Hydraulic { ); } - // Updates at the same rate as the sim or at a fixed maximum time step if sim rate is too slow - fn update_fast_physics( - &mut self, - context: &UpdateContext, - lgciu1: &impl LgciuInterface, - lgciu2: &impl LgciuInterface, - adirs: &impl AdirsDiscreteOutputs, - ) { - self.forward_cargo_door.update( - context, - &self.forward_cargo_door_controller, - self.green_circuit.auxiliary_section(), - ); - - self.aft_cargo_door.update( - context, - &self.aft_cargo_door_controller, - self.green_circuit.auxiliary_section(), - ); - - self.gear_system_hydraulic_controller.update( - adirs, - lgciu1, - lgciu2, - &self.gear_system_gravity_extension_controller, - ); - - self.trim_assembly.update( - context, - &self.trim_controller, - &self.trim_controller, - [ - self.green_circuit - .system_section() - .pressure_downstream_leak_valve(), - self.yellow_circuit - .system_section() - .pressure_downstream_leak_valve(), - ], - ); - } - fn update_with_sim_rate( &mut self, context: &UpdateContext, diff --git a/src/systems/systems/src/hydraulic/mod.rs b/src/systems/systems/src/hydraulic/mod.rs index f5e2c8820e7..573237457df 100644 --- a/src/systems/systems/src/hydraulic/mod.rs +++ b/src/systems/systems/src/hydraulic/mod.rs @@ -103,9 +103,13 @@ pub struct PressureSwitch { high_hysteresis_threshold: Pressure, low_hysteresis_threshold: Pressure, + current_pressure_filtered: LowPassFilter, + sensor_type: PressureSwitchType, } impl PressureSwitch { + const PRESSURE_DYNAMIC_TIME_CONSTANT: Duration = Duration::from_millis(300); + pub fn new( high_threshold: Pressure, low_threshold: Pressure, @@ -115,6 +119,7 @@ impl PressureSwitch { state_is_pressurised: false, high_hysteresis_threshold: high_threshold, low_hysteresis_threshold: low_threshold, + current_pressure_filtered: LowPassFilter::new(Self::PRESSURE_DYNAMIC_TIME_CONSTANT), sensor_type, } } @@ -124,10 +129,12 @@ impl PressureSwitch { PressureSwitchType::Relative => current_pressure - context.ambient_pressure(), PressureSwitchType::Absolute => current_pressure, }; + self.current_pressure_filtered + .update(context.delta(), pressure_measured); - if pressure_measured <= self.low_hysteresis_threshold { + if self.current_pressure_filtered.output() <= self.low_hysteresis_threshold { self.state_is_pressurised = false; - } else if pressure_measured >= self.high_hysteresis_threshold { + } else if self.current_pressure_filtered.output() >= self.high_hysteresis_threshold { self.state_is_pressurised = true; } } From b220a768283e3eecfa4718820fdf00275d0ef960 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:19:46 +0100 Subject: [PATCH 03/10] Update mod.rs --- src/systems/systems/src/hydraulic/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/systems/src/hydraulic/mod.rs b/src/systems/systems/src/hydraulic/mod.rs index 573237457df..bc5b78f3953 100644 --- a/src/systems/systems/src/hydraulic/mod.rs +++ b/src/systems/systems/src/hydraulic/mod.rs @@ -108,7 +108,7 @@ pub struct PressureSwitch { sensor_type: PressureSwitchType, } impl PressureSwitch { - const PRESSURE_DYNAMIC_TIME_CONSTANT: Duration = Duration::from_millis(300); + const PRESSURE_DYNAMIC_TIME_CONSTANT: Duration = Duration::from_millis(200); pub fn new( high_threshold: Pressure, From dc8d0e3cb248e6c90103a3a016a3ee938fdbd845 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:46:36 +0100 Subject: [PATCH 04/10] Update mod.rs --- src/systems/a320_systems/src/hydraulic/mod.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs index 77fc524adc1..c807bb14e90 100644 --- a/src/systems/a320_systems/src/hydraulic/mod.rs +++ b/src/systems/a320_systems/src/hydraulic/mod.rs @@ -51,15 +51,13 @@ use systems::{ AutoOffFaultPushButton, AutoOnFaultPushButton, MomentaryOnPushButton, MomentaryPushButton, }, shared::{ - interpolation, - low_pass_filter::LowPassFilter, - random_from_normal_distribution, random_from_range, - update_iterator::{FixedStepLoop, MaxStepLoop}, - AdirsDiscreteOutputs, DelayedFalseLogicGate, DelayedPulseTrueLogicGate, - DelayedTrueLogicGate, ElectricalBusType, ElectricalBuses, EmergencyElectricalRatPushButton, - EmergencyElectricalState, EmergencyGeneratorPower, EngineFirePushButtons, GearWheel, - HydraulicColor, HydraulicGeneratorControlUnit, LandingGearHandle, LgciuInterface, - LgciuWeightOnWheels, ReservoirAirPressure, SectionPressure, + interpolation, low_pass_filter::LowPassFilter, random_from_normal_distribution, + random_from_range, update_iterator::MaxStepLoop, AdirsDiscreteOutputs, + DelayedFalseLogicGate, DelayedPulseTrueLogicGate, DelayedTrueLogicGate, ElectricalBusType, + ElectricalBuses, EmergencyElectricalRatPushButton, EmergencyElectricalState, + EmergencyGeneratorPower, EngineFirePushButtons, GearWheel, HydraulicColor, + HydraulicGeneratorControlUnit, LandingGearHandle, LgciuInterface, LgciuWeightOnWheels, + ReservoirAirPressure, SectionPressure, }, simulation::{ InitContext, Read, Reader, SimulationElement, SimulationElementVisitor, SimulatorReader, @@ -10139,7 +10137,7 @@ mod tests { .set_cold_dark_inputs() .start_eng1(Ratio::new::(80.)) .start_eng2(Ratio::new::(80.)) - .run_waiting_for(Duration::from_millis(500)); + .run_waiting_for(Duration::from_millis(1000)); assert!(!test_bed.ptu_has_fault()); assert!(!test_bed.green_edp_has_fault()); From b0c8098c1204823f235eb210feb4480e258f05e5 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Mon, 5 Dec 2022 23:14:49 +0100 Subject: [PATCH 05/10] Update CHANGELOG.md --- .github/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 7efed97ba34..0837d5b669b 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -8,7 +8,7 @@ ## 0.10.0 1. [ADIRU] Implemented wind speed computation from TAS/GS/HDG - @tracernz (Mike) -1. [HYD] Faster Core hydraulics solver - @Crocket63 (crocket) +1. [HYD] Faster core hydraulics solver - @Crocket63 (crocket) ## 0.9.0 From ecf36945373be7c718d66303f68b8a60604fdbab Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Fri, 9 Dec 2022 10:46:41 +0100 Subject: [PATCH 06/10] removed a380 ptu test --- src/systems/a380_systems/src/hydraulic/mod.rs | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/systems/a380_systems/src/hydraulic/mod.rs b/src/systems/a380_systems/src/hydraulic/mod.rs index 361f5088f5c..9b5c3312b03 100644 --- a/src/systems/a380_systems/src/hydraulic/mod.rs +++ b/src/systems/a380_systems/src/hydraulic/mod.rs @@ -7583,27 +7583,6 @@ mod tests { assert!(test_bed.yellow_pressure().get::() < 3500.); } - #[test] - fn low_air_press_fault_causes_ptu_fault() { - let mut test_bed = test_bed_on_ground_with() - .engines_off() - .on_the_ground() - .set_cold_dark_inputs() - .start_eng1(Ratio::new::(80.)) - .start_eng2(Ratio::new::(80.)) - .run_waiting_for(Duration::from_millis(500)); - - assert!(!test_bed.green_edp_has_fault()); - assert!(!test_bed.yellow_edp_has_fault()); - - test_bed = test_bed - .air_press_low() - .run_waiting_for(Duration::from_secs_f64(10.)); - - assert!(test_bed.green_edp_has_fault()); - assert!(test_bed.yellow_edp_has_fault()); - } - #[test] fn ailerons_are_dropped_down_in_cold_and_dark() { let mut test_bed = test_bed_on_ground_with() From 363c7924cce814162f4d457ccdf744b84eee2d30 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:29:45 +0100 Subject: [PATCH 07/10] Run all hyd tests at 100Hz --- src/systems/a320_systems/src/hydraulic/mod.rs | 25 ---------------- .../src/hydraulic/electrical_generator.rs | 10 +++---- .../src/hydraulic/electrical_pump_physics.rs | 6 ++-- .../systems/src/hydraulic/flap_slat.rs | 6 ++-- .../systems/src/hydraulic/landing_gear.rs | 18 +++++------ .../systems/src/hydraulic/linear_actuator.rs | 30 +++++++++---------- .../trimmable_horizontal_stabilizer.rs | 10 +++---- 7 files changed, 40 insertions(+), 65 deletions(-) diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs index c807bb14e90..311fd3fc791 100644 --- a/src/systems/a320_systems/src/hydraulic/mod.rs +++ b/src/systems/a320_systems/src/hydraulic/mod.rs @@ -9567,31 +9567,6 @@ mod tests { assert!(test_bed.is_slats_moving()); } - #[test] - fn yellow_epump_can_deploy_flaps_and_slats() { - let mut test_bed = test_bed_on_ground_with() - .engines_off() - .on_the_ground() - .set_cold_dark_inputs() - .run_one_tick(); - - test_bed = test_bed - .set_yellow_e_pump(false) - .run_waiting_for(Duration::from_secs(10)); - - // Yellow epump working - assert!(test_bed.is_yellow_pressure_switch_pressurised()); - - test_bed = test_bed - .set_flaps_handle_position(4) - .run_waiting_for(Duration::from_secs(80)); - - assert!(test_bed.get_flaps_left_position_percent() > 99.); - assert!(test_bed.get_flaps_right_position_percent() > 99.); - assert!(test_bed.get_slats_left_position_percent() > 99.); - assert!(test_bed.get_slats_right_position_percent() > 99.); - } - #[test] fn yellow_epump_can_deploy_flaps_and_slats_on_worst_case_ptu() { let mut test_bed = test_bed_on_ground_with() diff --git a/src/systems/systems/src/hydraulic/electrical_generator.rs b/src/systems/systems/src/hydraulic/electrical_generator.rs index e5e85daa0f4..3ff0f08f8cd 100644 --- a/src/systems/systems/src/hydraulic/electrical_generator.rs +++ b/src/systems/systems/src/hydraulic/electrical_generator.rs @@ -364,7 +364,7 @@ impl EmergencyGeneratorPower for TestGenerator { #[cfg(test)] mod tests { use super::*; - use crate::shared::update_iterator::FixedStepLoop; + use crate::shared::update_iterator::MaxStepLoop; use crate::simulation::test::{SimulationTestBed, TestBed}; use crate::simulation::{Aircraft, SimulationElement, SimulationElementVisitor}; use std::time::Duration; @@ -478,7 +478,7 @@ mod tests { } struct TestAircraft { - updater_fixed_step: FixedStepLoop, + updater_max_step: MaxStepLoop, gcu: GeneratorControlUnit<9>, lgciu: TestLgciuSensors, @@ -491,7 +491,7 @@ mod tests { impl TestAircraft { fn new(context: &mut InitContext) -> Self { Self { - updater_fixed_step: FixedStepLoop::new(Duration::from_millis(33)), + updater_max_step: MaxStepLoop::new(Duration::from_millis(10)), gcu: gen_control_unit(), lgciu: TestLgciuSensors::compressed(), rat_man_on: TestRatManOn::not_pressed(), @@ -524,9 +524,9 @@ mod tests { } impl Aircraft for TestAircraft { fn update_after_power_distribution(&mut self, context: &UpdateContext) { - self.updater_fixed_step.update(context); + self.updater_max_step.update(context); - for cur_time_step in &mut self.updater_fixed_step { + for cur_time_step in &mut self.updater_max_step { self.gcu.update( &context.with_delta(cur_time_step), &self.emergency_gen, diff --git a/src/systems/systems/src/hydraulic/electrical_pump_physics.rs b/src/systems/systems/src/hydraulic/electrical_pump_physics.rs index 44d73d953b2..30295a40f60 100644 --- a/src/systems/systems/src/hydraulic/electrical_pump_physics.rs +++ b/src/systems/systems/src/hydraulic/electrical_pump_physics.rs @@ -239,7 +239,7 @@ mod tests { use crate::electrical::ElectricalBus; use crate::electrical::Electricity; - use crate::shared::{update_iterator::FixedStepLoop, PotentialOrigin}; + use crate::shared::{update_iterator::MaxStepLoop, PotentialOrigin}; use crate::simulation::{Aircraft, SimulationElement, SimulationElementVisitor, UpdateContext}; use crate::simulation::test::{SimulationTestBed, TestBed}; @@ -270,7 +270,7 @@ mod tests { } struct TestAircraft { - core_hydraulic_updater: FixedStepLoop, + core_hydraulic_updater: MaxStepLoop, pump: ElectricalPumpPhysics, hydraulic_section: TestHydraulicSection, @@ -283,7 +283,7 @@ mod tests { impl TestAircraft { fn new(context: &mut InitContext) -> Self { Self { - core_hydraulic_updater: FixedStepLoop::new(Duration::from_millis(33)), + core_hydraulic_updater: MaxStepLoop::new(Duration::from_millis(10)), pump: physical_pump(context), hydraulic_section: TestHydraulicSection::default(), current_displacement: Volume::new::(0.), diff --git a/src/systems/systems/src/hydraulic/flap_slat.rs b/src/systems/systems/src/hydraulic/flap_slat.rs index 4917804870f..f817aab8559 100644 --- a/src/systems/systems/src/hydraulic/flap_slat.rs +++ b/src/systems/systems/src/hydraulic/flap_slat.rs @@ -500,7 +500,7 @@ mod tests { use uom::si::pressure::psi; - use crate::shared::update_iterator::FixedStepLoop; + use crate::shared::update_iterator::MaxStepLoop; use crate::simulation::{Aircraft, SimulationElement, SimulationElementVisitor, UpdateContext}; @@ -532,7 +532,7 @@ mod tests { } struct TestAircraft { - core_hydraulic_updater: FixedStepLoop, + core_hydraulic_updater: MaxStepLoop, flaps_slats: FlapSlatAssembly, @@ -545,7 +545,7 @@ mod tests { impl TestAircraft { fn new(context: &mut InitContext, max_speed: AngularVelocity) -> Self { Self { - core_hydraulic_updater: FixedStepLoop::new(Duration::from_millis(33)), + core_hydraulic_updater: MaxStepLoop::new(Duration::from_millis(10)), flaps_slats: flap_system(context, max_speed), left_motor_angle_request: None, right_motor_angle_request: None, diff --git a/src/systems/systems/src/hydraulic/landing_gear.rs b/src/systems/systems/src/hydraulic/landing_gear.rs index c860d5c329c..a74ceef359b 100644 --- a/src/systems/systems/src/hydraulic/landing_gear.rs +++ b/src/systems/systems/src/hydraulic/landing_gear.rs @@ -1284,13 +1284,13 @@ mod tests { fn door_assembly_init_uplocked() { let mut test_bed = SimulationTestBed::new(|_| { TestSingleGearAircraft::new( - Duration::from_millis(33), + Duration::from_millis(10), main_gear_door_right_assembly(), main_gear_right_assembly(true), ) }); - test_bed.run_with_delta(Duration::from_millis(33)); + test_bed.run_with_delta(Duration::from_millis(10)); assert!(test_bed.query(|a| a.door_assembly.is_locked())); assert!( @@ -1302,13 +1302,13 @@ mod tests { fn door_uplocked_gives_correct_proximity_sensor_state() { let mut test_bed = SimulationTestBed::new(|_| { TestSingleGearAircraft::new( - Duration::from_millis(33), + Duration::from_millis(10), main_gear_door_right_assembly(), main_gear_right_assembly(true), ) }); - test_bed.run_with_delta(Duration::from_millis(33)); + test_bed.run_with_delta(Duration::from_millis(10)); assert!( test_bed.query(|a| a.door_assembly.position_normalized()) == Ratio::new::(0.) @@ -1325,13 +1325,13 @@ mod tests { fn door_opens_gear_stays_down_and_locked() { let mut test_bed = SimulationTestBed::new(|_| { TestSingleGearAircraft::new( - Duration::from_millis(33), + Duration::from_millis(10), main_gear_door_right_assembly(), main_gear_right_assembly(true), ) }); - test_bed.run_with_delta(Duration::from_millis(33)); + test_bed.run_with_delta(Duration::from_millis(10)); assert!(test_bed.query(|a| a.is_door_sensor_uplock(LgciuId::Lgciu1))); assert!(test_bed.query(|a| a.is_door_sensor_uplock(LgciuId::Lgciu2))); @@ -1343,7 +1343,7 @@ mod tests { fn no_unlocking_from_door_uplock_without_pressure() { let mut test_bed = SimulationTestBed::new(|_| { TestSingleGearAircraft::new( - Duration::from_millis(33), + Duration::from_millis(10), main_gear_door_right_assembly(), main_gear_right_assembly(true), ) @@ -1361,12 +1361,12 @@ mod tests { fn full_retract_extend_cycle() { let mut test_bed = SimulationTestBed::new(|_| { TestSingleGearAircraft::new( - Duration::from_millis(33), + Duration::from_millis(10), main_gear_door_right_assembly(), main_gear_right_assembly(true), ) }); - test_bed.run_with_delta(Duration::from_millis(33)); + test_bed.run_with_delta(Duration::from_millis(10)); println!("RETRACT -- > DOOR OPENING"); test_bed.command(|a| a.command_doors_opening()); diff --git a/src/systems/systems/src/hydraulic/linear_actuator.rs b/src/systems/systems/src/hydraulic/linear_actuator.rs index 5d2517ff522..b156c8d1042 100644 --- a/src/systems/systems/src/hydraulic/linear_actuator.rs +++ b/src/systems/systems/src/hydraulic/linear_actuator.rs @@ -2376,7 +2376,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2393,7 +2393,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2415,7 +2415,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2441,7 +2441,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2467,7 +2467,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2494,7 +2494,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2521,7 +2521,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2541,7 +2541,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2570,7 +2570,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(false), ) }); @@ -2592,7 +2592,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2617,7 +2617,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2649,7 +2649,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2691,7 +2691,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), cargo_door_assembly(true), ) }); @@ -2897,7 +2897,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), main_gear_right_assembly(true), ) }); @@ -3008,7 +3008,7 @@ mod tests { let mut test_bed = SimulationTestBed::new(|context| { TestAircraft::new( context, - Duration::from_millis(33), + Duration::from_millis(10), main_gear_left_assembly(true), ) }); diff --git a/src/systems/systems/src/hydraulic/trimmable_horizontal_stabilizer.rs b/src/systems/systems/src/hydraulic/trimmable_horizontal_stabilizer.rs index cc0ab67bb3d..16fc548f750 100644 --- a/src/systems/systems/src/hydraulic/trimmable_horizontal_stabilizer.rs +++ b/src/systems/systems/src/hydraulic/trimmable_horizontal_stabilizer.rs @@ -726,7 +726,7 @@ mod tests { use crate::electrical::Electricity; use super::*; - use crate::shared::{update_iterator::FixedStepLoop, PotentialOrigin}; + use crate::shared::{update_iterator::MaxStepLoop, PotentialOrigin}; use crate::simulation::test::{ReadByName, SimulationTestBed, TestBed}; use crate::simulation::{Aircraft, SimulationElement}; use std::time::Duration; @@ -804,7 +804,7 @@ mod tests { } struct TestAircraft { - updater_fixed_step: FixedStepLoop, + updater_max_step: MaxStepLoop, elec_trim_control: TestElecTrimControl, manual_trim_control: TestManualTrimControl, @@ -822,7 +822,7 @@ mod tests { impl TestAircraft { fn new(context: &mut InitContext) -> Self { Self { - updater_fixed_step: FixedStepLoop::new(Duration::from_millis(33)), + updater_max_step: MaxStepLoop::new(Duration::from_millis(10)), elec_trim_control: TestElecTrimControl::inactive_control(), manual_trim_control: TestManualTrimControl::without_manual_input(), trim_assembly: TrimmableHorizontalStabilizerAssembly::new( @@ -902,9 +902,9 @@ mod tests { } fn update_after_power_distribution(&mut self, context: &UpdateContext) { - self.updater_fixed_step.update(context); + self.updater_max_step.update(context); - for cur_time_step in &mut self.updater_fixed_step { + for cur_time_step in &mut self.updater_max_step { self.trim_assembly.update( &context.with_delta(cur_time_step), &self.elec_trim_control, From 605d7c3af3ec9bcc0cb2383896e59420b810bc04 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Wed, 21 Dec 2022 10:41:31 +0100 Subject: [PATCH 08/10] fix merge --- src/systems/a320_systems/src/hydraulic/mod.rs | 12 +------ src/systems/a380_systems/src/hydraulic/mod.rs | 2 -- .../systems/src/hydraulic/landing_gear.rs | 33 +++++++++++-------- .../systems/src/hydraulic/linear_actuator.rs | 30 ----------------- 4 files changed, 21 insertions(+), 56 deletions(-) diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs index 9f1716c2f29..614b0baa7ad 100644 --- a/src/systems/a320_systems/src/hydraulic/mod.rs +++ b/src/systems/a320_systems/src/hydraulic/mod.rs @@ -62,17 +62,7 @@ use systems::{ ElectricalBuses, EmergencyElectricalRatPushButton, EmergencyElectricalState, EmergencyGeneratorPower, EngineFirePushButtons, GearWheel, HydraulicColor, HydraulicGeneratorControlUnit, LandingGearHandle, LgciuInterface, LgciuWeightOnWheels, - ReservoirAirPressure, SectionPressure, - interpolation, - low_pass_filter::LowPassFilter, - random_from_normal_distribution, random_from_range, - update_iterator::{FixedStepLoop, MaxStepLoop}, - AdirsDiscreteOutputs, DelayedFalseLogicGate, DelayedPulseTrueLogicGate, - DelayedTrueLogicGate, ElectricalBusType, ElectricalBuses, EmergencyElectricalRatPushButton, - EmergencyElectricalState, EmergencyGeneratorPower, EngineFirePushButtons, GearWheel, - HydraulicColor, HydraulicGeneratorControlUnit, LandingGearHandle, LgciuInterface, - LgciuWeightOnWheels, ReservoirAirPressure, SectionPressure, TrimmableHorizontalStabilizer, - + ReservoirAirPressure, SectionPressure, TrimmableHorizontalStabilizer, }, simulation::{ InitContext, Read, Reader, SimulationElement, SimulationElementVisitor, SimulatorReader, diff --git a/src/systems/a380_systems/src/hydraulic/mod.rs b/src/systems/a380_systems/src/hydraulic/mod.rs index f55a825f27b..48db626b240 100644 --- a/src/systems/a380_systems/src/hydraulic/mod.rs +++ b/src/systems/a380_systems/src/hydraulic/mod.rs @@ -1889,10 +1889,8 @@ impl A380Hydraulic { ); for cur_time_step in self.core_hydraulic_updater { - self.update_physics(&context.with_delta(cur_time_step), lgcius, adirs); - self.update_core_hydraulics( &context.with_delta(cur_time_step), engines, diff --git a/src/systems/systems/src/hydraulic/landing_gear.rs b/src/systems/systems/src/hydraulic/landing_gear.rs index 52386dd1917..049b927d225 100644 --- a/src/systems/systems/src/hydraulic/landing_gear.rs +++ b/src/systems/systems/src/hydraulic/landing_gear.rs @@ -1283,11 +1283,12 @@ mod tests { #[test] fn door_assembly_init_uplocked() { let mut test_bed = SimulationTestBed::new(|context| { + let gear_door = main_gear_door_right_assembly(context); + TestSingleGearAircraft::new( Duration::from_millis(10), - main_gear_door_right_assembly(), - main_gear_right_assembly(true), - + gear_door, + main_gear_right_assembly(context, true), ) }); @@ -1302,11 +1303,12 @@ mod tests { #[test] fn door_uplocked_gives_correct_proximity_sensor_state() { let mut test_bed = SimulationTestBed::new(|context| { + let gear_door = main_gear_door_right_assembly(context); + TestSingleGearAircraft::new( Duration::from_millis(10), - main_gear_door_right_assembly(), - main_gear_right_assembly(true), - + gear_door, + main_gear_right_assembly(context, true), ) }); @@ -1326,11 +1328,12 @@ mod tests { #[test] fn door_opens_gear_stays_down_and_locked() { let mut test_bed = SimulationTestBed::new(|context| { + let gear_door = main_gear_door_right_assembly(context); + TestSingleGearAircraft::new( Duration::from_millis(10), - main_gear_door_right_assembly(), - main_gear_right_assembly(true), - + gear_door, + main_gear_right_assembly(context, true), ) }); @@ -1345,10 +1348,12 @@ mod tests { #[test] fn no_unlocking_from_door_uplock_without_pressure() { let mut test_bed = SimulationTestBed::new(|context| { + let gear_door = main_gear_door_right_assembly(context); + TestSingleGearAircraft::new( Duration::from_millis(10), - main_gear_door_right_assembly(), - main_gear_right_assembly(true), + gear_door, + main_gear_right_assembly(context, true), ) }); test_bed.command(|a| a.set_pressure(Pressure::new::(10.))); @@ -1363,10 +1368,12 @@ mod tests { #[test] fn full_retract_extend_cycle() { let mut test_bed = SimulationTestBed::new(|context| { + let gear_door = main_gear_door_right_assembly(context); + TestSingleGearAircraft::new( Duration::from_millis(10), - main_gear_door_right_assembly(), - main_gear_right_assembly(true), + gear_door, + main_gear_right_assembly(context, true), ) }); test_bed.run_with_delta(Duration::from_millis(10)); diff --git a/src/systems/systems/src/hydraulic/linear_actuator.rs b/src/systems/systems/src/hydraulic/linear_actuator.rs index 2f9fffe67d8..65715ac287f 100644 --- a/src/systems/systems/src/hydraulic/linear_actuator.rs +++ b/src/systems/systems/src/hydraulic/linear_actuator.rs @@ -2538,10 +2538,8 @@ mod tests { #[test] fn linear_actuator_not_moving_on_locked_rigid_body() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2554,10 +2552,8 @@ mod tests { #[test] fn linear_actuator_moving_on_unlocked_rigid_body() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2575,10 +2571,8 @@ mod tests { #[test] fn linear_actuator_can_move_rigid_body_up() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2600,10 +2594,8 @@ mod tests { #[test] fn linear_actuator_resists_body_drop_when_valves_closed() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2625,10 +2617,8 @@ mod tests { #[test] fn linear_actuator_dampens_body_drop_when_active_damping_mode() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2651,10 +2641,8 @@ mod tests { #[test] fn linear_actuator_dampens_super_slow_body_drop_when_slow_damping_mode() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2677,10 +2665,8 @@ mod tests { #[test] fn linear_actuator_without_hyd_pressure_cant_move_body_up() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2696,10 +2682,8 @@ mod tests { #[test] fn linear_actuator_losing_hyd_pressure_half_way_cant_move_body_up() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2724,10 +2708,8 @@ mod tests { #[test] fn body_gravity_movement_if_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, false); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -2745,10 +2727,8 @@ mod tests { #[test] fn start_moving_once_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2769,10 +2749,8 @@ mod tests { #[test] fn locks_at_required_position() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2800,10 +2778,8 @@ mod tests { #[test] fn soft_lock_with_zero_velocity_stops_the_body() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2841,10 +2817,8 @@ mod tests { #[test] fn linear_actuator_can_control_position() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = cargo_door_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); test_bed.command(|a| a.command_unlock()); @@ -3019,10 +2993,8 @@ mod tests { #[test] fn right_main_gear_locked_down_at_init() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = main_gear_right_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); assert!(test_bed.query(|a| a.is_locked())); @@ -3117,10 +3089,8 @@ mod tests { #[test] fn left_main_gear_locked_down_at_init() { let mut test_bed = SimulationTestBed::new(|context| { - let tested_object = main_gear_left_assembly(context, true); TestAircraft::new(context, Duration::from_millis(10), tested_object) - }); assert!(test_bed.query(|a| a.is_locked())); From 4f71b246c01b0b935b4283c230f8b98b98fdc2f9 Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Thu, 22 Dec 2022 09:59:31 +0100 Subject: [PATCH 09/10] removed variable test timestep --- .../systems/src/hydraulic/linear_actuator.rs | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/src/systems/systems/src/hydraulic/linear_actuator.rs b/src/systems/systems/src/hydraulic/linear_actuator.rs index 3273873a6c5..eb2619901a7 100644 --- a/src/systems/systems/src/hydraulic/linear_actuator.rs +++ b/src/systems/systems/src/hydraulic/linear_actuator.rs @@ -2085,13 +2085,14 @@ mod tests { power_consumption: Power, } impl TestAircraft { + const PHYSICS_TIME_STEP: Duration = Duration::from_millis(10); + fn new( context: &mut InitContext, - time_step: Duration, hydraulic_assembly: HydraulicLinearActuatorAssembly, ) -> Self { Self { - loop_updater: MaxStepLoop::new(time_step), + loop_updater: MaxStepLoop::new(Self::PHYSICS_TIME_STEP), hydraulic_assembly, @@ -2551,7 +2552,7 @@ mod tests { fn linear_actuator_not_moving_on_locked_rigid_body() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2565,7 +2566,7 @@ mod tests { fn linear_actuator_moving_on_unlocked_rigid_body() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2584,7 +2585,7 @@ mod tests { fn linear_actuator_can_move_rigid_body_up() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); let actuator_position_init = test_bed.query(|a| a.body_position()); @@ -2607,7 +2608,7 @@ mod tests { fn linear_actuator_resists_body_drop_when_valves_closed() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2630,7 +2631,7 @@ mod tests { fn linear_actuator_dampens_body_drop_when_active_damping_mode() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2654,7 +2655,7 @@ mod tests { fn linear_actuator_dampens_super_slow_body_drop_when_slow_damping_mode() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2678,7 +2679,7 @@ mod tests { fn linear_actuator_without_hyd_pressure_cant_move_body_up() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2695,7 +2696,7 @@ mod tests { fn linear_actuator_losing_hyd_pressure_half_way_cant_move_body_up() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2721,7 +2722,7 @@ mod tests { fn body_gravity_movement_if_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2740,7 +2741,7 @@ mod tests { fn start_moving_once_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2762,7 +2763,7 @@ mod tests { fn locks_at_required_position() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2791,7 +2792,7 @@ mod tests { fn soft_lock_with_zero_velocity_stops_the_body() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2830,7 +2831,7 @@ mod tests { fn linear_actuator_can_control_position() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = cargo_door_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -2854,7 +2855,7 @@ mod tests { fn right_main_gear_door_drops_when_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_closed_circuit_damping_mode(0)); @@ -2868,7 +2869,7 @@ mod tests { fn right_main_gear_door_drops_freefall_when_unlocked_with_broken_actuator() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_right_broken_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_closed_circuit_damping_mode(0)); @@ -2882,7 +2883,7 @@ mod tests { fn right_main_gear_door_cant_open_fully_if_banking_right() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.run_with_delta(Duration::from_secs(1)); @@ -2899,7 +2900,7 @@ mod tests { fn right_main_gear_door_closes_after_opening_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -2923,7 +2924,7 @@ mod tests { fn nose_gear_door_closes_after_opening_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = nose_gear_door_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -2947,7 +2948,7 @@ mod tests { fn left_main_gear_door_drops_when_unlocked() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_closed_circuit_damping_mode(0)); @@ -2961,7 +2962,7 @@ mod tests { fn left_main_gear_door_can_open_fully_if_banking_right() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.write_by_name(UpdateContext::PLANE_BANK_KEY, -45.); @@ -2976,7 +2977,7 @@ mod tests { fn left_main_gear_door_opens_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_door_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -2991,7 +2992,7 @@ mod tests { fn right_main_gear_retracts_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -3006,7 +3007,7 @@ mod tests { fn right_main_gear_locked_down_at_init() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); assert!(test_bed.query(|a| a.is_locked())); @@ -3022,7 +3023,7 @@ mod tests { fn right_main_gear_locks_up_when_retracted() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -3041,7 +3042,7 @@ mod tests { fn right_main_gear_locks_down_when_extended_by_gravity() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_right_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); // FIRST GEAR UP @@ -3072,7 +3073,7 @@ mod tests { fn left_main_gear_retracts_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -3087,7 +3088,7 @@ mod tests { fn left_main_gear_retracts_with_limited_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(1500.)])); @@ -3102,7 +3103,7 @@ mod tests { fn left_main_gear_locked_down_at_init() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); assert!(test_bed.query(|a| a.is_locked())); @@ -3118,7 +3119,7 @@ mod tests { fn left_main_gear_locks_up_when_retracted() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -3137,7 +3138,7 @@ mod tests { fn left_main_gear_locks_down_when_extended_by_gravity() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = main_gear_left_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); // FIRST GEAR UP @@ -3168,7 +3169,7 @@ mod tests { fn nose_gear_locks_up_when_retracted() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = nose_gear_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.set_pressures([Pressure::new::(3000.)])); @@ -3187,7 +3188,7 @@ mod tests { fn aileron_initialized_down_stays_down_with_broken_actuator() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3202,7 +3203,7 @@ mod tests { fn aileron_initialized_down_moves_up_when_commanded() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3220,7 +3221,7 @@ mod tests { fn aileron_drops_from_middle_pos_in_more_20s_in_closed_circuit_damping() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3238,7 +3239,7 @@ mod tests { fn aileron_drops_from_middle_pos_and_damping_is_stable() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3258,7 +3259,7 @@ mod tests { fn aileron_position_control_is_stable() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3294,7 +3295,7 @@ mod tests { fn aileron_position_control_from_down_to_up_less_0_5s() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3318,7 +3319,7 @@ mod tests { fn aileron_initialized_down_goes_neutral_when_trimmed_90_degrees_down() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3339,7 +3340,7 @@ mod tests { fn aileron_position_control_resists_step_change_in_aero_force() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3367,7 +3368,7 @@ mod tests { fn aileron_position_control_fails_when_aero_force_over_max_force() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3402,7 +3403,7 @@ mod tests { { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3447,7 +3448,7 @@ mod tests { fn aileron_position_control_from_down_to_up_less_0_5s_with_limited_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = aileron_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3471,7 +3472,7 @@ mod tests { fn elevator_position_control_is_stable_with_all_actuators_in_control() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = elevator_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3509,7 +3510,7 @@ mod tests { fn elevator_droop_control_is_stable_engaged_at_full_speed() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = elevator_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3550,7 +3551,7 @@ mod tests { fn spoiler_position_control_from_down_to_up_less_0_8s() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3568,7 +3569,7 @@ mod tests { fn spoiler_position_can_go_down_but_not_up_when_soft_locked_up() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3606,7 +3607,7 @@ mod tests { fn spoiler_position_cant_go_up_when_not_pressurised() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, false); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3623,7 +3624,7 @@ mod tests { fn elevator_electro_hydrostatic_cannot_move_with_elec_and_no_pressure_but_backup_not_active() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = elevator_electro_hydrostatic_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3645,7 +3646,7 @@ mod tests { fn elevator_electro_hydrostatic_can_move_with_elec_and_no_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = elevator_electro_hydrostatic_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3669,7 +3670,7 @@ mod tests { fn elevator_electro_hydrostatic_losing_elec_cannot_move_anymore() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = elevator_electro_hydrostatic_assembly(context); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3701,7 +3702,7 @@ mod tests { fn spoiler_electro_hydrostatic_can_move_with_pressure() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3719,7 +3720,7 @@ mod tests { fn spoiler_electro_hydrostatic_cannot_move_without_pressure_without_backup_active() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3737,7 +3738,7 @@ mod tests { fn spoiler_electro_hydrostatic_cannot_move_without_pressure_without_elec_with_backup_active() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3756,7 +3757,7 @@ mod tests { fn spoiler_electro_hydrostatic_can_move_without_pressure_with_elec_with_backup_active() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3776,7 +3777,7 @@ mod tests { fn electro_hydrostatic_actuator_consumes_power_when_moving() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3801,7 +3802,7 @@ mod tests { fn electro_hydrostatic_actuator_do_not_use_hydraulic_flow_when_moving() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3826,7 +3827,7 @@ mod tests { fn electro_hydrostatic_actuator_do_not_consume_power_when_inactive() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3851,7 +3852,7 @@ mod tests { fn spoiler_electro_hydrostatic_cannot_move_once_accumulator_empty() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); test_bed.command(|a| a.command_unlock()); @@ -3877,7 +3878,7 @@ mod tests { fn electro_hydrostatic_accumulator_pressure_increase_when_refilled() { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); let accumulator_press_init = test_bed.query(|a| a.accumulator_pressure(0)); @@ -3896,7 +3897,7 @@ mod tests { { let mut test_bed = SimulationTestBed::new(|context| { let tested_object = spoiler_assembly(context, true); - TestAircraft::new(context, Duration::from_millis(10), tested_object) + TestAircraft::new(context, tested_object) }); let accumulator_press_init = test_bed.query(|a| a.accumulator_pressure(0)); From fe424f1203fa8156c673b0b4c55b8b35594ea0df Mon Sep 17 00:00:00 2001 From: davydecorps <38904654+crocket63@users.noreply.github.com> Date: Fri, 30 Dec 2022 16:07:12 +0100 Subject: [PATCH 10/10] Update mod.rs --- src/systems/a320_systems/src/hydraulic/mod.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/systems/a320_systems/src/hydraulic/mod.rs b/src/systems/a320_systems/src/hydraulic/mod.rs index b30fce318c4..3d5f992824a 100644 --- a/src/systems/a320_systems/src/hydraulic/mod.rs +++ b/src/systems/a320_systems/src/hydraulic/mod.rs @@ -56,16 +56,14 @@ use systems::{ AutoOffFaultPushButton, AutoOnFaultPushButton, MomentaryOnPushButton, MomentaryPushButton, }, shared::{ - interpolation, random_from_normal_distribution, - random_from_range, update_iterator::MaxStepLoop, - update_iterator::{ MaxStepLoop}, - AdirsDiscreteOutputs, AirbusElectricPumpId, AirbusEngineDrivenPumpId, - - DelayedFalseLogicGate, DelayedPulseTrueLogicGate, DelayedTrueLogicGate, ElectricalBusType, - ElectricalBuses, EmergencyElectricalRatPushButton, EmergencyElectricalState, - EmergencyGeneratorPower, EngineFirePushButtons, GearWheel, HydraulicColor, - HydraulicGeneratorControlUnit, LandingGearHandle, LgciuInterface, LgciuWeightOnWheels, - ReservoirAirPressure, SectionPressure, TrimmableHorizontalStabilizer, + interpolation, low_pass_filter::LowPassFilter, random_from_normal_distribution, + random_from_range, update_iterator::MaxStepLoop, AdirsDiscreteOutputs, + AirbusElectricPumpId, AirbusEngineDrivenPumpId, DelayedFalseLogicGate, + DelayedPulseTrueLogicGate, DelayedTrueLogicGate, ElectricalBusType, ElectricalBuses, + EmergencyElectricalRatPushButton, EmergencyElectricalState, EmergencyGeneratorPower, + EngineFirePushButtons, GearWheel, HydraulicColor, HydraulicGeneratorControlUnit, + LandingGearHandle, LgciuInterface, LgciuWeightOnWheels, ReservoirAirPressure, + SectionPressure, TrimmableHorizontalStabilizer, }, simulation::{ InitContext, Read, Reader, SimulationElement, SimulationElementVisitor, SimulatorReader,