Skip to content

Commit

Permalink
Fix fuel cell dispatch forms
Browse files Browse the repository at this point in the history
Set options in startup.lk for fuel cell dispatch and fix issues with conditional statements in UI callback scripts.

Replace `${}` with `value()` in callback scripts to get better debug feedback when variables are out of context.

Initial set of dummy defaults to avoid error when loading case.
  • Loading branch information
cpaulgilman committed Aug 24, 2023
1 parent db5d3ba commit 2e29fca
Show file tree
Hide file tree
Showing 10 changed files with 31,495 additions and 32,646 deletions.
2,459 changes: 874 additions & 1,585 deletions deploy/runtime/defaults/PVWatts Wind FuelCell Battery Hybrid_Host Developer.json

Large diffs are not rendered by default.

61,467 changes: 30,506 additions & 30,961 deletions deploy/runtime/defaults/PVWatts Wind FuelCell Battery Hybrid_Single Owner.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions deploy/runtime/startup.lk
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ function setup_community_solar_pages()
{ 'sidebar'='Depreciation', 'help'='depreciation' });
}

function setup_single_owner_Dispatch_pages()
function setup_single_owner_dispatch_pages()
{
setting( { 'analysis_period_var'='cf_length' } );
addpage( [[ 'Financial Analysis Parameters',
Expand Down Expand Up @@ -985,7 +985,7 @@ setup_etes_pages();
setup_lifetime_page(DEGRADATION_AC_SINGLE_YEAR);
addpage([['ETES Capital Costs']],{'sidebar'='System Costs','help'='cc_etes'});
addpage([['Operating Costs']], {'sidebar' = 'Operating Costs', 'help'='oc_operating'} );
setup_single_owner_Dispatch_pages();
setup_single_owner_dispatch_pages();
//setup_electricity_purchases();

//setconfig('ETES', 'Merchant Plant');
Expand All @@ -1003,7 +1003,7 @@ setup_ptes_pages();
setup_lifetime_page(DEGRADATION_AC_SINGLE_YEAR);
addpage([['PTES Capital Costs']],{'sidebar'='Installation Costs','help'='cc_system_costs'});
addpage([['Operating Costs']], {'sidebar' = 'Operating Costs', 'help'='oc_operating'} );
setup_single_owner_Dispatch_pages();
setup_single_owner_dispatch_pages();

// CSThermal - Physical Trough ////////////////////////////////
setconfig( 'Physical Trough IPH', 'None' );
Expand Down Expand Up @@ -2723,7 +2723,6 @@ addpage( [[ 'PVWatts', {'name'='PV Land Area', 'caption' = 'Land Area', 'collaps
addpage( [[ 'Degradation AC Single Year'], ], { 'sidebar'='PV Degradation','help'='degradation', 'bin_name'='PVWatts' } );
addpage( [[ 'PV Capital Costs' ], [ 'PVWatts Capital Cost Curve', 'PV Capex Table', 'PV Capex Table AC']], { 'sidebar'='PV Installation Costs', 'exclusive_var'='pv_capex_cost_choice', 'help'='cc_pv', 'bin_name'='PVWatts'} );
addpage( [[ 'Operating Costs', 'Operating Costs Land Lease' ]], {'sidebar' = 'PV Operating Costs', 'help'='oc_operating', 'bin_name'='PVWatts'} );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='PV Incentives', 'help'='incentives', 'bin_name'='PVWatts' } );
// wind
addpage( [[ 'Wind Resource File'], [ 'Wind Speed Weibull Distribution'], [ 'Wind Resource Probability Table']], { 'sidebar'='Wind Resource', 'exclusive_var'='wind_resource_model_choice', 'help'='wind_resource', 'bin_name'='Wind' } );
addpage( [[ 'Wind Turbine Design' ]], { 'sidebar'='Wind Turbine', 'help'='wind_turbine', 'bin_name'='Wind' } );
Expand All @@ -2732,19 +2731,19 @@ addpage( [[ 'Wind Losses' ]], { 'sidebar'='Wind Losses', 'help'='wind_losses', '
addpage( [[ 'Degradation AC Single Year'] ], { 'sidebar'='Wind Degradation','help'='lifetime', 'bin_name'='Wind'} );
addpage( [[ 'Wind Farm Costs']], { 'sidebar'='Wind Installation Costs', 'help'='cc_wind', 'bin_name'='Wind' } );
addpage( [[ 'Operating Costs' ]], {'sidebar' = 'Wind Operating Costs', 'help'='oc_operating', 'bin_name'='Wind'} );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='Wind Incentives', 'help'='incentives', 'bin_name'='Wind' } );
//fuel cell
setup_fuel_cell_pages_hybrid();
addpage( [[ 'Fuel Cell']], {'sidebar'='Fuel Cell', 'help'='fuelcell_fuel_cell', 'bin_name'='FuelCell'});
addpage( [[ 'Fuel Cell Costs Hybrid' ]], { 'sidebar'='Fuel Cell Installation Costs', 'help'='cc_fuel_cell', 'bin_name'='FuelCell' } );
addpage( [[ 'Operating Costs Fuel Cell Hybrid' ]], { 'sidebar'='Fuel Cell Operating Costs', 'help'='oc_fuel_cell', 'bin_name'='FuelCell' } );
// battery
setup_hybrid_battery_pages(FOM);
addpage( [[ 'Standalone Battery Costs' ]], { 'sidebar'='Battery Installation Costs', 'help'='cc_standalone_battery', 'bin_name'='Battery' } );
setup_pages_battery_cell_and_system(false, false); // No REopt and FOM
setup_pages_battery_life();
addpage( [[ {'name'='Battery Dispatch Automated FOM', 'caption'='Automated'} ], [{'name'='Battery Dispatch PV Smoothing', 'caption'='PV Smoothing'}], [ {'name'='Battery Dispatch Custom Time Series', 'caption'='Custom Time Series'} ], [{'name'='Fuel Cell Dispatch Manual', 'caption'='Manual'}]], { 'sidebar'='Dispatch', 'help'='fuelcell_dispatch', 'exclusive_var' = 'batt_dispatch_excl', 'exclusive_header_pages' = ['Fuel Cell Dispatch', 'Battery Dispatch Common', 'Battery Dispatch Options FOM'], 'exclusive_tabs'=true, 'exclusive_hide'=true} );
addpage( [[ 'Standalone Battery Costs', 'Battery Enable' ]], { 'sidebar'='Battery Installation Costs', 'help'='cc_standalone_battery', 'bin_name'='Battery' } );
addpage( [[ 'Operating Costs Standalone Battery']], { 'sidebar'='Battery Operating Costs', 'help'='oc_battery', 'bin_name'='Battery' } );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='Battery Incentives', 'help'='incentives', 'bin_name'='Battery' } );
setup_grid_limits_page();
// single owner
addpage([['Hybrid Costs']], {'sidebar'='Hybrid System Costs', 'help'='hybrid_system_costs', 'top_page'=true});

setup_single_owner_pages( );
setup_electricity_purchases();

Expand Down Expand Up @@ -2790,7 +2789,6 @@ addpage( [[ 'PVWatts', {'name'='PV Land Area', 'caption' = 'Land Area', 'collaps
addpage( [[ 'Degradation AC Single Year'], ], { 'sidebar'='PV Degradation','help'='degradation', 'bin_name'='PVWatts' } );
addpage( [[ 'PV Capital Costs' ], [ 'PVWatts Capital Cost Curve', 'PV Capex Table', 'PV Capex Table AC']], { 'sidebar'='PV Installation Costs', 'exclusive_var'='pv_capex_cost_choice', 'help'='cc_pv', 'bin_name'='PVWatts'} );
addpage( [[ 'Operating Costs']], {'sidebar' = 'PV Operating Costs', 'help'='oc_operating', 'bin_name'='PVWatts'} );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='PV Incentives', 'help'='incentives', 'bin_name'='PVWatts' } );
// wind
addpage( [[ 'Wind Resource File'], [ 'Wind Speed Weibull Distribution'], [ 'Wind Resource Probability Table']], { 'sidebar'='Wind Resource', 'exclusive_var'='wind_resource_model_choice', 'help'='wind_resource', 'bin_name'='Wind' } );
addpage( [[ 'Wind Turbine Design' ]], { 'sidebar'='Wind Turbine', 'help'='wind_turbine', 'bin_name'='Wind' } );
Expand All @@ -2799,17 +2797,19 @@ addpage( [[ 'Wind Losses' ]], { 'sidebar'='Wind Losses', 'help'='wind_losses', '
addpage( [[ 'Degradation AC Single Year'] ], { 'sidebar'='Wind Degradation','help'='lifetime', 'bin_name'='Wind'} );
addpage( [[ 'Wind Farm Costs']], { 'sidebar'='Wind Installation Costs', 'help'='cc_wind', 'bin_name'='Wind' } );
addpage( [[ 'Operating Costs' ]], {'sidebar' = 'Wind Operating Costs', 'help'='oc_operating', 'bin_name'='Wind'} );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='Wind Incentives', 'help'='incentives', 'bin_name'='Wind' } );
//fuel cell
setup_fuel_cell_pages_hybrid();
addpage( [[ 'Fuel Cell']], {'sidebar'='Fuel Cell', 'help'='fuelcell_fuel_cell', 'bin_name'='FuelCell'});
addpage( [[ 'Fuel Cell Costs Hybrid' ]], { 'sidebar'='Fuel Cell Installation Costs', 'help'='cc_fuel_cell', 'bin_name'='FuelCell' } );
addpage( [[ 'Operating Costs Fuel Cell Hybrid' ]], { 'sidebar'='Fuel Cell Operating Costs', 'help'='oc_fuel_cell', 'bin_name'='FuelCell' } );
// battery
setup_hybrid_battery_pages(BTM);
setup_pages_battery_cell_and_system(false, true); // No REopt and BTM
setup_pages_battery_life();
//addpage( [[ {'name'='Battery Dispatch Peak Shaving BTM', 'caption'='Peak Shaving'} ], [ {'name'='Battery Dispatch Grid Power Targets', 'caption'='Grid Power Targets'} ], [ {'name'='Battery Dispatch Battery Power Targets', 'caption'='Battery Power Targets'}], [ {'name'='Battery Dispatch Manual', 'caption'='Manual'}], [ {'name'='Battery Dispatch Price Signal', 'caption'='Price Signal'} ]], { 'sidebar'='Dispatch', 'help'='battery_dispatch_btm', 'exclusive_var' = 'batt_dispatch_excl', 'exclusive_header_pages' = ['Battery Dispatch Common', 'Battery Dispatch Options BTM'], 'exclusive_tabs'=true, 'exclusive_hide'=true } );
addpage( [[ {'name'='Battery Dispatch Peak Shaving BTM', 'caption'='Peak Shaving'} ], [ {'name'='Battery Dispatch Grid Power Targets', 'caption'='Grid Power Targets'} ], [ {'name'='Battery Dispatch Battery Power Targets', 'caption'='Battery Power Targets'}], [ 'Fuel Cell Dispatch Manual' ], [ {'name'='Battery Dispatch Price Signal', 'caption'='Price Signal'}]], { 'sidebar'='Dispatch', 'help'='fuelcell_dispatch', 'exclusive_var' = 'batt_dispatch_excl', 'exclusive_header_pages' = ['Fuel Cell Dispatch', 'Battery Dispatch Common', 'Battery Dispatch Options BTM'], 'exclusive_tabs'=true, 'exclusive_hide'=true} );
addpage( [[ 'Standalone Battery Costs', 'Battery Enable' ]],{ 'sidebar'='Battery Installation Costs', 'help'='cc_standalone_battery', 'bin_name'='Battery' } );
addpage( [[ 'Operating Costs Standalone Battery']],{ 'sidebar'='Battery Operating Costs', 'help'='oc_battery', 'bin_name'='Battery' } );
//addpage( [[ 'Financial Tax Credits','Financial Cash Incentives']], { 'sidebar'='Battery Incentives', 'help'='incentives', 'bin_name'='Battery' } );
// host developer
setup_grid_limits_page();
setup_grid_outage_page();// host developer
setup_host_developer_pages(LOAD_SIMPLE);
addpage([['Hybrid Costs']], {'sidebar'='Hybrid System Costs', 'help'='hybrid_system_costs', 'top_page'=true});

Expand Down
60 changes: 31 additions & 29 deletions deploy/runtime/ui/Battery Dispatch Automated FOM.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Battery Dispatch Automated FOM",
"Width": 1055.0,
"Height": 365.0,
"Width": 1052.0,
"Height": 388.0,
"FormObjects": {
"Label": {
"Visible": 1.0,
Expand Down Expand Up @@ -78,7 +78,7 @@
},
"Y": {
"Type": 3.0,
"Integer": 318.0
"Integer": 354.0
},
"Width": {
"Type": 3.0,
Expand Down Expand Up @@ -131,7 +131,7 @@
},
"Y": {
"Type": 3.0,
"Integer": 291.0
"Integer": 327.0
},
"Width": {
"Type": 3.0,
Expand Down Expand Up @@ -172,11 +172,11 @@
},
"Y": {
"Type": 3.0,
"Integer": 234.0
"Integer": 270.0
},
"Width": {
"Type": 3.0,
"Integer": 1023.0
"Integer": 1011.0
},
"Height": {
"Type": 3.0,
Expand Down Expand Up @@ -234,7 +234,7 @@
},
"Y": {
"Type": 3.0,
"Integer": 207.0
"Integer": 243.0
},
"Width": {
"Type": 3.0,
Expand Down Expand Up @@ -557,11 +557,11 @@
},
"X": {
"Type": 3.0,
"Integer": 411.0
"Integer": 396.0
},
"Y": {
"Type": 3.0,
"Integer": 180.0
"Integer": 186.0
},
"Width": {
"Type": 3.0,
Expand Down Expand Up @@ -602,11 +602,11 @@
},
"X": {
"Type": 3.0,
"Integer": 945.0
"Integer": 942.0
},
"Y": {
"Type": 3.0,
"Integer": 180.0
"Integer": 213.0
},
"Width": {
"Type": 3.0,
Expand Down Expand Up @@ -639,15 +639,15 @@
},
"X": {
"Type": 3.0,
"Integer": 246.0
"Integer": 396.0
},
"Y": {
"Type": 3.0,
"Integer": 180.0
"Integer": 213.0
},
"Width": {
"Type": 3.0,
"Integer": 698.0
"Integer": 542.0
},
"Height": {
"Type": 3.0,
Expand Down Expand Up @@ -710,7 +710,7 @@
},
"Height": {
"Type": 3.0,
"Integer": 359.0
"Integer": 380.0
},
"Tool Tip": {
"Type": 5.0,
Expand Down Expand Up @@ -874,7 +874,6 @@
"\tenable('batt_select_weather_file_forecast', ${batt_dispatch_wf_forecast_choice} == 2);",
"\tenable('batt_user_specified_weather_file', ${batt_dispatch_wf_forecast_choice} == 2);",
"\tenable('batt_pv_ac_forecast_fom_auto', ${batt_dispatch_wf_forecast_choice} == 2);",
"",
"\t",
"\tif (${batt_dispatch_wf_forecast_choice} == 2)",
"\t{",
Expand All @@ -897,8 +896,8 @@
"\t\t}",
"\t}",
"\telse {",
"\t\t${batt_pv_ac_forecast} = [0];",
"\t\t${batt_pv_clipping_forecast} = [0];",
"\t\tvalue('batt_pv_ac_forecast', [0]);",
"\t\tvalue('batt_pv_clipping_forecast', [0]);",
"\t}",
"",
"\tmode = value('batt_dispatch_wf_forecast_choice');",
Expand All @@ -918,7 +917,7 @@
"",
"function enable_auto_inputs_fom(on_off)",
"{",
"\tenable('batt_auto_gridcharge_max_daily', on_off);",
"\t//enable('batt_auto_gridcharge_max_daily', on_off);",
"\tenable('batt_dispatch_update_frequency_hours', on_off);",
"\tenable('batt_look_ahead_hours', on_off);",
"\tenable('batt_cycle_cost_choice', on_off);",
Expand All @@ -938,21 +937,24 @@
"\t",
"\tif (technology() == 'Generic Battery' ) {",
"\t\tmsg = 'For the Custom Forecast option, choose a generation profile at the simulation timestep to use for the dispatch forecast instead of the profile on the Power Plant page.';",
"\t\tshow('batt_pv_ac_forecast_fom_auto',true);",
"\t\tshow('batt_user_specified_weather_file',false);",
"\t\tshow('batt_select_weather_file_forecast',false);",
"\t\tenable('batt_pv_ac_forecast_fom_auto',true);",
"\t\tenable('batt_user_specified_weather_file',false);",
"\t\tenable('batt_select_weather_file_forecast',false);",
"\t}\r",
"\telseif (technology() == 'PVWatts Wind Battery Hybrid') {\r",
"\telseif ( technology() == 'PVWatts Wind Battery Hybrid' \r",
"\t || technology() == 'PVWatts Wind FuelCell Battery Hybrid'\r",
"\t || technology() == 'Photovoltaic Wind Battery Hybrid'\r",
"\t || technology() == 'Generic PVWatts Wind FuelCell Battery Hybrid' ) {\r",
"\t\tmsg = 'For the Custom Forecast option, choose a generation profile at the simulation timestep to use for the dispatch forecast instead of the combined generation of the wind and PV systems.';\r",
"\t\tshow('batt_pv_ac_forecast_fom_auto',true);\r",
"\t\tshow('batt_user_specified_weather_file',false);\r",
"\t\tshow('batt_select_weather_file_forecast',false);\r",
"\t\tenable('batt_pv_ac_forecast_fom_auto',true);\r",
"\t\tenable('batt_user_specified_weather_file',false);\r",
"\t\tenable('batt_select_weather_file_forecast',false);\r",
"\t}",
"\telse {",
"\t\tmsg = 'For the Custom Forecast option, choose a weather file in the SAM CSV format to use for the dispatch forecast instead of the weather file on the Location and Resource page.';\t",
"\t\tshow('batt_pv_ac_forecast_fom_auto',false);",
"\t\tshow('batt_user_specified_weather_file',true);",
"\t\tshow('batt_select_weather_file_forecast',true);",
"\t\tenable('batt_pv_ac_forecast_fom_auto',false);",
"\t\tenable('batt_user_specified_weather_file',true);",
"\t\tenable('batt_select_weather_file_forecast',true);",
"\t}",
"\t",
"\tproperty('batt_forecast_auto_description','Caption',msg);",
Expand Down
14 changes: 7 additions & 7 deletions deploy/runtime/ui/Battery Dispatch Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,9 @@
"{",
"\tlogmsg('Forecast file: ' + file);",
"\t",
"\tuser_specified_weather_file_old = ${user_specified_weather_file};",
"\tuse_specific_weather_file_old = ${use_specific_weather_file};",
"\tsolar_resource_file_old = ${solar_resource_file};",
"\tuser_specified_weather_file_old = value('user_specified_weather_file');",
"\tuse_specific_weather_file_old = value('use_specific_weather_file');",
"\tsolar_resource_file_old = value('solar_resource_file');",
"\t",
"\tif ( file != '' ) {",
"\t\tfile = replace(file, '\\\\', '/');",
Expand All @@ -642,8 +642,8 @@
"\t}",
"\telse",
"\t{",
"\t\t${batt_pv_ac_forecast} = ssc_var(forecast_run, 'gen');",
"\t\t${batt_pv_clipping_forecast} = ssc_var(forecast_run, 'inv_cliploss');",
"\t\tvalue('batt_pv_ac_forecast', ssc_var(forecast_run, 'gen'));",
"\t\tvalue('batt_pv_clipping_forecast', ssc_var(forecast_run, 'inv_cliploss'));",
"\t}",
"\tssc_free(forecast_run);",
"}",
Expand All @@ -666,8 +666,8 @@
"\t}",
"\telse",
"\t{",
"\t\t${batt_pv_ac_forecast} = ssc_var(forecast_run, 'gen');",
"\t\t${batt_pv_clipping_forecast} = [0];",
"\t\tvalue('batt_pv_ac_forecast', ssc_var(forecast_run, 'gen'));",
"\t\tvalue('batt_pv_clipping_forecast', [0]);",
"\t}",
"\tssc_free(forecast_run);",
"}"
Expand Down
4 changes: 3 additions & 1 deletion deploy/runtime/ui/Battery Dispatch Options FOM.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@
"\tenable_charge_from_clip();",
"\tshow_hide_charge_options();",
"\twave_batt_smoothing_msg();",
"\tif ( technology() == 'Fuel Cell' )",
"\tif ( technology() == 'Fuel Cell' \r",
"\t || technology() == 'PVWatts Wind FuelCell Battery Hybrid' \r",
"\t || technology() == 'Generic PVWatts Wind FuelCell Battery Hybrid' )",
"\t{",
"\t\tcheck_fuel_cell_dispatch(); // function defined in Fuel Cell Dispatch callback",
"\t}",
Expand Down
Loading

0 comments on commit 2e29fca

Please sign in to comment.