Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Molten Salt Linear Fresnel Model and IPH #1046

Merged
merged 55 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0ec50f1
Add empty fresnel solver model to begin transitioning fresnel to curr…
Jan 13, 2023
871d580
Continue physical fresnel model transition to CSP solver
taylorbrown75 Feb 2, 2023
6d0aa0b
Fix Solar Zenith angle (convert to radians). Continue transitioning f…
taylorbrown75 Feb 8, 2023
4fe0b31
Merge remote-tracking branch 'origin/develop' into fresnel-slvr
taylorbrown75 Feb 10, 2023
8b110bc
Continue transitioning linear fresnel to csp solver. Now is functiona…
taylorbrown75 Feb 13, 2023
0408d0f
Update new fresnel model to use same cmod inputs as original fresnel.…
taylorbrown75 Feb 16, 2023
35ef604
Begin synchronizing updated Molten Salt Linear Fresnel model with new UI
taylorbrown75 Feb 28, 2023
e1b04fb
Reorganize Evacuated Receiver Code into dedicated class
taylorbrown75 Mar 1, 2023
7a8df79
Remove defocus control options
taylorbrown75 Mar 1, 2023
6fd6ab1
Add check for pump coef value for system with different field and sto…
taylorbrown75 Mar 3, 2023
029ac69
Make new fresnel functional with the UI, including calculated variabl…
taylorbrown75 Mar 7, 2023
de3e6a9
Move design point calculations to solar field receiver class
taylorbrown75 Mar 8, 2023
7246f37
Add capital costs to cmod calculations.
taylorbrown75 Mar 22, 2023
ffa22b5
Fix actual total aperture and solar multiple calculations. Add design…
taylorbrown75 Mar 24, 2023
0c93c4d
Move MSLF installation cost calculations to csp_system_costs
taylorbrown75 Mar 24, 2023
6db9dfd
Clean code and reorganize cmod vartable
taylorbrown75 Mar 30, 2023
ee080a3
Add ctime to fix clock_t bug
taylorbrown75 Mar 31, 2023
c017780
Merge branch 'develop' into fresnel-slvr
tyneises Apr 10, 2023
3f0d540
merge develop
tyneises Apr 10, 2023
db43911
Merge branch 'develop' into fresnel-slvr
tyneises Apr 12, 2023
caf7316
Merge branch 'develop' into fresnel-slvr
tyneises Apr 18, 2023
30f52dd
sort dispatch and sim_type 2 in fresnel cmod
tyneises Apr 18, 2023
9748bf2
Add runner length to cmod, rather than hard code value
taylorbrown75 Apr 20, 2023
c67d4c7
Fix ppa_price_input variable type bug. Define fresnel functions neces…
taylorbrown75 Apr 24, 2023
4dba44f
update fresnel dispatch methods
tyneises Apr 25, 2023
9ff382b
Remove unnecessary hardcoded storage parameters
taylorbrown75 Apr 27, 2023
63d9aad
Remove temporary debugging code
taylorbrown75 May 1, 2023
219f988
Fix steady state optical efficiency bug. Add steady state design poin…
taylorbrown75 May 31, 2023
add710b
Merge latest develop
taylorbrown75 Jun 1, 2023
6f07649
Change dispatch factors to single array, to work with latest develop …
taylorbrown75 Jun 1, 2023
dc7e84f
Add steady state loop calculations, pumping power, and receiver and h…
taylorbrown75 Jun 6, 2023
c0c0177
Fix dispatch_tod_factors bug
taylorbrown75 Jun 8, 2023
6d0dbdf
Add sim info to thermal eff approx call. Use steady state to calculat…
taylorbrown75 Jun 8, 2023
722bf80
Clean pressure calculations and add variables to store pressure data.
taylorbrown75 Jun 14, 2023
4c755fb
Merge in latest develop branch
taylorbrown75 Jun 14, 2023
efa4f89
Add nan initialization for variables in Evacuated Receiver Model
taylorbrown75 Jul 5, 2023
2d599d5
Remove old method of calculating thermal efficiency approximate.
taylorbrown75 Jul 6, 2023
c0a02f2
add mspt iph cmod
tyneises Jul 21, 2023
e334c37
develop mspt iph cmod
tyneises Jul 22, 2023
acb90cb
update mspt iph cmod
tyneises Jul 24, 2023
ad886cd
update mspt iph
tyneises Jul 24, 2023
d5f9df2
add lcoh option to mspt iph cmod
tyneises Jul 25, 2023
0a39dd2
add lcoe fcr cmod that does not required input fixed charge rate
tyneises Jul 26, 2023
ffd9357
calculate electricity cost
tyneises Aug 1, 2023
677f656
Add fresnel iph cmod. Fix label bugs in mslf
taylorbrown75 Aug 7, 2023
0e19e5c
Add mslf iph cmod.
taylorbrown75 Aug 9, 2023
24996fa
Move powerblock runner length to solar field
taylorbrown75 Aug 10, 2023
81eec24
Remove fossil backup from MSLF IPH capital costs.
taylorbrown75 Aug 10, 2023
1cda190
On converged, resort to STARTUP rather than OFF, if dni is high but f…
taylorbrown75 Aug 27, 2023
25e4e4e
Merge remote-tracking branch 'origin/develop' into fresnel-slvr
taylorbrown75 Sep 1, 2023
d81fc8e
Merge remote-tracking branch 'origin/develop' into fresnel-slvr
taylorbrown75 Sep 5, 2023
c6ff796
Update MSPT IPH to correspond with updated receiver model. Add annual…
taylorbrown75 Sep 5, 2023
6e804e0
Add receiver reflectivity losses to receiver thermal incident power.
taylorbrown75 Sep 8, 2023
71d7e92
Clean code and remove unnecessary comments
taylorbrown75 Sep 11, 2023
f555e84
Merge branch 'develop' into fresnel-slvr
cpaulgilman Sep 18, 2023
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
3 changes: 3 additions & 0 deletions ssc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ set(SSC_SRC
cmod_financial_eqns.cpp
cmod_financial_eqns.h
cmod_fossilgen.cpp
cmod_fresnel_physical.cpp
cmod_fresnel_physical_iph.cpp
cmod_fuelcell.cpp
cmod_fuelcell.h
cmod_generic_system-builder.cpp
Expand Down Expand Up @@ -70,6 +72,7 @@ set(SSC_SRC
cmod_mhk_tidal.cpp
cmod_mhk_wave.cpp
cmod_mspt_sf_and_rec_isolated.cpp
cmod_mspt_iph.cpp
cmod_poacalib.cpp
cmod_ptes_design_point.cpp
cmod_pv6parmod.cpp
Expand Down
1,872 changes: 1,872 additions & 0 deletions ssc/cmod_fresnel_physical.cpp

Large diffs are not rendered by default.

1,480 changes: 1,480 additions & 0 deletions ssc/cmod_fresnel_physical_iph.cpp

Large diffs are not rendered by default.

182 changes: 182 additions & 0 deletions ssc/cmod_lcoefcr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "core.h"
#include "lib_financial.h"

#include <numeric>

static var_info vtab_lcoefcr[] =
{
/* VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS*/
Expand Down Expand Up @@ -77,3 +79,183 @@ class cm_lcoefcr : public compute_module
};

DEFINE_MODULE_ENTRY( lcoefcr, "Calculate levelized cost of energy using fixed charge rate method.", 1 )


static var_info vtab_lcoefcr_design[] =
{
/* VARTYPE DATATYPE NAME LABEL UNITS META GROUP REQUIRED_IF CONSTRAINTS UI_HINTS*/
{ SSC_INPUT, SSC_NUMBER, "sim_type", "1 (default): timeseries, 2: design only", "", "", "System Control", "?=1", "", "SIMULATION_PARAMETER"},

{ SSC_INPUT, SSC_NUMBER, "ui_fcr_input_option", "0: fixed charge rate; 1: calculate", "", "", "Simple LCOE", "*", "", ""},

// FCR Input Option = 0: Fixed fixed charge rate
{ SSC_INPUT, SSC_NUMBER, "ui_fixed_charge_rate", "Input fixed charge rate", "", "", "Simple LCOE", "ui_fcr_input_option=0", "", ""},

// FCR Input Option = 1: Calculated fixed charge rate
{ SSC_INPUT, SSC_NUMBER, "c_inflation", "Input fixed charge rate", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_equity_return", "IRR (nominal)", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_debt_percent", "Project term debt (% of capital)", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_nominal_interest_rate", "Nominal debt interest rate", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_tax_rate", "Effective tax rate", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_lifetime", "Analysis period", "years", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_ARRAY, "c_depreciation_schedule", "Depreciation schedule", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_NUMBER, "c_construction_interest", "Nominal construction interest rate", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},
{ SSC_INPUT, SSC_ARRAY, "c_construction_cost", "Construction cost schedule", "%", "", "Simple LCOE", "ui_fcr_input_option=1", "", ""},

// General Inputs

// "Performance" Inputs
{ SSC_INPUT, SSC_NUMBER, "total_installed_cost", "Total installed cost", "$", "", "System Costs", "sim_type=1", "", "SIMULATION_PARAMETER" },

{ SSC_INPUT, SSC_NUMBER, "annual_electricity_consumption","Annual electricity consumption with avail derate", "kWe-hr", "", "IPH LCOH", "sim_type=1", "", "SIMULATION_PARAMETER" },
{ SSC_INPUT, SSC_NUMBER, "electricity_rate", "Cost of electricity used to operate pumps and trackers", "$/kWe-hr","", "IPH LCOH", "sim_type=1", "", "SIMULATION_PARAMETER" },
{ SSC_INPUT, SSC_NUMBER, "fixed_operating_cost", "Annual fixed operating cost", "$", "", "Simple LCOE", "sim_type=1", "", "SIMULATION_PARAMETER" },

{ SSC_INPUT, SSC_NUMBER, "variable_operating_cost", "Annual variable operating cost", "$/kWh", "", "Simple LCOE", "sim_type=1", "", "SIMULATION_PARAMETER" },
{ SSC_INPUT, SSC_NUMBER, "annual_energy", "Annual energy production", "kWh", "", "Simple LCOE", "sim_type=1", "", "SIMULATION_PARAMETER" },

// "Design" outputs
{ SSC_OUTPUT, SSC_NUMBER, "crf", "Capital recovery factor", "", "", "Simple LCOE", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "pfin", "Project financing factor", "", "", "Simple LCOE", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "cfin", "Construction financing factor", "", "", "Simple LCOE", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "wacc", "WACC", "", "", "Simple LCOE", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "fixed_charge_rate_calc", "Calculated fixed charge rate", "", "", "Simple LCOE", "*", "", "" },

{ SSC_OUTPUT, SSC_NUMBER, "lcoe_fcr", "LCOE Levelized cost of energy", "$/kWh", "", "Simple LCOE", "sim_type=1", "", "" },

// "Performance" outputs

var_info_invalid };

class cm_lcoefcr_design : public compute_module
{
private:
public:
cm_lcoefcr_design()
{
add_var_info(vtab_lcoefcr_design);
}

void exec()
{
int fcr_input_option = as_integer("ui_fcr_input_option");

double fixed_charge_rate = std::numeric_limits<double>::quiet_NaN();
double crf = std::numeric_limits<double>::quiet_NaN();
double pfin = std::numeric_limits<double>::quiet_NaN();
double cfin = std::numeric_limits<double>::quiet_NaN();
double wacc = std::numeric_limits<double>::quiet_NaN();
if (fcr_input_option == 0) {
fixed_charge_rate = as_double("ui_fixed_charge_rate");
}
else {
double i = as_double("c_inflation") / 100.0;
double nroe = as_double("c_equity_return") / 100.0;
double rroe = (1. + nroe) / (1. + i) - 1.0; // real return on equity
double df = as_double("c_debt_percent") / 100.0;
double inom = as_double("c_nominal_interest_rate") / 100.0;
double ireal = (1. + inom) / (1. + i) - 1.0; // real interest rate
double tr = as_double("c_tax_rate") / 100.0;
wacc = ((1. + ((1. - df) * ((1. + rroe) * (1. + i) - 1.)) +
(df * ((1. + ireal) * (1. + i) - 1.) * (1. - tr))) / (1. + i)) - 1.;

double t = as_double("c_lifetime");
crf = wacc / (1.0 - (1.0 / std::pow((1.0 + wacc), t))); // real crf

std::vector<double> dep = as_vector_double("c_depreciation_schedule");
int n_dep = dep.size();
std::vector<double> arr_dep(n_dep);
for (int iii = 0; iii < n_dep; iii++) {
arr_dep[iii] = dep[iii] / 100.0 * (1.0 / std::pow((1.+wacc)*(1.+i), iii+1.0));
}

double pvd = std::accumulate(arr_dep.begin(), arr_dep.end(), 0.0);
pfin = (1.0 - tr*pvd) / (1.0 - tr);

double cint = as_double("c_construction_interest") / 100.0;
std::vector<double> ccon = as_vector_double("c_construction_cost");
int n_con = ccon.size();
std::vector<double> arr_con(n_con);
for (int iii = 0; iii < n_con; iii++) {
arr_con[iii] = ccon[iii] / 100.0 * (1.0 + (1.0 - tr)*(std::pow(1. + cint, iii + 0.5)-1.0));
}

cfin = std::accumulate(arr_con.begin(), arr_con.end(), 0.0);
fixed_charge_rate = crf * pfin * cfin;

}

assign("fixed_charge_rate_calc", fixed_charge_rate);
assign("crf", crf);
assign("pfin", pfin);
assign("cfin", cfin);
assign("wacc", wacc);

// *****************************************************
// If calling cmod to run design only, return here
if (as_integer("sim_type") != 1) {
return;
}
// *****************************************************
// *****************************************************

double aep = as_double("annual_energy"); // kWh annual output, get from performance model
double foc_in = as_double("fixed_operating_cost"); // $
double voc = as_double("variable_operating_cost"); // $/kWh
double icc = as_double("total_installed_cost"); // $

double electricity_rate = as_number("electricity_rate"); //[$/kWe-hr]
double annual_electricity_consumption = as_number("annual_electricity_consumption"); //[kWe-hr]
double annual_electricity_cost = electricity_rate*annual_electricity_consumption; //[$]

double foc = foc_in + annual_electricity_cost; //[$]

double lcoe = (fixed_charge_rate * icc + foc) / aep + voc; //$/kWh

assign("lcoe_fcr", var_data((ssc_number_t)lcoe));

// For reference: code from UI page 7/25/23
/*
if (${ ui_fcr_input_option } == 0)
${ fixed_charge_rate } = ${ ui_fixed_charge_rate };
else {
i = ${ c_inflation } / 100;
nroe = ${ c_equity_return } / 100;
rroe = (1 + nroe) / (1 + i) - 1; // real return on equity
df = ${ c_debt_percent } / 100;
inom = ${ c_nominal_interest_rate } / 100;
ireal = (1 + inom) / (1 + i) - 1; // real interest rate
tr = ${ c_tax_rate } / 100;
wacc = ((1 + ((1 - df) * ((1 + rroe) * (1 + i) - 1)) +
(df * ((1 + ireal) * (1 + i) - 1) * (1 - tr))) / (1 + i)) - 1; // real wacc
${ ui_wacc } = wacc;
t = ${ c_lifetime };
crf = wacc / (1 - (1 / (1 + wacc) ^ t)); // real crf
dep = ${ c_depreciation_schedule };
arr = alloc(#dep);
for (n = 0; n < #arr; n++)
arr[n] = dep[n] / 100 * (1 / ((1 + wacc) * (1 + i)) ^ (n + 1));
pvd = sum(arr);
pfin = (1 - tr * pvd) / (1 - tr);
ccon = ${ c_construction_cost };
cint = ${ c_construction_interest } / 100;
arr = alloc(#ccon);
for (n = 0; n < #arr; n++)
arr[n] = ccon[n] / 100 * (1 + (1 - tr) * ((1 + cint) ^ (n + 0.5) - 1));
cfin = sum(arr);
fcr = crf * pfin * cfin;
${ ui_crf } = crf;
${ ui_pfin } = pfin;
${ ui_cfin } = cfin;
${ ui_wacc } = wacc;
${ ui_ireal } = ireal;
${ fixed_charge_rate } = fcr;
}

*/

}

};

DEFINE_MODULE_ENTRY(lcoefcr_design, "Calculate levelized cost of energy using fixed charge rate method.", 1)
Loading
Loading