Skip to content

Commit

Permalink
refactor(cond): merge air cond and pneumatic pack flow valve (#7355)
Browse files Browse the repository at this point in the history
* refactor: split PackFlowValveController for each pack

* refactor: connect pneumatic valve to acsc

* refactor: remove pack_flow_valve_controller in pneumatic

* refactor: remove PackFlowValve in air_conditioning

* feat: split cond_pack_flow LVar for each pack

* test: refactor tests for pack flow valve

* feat: connect flow from pneumatic valve to air cond

* refactor: change enum PackId to tuple struct

* refactor: change From implementation to to_index() fn for Pack
  • Loading branch information
mjuhe authored Aug 15, 2022
1 parent 050f645 commit 20c7cd7
Show file tree
Hide file tree
Showing 8 changed files with 676 additions and 715 deletions.
4 changes: 2 additions & 2 deletions docs/a320-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -2438,9 +2438,9 @@ In the variables below, {number} should be replaced with one item in the set: {
- Bool
- True if the respective {1 or 2} pack flow valve is open

- A32NX_COND_PACK_FLOW
- A32NX_COND_PACK_FLOW_{index}
- Percent
- Percentage flow coming out of the packs into the cabin (LO: 80%, NORM: 100%, HI: 120%)
- Percentage flow coming out of each pack {1 or 2} into the cabin (LO: 80%, NORM: 100%, HI: 120%)

- A32NX_OVHD_COND_{id}_SELECTOR_KNOB
- Percentage
Expand Down
2 changes: 1 addition & 1 deletion src/instruments/src/SD/Pages/Bleed/elements/BleedGauge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const BleedGauge: FC<BleedGaugeProps> = ({ x, y, engine, sdacDatum, packFlowValv
const [precoolerOutletTemp] = useSimVar(`L:A32NX_PNEU_ENG_${engine}_PRECOOLER_OUTLET_TEMPERATURE`, 'celsius', 500);
const compressorOutletTemp = Math.round(precoolerOutletTemp / 5) * 5;

const [packInletFlowPercentage] = useSimVar('L:A32NX_COND_PACK_FLOW', 'percent', 500);
const [packInletFlowPercentage] = useSimVar(`L:A32NX_COND_PACK_FLOW_${engine}`, 'percent', 500);

const [fwdCondSelectorKnob] = useSimVar('L:A32NX_OVHD_COND_FWD_SELECTOR_KNOB', 'number', 1000); // 0 to 300
const packBypassValve = Math.round(fwdCondSelectorKnob / 300 * 100);
Expand Down
15 changes: 12 additions & 3 deletions src/systems/a320_systems/src/air_conditioning.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use systems::{
accept_iterable,
air_conditioning::{
cabin_air::CabinZone, AirConditioningSystem, DuctTemperature, PackFlow, ZoneType,
acs_controller::{Pack, PackFlowController},
cabin_air::CabinZone,
AirConditioningSystem, DuctTemperature, PackFlow, PackFlowControllers, ZoneType,
},
pressurization::PressurizationOverheadPanel,
shared::{
Cabin, EngineBleedPushbutton, EngineCorrectedN1, EngineFirePushButtons, EngineStartState,
GroundSpeed, LgciuWeightOnWheels, PneumaticBleed,
GroundSpeed, LgciuWeightOnWheels, PackFlowValveState, PneumaticBleed,
},
simulation::{InitContext, SimulationElement, SimulationElementVisitor, UpdateContext},
};
Expand Down Expand Up @@ -34,7 +36,7 @@ impl A320AirConditioning {
adirs: &impl GroundSpeed,
engines: [&impl EngineCorrectedN1; 2],
engine_fire_push_buttons: &impl EngineFirePushButtons,
pneumatic: &(impl PneumaticBleed + EngineStartState),
pneumatic: &(impl EngineStartState + PackFlowValveState + PneumaticBleed),
pneumatic_overhead: &impl EngineBleedPushbutton,
pressurization: &impl Cabin,
pressurization_overhead: &PressurizationOverheadPanel,
Expand All @@ -60,6 +62,13 @@ impl A320AirConditioning {
}
}

impl PackFlowControllers<3> for A320AirConditioning {
fn pack_flow_controller(&self, pack_id: Pack) -> PackFlowController<3> {
self.a320_air_conditioning_system
.pack_flow_controller(pack_id)
}
}

impl SimulationElement for A320AirConditioning {
fn accept<T: SimulationElementVisitor>(&mut self, visitor: &mut T) {
self.a320_cabin.accept(visitor);
Expand Down
1 change: 1 addition & 0 deletions src/systems/a320_systems/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ impl Aircraft for A320 {
&self.pneumatic_overhead,
&self.engine_fire_overhead,
&self.apu,
&self.air_conditioning,
);
self.air_conditioning.update(
context,
Expand Down
Loading

0 comments on commit 20c7cd7

Please sign in to comment.