From 69adf843462ff1763aac82fa49ec3f8f65b41d6b Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Tue, 18 Jul 2023 04:24:55 -0600 Subject: [PATCH] Hybrids cash flow updates - PV-Batt /SO having issues - check develop --- deploy/runtime/cashflow.lk | 2 +- .../Financial Solution Mode Single Owner.json | 16 +- src/results.cpp | 256 +++++++++--------- 3 files changed, 144 insertions(+), 130 deletions(-) diff --git a/deploy/runtime/cashflow.lk b/deploy/runtime/cashflow.lk index 3c8f3a70b2..e5671600f1 100644 --- a/deploy/runtime/cashflow.lk +++ b/deploy/runtime/cashflow.lk @@ -253,7 +253,7 @@ function cf_om_expenses() { cfline( 'PVWattscf_om_fixed,PVWattscf_om_production,PVWattscf_om_capacity,PVWattscf_om_land_lease',0); cfline( 'Windcf_om_fixed,Windcf_om_production,Windcf_om_capacity',0); - cfline( 'Batterycf_om_fixed,Batterycf_om_production,Batterycf_om_capacity',0); + cfline( 'Batterycf_om_fixed,Batterycf_om_production,Batterycf_om_capacity,Batterycf_battery_replacement_cost_schedule',0); } } diff --git a/deploy/runtime/ui/Financial Solution Mode Single Owner.json b/deploy/runtime/ui/Financial Solution Mode Single Owner.json index ebf903fd81..d051adbc97 100644 --- a/deploy/runtime/ui/Financial Solution Mode Single Owner.json +++ b/deploy/runtime/ui/Financial Solution Mode Single Owner.json @@ -719,6 +719,20 @@ " enable( 'ppa_price_input', !is_specify_irr );", "\tshow_escalation = (#${ppa_price_input} < 2);", "\tenable(\"ppa_escalation\",(show_escalation || is_specify_irr));", - "}" + "}\r", + "\r", + "\r", + "function check_auto_ppa()\r", + "{\r", + "\tdispatch = value('batt_dispatch_choice_ui');\r", + "\tif (dispatch == 0 && value('en_batt') != 0 && financing() != \"Merchant Plant\") \r", + "\t{\r", + "\t\tppa_mode = value('ppa_soln_mode');\r", + "\t\tif (ppa_mode == 0) {\r", + "\t\t\tmsgbox('Specify IRR Target not available for automated dispatch.\\nThe automated battery dispatch options require the Specify PPA Price option on the Revenue or Financial Parameters page.\\n\\nPlease change Specify IRR Target to Specify PPA Price and specify a PPA price and optional escalation rate to use the Automated Dispatch options.');\r", + "\t\t}\r", + "\t}\r", + "}\r", + "" ] } \ No newline at end of file diff --git a/src/results.cpp b/src/results.cpp index c2bc705306..af962d8341 100644 --- a/src/results.cpp +++ b/src/results.cpp @@ -1082,152 +1082,152 @@ void ResultsViewer::Setup(Simulation* sim) // setup graphs m_graphViewer->Setup(m_sim); - - // TODO: remove this after adding for other technologies... - // TODO: update GetCurrentContext() when adding for other technologies to correctly assign help context id - if (CaseWindow* cw = static_cast(this->GetParent()->GetParent())) - { - wxString tech_model = cw->GetCase()->GetConfiguration()->TechnologyFullName; - if (tech_model == "Wind Power") + if (m_sim->Outputs().size() > 0) { + // TODO: remove this after adding for other technologies... + // TODO: update GetCurrentContext() when adding for other technologies to correctly assign help context id + if (CaseWindow* cw = static_cast(this->GetParent()->GetParent())) { - VarValue* wind_uncertainty_enabled = m_sim->GetValue("en_wind_uncertainty"); - int wind_uncert_enabled_value = wind_uncertainty_enabled->Value(); - if (wind_uncert_enabled_value == 1) { - // if model was changed from another technology, the ResultsViewer was not initialized with Uncertainties - if (!m_uncertaintiesViewer) { - m_uncertaintiesViewer = new UncertaintiesViewer(this); - AddPage(m_uncertaintiesViewer, "Uncertainties"); - // testing Uncertainties - remove after added for other technologies and add to uncertainties.lk (like autographs.lk) - std::vector ul; - Uncertainties u1, u2, u3; - u1.Title = "Figure2"; - u2.Title = "Figure5"; - u3.Title = "Figure10"; - ul.push_back(u1); - ul.push_back(u2); - ul.push_back(u3); - SetUncertainties(ul); + wxString tech_model = cw->GetCase()->GetConfiguration()->TechnologyFullName; + if (tech_model == "Wind Power") + { + VarValue* wind_uncertainty_enabled = m_sim->GetValue("en_wind_uncertainty"); + int wind_uncert_enabled_value = wind_uncertainty_enabled->Value(); + if (wind_uncert_enabled_value == 1) { + // if model was changed from another technology, the ResultsViewer was not initialized with Uncertainties + if (!m_uncertaintiesViewer) { + m_uncertaintiesViewer = new UncertaintiesViewer(this); + AddPage(m_uncertaintiesViewer, "Uncertainties"); + // testing Uncertainties - remove after added for other technologies and add to uncertainties.lk (like autographs.lk) + std::vector ul; + Uncertainties u1, u2, u3; + u1.Title = "Figure2"; + u2.Title = "Figure5"; + u3.Title = "Figure10"; + ul.push_back(u1); + ul.push_back(u2); + ul.push_back(u3); + SetUncertainties(ul); + } + m_uncertaintiesViewer->Setup(m_sim); + ShowPage(10); } - m_uncertaintiesViewer->Setup(m_sim); - ShowPage(10); - } - else { - if (!m_uncertaintiesViewer) { - m_uncertaintiesViewer = new UncertaintiesViewer(this); - AddPage(m_uncertaintiesViewer, "Uncertainties"); - // testing Uncertainties - remove after added for other technologies and add to uncertainties.lk (like autographs.lk) - std::vector ul; - Uncertainties u1, u2, u3; - u1.Title = "Figure2"; - u2.Title = "Figure5"; - u3.Title = "Figure10"; - ul.push_back(u1); - ul.push_back(u2); - ul.push_back(u3); - SetUncertainties(ul); + else { + if (!m_uncertaintiesViewer) { + m_uncertaintiesViewer = new UncertaintiesViewer(this); + AddPage(m_uncertaintiesViewer, "Uncertainties"); + // testing Uncertainties - remove after added for other technologies and add to uncertainties.lk (like autographs.lk) + std::vector ul; + Uncertainties u1, u2, u3; + u1.Title = "Figure2"; + u2.Title = "Figure5"; + u3.Title = "Figure10"; + ul.push_back(u1); + ul.push_back(u2); + ul.push_back(u3); + SetUncertainties(ul); + } + m_uncertaintiesViewer->Setup(m_sim); + HidePage(10); } - m_uncertaintiesViewer->Setup(m_sim); - HidePage(10); } - } - wxString tech = cw->GetCase()->GetConfiguration()->TechnologyFullName; - auto as = wxSplit(tech, ' '); - if (as.Count() > 1 && as[as.size() - 1].Lower() == "hybrid") { - HidePage(2); - HidePage(3); - HidePage(6); - HidePage(7); - HidePage(9); - //HidePage(10); - } - else { - ShowPage(2); - ShowPage(3); - ShowPage(6); - ShowPage(7); - ShowPage(9); - } - - if (cw->GetCase()->GetConfiguration()->TechnologyFullName == "MEwave" && cw->GetCase()->GetConfiguration()->Financing != "Single Owner") - { - VarValue* wave_resource_model_choice = m_sim->GetValue("wave_resource_model_choice"); - int wave_resource_model_choice_value = wave_resource_model_choice->Value(); - if (wave_resource_model_choice_value != 1) - { - HidePage(5); + wxString tech = cw->GetCase()->GetConfiguration()->TechnologyFullName; + auto as = wxSplit(tech, ' '); + if (as.Count() > 1 && as[as.size() - 1].Lower() == "hybrid") { + HidePage(2); + HidePage(3); HidePage(6); HidePage(7); - HidePage(8); HidePage(9); + //HidePage(10); } - else - { - ShowPage(5); + else { + ShowPage(2); + ShowPage(3); ShowPage(6); ShowPage(7); - ShowPage(8); ShowPage(9); } - } - if (tech_model == "Flat Plate PV" || tech_model == "PV Battery") - { - m_spatialLayout->DeleteAll(); - wxString x_label; - if (m_sim->GetValue("subarray1_track_mode")->Value() == 1) { // 0=fixed, 1=1-axis, 2=2-axis, 3=azimuth-axis, 4=seasonal - x_label = "[meters from morning side]"; - } - else { - x_label = "[meters from row front]"; - } - - if (m_sim->GetValue("use_spatial_albedos")->Value() == 1) + if (cw->GetCase()->GetConfiguration()->TechnologyFullName == "MEwave" && cw->GetCase()->GetConfiguration()->Financing != "Single Owner") { - Graph g1; - g1.Y = wxSplit("alb_spatial", ','); - g1.Title = "Ground Albedo, Subarray 1 (W/m2)"; - g1.XLabel = x_label; - g1.YLabel = "Time Index"; - g1.LegendPos = wxPLPlotCtrl::BOTTOM; - g1.ShowXValues = true; - g1.ShowLegend = false; - g1.Size = -1; - g1.Type = 4; - g1.XMin = -1; - g1.XMax = -1; - m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g1)); + VarValue* wave_resource_model_choice = m_sim->GetValue("wave_resource_model_choice"); + int wave_resource_model_choice_value = wave_resource_model_choice->Value(); + if (wave_resource_model_choice_value != 1) + { + HidePage(5); + HidePage(6); + HidePage(7); + HidePage(8); + HidePage(9); + } + else + { + ShowPage(5); + ShowPage(6); + ShowPage(7); + ShowPage(8); + ShowPage(9); + } } + if (tech_model == "Flat Plate PV" || tech_model == "PV Battery") + { + m_spatialLayout->DeleteAll(); + + wxString x_label; + if (m_sim->GetValue("subarray1_track_mode")->Value() == 1) { // 0=fixed, 1=1-axis, 2=2-axis, 3=azimuth-axis, 4=seasonal + x_label = "[meters from morning side]"; + } + else { + x_label = "[meters from row front]"; + } - Graph g2; - g2.Y = wxSplit("subarray1_ground_rear_spatial", ','); - g2.Title = "Ground Irradiance Between Rows, Subarray 1 (W/m2)"; - g2.XLabel = x_label; - g2.YLabel = "Time Index"; - g2.LegendPos = wxPLPlotCtrl::BOTTOM; - g2.ShowXValues = true; - g2.ShowLegend = false; - g2.Size = -1; - g2.Type = 4; - g2.XMin = -1; - g2.XMax = -1; - m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g2)); - - Graph g3; - g3.Y = wxSplit("subarray1_poa_rear_spatial", ','); - g3.Title = "Module Rear Irradiance, Subarray 1 (W/m2)"; - g3.XLabel = x_label; - g3.YLabel = "Time Index"; - g3.LegendPos = wxPLPlotCtrl::BOTTOM; - g3.ShowXValues = true; - g3.ShowLegend = false; - g3.Size = -1; - g3.Type = 4; - g3.XMin = -1; - g3.XMax = -1; - m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g3)); + if (m_sim->GetValue("use_spatial_albedos")->Value() == 1) + { + Graph g1; + g1.Y = wxSplit("alb_spatial", ','); + g1.Title = "Ground Albedo, Subarray 1 (W/m2)"; + g1.XLabel = x_label; + g1.YLabel = "Time Index"; + g1.LegendPos = wxPLPlotCtrl::BOTTOM; + g1.ShowXValues = true; + g1.ShowLegend = false; + g1.Size = -1; + g1.Type = 4; + g1.XMin = -1; + g1.XMax = -1; + m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g1)); + } + + Graph g2; + g2.Y = wxSplit("subarray1_ground_rear_spatial", ','); + g2.Title = "Ground Irradiance Between Rows, Subarray 1 (W/m2)"; + g2.XLabel = x_label; + g2.YLabel = "Time Index"; + g2.LegendPos = wxPLPlotCtrl::BOTTOM; + g2.ShowXValues = true; + g2.ShowLegend = false; + g2.Size = -1; + g2.Type = 4; + g2.XMin = -1; + g2.XMax = -1; + m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g2)); + + Graph g3; + g3.Y = wxSplit("subarray1_poa_rear_spatial", ','); + g3.Title = "Module Rear Irradiance, Subarray 1 (W/m2)"; + g3.XLabel = x_label; + g3.YLabel = "Time Index"; + g3.LegendPos = wxPLPlotCtrl::BOTTOM; + g3.ShowXValues = true; + g3.ShowLegend = false; + g3.Size = -1; + g3.Type = 4; + g3.XMin = -1; + g3.XMax = -1; + m_spatialLayout->Add(new AutoGraphCtrl(m_spatialLayout, m_sim, g3)); + } } } - m_tables->Setup(m_sim); // build cashflow