8vector<string> divide_string(
string str,
char c) {
11 vector<char> cstr(str.begin(), str.end());
13 bool element_found =
false;
15 while (l < str.length()) {
17 element = element + cstr[l];
20 list.push_back(element);
23 if (l == str.length() - 1) {
24 list.push_back(element);
34#include "pathfinder.h"
35using namespace MyPaths;
39std::string DIR = getFileDirectory() +
"/";
41std::string project = project_name();
44#include "Parameters.cpp"
49bool bioCHP_plant(vector<string> fuel_def, vector<double> Yj, vector<double> YH2Oj,
50 double W_el, vector<double> Qk, vector<double> Tk_in,
51 vector<double> Tk_out, vector<double> &Mj,
double &Q_prod,
52 double &W_el_prod,
double &C_inv,
double &C_op,
double &C_op_var) {
70 cout <<
"calculating the bioCHP plant model" << endl;
71 cout <<
"Executable path: " << getExecutablePath() << endl;
72 cout <<
"Actual DIR: " << DIR << endl;
73 cout <<
"Project name: " << project << endl;
76 if (fuel_def.size() != Yj.size()) {
77 cout <<
"number of specifications for Yj and fuel_def re different" << endl;
82 for (
size_t nf = 0; nf < fuel_def.size(); nf++) {
83 if (!find_flow(fuel_def[nf])) {
84 for (
size_t nff = 0; nff < fuel_def.size(); nff++) {
97 if (Qk.size() != Tk_in.size()) {
98 cout <<
"number of specifications for Tk_in and Qk are different" << endl;
101 if (Qk.size() != Tk_out.size()) {
102 cout <<
"number of specifications for Tk_out and Qk are different" << endl;
105 if (Tk_in.size() != Tk_out.size()) {
106 cout <<
"number of specifications for Tk_in and Tk_out are different" << endl;
109 for (
size_t nk = 0; nk < Tk_in.size(); nk++) {
110 if (Tk_in[nk] > Tk_out[nk]) {
111 cout <<
"return temperature of heat demand no. " << nk
112 <<
" is higher than supply temperature" << endl;
119 for (
size_t nk = 0; nk < Qk.size(); nk++) {
120 sum_Qk = sum_Qk + Qk[nk];
122 if (sum_Qk > 0.5 * (W_el / 0.2)) {
123 cout <<
"there is not sufficient heat available from Rankine cycle to supply the "
124 "specifiy heat demand"
126 cout <<
"Reducing proportionally the heat demands" << endl;
127 for (
size_t nk = 0; nk < Qk.size(); nk++) {
128 Qk[nk] = Qk[nk] * (0.5 * (W_el / 0.2)) / sum_Qk;
132 for (
size_t nk = 0; nk < Qk.size(); nk++) {
133 sum_Qk = sum_Qk + Qk[nk];
137 cout <<
"calculating the bioCHP plant model" << endl;
139 object bioCHP(
"plant",
"bioCHP_PLANT", DIR +
"Database/bioCHP_inputs");
140 bioCHP.vct_sp(
"fuel_def", fuel_def);
141 bioCHP.vct_fp(
"Yj", Yj);
142 bioCHP.vct_fp(
"YH2Oj", YH2Oj);
143 bioCHP.fval_p(
"W_el", W_el);
144 bioCHP.vct_fp(
"Qk", Qk);
145 bioCHP.vct_fp(
"Tk_in", Tk_in);
146 bioCHP.vct_fp(
"Tk_out", Tk_out);
148 bioCHP_plant_model(bioCHP);
150 Mj = bioCHP.vctp(
"Mj");
151 Q_prod = bioCHP.fp(
"Heat_production_(MW)");
152 W_el_prod = bioCHP.fp(
"Electricity_production_(MW)");
153 C_inv = bioCHP.fp(
"C_inv") * 1e-6;
154 C_inv = bioCHP.fp(
"C_inv") * 1e-6;
155 C_op = bioCHP.fp(
"C_op") * 1e-6;
156 C_op_var = bioCHP.fp(
"C_op_var") * 1e-6;
158 export_output_parameters(bioCHP, getExecutableDir() +
"Output-bioCHP_" + project);