Skip to content

Commit

Permalink
feat(cond): a380 temperature control and ventilation (flybywiresim#8086)
Browse files Browse the repository at this point in the history
* feat: trim air drive device and tcs application

* feat: connect tadd and cpiom to air cond system

* feat: improve local controller channels

* feat: use a380 volume for the cabin zones

* feat: ventilation control module

* feat: cpiom b ventilation control system app

* feat: cargo bulk ventilation

* feat: forward cargo temperature control and tests

* style: small refactor and style improvements

* refactor: variable trim air system volume

* feat: system outputs

* fix: power source for HP fans

* fix: wrong vcm updating aft fans

* fix: merge conflicts

* fix: review comments

* refactor: small final style updates

* refactor: move local controllers to aircraft crate

* fix: second round of comments

* style: add comment to clarify duct_demand_temperature fn

* fix: comment typo
  • Loading branch information
mjuhe authored Oct 20, 2023
1 parent 7393f1d commit 581edbc
Show file tree
Hide file tree
Showing 17 changed files with 3,057 additions and 416 deletions.
52 changes: 38 additions & 14 deletions fbw-a32nx/src/wasm/systems/a320_systems/src/air_conditioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use systems::{
AdirsToAirCondInterface, Air, AirConditioningOverheadShared, AirConditioningPack, CabinFan,
Channel, DuctTemperature, MixerUnit, OutflowValveSignal, OutletAir, OverheadFlowSelector,
PackFlowControllers, PressurizationConstants, PressurizationOverheadShared, TrimAirSystem,
ZoneType,
VcmShared, ZoneType,
},
overhead::{
AutoManFaultPushButton, NormalOnPushButton, OnOffFaultPushButton, OnOffPushButton,
Expand All @@ -33,7 +33,7 @@ use systems::{
use std::time::Duration;
use uom::si::{
f64::*, pressure::hectopascal, ratio::percent, thermodynamic_temperature::degree_celsius,
velocity::knot,
velocity::knot, volume::cubic_meter, volume_rate::liter_per_second,
};

use crate::payload::A320Pax;
Expand Down Expand Up @@ -177,7 +177,7 @@ impl A320Cabin {
fn update(
&mut self,
context: &UpdateContext,
air_conditioning_system: &(impl OutletAir + DuctTemperature),
air_conditioning_system: &(impl OutletAir + DuctTemperature + VcmShared),
lgciu: [&impl LgciuWeightOnWheels; 2],
number_of_passengers: &impl NumberOfPassengers,
pressurization: &A320PressurizationSystem,
Expand Down Expand Up @@ -252,6 +252,8 @@ pub struct A320AirConditioningSystem {
}

impl A320AirConditioningSystem {
const CAB_FAN_DESIGN_FLOW_RATE_L_S: f64 = 325.; // litres/sec

pub(crate) fn new(context: &mut InitContext, cabin_zones: &[ZoneType; 3]) -> Self {
Self {
acs_interface: [
Expand Down Expand Up @@ -299,15 +301,29 @@ impl A320AirConditioningSystem {
),
],
cabin_fans: [
CabinFan::new(1, ElectricalBusType::AlternatingCurrent(1)),
CabinFan::new(2, ElectricalBusType::AlternatingCurrent(2)),
CabinFan::new(
1,
VolumeRate::new::<liter_per_second>(Self::CAB_FAN_DESIGN_FLOW_RATE_L_S),
ElectricalBusType::AlternatingCurrent(1),
),
CabinFan::new(
2,
VolumeRate::new::<liter_per_second>(Self::CAB_FAN_DESIGN_FLOW_RATE_L_S),
ElectricalBusType::AlternatingCurrent(2),
),
],
mixer_unit: MixerUnit::new(cabin_zones),
packs: [
AirConditioningPack::new(Pack(1)),
AirConditioningPack::new(Pack(2)),
AirConditioningPack::new(context, Pack(1)),
AirConditioningPack::new(context, Pack(2)),
],
trim_air_system: TrimAirSystem::new(context, cabin_zones, &[1]),
trim_air_system: TrimAirSystem::new(
context,
cabin_zones,
&[1],
Volume::new::<cubic_meter>(4.),
Volume::new::<cubic_meter>(0.03),
),

air_conditioning_overhead: A320AirConditioningSystemOverhead::new(context, cabin_zones),
}
Expand Down Expand Up @@ -424,9 +440,9 @@ impl A320AirConditioningSystem {
self.trim_air_system.update(
context,
&self.mixer_unit,
&[
&self.acsc[0].trim_air_pressure_regulating_valve_controller(),
&self.acsc[1].trim_air_pressure_regulating_valve_controller(),
[
self.acsc[0].trim_air_pressure_regulating_valve_controller(),
self.acsc[1].trim_air_pressure_regulating_valve_controller(),
],
&[&self.acsc[0], &self.acsc[1], &self.acsc[1]],
);
Expand Down Expand Up @@ -481,15 +497,21 @@ impl OutletAir for A320AirConditioningSystem {
outlet_air.set_temperature(self.duct_temperature().iter().average());

outlet_air

// TODO: This should use self.trim_air_system.outlet_air()
}
}

// This is not used in the A320
impl VcmShared for A320AirConditioningSystem {}

impl SimulationElement for A320AirConditioningSystem {
fn accept<V: SimulationElementVisitor>(&mut self, visitor: &mut V) {
accept_iterable!(self.acs_interface, visitor);
accept_iterable!(self.acsc, visitor);
self.trim_air_system.accept(visitor);
accept_iterable!(self.cabin_fans, visitor);
accept_iterable!(self.packs, visitor);

self.air_conditioning_overhead.accept(visitor);

Expand Down Expand Up @@ -550,7 +572,7 @@ impl AirConditioningSystemInterfaceUnit {
self.discrete_word_1.set_bit(21, acsc.channel_1_inop());
self.discrete_word_1.set_bit(22, acsc.channel_2_inop());
self.discrete_word_1
.set_bit(23, acs_overhead.hot_air_pushbutton_is_on());
.set_bit(23, acs_overhead.hot_air_pushbutton_is_on(1));
self.discrete_word_1.set_bit(24, acsc.galley_fan_fault());
self.discrete_word_1.set_bit(25, cabin_fans[0].has_fault());
self.discrete_word_1.set_bit(26, cabin_fans[1].has_fault());
Expand Down Expand Up @@ -637,7 +659,7 @@ impl<const ZONES: usize> AirConditioningOverheadShared
self.pack_pbs.iter().map(|pack| pack.is_on()).collect()
}

fn hot_air_pushbutton_is_on(&self) -> bool {
fn hot_air_pushbutton_is_on(&self, _hot_air_id: usize) -> bool {
self.hot_air_pb.is_on()
}

Expand Down Expand Up @@ -828,8 +850,10 @@ struct A320PressurizationConstants;

impl PressurizationConstants for A320PressurizationConstants {
// Volume data from A320 AIRCRAFT CHARACTERISTICS - AIRPORT AND MAINTENANCE PLANNING
const CABIN_VOLUME_CUBIC_METER: f64 = 139.; // m3
const CABIN_ZONE_VOLUME_CUBIC_METER: f64 = 139.; // m3
const COCKPIT_VOLUME_CUBIC_METER: f64 = 9.; // m3
const FWD_CARGO_ZONE_VOLUME_CUBIC_METER: f64 = 0.; // m3 Not used in A320
const BULK_CARGO_ZONE_VOLUME_CUBIC_METER: f64 = 0.; // m3 Not used in A320
const PRESSURIZED_FUSELAGE_VOLUME_CUBIC_METER: f64 = 330.; // m3
const CABIN_LEAKAGE_AREA: f64 = 0.0003; // m2
const OUTFLOW_VALVE_SIZE: f64 = 0.05; // m2
Expand Down
53 changes: 53 additions & 0 deletions fbw-a380x/docs/a380-simvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,72 @@
- UPPER_DECK_5
- UPPER_DECK_6
- UPPER_DECK_7
- CARGO_FWD
- CARGO_BULK

- A32NX_COND_{id}_DUCT_TEMP
- Degree Celsius
- Temperature of trim air coming out of the ducts in the cabin and cockpit
- {id}
- Same as A32NX_COND_{id}_TEMP

- A32NX_COND_PACK_{id}_IS_OPERATING
- Bool
- True when the pack operates normally (at least one FCV is open)
- {id} 1 or 2

- A32NX_COND_PACK_{id}_OUTLET_TEMPERATURE
- Degree Celsius
- Outlet temperature of the packs
- {id} 1 or 2

- A32NX_COND_{id}_TRIM_AIR_VALVE_POSITION
- Percentage
- Percentage opening of each trim air valve (hot air)
- {id}
- Same as A32NX_COND_{id}_TEMP

- A32NX_COND_HOT_AIR_VALVE_{id}_IS_ENABLED
- Bool
- True if the hot air valve {1 or 2} is enabled

- A32NX_COND_HOT_AIR_VALVE_{id}_IS_OPEN
- Bool
- True if the hot air valve {1 or 2} is open

- A32NX_COND_TADD_CHANNEL_FAILURE
- Number
- 0 if no failure
- 1 or 2 if single channel failure (for failed channel id)
- 3 if dual channel failure

- A32NX_VENT_PRIMARY_FANS_ENABLED
- Bool
- True if the primary (high pressure) fans are enabled and operating normally

- A32NX_VENT_{id}_EXTRACTION_FAN_ON
- Bool
- True when the the extraction fans of the fwd/bulk cargo compartment operate normally
- {id}
- FWD
- BULK

- A32NX_VENT_{id}_ISOLATION_VALVE_OPEN
- Bool
- True when the isolation valves of the fwd/bulk cargo compartment are open
- {id}
- FWD
- BULK

- A32NX_VENT_{id}_VCM_CHANNEL_FAILURE
- Number
- 0 if no failure
- 1 or 2 if single channel failure (for failed channel id)
- 3 if dual channel failure
- {id}
- FWD
- AFT

- A32NX_OVHD_COND_{id}_SELECTOR_KNOB
- Number (0 to 300)
- Rotation amount of the overhead temperature selectors for the cockpit and the cabin
Expand Down
Loading

0 comments on commit 581edbc

Please sign in to comment.