Skip to content

Commit

Permalink
add function to build ventilation ductwork for corpus
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldo committed Jan 4, 2024
1 parent 70cf937 commit 3dc84ae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod heating_systems;
pub mod material_properties;
mod pipework;

mod ductwork;
pub mod ductwork;
pub mod schedule;
pub mod space_heat_demand;
pub mod units;
Expand Down
20 changes: 19 additions & 1 deletion src/corpus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::core::controls::time_control::{
Control, OnOffMinimisingTimeControl, OnOffTimeControl, SetpointTimeControl, ToUChargeControl,
};
use crate::core::ductwork::Ductwork;
use crate::core::energy_supply::energy_supply::{EnergySupplies, EnergySupply};
use crate::core::heating_systems::wwhrs::{
WWHRSInstantaneousSystemA, WWHRSInstantaneousSystemB, WWHRSInstantaneousSystemC, Wwhrs,
Expand All @@ -10,14 +11,15 @@ use crate::core::schedule::{
};
use crate::core::space_heat_demand::internal_gains::InternalGains;
use crate::core::space_heat_demand::ventilation_element::VentilationElementInfiltration;
use crate::core::units::MILLIMETRES_IN_METRE;
use crate::core::water_heat_demand::cold_water_source::ColdWaterSource;
use crate::core::water_heat_demand::dhw_demand::DomesticHotWaterDemand;
use crate::external_conditions::ExternalConditions;
use crate::input::{
ColdWaterSourceDetails, ColdWaterSourceInput, ColdWaterSourceType, Control as ControlInput,
ControlDetails, EnergyDiverter, EnergySupplyDetails, EnergySupplyInput, EnergySupplyType,
ExternalConditionsInput, HotWaterSourceDetails, Infiltration, Input,
InternalGains as InternalGainsInput, InternalGainsDetails, WasteWaterHeatRecovery,
InternalGains as InternalGainsInput, InternalGainsDetails, Ventilation, WasteWaterHeatRecovery,
WasteWaterHeatRecoveryDetails, WaterHeatingEvent, WaterHeatingEvents, WwhrsType,
};
use crate::simulation_time::{SimulationTime, SimulationTimeIterator};
Expand Down Expand Up @@ -506,3 +508,19 @@ fn schedule_event_from_input(
let total_timesteps = simulation_time_iterator.total_steps();
expand_water_heating_events(events_input, sim_timestep, total_timesteps)
}

fn ductwork_from_ventilation_input(ventilation: &Option<Ventilation>) -> Option<Ductwork> {
ventilation.as_ref().and_then(|v| match v {
Ventilation::MVHR { ductwork, .. } => Some(Ductwork::new(
ductwork.internal_diameter_mm / MILLIMETRES_IN_METRE as f64,
ductwork.external_diameter_mm / MILLIMETRES_IN_METRE as f64,
ductwork.length_in,
ductwork.length_out,
ductwork.insulation_thermal_conductivity,
ductwork.insulation_thickness_mm / MILLIMETRES_IN_METRE as f64,
ductwork.reflective,
ductwork.mvhr_location,
)),
_ => None,
})
}
18 changes: 9 additions & 9 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,18 +604,18 @@ pub enum Ventilation {
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct VentilationDuctwork {
internal_diameter_mm: f64,
external_diameter_mm: f64,
length_in: f64,
length_out: f64,
insulation_thermal_conductivity: f64,
insulation_thickness_mm: f64,
reflective: bool,
pub internal_diameter_mm: f64,
pub external_diameter_mm: f64,
pub length_in: f64,
pub length_out: f64,
pub insulation_thermal_conductivity: f64,
pub insulation_thickness_mm: f64,
pub reflective: bool,
#[serde(rename(deserialize = "MVHR_location"))]
mvhr_location: MVHRLocation,
pub mvhr_location: MVHRLocation,
}

#[derive(Debug, Deserialize)]
#[derive(Copy, Clone, Debug, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum MVHRLocation {
Inside,
Expand Down

0 comments on commit 3dc84ae

Please sign in to comment.