Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eb11954
Create v1 of custom combine cases widget and add to ui
Matthew-Boyd Sep 9, 2021
1a36acc
Run cases from widget
Matthew-Boyd Sep 10, 2021
e57a41f
Add FindActiveObject code that is currently failing
Matthew-Boyd Sep 14, 2021
c91b912
Mildly clean up code
Matthew-Boyd Sep 15, 2021
cf19136
Add FindObject UI function
Matthew-Boyd Sep 15, 2021
97428ab
Implement FindObject in combinecases
Matthew-Boyd Sep 15, 2021
c2a3878
Refine UI look of Power Plant page with new Select cases button
Matthew-Boyd Sep 15, 2021
01a4314
Refine combine cases dialog window
Matthew-Boyd Sep 16, 2021
e096b2c
Fix issue with wxUISchedNumeric always returning false for "UseSchedu…
sjanzou Sep 16, 2021
89e59df
Exclude generic case from ui case list
Matthew-Boyd Sep 16, 2021
849eafd
Merge pull request #1 from sjanzou/combine_cases
Matthew-Boyd Sep 16, 2021
5ec1f0d
Merge branch 'combine_cases' of https://github.com/Matthew-Boyd/SAM i…
Matthew-Boyd Sep 16, 2021
9f50118
Get most everything working minus carrying over costs
Matthew-Boyd Sep 22, 2021
80f8c01
Add non-working start of GetInputPage function
Matthew-Boyd Sep 22, 2021
91856fe
Open data array dialog window at end and other small changes
Matthew-Boyd Sep 22, 2021
bc918f4
Add SwitchToInputPage capability
Matthew-Boyd Sep 23, 2021
a3b0078
Clean up some odds and ends
Matthew-Boyd Sep 23, 2021
3877290
Change combine cases degradation widget to a SchedNumeric
Matthew-Boyd Sep 23, 2021
47620b0
Restrict degradation queries to certain financial models
Matthew-Boyd Sep 24, 2021
71ee73c
Fix constant generation case
Matthew-Boyd Sep 25, 2021
9060bc1
Fix battery replacement cost
Matthew-Boyd Sep 25, 2021
b673cc8
Fix lcoh handling
Matthew-Boyd Sep 25, 2021
d8753dc
Ensure notices messagebox stays on top
Matthew-Boyd Sep 25, 2021
de2cf58
Remove combine cases macro
Matthew-Boyd Sep 25, 2021
d647e90
Small cleanups
Matthew-Boyd Sep 26, 2021
c250b29
Add notice for generic-battery contingency
Matthew-Boyd Sep 26, 2021
3ddebab
Fix Third Party Owner usage
Matthew-Boyd Sep 26, 2021
5e76027
Handle when there are no other cases
Matthew-Boyd Sep 26, 2021
7607270
Merge branch 'develop' into combine_cases
Matthew-Boyd Sep 27, 2021
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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ set(SAM_SRC
src/shadingfactors.cpp
src/materials.cpp
src/codegenerator.cpp
src/pythonhandler.cpp src/pythonhandler.h)
src/pythonhandler.cpp src/pythonhandler.h
src/combinecases.cpp src/combinecases.h)


#####################################################################################################################
Expand Down
564 changes: 0 additions & 564 deletions deploy/runtime/macros/Combine Cases.lk

This file was deleted.

Binary file removed deploy/runtime/macros/combine_cases.JPG
Binary file not shown.
109 changes: 81 additions & 28 deletions deploy/runtime/ui/Generic System Plant.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Generic System Plant
788
527
19
787
547
20
GroupBox

1
Expand All @@ -21,7 +21,7 @@ Width
780
Height
3
389
410
Tool Tip
5
0
Expand All @@ -45,7 +45,7 @@ X
6
Y
3
393
414
Width
3
780
Expand Down Expand Up @@ -105,7 +105,7 @@ X
357
Y
3
423
444
Width
3
294
Expand All @@ -118,6 +118,36 @@ Tool Tip
TabOrder
3
7
Button

1
8
Name
5
15
btn_selectcases
X
3
411
Y
3
99
Width
3
143
Height
3
21
Tool Tip
5
0
Caption
5
15
Select cases...
TabOrder
3
4294967295
Numeric

1
Expand All @@ -131,7 +161,7 @@ X
432
Y
3
297
318
Width
3
120
Expand Down Expand Up @@ -193,7 +223,7 @@ X
453
Y
3
363
384
Width
3
100
Expand Down Expand Up @@ -255,7 +285,7 @@ X
453
Y
3
207
228
Width
3
100
Expand Down Expand Up @@ -317,7 +347,7 @@ X
411
Y
3
102
123
Width
3
143
Expand Down Expand Up @@ -352,7 +382,7 @@ X
432
Y
3
249
270
Width
3
120
Expand Down Expand Up @@ -414,7 +444,7 @@ X
432
Y
3
273
294
Width
3
120
Expand Down Expand Up @@ -476,7 +506,7 @@ X
453
Y
3
339
360
Width
3
100
Expand Down Expand Up @@ -538,7 +568,7 @@ X
48
Y
3
129
150
Width
3
636
Expand Down Expand Up @@ -585,7 +615,7 @@ X
48
Y
3
321
342
Width
3
600
Expand Down Expand Up @@ -624,7 +654,7 @@ X
48
Y
3
228
249
Width
3
600
Expand Down Expand Up @@ -663,7 +693,7 @@ X
48
Y
3
189
210
Width
3
600
Expand Down Expand Up @@ -702,7 +732,7 @@ X
21
Y
3
423
444
Width
3
243
Expand Down Expand Up @@ -753,10 +783,10 @@ Y
30
Width
3
536
413
Height
3
44
65
Tool Tip
5
0
Expand All @@ -765,9 +795,10 @@ Selection
0
Items
6
2
3
Constant generation profile from nameplate capacity and capacity factor
Import hourly or subhourly generation profile from file
Generate production profiles from open cases
ShowCaptions
2
1
Expand All @@ -790,7 +821,7 @@ X
453
Y
3
78
99
Width
3
100
Expand Down Expand Up @@ -852,7 +883,7 @@ X
453
Y
3
102
123
Width
3
100
Expand Down Expand Up @@ -1032,8 +1063,8 @@ spec_mode
Generic system plant output specification mode

Generic System Plant
127
Constant generation profile from nameplate capacity and capacity factor|Import hourly or subhourly generation profile from file
172
Constant generation profile from nameplate capacity and capacity factor|Import hourly or subhourly generation profile from file|Generate production profiles from open cases
1
1
1
Expand Down Expand Up @@ -1152,7 +1183,7 @@ equations{ 'ui_step_minutes' } = define() {
}
};

1032
1701
on_load{"Generic System Plant"}=define(){
on_change{'spec_mode'}();
on_change{'system_capacity'}();
Expand All @@ -1167,16 +1198,38 @@ on_change{'system_capacity'}=define(){
check_inputs();
};

on_change{'btn_selectcases'} = define() {
if ( value('spec_mode') == 2 ) {
combine_cases();
}
};

// display window for combine cases
function combine_cases()
{
hash = combinecasesquery();
// meta data
if ( hash != '' )
{
result = hash{'result_code'}; // 0=success, 1=error
}
}

function check_inputs() {
mode = value('spec_mode');
show('system_capacity',
mode == 0 || mode == 1);
show('user_capacity_factor',
mode == 0 );
show('energy_output_array',
mode == 1);
mode == 1 || mode == 2);
show('btn_selectcases',
mode == 2);
color = 'black';
if ( mode == 1 )
txt = 'Click "Edit data" to import generation data from a file. After importing the data, type a value for the nameplate capacity, which SAM uses to calculate the capacity factor and dollar amounts from any costs or incentives expressed $/W. Use the calculated values below to help you choose a nameplate capacity value. See Help for details.';
txt = 'Click "Edit array..." to import generation data from a file. After importing the data, type a value for the nameplate capacity, which SAM uses to calculate the capacity factor and dollar amounts from any costs or incentives expressed $/W. Use the calculated values below to help you choose a nameplate capacity value. See Help for details.';
elseif ( mode == 2 )
txt = 'Click "Select cases..." to select open cases, simulate those cases and combine their generation profiles into a single profile to be used with this generic case. Click "Edit array..." to view or edit the combined simulated productions.';
else
txt = '';
/* if ( value('system_capacity')*0.9 > value('first_year_output_peak' ) ) {
Expand Down
22 changes: 22 additions & 0 deletions src/casewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,21 @@ void CaseWindow::OnCommand( wxCommandEvent &evt )
}
}

wxUIObject* CaseWindow::FindObject(const wxString& name, ActiveInputPage** ipage)
{
auto aPage = GetInputPages();
for (auto &page : aPage)
{
SwitchToInputPage(page);
if (wxUIObject* obj = FindActiveObject(name, ipage))
return obj;
}

if (ipage) *ipage = 0;
return 0;
}


wxUIObject *CaseWindow::FindActiveObject( const wxString &name, ActiveInputPage **ipage )
{
for( size_t i=0;i<m_currentActivePages.size();i++ )
Expand Down Expand Up @@ -814,6 +829,13 @@ void CaseWindow::DetachCurrentInputPage()
m_currentActivePages.clear();
}

wxString CaseWindow::GetInputPage()
{
wxString input_page = m_inputPageList->GetStringSelection();
// do checks
return input_page;
}

wxArrayString CaseWindow::GetInputPages()
{
wxArrayString list;
Expand Down
4 changes: 3 additions & 1 deletion src/casewin.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener
void UpdateConfiguration();

bool SwitchToInputPage( const wxString &name );
wxString GetInputPage();
wxArrayString GetInputPages();
wxUIObject *FindActiveObject( const wxString &name, ActiveInputPage **page = 0 );
wxUIObject* FindActiveObject(const wxString& name, ActiveInputPage** page = 0);
wxUIObject* FindObject(const wxString& name, ActiveInputPage** page = 0);

bool SwitchToPage( const wxString &name ); // can navigate to results, parametrics, as well as input pages

Expand Down
Loading