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,
50 vector<double> YH2Oj,
double W_el, vector<double> Qk,
51 vector<double> Tk_in, vector<double> Tk_out,
52 vector<double> &Mj,
double &Q_prod,
double &W_el_prod,
53 double &C_inv,
double &C_op,
double &C_op_var) {
77 if (fuel_def.size() != Yj.size()) {
78 cout <<
"number of specifications for Yj and fuel_def re different" << endl;
83 for (
size_t nf = 0; nf < fuel_def.size(); nf++) {
84 if (!find_flow(fuel_def[nf])) {
85 for (
size_t nff = 0; nff < fuel_def.size(); nff++) {
98 if (Qk.size() != Tk_in.size()) {
99 cout <<
"number of specifications for Tk_in and Qk are different" << endl;
102 if (Qk.size() != Tk_out.size()) {
103 cout <<
"number of specifications for Tk_out and Qk are different" << endl;
106 if (Tk_in.size() != Tk_out.size()) {
107 cout <<
"number of specifications for Tk_in and Tk_out are different"
111 for (
size_t nk = 0; nk < Tk_in.size(); nk++) {
112 if (Tk_in[nk] > Tk_out[nk]) {
113 cout <<
"return temperature of heat demand no. " << nk
114 <<
" is higher than supply temperature" << endl;
121 for (
size_t nk = 0; nk < Qk.size(); nk++) {
122 sum_Qk = sum_Qk + Qk[nk];
124 if (sum_Qk > 0.5 * (W_el / 0.2)) {
125 cout <<
"there is not sufficient heat available from Rankine cycle to "
127 "specifiy heat demand"
129 cout <<
"Reducing proportionally the heat demands" << endl;
130 for (
size_t nk = 0; nk < Qk.size(); nk++) {
131 Qk[nk] = Qk[nk] * (0.5 * (W_el / 0.2)) / sum_Qk;
135 for (
size_t nk = 0; nk < Qk.size(); nk++) {
136 sum_Qk = sum_Qk + Qk[nk];
140 object bioCHP(
"plant",
"bioCHP_PLANT", DIR +
"Database/bioCHP_inputs");
141 bioCHP.vct_sp(
"fuel_def", fuel_def);
142 bioCHP.vct_fp(
"Yj", Yj);
143 bioCHP.vct_fp(
"YH2Oj", YH2Oj);
144 bioCHP.fval_p(
"W_el", W_el);
145 bioCHP.vct_fp(
"Qk", Qk);
146 bioCHP.vct_fp(
"Tk_in", Tk_in);
147 bioCHP.vct_fp(
"Tk_out", Tk_out);
149 bioCHP_plant_model(bioCHP);
151 Mj = bioCHP.vctp(
"Mj");
152 Q_prod = bioCHP.fp(
"Heat_production_(MW)");
153 W_el_prod = bioCHP.fp(
"Electricity_production_(MW)");
154 C_inv = bioCHP.fp(
"C_inv") * 1e-6;
155 C_inv = bioCHP.fp(
"C_inv") * 1e-6;
156 C_op = bioCHP.fp(
"C_op") * 1e-6;
157 C_op_var = bioCHP.fp(
"C_op_var") * 1e-6;
159 export_output_parameters(bioCHP,
160 getExecutableDir() +
"Output-bioCHP_" + project);