Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9783,6 +9783,7 @@
"ud_m_dot_water_cool_des": 0
},
"TimeOfDeliveryFactors": {
"is_timestep_load_fractions": 0
},
"FinancialSolutionMode": {
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9783,6 +9783,7 @@
"ud_m_dot_water_cool_des": 0
},
"TimeOfDeliveryFactors": {
"is_timestep_load_fractions": 0
},
"FinancialSolutionMode": {
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 10 additions & 0 deletions api/include/SAM_TcsmoltenSalt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);


Expand Down
15 changes: 15 additions & 0 deletions api/modules/SAM_TcsmoltenSalt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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, [&]{
Expand Down
32 changes: 26 additions & 6 deletions src/casewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
Loading