Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ssc/cmod_communitysolar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4328,6 +4328,19 @@ class cm_communitysolar : public compute_module
double pvPropertyTax = npv(CF_property_tax_expense, nyears, nom_discount_rate);

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));

// check financial metric outputs per SAM issue 551
ssc_number_t irr_metric_end = irr(CF_project_return_aftertax, nyears) * 100.0;
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_metric = npv(CF_project_return_aftertax, nyears, nom_discount_rate) + cf.at(CF_project_return_aftertax, 0);

check_financial_metrics cfm;
cfm.check_irr(this, irr_metric_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_metric);
cfm.check_debt_percentage(this, debt_fraction);


}


Expand Down
17 changes: 16 additions & 1 deletion ssc/cmod_equpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3399,7 +3399,22 @@ class cm_equpartflip : public compute_module
double pvPropertyTax = npv(CF_property_tax_expense, nyears, nom_discount_rate);

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));
}


// check financial metric outputs per SAM issue 551 and 1194
ssc_number_t irr_ti_end = cf.at(CF_tax_investor_aftertax_irr, nyears);
ssc_number_t irr_sp_end = cf.at(CF_sponsor_aftertax_irr, nyears);
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_ti = cf.at(CF_tax_investor_aftertax_npv, nyears);
ssc_number_t npv_sp = cf.at(CF_sponsor_aftertax_npv, nyears);

check_financial_metrics cfm;
cfm.check_irr(this, irr_ti_end);
cfm.check_irr(this, irr_sp_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_ti);
cfm.check_npv(this, npv_sp);
}


// std lib
Expand Down
14 changes: 14 additions & 0 deletions ssc/cmod_host_developer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3718,6 +3718,20 @@ class cm_host_developer : public compute_module
double pvPropertyTax = npv(CF_property_tax_expense, nyears, nom_discount_rate);

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));

// check financial metric outputs per SAM issue 551
ssc_number_t irr_metric_end = irr(CF_project_return_aftertax, nyears) * 100.0;
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_metric = npv(CF_project_return_aftertax, nyears, nom_discount_rate) + cf.at(CF_project_return_aftertax, 0);

check_financial_metrics cfm;
cfm.check_irr(this, irr_metric_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_metric);
cfm.check_debt_percentage(this, debt_fraction);



}


Expand Down
16 changes: 16 additions & 0 deletions ssc/cmod_levpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3760,6 +3760,22 @@ class cm_levpartflip : public compute_module

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));


// check financial metric outputs per SAM issue 551 and 1194
ssc_number_t irr_ti_end = cf.at(CF_tax_investor_aftertax_irr, nyears);
ssc_number_t irr_sp_end = cf.at(CF_sponsor_aftertax_irr, nyears);
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_ti = cf.at(CF_tax_investor_aftertax_npv, nyears);
ssc_number_t npv_sp = cf.at(CF_sponsor_aftertax_npv, nyears);

check_financial_metrics cfm;
cfm.check_irr(this, irr_ti_end);
cfm.check_irr(this, irr_sp_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_ti);
cfm.check_npv(this, npv_sp);
cfm.check_debt_percentage(this, debt_fraction);

}


Expand Down
14 changes: 14 additions & 0 deletions ssc/cmod_merchantplant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3622,6 +3622,20 @@ class cm_merchantplant : public compute_module
double pvPropertyTax = npv(CF_property_tax_expense, nyears, nom_discount_rate);

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));

// check financial metric outputs per SAM issue 551
ssc_number_t irr_metric_end = irr(CF_project_return_aftertax, nyears) * 100.0;
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_metric = npv(CF_project_return_aftertax, nyears, nom_discount_rate) + cf.at(CF_project_return_aftertax, 0);

check_financial_metrics cfm;
cfm.check_irr(this, irr_metric_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_metric);
cfm.check_debt_percentage(this, debt_fraction);



}


Expand Down
14 changes: 14 additions & 0 deletions ssc/cmod_saleleaseback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3547,6 +3547,20 @@ class cm_saleleaseback : public compute_module
double pvPropertyTax = npv(CF_property_tax_expense, nyears, nom_discount_rate);

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));

// check financial metric outputs per SAM issue 551 and 1194
ssc_number_t irr_ti_end = cf.at(CF_tax_investor_aftertax_irr, nyears);
ssc_number_t irr_sp_end = cf.at(CF_sponsor_aftertax_irr, nyears);
ssc_number_t irr_metric_flip_year = actual_flip_irr;
ssc_number_t npv_ti = cf.at(CF_tax_investor_aftertax_npv, nyears);
ssc_number_t npv_sp = cf.at(CF_sponsor_aftertax_npv, nyears);

check_financial_metrics cfm;
cfm.check_irr(this, irr_ti_end);
cfm.check_irr(this, irr_sp_end);
cfm.check_irr_flip(this, irr_metric_flip_year);
cfm.check_npv(this, npv_ti);
cfm.check_npv(this, npv_sp);
}


Expand Down
12 changes: 1 addition & 11 deletions ssc/cmod_singleowner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3789,21 +3789,11 @@ class cm_singleowner : public compute_module

assign( "present_value_insandproptax", var_data((ssc_number_t)(pvInsurance + pvPropertyTax)));

// TODO - refactor into general function in common_financial
// github issue SAM 551, check NPV > 0, Debt Percentage <=100% and IRR != NaN
// log(util::format("POA decomposition model calculated negative global horizontal irradiance at time [y:%d m:%d d:%d h:%d minute:%lg], set to zero.", wf.year, wf.month, wf.day, wf.hour, wf.minute), SSC_NOTICE, (float)idx);

// check financial metric outputs per SAM issue 551
ssc_number_t irr_metric_end = irr(CF_project_return_aftertax, nyears) * 100.0;
// if (isnan(irr_metric_end))
// log("End of analysis IRR is not a number, please review all financial results", SSC_WARNING);
ssc_number_t irr_metric_flip_year = cf.at(CF_project_return_aftertax_irr, flip_target_year);
// if (isnan(irr_metric_flip_year))
// log("IRR is not a number, please review all financial results", SSC_WARNING);
ssc_number_t npv_metric = npv(CF_project_return_aftertax, nyears, nom_discount_rate) + cf.at(CF_project_return_aftertax, 0);
// if (npv_metric < 0.0)
// log(util::format("NPV, %lg, is less than zero, please review all financial results", npv_metric), SSC_WARNING);
// if (debt_fraction > 100.0)
// log(util::format("Debt percent, %lg, is greater than 100%%, please review all financial results", debt_fraction), SSC_WARNING);

check_financial_metrics cfm;
cfm.check_irr(this, irr_metric_end);
Expand Down