diff --git a/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridHostDeveloper.json b/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridHostDeveloper.json index fad5f0fa3..e582153f6 100644 --- a/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridHostDeveloper.json +++ b/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridHostDeveloper.json @@ -27,6 +27,7 @@ "calculate_rack_shading": 0, "dcoptimizer_loss": 0, "en_snow_model": 0, + "snow_array": [0.000000], "subarray1_dcwiring_loss": 2, "subarray1_diodeconn_loss": 0.5, "subarray1_electrical_mismatch": 0, diff --git a/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridSingleOwner.json b/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridSingleOwner.json index 96b873d04..796e6d648 100644 --- a/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridSingleOwner.json +++ b/api/api_autogen/library/defaults/Pvsamv1_PhotovoltaicWindBatteryHybridSingleOwner.json @@ -27,6 +27,7 @@ "calculate_rack_shading": 0, "dcoptimizer_loss": 0, "en_snow_model": 0, + "snow_array": [0.000000], "subarray1_dcwiring_loss": 2, "subarray1_diodeconn_loss": 0.5, "subarray1_electrical_mismatch": 0, diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTAllEquityPartnershipFlip.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTAllEquityPartnershipFlip.json index b574ce300..78cc7e115 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTAllEquityPartnershipFlip.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTAllEquityPartnershipFlip.json @@ -9813,6 +9813,7 @@ [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000] ], "dispatch_tod_factors": [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000], + "is_timestep_load_fractions": 0, "ppa_multiplier_model": 0 }, "FinancialSolutionMode": { diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTLeveragedPartnershipFlip.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTLeveragedPartnershipFlip.json index 324090428..451eb42ef 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTLeveragedPartnershipFlip.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTLeveragedPartnershipFlip.json @@ -9813,6 +9813,7 @@ [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000] ], "dispatch_tod_factors": [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000], + "is_timestep_load_fractions": 0, "ppa_multiplier_model": 0 }, "FinancialSolutionMode": { diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTMerchantPlant.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTMerchantPlant.json index a829a5c6c..4bf634075 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTMerchantPlant.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTMerchantPlant.json @@ -9783,6 +9783,7 @@ "ud_m_dot_water_cool_des": 0 }, "TimeOfDeliveryFactors": { + "is_timestep_load_fractions": 0 }, "FinancialSolutionMode": { }, diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTNone.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTNone.json index 2d071e748..cead0d937 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTNone.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTNone.json @@ -9783,6 +9783,7 @@ "ud_m_dot_water_cool_des": 0 }, "TimeOfDeliveryFactors": { + "is_timestep_load_fractions": 0 }, "FinancialSolutionMode": { }, diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSaleLeaseback.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSaleLeaseback.json index 2045f9cf7..2301e83c2 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSaleLeaseback.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSaleLeaseback.json @@ -9813,6 +9813,7 @@ [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000] ], "dispatch_tod_factors": [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000], + "is_timestep_load_fractions": 0, "ppa_multiplier_model": 0 }, "FinancialSolutionMode": { diff --git a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSingleOwner.json b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSingleOwner.json index 1b3a6cefc..f4a51a536 100644 --- a/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSingleOwner.json +++ b/api/api_autogen/library/defaults/TcsmoltenSalt_MSPTSingleOwner.json @@ -9813,6 +9813,7 @@ [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000] ], "dispatch_tod_factors": [1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000], + "is_timestep_load_fractions": 0, "ppa_multiplier_model": 0 }, "FinancialSolutionMode": { diff --git a/api/include/SAM_TcsmoltenSalt.h b/api/include/SAM_TcsmoltenSalt.h index 6f90789da..59bb9333a 100644 --- a/api/include/SAM_TcsmoltenSalt.h +++ b/api/include/SAM_TcsmoltenSalt.h @@ -2272,6 +2272,14 @@ extern "C" */ SAM_EXPORT void SAM_TcsmoltenSalt_TimeOfDeliveryFactors_dispatch_tod_factors_aset(SAM_table ptr, double* arr, int length, SAM_error *err); + /** + * Set is_timestep_load_fractions: Use turbine load fraction for each timestep instead of block dispatch? + * options: None + * constraints: None + * required if: ?=0 + */ + SAM_EXPORT void SAM_TcsmoltenSalt_TimeOfDeliveryFactors_is_timestep_load_fractions_nset(SAM_table ptr, double number, SAM_error *err); + /** * Set ppa_multiplier_model: PPA multiplier model 0: dispatch factors dispatch_factorX, 1: hourly multipliers dispatch_factors_ts [0/1] * options: 0=diurnal,1=timestep @@ -3252,6 +3260,8 @@ extern "C" SAM_EXPORT double* SAM_TcsmoltenSalt_TimeOfDeliveryFactors_dispatch_tod_factors_aget(SAM_table ptr, int* length, SAM_error *err); + SAM_EXPORT double SAM_TcsmoltenSalt_TimeOfDeliveryFactors_is_timestep_load_fractions_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_TcsmoltenSalt_TimeOfDeliveryFactors_ppa_multiplier_model_nget(SAM_table ptr, SAM_error *err); diff --git a/api/modules/SAM_TcsmoltenSalt.cpp b/api/modules/SAM_TcsmoltenSalt.cpp index ab37cbcdf..41cdacb2e 100644 --- a/api/modules/SAM_TcsmoltenSalt.cpp +++ b/api/modules/SAM_TcsmoltenSalt.cpp @@ -1646,6 +1646,12 @@ SAM_EXPORT void SAM_TcsmoltenSalt_TimeOfDeliveryFactors_dispatch_tod_factors_ase }); } +SAM_EXPORT void SAM_TcsmoltenSalt_TimeOfDeliveryFactors_is_timestep_load_fractions_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "is_timestep_load_fractions", number); + }); +} + SAM_EXPORT void SAM_TcsmoltenSalt_TimeOfDeliveryFactors_ppa_multiplier_model_nset(SAM_table ptr, double number, SAM_error *err){ translateExceptions(err, [&]{ ssc_data_set_number(ptr, "ppa_multiplier_model", number); @@ -4376,6 +4382,15 @@ SAM_EXPORT double* SAM_TcsmoltenSalt_TimeOfDeliveryFactors_dispatch_tod_factors_ return result; } +SAM_EXPORT double SAM_TcsmoltenSalt_TimeOfDeliveryFactors_is_timestep_load_fractions_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "is_timestep_load_fractions", &result)) + make_access_error("SAM_TcsmoltenSalt", "is_timestep_load_fractions"); + }); + return result; +} + SAM_EXPORT double SAM_TcsmoltenSalt_TimeOfDeliveryFactors_ppa_multiplier_model_nget(SAM_table ptr, SAM_error *err){ double result; translateExceptions(err, [&]{ diff --git a/src/casewin.cpp b/src/casewin.cpp index 7ec9f91eb..f4235f260 100644 --- a/src/casewin.cpp +++ b/src/casewin.cpp @@ -1063,13 +1063,29 @@ wxArrayString CaseWindow::GetInputPages() bool CaseWindow::SwitchToNavigationMenu(const wxString& name) { // iterate over menu tree items and match "name" or select first item (SAM issue 1618) - wxDataViewItem dvi;// = m_navigationMenu->GetNthChild(wxDataViewItem(0), 0); + wxDataViewItem dvi, dvi_child;// = m_navigationMenu->GetNthChild(wxDataViewItem(0), 0); bool found = false; + int count = m_navigationMenu->GetChildCount(wxDataViewItem(0)); for (int i = 0; i < count && !found; i++) { dvi = m_navigationMenu->GetNthChild(wxDataViewItem(0), i); - if (dvi.IsOk() && m_navigationMenu->GetItemText(dvi) == name) - found = true; + // should be a lambda function but not more than one deep... + if (m_navigationMenu->IsContainer(dvi)) { + int count_child = m_navigationMenu->GetChildCount(dvi); + for (int j = 0; j < count_child && !found; j++) { + dvi_child = m_navigationMenu->GetNthChild(dvi, j); + wxString stmp = m_navigationMenu->GetItemText(dvi_child); // for debugging + if (dvi_child.IsOk() && stmp == name) { + found = true; + dvi = dvi_child; + } + } + } + else { + wxString stmp = m_navigationMenu->GetItemText(dvi); + if (dvi.IsOk() && m_navigationMenu->GetItemText(dvi) == name) + found = true; + } } // first item if not found if (!found) @@ -1081,10 +1097,11 @@ bool CaseWindow::SwitchToNavigationMenu(const wxString& name) if (dvi.IsOk()) { m_navigationMenu->SetCurrentItem(dvi); m_currentSelection = (dvi); - SwitchToInputPage(m_navigationMenu->GetItemText(dvi)); + m_left_panel->SetFocus(); + SwitchToPage(m_navigationMenu->GetItemText(dvi)); + m_left_panel->Layout(); } - return true; } @@ -1119,6 +1136,7 @@ bool CaseWindow::SwitchToInputPage( const wxString &name ) int p = m_inputPageList->Find(name); m_inputPageList->Select( p ); m_inputPageList->Refresh(); + m_navigationMenu->Layout(); m_left_panel->Layout();// try to force onPaint call for the input page list return true; @@ -1157,7 +1175,9 @@ bool CaseWindow::SwitchToPage( const wxString &name ) else { m_pageFlipper->SetSelection( PG_INPUTS ); - return SwitchToInputPage( name ); +// return SwitchToInputPage(name); + SwitchToInputPage(name); + m_left_panel->Layout(); } return true; diff --git a/src/main.cpp b/src/main.cpp index 902364d9c..38a451c8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -515,9 +515,9 @@ CaseWindow *MainWindow::CreateCaseWindow( Case *c ) } // load first page of hybrid and non-hybrid configurations if (c->GetConfiguration()->Technology.size() > 1) // hybrid - win->SwitchToInputPage(c->GetConfiguration()->InputPageGroups[c->GetConfiguration()->Technology.size() - 1][0]->SideBarLabel); + win->SwitchToNavigationMenu(c->GetConfiguration()->InputPageGroups[c->GetConfiguration()->Technology.size() - 1][0]->SideBarLabel); else - win->SwitchToInputPage(pages[0]); + win->SwitchToNavigationMenu(pages[0]); // reevaluate all equations address SAM #1583 c->EvaluateEquations(); diff --git a/src/script.cpp b/src/script.cpp index 2faf6ed63..0d7a63675 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -584,8 +584,9 @@ void fcall_show_page(lk::invoke_t &cxt) LK_DOC("show_page", "Show a specific page in the user interface for the active case", "( string:page name ):boolean"); wxString page_name = cxt.arg(0).as_string(); Case *active_case = CurrentCase(); - if (CaseWindow *case_window = SamApp::Window()->GetCaseWindow(active_case)) - cxt.result().assign((case_window->SwitchToPage(page_name) ? 1.0 : 0.0)); + if (CaseWindow* case_window = SamApp::Window()->GetCaseWindow(active_case)) { + cxt.result().assign((case_window->SwitchToNavigationMenu(page_name) ? 1.0 : 0.0)); + } else cxt.error("no active case"); }