13 double Cpi, W_el, C_maint;
19 double Q_annual, price, C_annual;
22double cecpi(
int year_input) {
24 if (year_input == 1994) {
27 if (year_input == 1995) {
30 if (year_input == 1996) {
33 if (year_input == 1997) {
36 if (year_input == 1998) {
39 if (year_input == 1999) {
42 if (year_input == 2000) {
45 if (year_input == 2001) {
48 if (year_input == 2002) {
51 if (year_input == 2003) {
54 if (year_input == 2004) {
57 if (year_input == 2005) {
60 if (year_input == 2006) {
63 if (year_input == 2007) {
66 if (year_input == 2008) {
69 if (year_input == 2009) {
72 if (year_input == 2010) {
75 if (year_input == 2011) {
78 if (year_input == 2012) {
81 if (year_input == 2013) {
84 if (year_input == 2014) {
87 if (year_input == 2015) {
90 if (year_input == 2016) {
93 if (year_input == 2017) {
96 if (year_input == 2018) {
99 if (year_input == 2019) {
102 if (year_input == 2020) {
108double I_cecpi(
int year_ref,
int year) {
109 double CECPI, CECPI_ref;
112 for (
int i = 0; i < 2; i++) {
114 year_input = year_ref;
120 CECPI = cecpi(year_input);
126 return CECPI / CECPI_ref;
129void equipment_cost(
object &par) {
130 par.fval_p(
"Cpi", par.fp(
"f_inst") * par.fp(
"Cpb") *
131 pow(par.fp(
"S") / par.fp(
"Sb"), par.fp(
"n")) *
132 I_cecpi(stoi(par.sp(
"base_year")), 2020));
135void material_cost(
object &par) {
136 par.fval_p(
"C_annual", par.fp(
"Q_annual") * par.fp(
"price"));
139void equipment_list(vector<equipment> &list,
object &par) {
141 for (
size_t n = 0; n < par.c.size(); n++) {
142 if (par.c[n].sys_type ==
"equipment") {
143 eq.def = par.sys_def +
"-" + par.c[n].sys_def;
144 eq.Cpi = par.c[n].fp(
"Cpi");
145 eq.W_el = par.c[n].fp(
"W_el");
146 eq.C_maint = par.c[n].fp(
"Cpi") * par.c[n].fp(
"f_maint");
148 par.fval_p(
"output-electric_load_" + par.c[n].sys_def, par.c[n].fp(
"W_el"));
150 if (par.c[n].c.size() > 0) {
151 equipment_list(list, par.c[n]);
156void material_list(
string type, vector<material> &list,
object &par) {
158 for (
size_t n = 0; n < par.c.size(); n++) {
159 if (par.c[n].sys_type == type) {
160 m.def = par.sys_def +
"-" + par.c[n].sys_def;
161 m.Q_annual = par.c[n].fp(
"Q_annual");
162 m.price = par.c[n].fp(
"price");
163 m.C_annual = par.c[n].fp(
"C_annual");
166 if (par.c[n].c.size() > 0) {
167 material_list(type, list, par.c[n]);
172void capex(
object &par) {
173 vector<equipment> eq;
174 equipment_list(eq, par);
176 double C_eq = 0.0, W_el = 0.0, C_eq_maint = 0.0;
177 for (
size_t n = 0; n < eq.size(); n++) {
179 C_eq = C_eq + eq[n].Cpi;
180 W_el = W_el + eq[n].W_el;
181 C_eq_maint = C_eq_maint + eq[n].C_maint;
184 par.fval_p(
"W_el(kW)", W_el);
186 par.fval_p(
"output-electric_load", W_el);
187 par.fval_p(
"output-C_eq", C_eq);
188 par.fval_p(
"output-C_piping", C_eq * par.fp(
"f_piping"));
189 par.fval_p(
"output-C_el", C_eq * par.fp(
"f_el"));
190 par.fval_p(
"output-C_I&C", C_eq * par.fp(
"f_I&C"));
191 par.fval_p(
"output-C_pi",
192 par.fp(
"C_eq") + par.fp(
"C_piping") + par.fp(
"C_el") + par.fp(
"C_I&C"));
193 par.fval_p(
"output-C_land", par.fp(
"C_pi") * par.fp(
"f_land"));
194 par.fval_p(
"output-C_site", par.fp(
"C_pi") * par.fp(
"f_site"));
195 par.fval_p(
"output-C_build", par.fp(
"C_pi") * par.fp(
"f_build"));
196 par.fval_p(
"output-C_com", par.fp(
"C_pi") * par.fp(
"f_com"));
197 par.fval_p(
"output-C_eng",
198 (par.fp(
"C_pi") + par.fp(
"C_site") + par.fp(
"C_build") + par.fp(
"C_com")) *
200 par.fval_p(
"output-C_dev", (par.fp(
"C_pi") + par.fp(
"C_land") + par.fp(
"C_site") +
201 par.fp(
"C_build") + par.fp(
"C_com") + par.fp(
"C_eng")) *
203 par.fval_p(
"output-C_cont",
204 (par.fp(
"C_pi") + par.fp(
"C_land") + par.fp(
"C_site") + par.fp(
"C_build") +
205 par.fp(
"C_com") + par.fp(
"C_eng") + par.fp(
"C_dev")) *
207 par.fval_p(
"output-C_inv", par.fp(
"C_pi") + par.fp(
"C_land") + par.fp(
"C_site") +
208 par.fp(
"C_build") + par.fp(
"C_com") + par.fp(
"C_eng") +
209 par.fp(
"C_dev") + par.fp(
"C_cont"));
210 par.fval_p(
"output-C_eq_maint", par.fp(
"C_eq") * 0.02);
211 par.fval_p(
"output-C_piping_maint", par.fp(
"C_piping") * 0.02);
212 par.fval_p(
"output-C_el_maint", par.fp(
"C_el") * 0.02);
213 par.fval_p(
"output-C_I&C_maint", par.fp(
"C_I&C") * 0.02);
215 cout <<
"-------------------------" << endl;
216 cout <<
" Capital costs (M$): " << par.fp(
"C_inv") * 1e-6 << endl;
217 cout <<
"------------------" << endl;
218 cout <<
"C_eq = " << C_eq * 1e-6 << endl;
219 cout <<
"C_piping = " << par.fp(
"C_piping") * 1e-6 << endl;
220 cout <<
"C_el = " << par.fp(
"C_el") * 1e-6 << endl;
221 cout <<
"C_I&C = " << par.fp(
"C_I&C") * 1e-6 << endl;
222 cout <<
"C_land = " << par.fp(
"C_land") * 1e-6 << endl;
223 cout <<
"C_site = " << par.fp(
"C_site") * 1e-6 << endl;
224 cout <<
"C_build = " << par.fp(
"C_build") * 1e-6 << endl;
225 cout <<
"C_com = " << par.fp(
"C_com") * 1e-6 << endl;
226 cout <<
"C_eng = " << par.fp(
"C_eng") * 1e-6 << endl;
227 cout <<
"C_dev = " << par.fp(
"C_dev") * 1e-6 << endl;
228 cout <<
"C_cont = " << par.fp(
"C_cont") * 1e-6 << endl;
229 cout <<
"------------------" << endl;
232void opex(
object &par) {
234 material_list(
"consumable", m, par);
235 material_list(
"solid_residue", m, par);
237 cout <<
"------------------" << endl;
238 cout <<
"Material list" << endl;
239 cout <<
"------------------" << endl;
240 double C_op_mat = 0.0;
241 for (
size_t n = 0; n < m.size(); n++) {
242 cout << m[n].type << m[n].def <<
" Q_annual: " << m[n].Q_annual
243 <<
" price: " << m[n].price <<
" " << m[n].C_annual << endl;
244 C_op_mat = C_op_mat + m[n].C_annual;
247 par.fval_p(
"output-C_op_mat", C_op_mat);
249 par.fval_p(
"output-C_op_el", par.fp(
"W_el(kW)") * par.fp(
"price_electricity") * 8000);
251 par.fval_p(
"output-C_op_maint", par.fp(
"C_eq_maint") + par.fp(
"C_piping_maint") +
252 par.fp(
"C_el_maint") + par.fp(
"C_I&C_maint"));
254 par.fval_p(
"output-C_op_ins", par.fp(
"C_pi") * par.fp(
"f_ins"));
256 par.fval_p(
"output-C_op_adm", par.fp(
"C_pi") * par.fp(
"f_adm"));
258 par.fval_p(
"output-C_op", par.fp(
"C_op_mat") + par.fp(
"C_op_el") + par.fp(
"C_op_maint") +
259 par.fp(
"C_op_ins") + par.fp(
"C_op_adm"));
261 par.fval_p(
"output-C_op_var", par.fp(
"C_op_mat") + par.fp(
"C_op_el"));
263 cout <<
"-------------------------" << endl;
264 cout <<
" Operational costs (M$): " << endl;
265 cout <<
"-------------------------" << endl;
266 cout <<
"Materials = " << par.fp(
"C_op_mat") * 1e-6 << endl;
267 cout <<
"Electricity = " << par.fp(
"C_op_el") * 1e-6 << endl;
268 cout <<
"Equipment maintenance = " << par.fp(
"C_eq_maint") * 1e-6 << endl;
269 cout <<
"Piping maintenance = " << par.fp(
"C_piping_maint") * 1e-6 << endl;
270 cout <<
"Electric system maintenance = " << par.fp(
"C_el_maint") * 1e-6 << endl;
271 cout <<
"I&C_maintenance = " << par.fp(
"C_I&C_maint") * 1e-6 << endl;
272 cout <<
"Total maintenance = " << par.fp(
"C_op_maint") * 1e-6 << endl;
273 cout <<
"Insurance and taxes = " << par.fp(
"C_op_ins") * 1e-6 << endl;
274 cout <<
"Administration = " << par.fp(
"C_op_adm") * 1e-6 << endl;
275 cout <<
"------------------" << endl;
278void cost(
object &par) {