From ecdbbee27c837dc52cf5c9409756b9da1434aac3 Mon Sep 17 00:00:00 2001 From: Bill Hamilton Date: Wed, 6 Nov 2024 09:28:26 -0700 Subject: [PATCH] fixing rec_azimuth_opt for UI reporting --- solarpilot/AutoPilot_API.cpp | 3 +-- ssc/cmod_solarpilot.cpp | 8 ++++++-- ssc/csp_common.cpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/solarpilot/AutoPilot_API.cpp b/solarpilot/AutoPilot_API.cpp index 64cbe268a..dcaaf358b 100644 --- a/solarpilot/AutoPilot_API.cpp +++ b/solarpilot/AutoPilot_API.cpp @@ -329,8 +329,7 @@ struct AutoOptHelper vector current; //update the objective variables - for(int i=0; i<(int)m_opt_vars.size(); i++) - { + for(int i=0; i<(int)m_opt_vars.size(); i++) { current.push_back( x[i] ); *m_opt_vars.at(i) = current.at(i)/* * m_normalizers.at(i)*/; } diff --git a/ssc/cmod_solarpilot.cpp b/ssc/cmod_solarpilot.cpp index d8295cebd..ccdaaa25e 100644 --- a/ssc/cmod_solarpilot.cpp +++ b/ssc/cmod_solarpilot.cpp @@ -175,7 +175,7 @@ static var_info _cm_vtab_solarpilot[] = { { SSC_OUTPUT, SSC_NUMBER, "rec_aspect_opt", "Optimized receiver aspect ratio", "-", "", "SolarPILOT", "receiver_type=0", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "cav_rec_aper_width_opt", "Optimized cavity receiver aperture width", "-", "", "SolarPILOT", "receiver_type=1", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "rec_width_opt", "Optimized receiver width", "m", "", "SolarPILOT", "receiver_type=3", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "rec_azimuth_opt", "Optimized receiver azimuth", "deg", "", "SolarPILOT", "receiver_type=3", "", "" }, + { SSC_OUTPUT, SSC_ARRAY, "rec_azimuth_opt", "Optimized receiver azimuth", "deg", "", "SolarPILOT", "receiver_type=3", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "flux_max_observed", "Maximum observed flux at design", "kW/m2", "", "SolarPILOT", "check_max_flux=1", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "cost_rec_tot", "Total receiver cost", "$", "", "SolarPILOT", "*", "", "" }, @@ -244,7 +244,11 @@ class cm_solarpilot : public compute_module } else if (rec_type == 3) { // free-falling receiver assign("rec_width_opt", (ssc_number_t)spi.recs.front().rec_width.val); - assign("rec_azimuth_opt", (ssc_number_t)spi.recs.front().rec_azimuth.val); + + ssc_number_t* rec_azi_opt = allocate("rec_azimuth_opt", spi.recs.size()); + for (size_t i = 0; i < spi.recs.size(); i++) { + rec_azi_opt[i] = (ssc_number_t)spi.recs.at(i).rec_azimuth.val; + } } assign("h_tower_opt", (ssc_number_t)spi.sf.tht.val); diff --git a/ssc/csp_common.cpp b/ssc/csp_common.cpp index d4b116396..ef113ed0e 100644 --- a/ssc/csp_common.cpp +++ b/ssc/csp_common.cpp @@ -529,7 +529,7 @@ bool solarpilot_invoke::run(std::shared_ptr wdata) vector step_size(nv); vector names(nv); - // NOTE: If variable order changes, update Simulate_fp_rec() within AutoPilot_API.cpp + // NOTE: If variable order changes, update update_fp_rec_dep_vars() within AutoPilot_API.cpp //pointers opt_vars.at(0) = &sf.tht.val; opt_vars.at(1) = &recs.front().rec_height.val;