Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldo committed Mar 13, 2024
1 parent e689eb6 commit f460da5
Showing 1 changed file with 68 additions and 5 deletions.
73 changes: 68 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ use crate::read_weather_file::ExternalConditions as ExternalConditionsFromFile;
use std::collections::HashMap;

use crate::core::units::{SECONDS_PER_HOUR, WATTS_PER_KILOWATT};
use crate::corpus::Corpus;
use crate::corpus::{Corpus, HotWaterResultMap};
use crate::external_conditions::{DaylightSavingsConfig, ExternalConditions};
use crate::simulation_time::{SimulationTime, SimulationTimeIteration, SimulationTimeIterator};
use std::error::Error;
use std::ffi::OsStr;
use std::fmt::Arguments;
use std::ops::Deref;
use std::path::Path;
use std::sync::Arc;
Expand All @@ -41,9 +42,9 @@ pub fn run_project(
Some(ext) => &input_file[..(input_file.len() - ext.len() - 1)],
None => input_file,
};
let _output_file = format_args!("{input_file_stem}_results.csv");
let _output_file_static = format_args!("{input_file_stem}_results_static.csv");
let _output_file_summary = format_args!("{input_file_stem}_results_summary.csv");
let output_file_detailed = format!("{input_file_stem}_results.csv");
let _output_file_static = format!("{input_file_stem}_results_static.csv");
let _output_file_summary = format!("{input_file_stem}_results_summary.csv");

println!("about to try and open {}", input_file);

Expand All @@ -61,7 +62,48 @@ pub fn run_project(

let mut corpus: Corpus = Corpus::from_inputs(input, external_conditions)?;

corpus.run();
let (
timestep_array,
results_totals,
results_end_user,
energy_import,
energy_export,
energy_generated_consumed,
energy_to_storage,
energy_from_storage,
energy_diverted,
betafactor,
zone_dict,
zone_list,
hc_system_dict,
hot_water_dict,
heat_cop_dict,
cool_cop_dict,
dhw_cop_dict,
ductwork_gains,
heat_balance_dict,
heat_source_wet_results_dict,
heat_source_wet_results_annual_dict,
) = corpus.run();

write_core_output_file(
output_file_detailed,
timestep_array,
results_totals,
results_end_user,
energy_import,
energy_export,
energy_generated_consumed,
energy_to_storage,
energy_from_storage,
energy_diverted,
betafactor,
zone_dict,
zone_list,
hc_system_dict,
hot_water_dict,
ductwork_gains,
);

Ok(())
}
Expand Down Expand Up @@ -118,3 +160,24 @@ fn external_conditions_from_input(
),
}
}

fn write_core_output_file(
output_file: String,
timestep_array: Vec<f64>,
results_totals: HashMap<&str, f64>,
results_end_user: HashMap<&str, HashMap<&str, f64>>,
energy_import: HashMap<&str, f64>,
energy_export: HashMap<&str, f64>,
energy_generated_consumed: HashMap<&str, f64>,
energy_to_storage: HashMap<&str, f64>,
energy_from_storage: HashMap<&str, f64>,
energy_diverted: HashMap<&str, f64>,
betafactor: HashMap<&str, f64>,
zone_dict: HashMap<&str, HashMap<String, Vec<f64>>>,
zone_list: Vec<&str>,
hc_system_dict: HashMap<&str, HashMap<String, Vec<f64>>>,
hot_water_dict: HashMap<&str, HotWaterResultMap>,
ductwork_gains: HashMap<&str, Vec<f64>>,
) {
//
}

0 comments on commit f460da5

Please sign in to comment.