Skip to content

Commit

Permalink
Merge pull request #1762 from NREL/SAM_1563
Browse files Browse the repository at this point in the history
Address issue #1563
  • Loading branch information
sjanzou committed Apr 19, 2024
2 parents cc0aca0 + e29343a commit cddf732
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions deploy/runtime/cashflow.lk
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function cf_production()
{
cfline( 'cf_energy_net', 0);
}
if ( is_batt_tech() )
if ( is_batt_tech() && (varinfo('gen_without_battery')!= null)) // SAM issue 1563
{
cfline( 'cf_energy_without_battery',0);
cfline( 'batt_annual_discharge_energy',0);
Expand Down Expand Up @@ -1736,7 +1736,7 @@ function set_annual_values( xl )
}
}
// tech-dependent
if ( is_batt_tech() )
if ( is_batt_tech() && (varinfo('gen_without_battery')!= null)) // SAM issue 1563
{
xl_set_output( xl, 'cf_energy_without_battery' );
xl_set_output( xl, 'batt_annual_discharge_energy');
Expand Down
Binary file modified deploy/runtime/spreadsheets/residential_commercial.xlsx
Binary file not shown.
12 changes: 9 additions & 3 deletions src/invoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,10 +1735,16 @@ static void fcall_xl_set( lk::invoke_t &cxt )
wxArrayString list;
for( size_t i=0;i<cxt.arg(1).length();i++ )
list.Add( cxt.arg(1).index( i )->deref().as_string() );
xl->Excel().SetNamedRangeArray( cxt.arg(2).as_string(), list );
if (!xl->Excel().SetNamedRangeArray(cxt.arg(2).as_string(), list)) {
cxt.error(xl->Excel().GetLastError());
}

}
else if (cxt.arg_count() == 3) {
if (!xl->Excel().SetNamedRangeValue(cxt.arg(2).as_string(), cxt.arg(1).as_string())) {
cxt.error(xl->Excel().GetLastError());
}
}
else if ( cxt.arg_count() == 3 )
xl->Excel().SetNamedRangeValue( cxt.arg(2).as_string(), cxt.arg(1).as_string() );
}
else
cxt.error( "invalid xl-obj-ref" );
Expand Down

0 comments on commit cddf732

Please sign in to comment.