1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include "iostream"
#include "vector"
#include "stdio.h"
#include "string"
#include "limits"
#include "cstdlib"
class Bad_input {};//for error handling
inline double InterpolareCalduraSpecificaGaze(double tempgc, std::vector<double> compgc){
std::vector<double> temp = { 600, 700, 800, 900, 1000 };
std::vector<double> CO2 = { 2.041, 2.088, 2.131, 2.169, 2.204 };
std::vector<double> O2 = { 1.417, 1.434, 1.45, 1.465, 1.478 };
std::vector<double> H2O = { 1.61, 1.64, 1.67, 1.695, 1.72 };
std::vector<double> CO = { 1.357, 1.372, 1.386, 1.4, 1.413 };
std::vector<double> N2 = { 1.345, 1.359, 1.372, 1.385, 1.397 };
int i{ -1 };
double retvalue{ -1 };
if (tempgc>600 && tempgc < 700) i = 0;
if (tempgc>700 && tempgc < 800) i = 1;
if (tempgc>800 && tempgc < 900) i = 2;
if (tempgc>900 && tempgc < 1000) i = 3;
double cgmCO2 = ((tempgc - temp[i]) / (temp[i + 1] - temp[i]))*(CO2[i + 1] - CO2[i]) + CO2[i];
double cgmO2 = ((tempgc - temp[i]) / (temp[i + 1] - temp[i]))*(O2[i + 1] - O2[i]) + O2[i];
double cgmH2O = ((tempgc - temp[i]) / (temp[i + 1] - temp[i]))*(H2O[i + 1] - H2O[i]) + H2O[i];
double cgmCO = ((tempgc - temp[i]) / (temp[i + 1] - temp[i]))*(CO[i + 1] - CO[i]) + CO[i];
double cgmN2 = ((tempgc - temp[i]) / (temp[i + 1] - temp[i]))*(N2[i + 1] - N2[i]) + N2[i];
//std::vector<double> compozitiaG = { rCO2, rO2, rH2O, rCO, rN2 } =compg
std::vector<double> cgm = { cgmCO2, cgmO2, cgmH2O, cgmCO, cgmN2 };
//r este in procente => impartim retvalue cu 100
retvalue = ((cgm[0] * compgc[0]) + (cgm[1] * compgc[1]) + (cgm[2] * compgc[2]) + (cgm[3] * compgc[3]) + (cgm[4] * compgc[4])) / 100;
return retvalue;
}
class ProprietatiGaze{
public:
double cGm;
double iG;
double densitateGN;
double densitateG;
double lambdaG;
double etaG;
double niuG;
double aG;
double PrG;
};
ProprietatiGaze PropG(double tempg, std::vector<double> compg){
//std::vector<double> compozitiaG = { rCO2, rO2, rH2O, rCO, rN2 } =compg
ProprietatiGaze retg;
//entalpia
retg.cGm = InterpolareCalduraSpecificaGaze(tempg, compg);
retg.iG = retg.cGm*tempg;
//densitate la starea normala
std::vector<double> roN = { 1.9748, 1.4289, 0.8036, 1.25, 1.2505 };
retg.densitateGN = ((roN[0] * compg[0]) + (roN[1] * compg[1]) + (roN[2] * compg[2]) + (roN[3] * compg[3]) + (roN[4] * compg[4]))/100;
//densitatea la o temperatura oarecare:
retg.densitateG = retg.densitateGN*(273.15 / (tempg + 273.15));
//vascozitate cinematica
retg.etaG = InterpolareEtaGaze(tempg, compg);
retg.niuG = retg.etaG / retg.densitateG;
//difuzivtatea termica a aerului
retg.lambdaG = InterpolareLambdaGaze(tempg, compg);
retg.aG = (retg.lambdaG / (retg.densitateG*retg.cGm))*retg.densitateGN;
//Prandtl pentru aer
retg.PrG = retg.niuG / retg.aG;
//return
return retg;
}
|