Skip to content

Commit

Permalink
Add autograph functions for BTM battery + hybrids, default timeseries
Browse files Browse the repository at this point in the history
graph to stacked area plot for now
  • Loading branch information
mjprilliman committed Oct 14, 2024
1 parent b3a0753 commit e271b1c
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 160 deletions.
77 changes: 45 additions & 32 deletions deploy/runtime/autographs.lk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ function heatmap_graphs()
}
}

function battery_btm_monthly_graph()
{
fin = financing();
if (fin == "Residential" || fin == "Commercial" || fin == "Third Party" || fin == "Host Developer") {
agraph( 'monthly_system_to_load,monthly_batt_to_load,monthly_grid_to_load', 'Monthly Energy to Load in Year 1', '', 'kWh' , -1, true, true, 'right', 1 );
agraph( 'year1_monthly_ec_charge_with_system,year1_monthly_dc_tou_with_system,year1_monthly_dc_fixed_with_system,year1_monthly_fixed_with_system', 'Monthly Utility Bill in Year 1', '', '$/month' , -1, true, true, 'right', 1 );
}
}

function battery_btm_monthly_graph_hybrid()
{
fin = financing();
if (fin == "Residential" || fin == "Commercial" || fin == "Third Party" || fin == "Host Developer") {
agraph( 'battery_monthly_system_to_load,battery_monthly_batt_to_load,battery_monthly_grid_to_load', 'Monthly Energy to Load in Year 1', '', 'kWh' , -1, true, true, 'bottom', 1 );
agraph( 'year1_monthly_ec_charge_with_system,year1_monthly_dc_tou_with_system,year1_monthly_dc_fixed_with_system,year1_monthly_fixed_with_system', 'Monthly Utility Bill in Year 1', '', '$/month' , -1, true, true, 'bottom', 1 );
}

}

//**************Categories of graphs for financials**************************
function rescom_financial_graphs()
{
Expand All @@ -48,6 +67,12 @@ function third_party_graphs()
if (technology() != "Standalone Battery") { //No monthly_energy for standalone battery
agraph( 'monthly_energy,year1_monthly_load', 'Monthly AC Energy and Load in Year 1', '', 'kWh', -1, true, true, 'bottom' );
}
if (technology() == "PV Battery" || technology() == "PVWatts Battery" || technology() == "Generic Battery") {
battery_btm_monthly_graph();
}
if (technology() == "PVWatts Wind Battery Hybrid" || technology() == "Photovoltaic Wind Battery Hybrid" || technology() == "Generic PVWatts Wind FuelCell Battery Hybrid" || technology() == "PVWatts Wind FuelCell Battery Hybrid") {
battery_btm_monthly_graph_hybrid();
}
agraph( 'cf_agreement_cost,cf_energy_value', 'Annual Agreement Cost and Electricity Savings', 'Year', '$' );
}

Expand All @@ -56,6 +81,12 @@ function host_developer_graphs()
if (technology() != "Standalone Battery") { //No monthly_energy for standalone battery
agraph( 'monthly_energy,year1_monthly_load', 'Monthly AC Energy and Load in Year 1', '', 'kWh', -1, true, true, 'bottom' );
}
if (technology() == "PV Battery" || technology() == "PVWatts Battery" || technology() == "Generic Battery") {
battery_btm_monthly_graph();
}
if (technology() == "PVWatts Wind Battery Hybrid" || technology() == "Photovoltaic Wind Battery Hybrid" || technology() == "Generic PVWatts Wind FuelCell Battery Hybrid" || technology() == "PVWatts Wind FuelCell Battery Hybrid") {
battery_btm_monthly_graph_hybrid();
}
agraph( 'cf_project_return_aftertax', 'Developer After-tax Cash Flow', 'Year', '$', -1, true, false, 'bottom' );
agraph( 'cf_nte,cf_ppa_price', 'Host Indifference Point and PPA Price', 'Year', '$', -1, true, true,'bottom' );
agraph( 'cf_agreement_cost,annual_energy_value', 'Host Annual Agreement Cost and Electricity Savings', 'Year', '$', -1, true, true, 'bottom' );
Expand Down Expand Up @@ -136,6 +167,7 @@ function resiliency_graphs()
}
}


//**************Technologies***************************
autographs{ 'High-X Concentrating PV' } = define() { base_technology_graphs(); heatmap_graphs(); };
autographs{ 'Concentrating Solar Power = Physical Trough' } = define() { base_technology_graphs(); heatmap_graphs(); };
Expand All @@ -158,7 +190,7 @@ autographs{ 'Physical Trough IPH' } = define() {heatmap_graphs();};
autographs{ 'DSGL IPH' } = define() {heatmap_graphs();};
autographs{ 'MSPT IPH' } = define() {heatmap_graphs();};
autographs{ 'MSLF IPH' } = define() {heatmap_graphs();};
autographs{ 'Generic Battery' } = define() {heatmap_graphs();};
autographs{ 'Generic Battery' } = define() {battery_btm_monthly_graph();heatmap_graphs();};



Expand Down Expand Up @@ -188,8 +220,8 @@ autographs { 'PVWatts Wind Battery Hybrid|Single Owner' } = define () {

autographs { 'PVWatts Wind Battery Hybrid|Host Developer' } = define () {
// monthly energy
agraph( 'pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, false, true, 'bottom', 1 );

agraph( 'pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, true, 'bottom', 1 );
battery_btm_monthly_graph_hybrid();
// after-tax cash flow and host indifference point
agraph( 'cf_project_return_aftertax', 'Developer After-tax Cash Flow', 'Year', '$', -1, true, false, 'bottom' );
agraph( 'cf_nte,cf_ppa_price', 'Host Indifference Point and PPA Price', 'Year', '$', -1, true, true,'bottom' );
Expand Down Expand Up @@ -235,8 +267,8 @@ autographs { 'PVWatts Wind FuelCell Battery Hybrid|Single Owner' } = define () {

autographs { 'PVWatts Wind FuelCell Battery Hybrid|Host Developer' } = define () {
// monthly energy
agraph( 'pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, false, true, 'bottom', 1 );

agraph( 'pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, true, 'bottom', 1 );
battery_btm_monthly_graph_hybrid();
// after-tax cash flow and host indifference point
agraph( 'cf_project_return_aftertax', 'Developer After-tax Cash Flow', 'Year', '$', -1, true, false, 'bottom' );
agraph( 'cf_nte,cf_ppa_price', 'Host Indifference Point and PPA Price', 'Year', '$', -1, true, true,'bottom' );
Expand Down Expand Up @@ -282,8 +314,8 @@ autographs { 'Photovoltaic Wind Battery Hybrid|Single Owner' } = define () {

autographs { 'Photovoltaic Wind Battery Hybrid|Host Developer' } = define () {
// monthly energy
agraph( 'photovoltaic_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, false, true, 'bottom', 1 );

agraph( 'photovoltaic_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, true, 'bottom', 1 );
battery_btm_monthly_graph_hybrid();
// after-tax cash flow and host indifference point
agraph( 'cf_project_return_aftertax', 'Developer After-tax Cash Flow', 'Year', '$', -1, true, false, 'bottom' );
agraph( 'cf_nte,cf_ppa_price', 'Host Indifference Point and PPA Price', 'Year', '$', -1, true, true,'bottom' );
Expand Down Expand Up @@ -330,8 +362,8 @@ autographs { 'Generic PVWatts Wind FuelCell Battery Hybrid|Single Owner' } = def

autographs { 'Generic PVWatts Wind FuelCell Battery Hybrid|Host Developer' } = define () {
// monthly energy
agraph( 'generic_monthly_energy,pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, false, true, 'bottom', 1 );

agraph( 'generic_monthly_energy,pvwatts_monthly_energy,wind_monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, true, 'bottom', 1 );
battery_btm_monthly_graph_hybrid();
// after-tax cash flow and host indifference point
agraph( 'cf_project_return_aftertax', 'Developer After-tax Cash Flow', 'Year', '$', -1, true, false, 'bottom' );
agraph( 'cf_nte,cf_ppa_price', 'Host Indifference Point and PPA Price', 'Year', '$', -1, true, true,'bottom' );
Expand Down Expand Up @@ -387,6 +419,7 @@ autographs{ 'PVWatts'} = define()
autographs{ 'PVWatts Battery'} = define()
{
agraph( 'monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, false, 'bottom' );
battery_btm_monthly_graph();
heatmap_graphs();
};

Expand All @@ -396,20 +429,6 @@ autographs{ 'Flat Plate PV' } = define()

//Loss percentage graph per 9/18/14 meeting
//add columns depending on what models are enabled
columns = 'annual_poa_shading_loss_percent,annual_poa_soiling_loss_percent,annual_poa_cover_loss_percent,';
if (value('en_snow_model') == true)
columns += 'annual_dc_snow_loss_percent,';
columns += 'annual_dc_module_loss_percent,annual_dc_mppt_clip_loss_percent,annual_dc_mismatch_loss_percent,annual_dc_diodes_loss_percent,annual_dc_wiring_loss_percent,annual_dc_tracking_loss_percent,annual_dc_nameplate_loss_percent,annual_dc_optimizer_loss_percent,annual_dc_perf_adj_loss_percent,';
if (varinfo('system_use_lifetime_output'))
if (value('system_use_lifetime_output') && value('en_dc_lifetime_losses'))
columns += 'annual_dc_lifetime_loss_percent,';
columns += 'annual_ac_inv_clip_loss_percent,annual_ac_inv_pso_loss_percent,annual_ac_inv_pnt_loss_percent,annual_ac_inv_eff_loss_percent,';
columns += 'annual_ac_wiring_loss_percent,';
if (varinfo('system_use_lifetime_output'))
if (value('system_use_lifetime_output') && value('en_ac_lifetime_losses'))
columns += 'annual_ac_lifetime_loss_percent,';
columns += 'annual_xfmr_loss_percent,annual_ac_perf_adj_loss_percent';
agraph(columns, 'Energy Loss', '', '%', -1, false, true, 'right');
heatmap_graphs();
};

Expand All @@ -419,17 +438,9 @@ autographs{ 'PV Battery' } = define()
is_btm = ( fin == 'Residential' || fin == 'Commercial' || fin == 'Third Party' || fin == 'Host Developer' );

agraph( 'monthly_energy', 'Monthly AC Energy in Year 1', '', 'kWh' , -1, true, false, 'bottom' );

battery_btm_monthly_graph();
heatmap_graphs();

if (value('batt_ac_or_dc') == 0)
{
agraph('annual_poa_shading_loss_percent,annual_poa_soiling_loss_percent,annual_dc_module_loss_percent,annual_dc_mismatch_loss_percent,annual_dc_diodes_loss_percent,annual_dc_wiring_loss_percent,annual_dc_tracking_loss_percent,annual_dc_nameplate_loss_percent,annual_dc_battery_loss_percent, annual_ac_inv_clip_loss_percent,annual_ac_inv_pso_loss_percent,annual_ac_inv_pnt_loss_percent,annual_ac_inv_eff_loss_percent,annual_ac_wiring_loss_percent,annual_ac_transformer_loss_percent,annual_ac_perf_adj_loss_percent', 'Energy Loss', '', '%', -1, false, true, 'right');
}
else
{
agraph('annual_poa_shading_loss_percent,annual_poa_soiling_loss_percent,annual_dc_module_loss_percent,annual_dc_mismatch_loss_percent,annual_dc_diodes_loss_percent,annual_dc_wiring_loss_percent,annual_dc_tracking_loss_percent,annual_dc_nameplate_loss_percent,annual_ac_inv_clip_loss_percent,annual_ac_inv_pso_loss_percent,annual_ac_inv_pnt_loss_percent,annual_ac_inv_eff_loss_percent,annual_ac_battery_loss_percent,annual_ac_wiring_loss_percent,annual_ac_transformer_loss_percent,annual_ac_perf_adj_loss_percent', 'Energy Loss', '', '%', -1, false, true, 'right');
}

if ( is_btm ) { resiliency_graphs(); }
};
Expand Down Expand Up @@ -459,6 +470,8 @@ autographs{ 'MEwave Battery' } = define()
}
};



//**************Financials***************************
autographs{ 'Residential' } = define() { rescom_financial_graphs(); };
autographs{ 'Commercial' } = define() { rescom_financial_graphs(); };
Expand Down
15 changes: 12 additions & 3 deletions src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ static const char *s_monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun"
}
else if (m_g.Type == Graph::STACKED)
{
wxPLBarPlot* bar = new wxPLBarPlot(plotdata[i], 0.0, m_s->GetLabel(ynames[i]), s_colours[cidx]);
if (ynames[i].Contains("Battery ")) ynames[i].Replace("Battery ", ""); //Check for battery prepend in hybrid configs, remove it for graphing?
wxPLBarPlot* bar = new wxPLBarPlot(plotdata[i], 0.0, m_s->GetLabel(ynames[i]), s_colours[cidx]);
if (m_g.Size != 0)
bar->SetThickness(m_g.Size);
bar->SetStackedOn(last_bar);
Expand Down Expand Up @@ -474,9 +475,17 @@ static const char *s_monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun"
wxPLLabelAxis *x1 = new wxPLLabelAxis(m_g.XMin, m_g.XMax, m_g.XLabel);
if (m_g.ShowXValues)
{
for (size_t i = 0; i < ynames.size(); i++)
x1->Add(i, m_s->GetLabel(ynames[i]));
if (ndata == 12) {
for (size_t i = 0; i < 12; i++)
x1->Add(i, s_monthNames[i]);
}
else {
for (size_t i = 0; i < ynames.size(); i++) {
x1->Add(i, m_s->GetLabel(ynames[i]));
}
}
}

SetXAxis1(x1);
}
else if (ndata == 1)
Expand Down
Loading

0 comments on commit e271b1c

Please sign in to comment.