Skip to content

Commit

Permalink
Hybrids cash flow updates - PV-Batt /SO having issues - check develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanzou committed Jul 18, 2023
1 parent 69fa40d commit 69adf84
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 130 deletions.
2 changes: 1 addition & 1 deletion deploy/runtime/cashflow.lk
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
16 changes: 15 additions & 1 deletion deploy/runtime/ui/Financial Solution Mode Single Owner.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
""
]
}
256 changes: 128 additions & 128 deletions src/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CaseWindow*>(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<CaseWindow*>(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<Uncertainties> 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<Uncertainties> 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<Uncertainties> 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<Uncertainties> 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
Expand Down

0 comments on commit 69adf84

Please sign in to comment.