Skip to content

Commit

Permalink
remove calculation stub from alpha period
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldo committed Mar 13, 2024
1 parent dfd7b24 commit 275952f
Showing 1 changed file with 0 additions and 119 deletions.
119 changes: 0 additions & 119 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,122 +118,3 @@ fn external_conditions_from_input(
),
}
}

struct Calculation {
corpus: Input,
external_conditions: ExternalConditions,
simulation_time: SimulationTime,
}

impl Calculation {
pub fn new(
corpus: Input,
external_conditions: ExternalConditions,
simulation_time: SimulationTime,
) -> Self {
Self {
corpus,
external_conditions,
simulation_time,
}
}

pub fn run(&self) -> () {
let simulation_time = self.simulation_time;

for iteration in simulation_time.iter() {
let (
hw_demand,
hw_duration,
no_events,
pw_losses_internal,
gains_internal_dhw_use,
hw_energy_demand,
) = hot_water_demand(iteration.index);

let gains_internal_dhw = (pw_losses_internal + gains_internal_dhw_use)
* WATTS_PER_KILOWATT as f64
/ iteration.timestep;
// TODO: python has clauses to add to this value for particular types of hot water source

let SpaceHeatingCalculation {
gains_internal_zone,
gains_solar_zone,
operative_temp,
internal_air_temp,
space_heat_demand_zone,
space_cool_demand_zone,
space_heat_demand_system,
space_cool_demand_system,
ductwork_gains,
heat_balance,
} = self.calc_space_heating(iteration.timestep, gains_internal_dhw, iteration);
}

fn hot_water_demand(timestep_idx: usize) -> (f64, f64, u32, f64, f64, f64) {
(10., 10., 10, 10., 10., 10.)
}
}

/// Calculate the losses/gains in the MVHR ductwork
///
/// ## Arguments
/// * `timestep_idx` -- timestep index/count
/// * `delta_t_h` -- calculation timestep, in hours
/// * `efficiency` -- MVHR heat recovery efficiency
fn calc_ductwork_losses(&self, timestep_idx: usize, delta_t_h: f64, efficiency: f64) -> f64 {
// assume 100% efficiency
// i.e. temp inside the supply and extract ducts is room temp and temp inside exhaust and intake is external temp
// assume MVHR unit is running 100% of the time
// let internal_air_temperature = self.temp_internal_air();

// Calculate heat loss from ducts when unit is inside
// Air temp inside ducts increases, heat lost from dwelling
// TODO: complete
0.0
}

/// Calculate space heating demand, heating system output and temperatures
///
/// ## Arguments
/// * `delta_t_h` - calculation timestep, in hours
/// * `gains_internal_dhw` - internal gains from hot water system for this timestep, in W
fn calc_space_heating(
&self,
delta_t_h: f64,
gains_internal_dhw: f64,
simtime: SimulationTimeIteration,
) -> SpaceHeatingCalculation {
let temp_ext_air = self.external_conditions.air_temp(&simtime);

// calculate timestep in seconds
let delta_t = delta_t_h * SECONDS_PER_HOUR as f64;

let (mut ductwork_losses, mut ductwork_losses_per_m3) = (0.0, 0.0);

// ductwork gains/losses only for MVHR
if let Some(Ventilation::Mvhr { .. }) = self.corpus.ventilation {
// ductwork_losses =
// calc_ductwork_losses(0, delta_t_h, self.corpus.ventilation.efficiency());
// ductwork_losses_per_m3 = ductwork_losses /
}

// TODO: complete

Default::default()
}
}

#[derive(Default)]
struct SpaceHeatingCalculation {
gains_internal_zone: f64,
gains_solar_zone: f64,
operative_temp: f64,
internal_air_temp: f64,
space_heat_demand_zone: f64,
space_cool_demand_zone: f64,
space_heat_demand_system: f64,
space_cool_demand_system: f64,
ductwork_gains: f64,
heat_balance: HashMap<String, f64>,
}

0 comments on commit 275952f

Please sign in to comment.