OpenWAM
TAcousticTurbine.cpp
1 // ---------------------------------------------------------------------------
2 
3 #pragma hdrstop
4 
5 #include "TAcousticTurbine.h"
6 
7 // ---------------------------------------------------------------------------
8 
9 TAcousticTurbine::TAcousticTurbine(iVector InletPipeID, iVector VoluteID, int OutletPipeID) {
10 
11  FInletPipeID.resize(InletPipeID.size());
12  FVoluteID.resize(InletPipeID.size());
13  FInletPipe.resize(InletPipeID.size());
14  FVolute.resize(InletPipeID.size());
15 
16  for(int i = 0; i < InletPipeID.size(); i++) {
17  FInletPipeID[i] = InletPipeID[i];
18  FVoluteID[i] = VoluteID[i];
19  }
20  FOutletPipeID = OutletPipeID;
21 }
22 
23 TAcousticTurbine::TAcousticTurbine() {
24 }
25 
26 TAcousticTurbine::~TAcousticTurbine() {
27 }
28 
29 double TAcousticTurbine::T3(int i) {
30 
31  double a = FInletPipe[i]->GetAsonido(0) * __cons::ARef;
32  double g = FInletPipe[i]->GetGamma(0);
33  double R = FInletPipe[i]->GetRMezcla(0);
34 
35  return a * a / g / R;
36 }
37 
38 double TAcousticTurbine::T3() {
39 
40  double T3Sum = 0;
41  double MasSum = 0;
42  double ret_val = 0;
43  for(int i = 0; i < FInletPipe.size(); i++) {
44  MasSum += MassIn(i);
45  }
46  if(MasSum == 0) {
47  for(int i = 0; i < FInletPipe.size(); i++) {
48  T3Sum += T3(i);
49  }
50  T3Sum /= FInletPipe.size();
51  } else {
52  for(int i = 0; i < FInletPipe.size(); i++) {
53  T3Sum += T3(i) * MassIn(i);
54  }
55  T3Sum /= MasSum;
56  }
57  return ret_val;
58 }
59 
60 double TAcousticTurbine::P3(int i) {
61 
62  return FInletPipe[i]->GetPresion(0);
63 }
64 
65 double TAcousticTurbine::P3() {
66 
67  double P3Sum = 0.;
68  for(int i = 0; i < FInletPipe.size(); i++) {
69  P3Sum += P3(i);
70  }
71  P3Sum /= FInletPipe.size();
72 
73  return P3Sum;
74 }
75 
76 double TAcousticTurbine::P30(int i) {
77 
78  double p = FInletPipe[i]->GetPresion(0);
79  double a = FInletPipe[i]->GetAsonido(0) * __cons::ARef;
80  double v = FInletPipe[i]->GetVelocidad(0) * __cons::ARef;
81  double g = FInletPipe[i]->GetGamma(0);
82 
83  double p3 = p * pow(1 + (g - 1) / 2 * pow2(v / a), g / (g - 1));
84 
85  return p3;
86 }
87 
88 double TAcousticTurbine::T30(int i) {
89  double p = FInletPipe[i]->GetPresion(0);
90  double a = FInletPipe[i]->GetAsonido(0) * __cons::ARef;
91  double v = FInletPipe[i]->GetVelocidad(0) * __cons::ARef;
92  double g = FInletPipe[i]->GetGamma(0);
93  double R = FInletPipe[i]->GetRMezcla(0);
94 
95  double T0 = (pow2(a) + (g - 1) / 2 * pow2(v)) / g / R;
96 
97  return T0;
98 }
99 
100 double TAcousticTurbine::DiabEfficiency(int i) {
101  double g = FInletPipe[i]->GetGamma(0);
102  double eff = (T30(i) - T4()) / (T30(i) * (1 - pow(1 / ExpRatio(i), (g - 1) / g)));
103 
104  return eff;
105 }
106 
107 double TAcousticTurbine::ExpRatio(int i) {
108 
109  return P30(i) / P4();
110 
111 }
112 
113 double TAcousticTurbine::ExpRatio() {
114 
115  double ERSum = 0.;
116  for(int i = 0; i < FInletPipe.size(); i++) {
117  ERSum += ExpRatio(i);
118  }
119  ERSum /= FInletPipe.size();
120 
121  return ERSum;
122 
123 }
124 
125 double TAcousticTurbine::P4() {
126 
127  int n = FOutletPipe->getNin() - 1;
128 
129  return FOutletPipe->GetPresion(n);
130 
131 }
132 
133 double TAcousticTurbine::T4() {
134 
135  int n = FOutletPipe->getNin() - 1;
136 
137  return pow2(FOutletPipe->GetAsonido(n) * __cons::ARef) / FOutletPipe->GetGamma(n) / FOutletPipe->GetRMezcla(0);
138 
139 }
140 
141 double TAcousticTurbine::MassIn(int i) {
142 
143  return FInletPipe[i]->GetDensidad(0) * FInletPipe[i]->GetVelocidad(0) * __cons::ARef * SIn(i);
144 }
145 
146 double TAcousticTurbine::MassIn() {
147 
148  double MasSum = 0.;
149  for(int i = 0; i < FInletPipe.size(); i++) {
150  MasSum += MassIn(i);
151  }
152 
153  return MasSum;
154 }
155 
156 double TAcousticTurbine::MassOut() {
157 
158  int n = FOutletPipe->getNin() - 1;
159 
160  return FOutletPipe->GetDensidad(n) * FOutletPipe->GetVelocidad(n) * __cons::ARef * SOut();
161 }
162 
163 double TAcousticTurbine::DIn() {
164 
165  double DInSum = 0.;
166  for(int i = 0; i < FInletPipe.size(); i++) {
167  DInSum += pow2(DIn(i));
168  }
169 
170  return sqrt(DInSum);
171 }
172 
173 #pragma package(smart_init)
TTubo::GetGamma
double GetGamma(int i) const
Gets the specific heat capacities ratio at a given cell.
Definition: TTubo.cpp:5444
iVector
std::vector< int > iVector
Integer vector.
Definition: Math_wam.h:72
TTubo::GetVelocidad
double GetVelocidad(int i) const
Gets the fluid speed.
Definition: TTubo.cpp:5505
TTubo::GetPresion
double GetPresion(int i) const
Gets the fluid pressure.
Definition: TTubo.cpp:5468
TAcousticTurbine.h
pow2
T pow2(T x)
Returns x to the power of 2.
Definition: Math_wam.h:88
TTubo::GetDensidad
double GetDensidad(int i) const
Gets the density.
Definition: TTubo.cpp:5432
TTubo::GetRMezcla
double GetRMezcla(int i) const
Gets the gas constant of the mixture at a given cell.
Definition: TTubo.cpp:5476
TTubo::GetAsonido
double GetAsonido(int i) const
Gets the speed of sound.
Definition: TTubo.cpp:5412