From afa33b9c90491d4986f20bc9dfefd4ff6447837b Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Thu, 31 Oct 2024 04:31:34 -0600 Subject: [PATCH] Update heatmaps for all iph technologies --- ssc/cmod_fresnel_physical_iph.cpp | 2 +- ssc/cmod_linear_fresnel_dsg_iph.cpp | 4 ++-- ssc/cmod_mspt_iph.cpp | 2 +- ssc/cmod_trough_physical_iph.cpp | 4 ++-- ssc/common.cpp | 9 +++++++-- ssc/common.h | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ssc/cmod_fresnel_physical_iph.cpp b/ssc/cmod_fresnel_physical_iph.cpp index 1a5243c20..8cc0f2f7e 100644 --- a/ssc/cmod_fresnel_physical_iph.cpp +++ b/ssc/cmod_fresnel_physical_iph.cpp @@ -1625,7 +1625,7 @@ class cm_fresnel_physical_iph : public compute_module // Do unit post-processing here - ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour); + ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour, true); // Non-timeseries array outputs double P_adj = storage.P_in_des; // slightly adjust all field design pressures to account for pressure drop in TES before hot tank transform(c_fresnel.m_P_rnr_dsn.begin(), c_fresnel.m_P_rnr_dsn.end(), c_fresnel.m_P_rnr_dsn.begin(), [P_adj](double x) {return x + P_adj; }); diff --git a/ssc/cmod_linear_fresnel_dsg_iph.cpp b/ssc/cmod_linear_fresnel_dsg_iph.cpp index 3ed1b8111..ead00c0ba 100644 --- a/ssc/cmod_linear_fresnel_dsg_iph.cpp +++ b/ssc/cmod_linear_fresnel_dsg_iph.cpp @@ -215,7 +215,7 @@ class cm_linear_fresnel_dsg_iph : public compute_module { add_var_info(_cm_vtab_linear_fresnel_dsg_iph); add_var_info(vtab_adjustment_factors); - //add_var_info(vtab_technology_outputs); + add_var_info(vtab_technology_outputs); } void exec( ) @@ -630,7 +630,7 @@ class cm_linear_fresnel_dsg_iph : public compute_module p_load[i] = p_W_dot_par_tot_haf[i]; } - ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour); + ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour, true); accumulate_annual_for_year("gen", "annual_field_energy", sim_setup.m_report_step / 3600.0, steps_per_hour); //[kWt-hr] diff --git a/ssc/cmod_mspt_iph.cpp b/ssc/cmod_mspt_iph.cpp index 6769aabeb..427625c28 100644 --- a/ssc/cmod_mspt_iph.cpp +++ b/ssc/cmod_mspt_iph.cpp @@ -2327,7 +2327,7 @@ class cm_mspt_iph : public compute_module p_load[i] = p_W_dot_par_tot_haf[i]; } - ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour); + ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour, true); accumulate_annual_for_year("gen_heat", "annual_energy", sim_setup.m_report_step / 3600.0, steps_per_hour, 1, n_steps_fixed / steps_per_hour); //[kWt-hr] diff --git a/ssc/cmod_trough_physical_iph.cpp b/ssc/cmod_trough_physical_iph.cpp index 9340040c7..df6f36b52 100644 --- a/ssc/cmod_trough_physical_iph.cpp +++ b/ssc/cmod_trough_physical_iph.cpp @@ -740,7 +740,7 @@ class cm_trough_physical_iph : public compute_module { add_var_info( _cm_vtab_trough_physical_iph ); add_var_info( vtab_adjustment_factors ); - //add_var_info(vtab_technology_outputs); + add_var_info(vtab_technology_outputs); add_var_info(vtab_utility_rate_common); // Required for dispatch w/ utility rates } @@ -2276,7 +2276,7 @@ class cm_trough_physical_iph : public compute_module annual_elec_cost += i_elec_cost; //[$] } - ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour); + ssc_number_t* p_annual_energy_dist_time = gen_heatmap(this, steps_per_hour, true); // Non-timeseries array outputs double P_adj = 0; // slightly adjust all field design pressures to account for pressure drop in TES before hot tank if (tes_type == C_csp_tes::csp_tes_types::E_TES_TWO_TANK) diff --git a/ssc/common.cpp b/ssc/common.cpp index 2cd726697..791aa1d59 100644 --- a/ssc/common.cpp +++ b/ssc/common.cpp @@ -649,7 +649,7 @@ var_info vtab_technology_outputs[] = { var_info_invalid }; -ssc_number_t* gen_heatmap(compute_module* cm, double step_per_hour) { +ssc_number_t* gen_heatmap(compute_module* cm, double step_per_hour, bool heat) { if (!cm) return 0; size_t count = (size_t)(8760 * step_per_hour); @@ -657,7 +657,12 @@ ssc_number_t* gen_heatmap(compute_module* cm, double step_per_hour) { size_t iday = 0; size_t hour; size_t count_gen; - ssc_number_t* p_gen = cm->as_array("gen", &count_gen); + ssc_number_t* p_gen = NULL; + if (heat) + p_gen = cm->as_array("gen_heat", &count_gen); + else + p_gen = cm->as_array("gen", &count_gen); + ssc_number_t* p_annual_energy_dist_time = cm->allocate("annual_energy_distribution_time", 25, 366); for (size_t i = 0; i < count; i++) { hour = (size_t)fmod(floor(double(i) / step_per_hour), 24); diff --git a/ssc/common.h b/ssc/common.h index 750a1ca8e..211f6bc9f 100644 --- a/ssc/common.h +++ b/ssc/common.h @@ -75,7 +75,7 @@ bool calculate_p50p90(compute_module *cm); void calculate_resilience_outputs(compute_module *cm, std::unique_ptr &resilience); -ssc_number_t* gen_heatmap(compute_module* cm, double step_per_hour); +ssc_number_t* gen_heatmap(compute_module* cm, double step_per_hour, bool heat=false); void prepend_to_output(compute_module* cm, std::string var_name, size_t count, ssc_number_t value);