OpenWAM
TAcousticCompressor.cpp
1 /*--------------------------------------------------------------------------------*\
2 |==========================|
3  |\\ /\ /\ // O pen | OpenWAM: The Open Source 1D Gas-Dynamic Code
4  | \\ | X | // W ave |
5  | \\ \/_\/ // A ction | CMT-Motores Termicos / Universidad Politecnica Valencia
6  | \\/ \// M odel |
7  ----------------------------------------------------------------------------------
8  | License
9  |
10  | This file is part of OpenWAM.
11  |
12  | OpenWAM is free software: you can redistribute it and/or modify
13  | it under the terms of the GNU General Public License as published by
14  | the Free Software Foundation, either version 3 of the License, or
15  | (at your option) any later version.
16  |
17  | OpenWAM is distributed in the hope that it will be useful,
18  | but WITHOUT ANY WARRANTY; without even the implied warranty of
19  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  | GNU General Public License for more details.
21  |
22  | You should have received a copy of the GNU General Public License
23  | along with OpenWAM. If not, see <http://www.gnu.org/licenses/>.
24  |
25  \*--------------------------------------------------------------------------------*/
26 
27 // ---------------------------------------------------------------------------
28 #pragma hdrstop
29 
30 #include "TAcousticCompressor.h"
31 
32 // ---------------------------------------------------------------------------
33 
34 #pragma package(smart_init)
35 
37 }
38 
39 TAcousticCompressor::TAcousticCompressor(int InletPipeID, int VoluteID, int OutletPipeID, int RotorVolumeID,
40  int StatorVolumeID) {
41 
42  FInletPipeID = InletPipeID;
43  FVoluteID = VoluteID;
44  FOutletPipeID = OutletPipeID;
45  FRotorVolumeID = RotorVolumeID;
46  FStatorVolumeID = StatorVolumeID;
47 }
48 
50 }
51 
53 
54  double p = FInletPipe->GetPresion(0);
55  double a = FInletPipe->GetAsonido(0) * __cons::ARef;
56  double v = FInletPipe->GetVelocidad(0) * __cons::ARef;
57  double g = FInletPipe->GetGamma(0);
58 
59  double p0 = p * pow(1 + (g - 1) / 2 * pow2(v / a), g / (g - 1));
60 
61  return p0;
62 }
63 
64 double TAcousticCompressor::P1() {
65 
66  return FInletPipe->GetPresion(0);
67 
68 }
69 
71 
72  int n = FOutletPipe->getNin() - 1;
73 
74  double p = FOutletPipe->GetPresion(n);
75  double a = FOutletPipe->GetAsonido(n) * __cons::ARef;
76  double v = FOutletPipe->GetVelocidad(n) * __cons::ARef;
77  double g = FOutletPipe->GetGamma(n);
78 
79  double p0 = p * pow(1 + (g - 1) / 2 * pow2(v / a), g / (g - 1));
80 
81  return p0;
82 }
83 
85 
86  int n = FOutletPipe->getNin() - 1;
87 
88  return FOutletPipe->GetPresion(n);
89 
90 }
91 
93 
94  double p = FInletPipe->GetPresion(0);
95  double a = FInletPipe->GetAsonido(0) * __cons::ARef;
96  double v = FInletPipe->GetVelocidad(0) * __cons::ARef;
97  double g = FInletPipe->GetGamma(0);
98  double R = FInletPipe->GetRMezcla(0);
99 
100  double T0 = (pow2(a) + (g - 1) / 2 * pow2(v)) / g / R;
101 
102  return T0;
103 
104 }
105 
107 
108  int n = FOutletPipe->getNin() - 1;
109 
110  double a = FOutletPipe->GetAsonido(n) * __cons::ARef;
111  double g = FOutletPipe->GetGamma(n);
112  double R = FOutletPipe->GetRMezcla(n);
113 
114  return a * a / g / R;
115 
116 }
117 
118 double TAcousticCompressor::T20() {
119 
120  int n = FOutletPipe->getNin() - 1;
121 
122  double a = FOutletPipe->GetAsonido(n) * __cons::ARef;
123  double g = FOutletPipe->GetGamma(n);
124  double v = FOutletPipe->GetVelocidad(n) * __cons::ARef;
125  double R = FOutletPipe->GetRMezcla(n);
126 
127  double T0 = (pow2(a) + (g - 1) / 2 * pow2(v)) / g / R;
128 
129  return T0;
130 
131 }
132 
133 double TAcousticCompressor::T1() {
134 
135  double a = FInletPipe->GetAsonido(0) * __cons::ARef;
136  double g = FInletPipe->GetGamma(0);
137  double R = FInletPipe->GetRMezcla(0);
138 
139  return a * a / g / R;
140 
141 }
142 
143 double TAcousticCompressor::CompRatio() {
144  return P20() / P10();
145 }
146 
147 void TAcousticCompressor::PutHeatPower(double Power) {
148  FStatorVolume->PutHeatPower(Power);
149 }
150 
151 void TAcousticCompressor::PutHeatPowerIn(double Power) {
152  FRotorVolume->PutHeatPower(Power);
153 }
154 
155 void TAcousticCompressor::AsignElementsID(int InletPipeID, int VoluteID, int OutletPipeID, int RotorVolumeID,
156  int StatorVolumeID) {
157 
158  FInletPipeID = InletPipeID;
159  FVoluteID = VoluteID;
160  FOutletPipeID = OutletPipeID;
161  FRotorVolumeID = RotorVolumeID;
162  FStatorVolumeID = StatorVolumeID;
163 }
164 
165 double TAcousticCompressor::CRCorrector() {
166 
167  double p = FVolute->GetPresion(0);
168  double a = FVolute->GetAsonido(0) * __cons::ARef;
169  double v = FVolute->GetVelocidad(0) * __cons::ARef;
170  double g = FVolute->GetGamma(0);
171 
172  double p20out = p * pow(1 + (g - 1) / 2 * pow2(v / a), 2 * g / (g - 1));
173 
174  double Correction = p20out * P10() / FRotorVolume->getPressure() / P20();
175 
176  return Correction;
177 
178 }
179 
180 double TAcousticCompressor::EFCorrector(double rcorr, double rorig) {
181 
182  double g = FRotorVolume->getGamma();
183 
184  if(rorig <= 1.) {
185  return 1;
186  }
187 
188  double Correction = __units::degCToK(FRotorVolume->getTemperature()) / T10() * (pow(rorig * rcorr,
189  (g - 1) / g) - 1) / (pow(rorig, (g - 1) / g) - 1);
190 
191  return Correction;
192 
193 }
194 
195 double TAcousticCompressor::MassFlow() {
196 
197  double p = FVolute->GetPresion(0);
198  double a = FVolute->GetAsonido(0) * __cons::ARef;
199  double v = FVolute->GetVelocidad(0) * __cons::ARef;
200  double g = FVolute->GetGamma(0);
201  double S = FVolute->GetArea(0);
202 
203  double Mass = __units::BarToPa(p) * g * v * S / a / a;
204 
205  return Mass;
206 
207 }
208 
209 double TAcousticCompressor::Efficiency() {
210  double g = FVolute->GetGamma(0);
211  double eff = T10() * (pow(CompRatio(), (g - 1) / g) - 1) / (T20() - T10());
212 
213  return eff;
214 }
215 
216 double TAcousticCompressor::Din() {
217 
218  return FInletPipe->GetDiametro(0);
219 }
TAcousticCompressor::TAcousticCompressor
TAcousticCompressor()
Definition: TAcousticCompressor.cpp:36
TTubo::GetGamma
double GetGamma(int i) const
Gets the specific heat capacities ratio at a given cell.
Definition: TTubo.cpp:5444
TAcousticCompressor::T10
double T10()
Compute the total temperature at compressor inlet.
Definition: TAcousticCompressor.cpp:92
TAcousticCompressor::~TAcousticCompressor
~TAcousticCompressor()
Definition: TAcousticCompressor.cpp:49
TTubo::GetDiametro
double GetDiametro(int i) const
Gets the cell diameter.
Definition: TTubo.cpp:5436
TAcousticCompressor::P20
double P20()
Compute the total pressure at compressor outlet.
Definition: TAcousticCompressor.cpp:70
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
TAcousticCompressor::T2
double T2()
Compute the temperature at compressor outlet.
Definition: TAcousticCompressor.cpp:106
pow2
T pow2(T x)
Returns x to the power of 2.
Definition: Math_wam.h:88
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
TAcousticCompressor::P2
double P2()
Compute the pressure at compressor outlet.
Definition: TAcousticCompressor.cpp:84
TTubo::GetArea
double GetArea(int i) const
Gets the cross section at a given cell.
Definition: TTubo.cpp:5408
TAcousticCompressor::P10
double P10()
Compute the total pressure at compressor inlet.
Definition: TAcousticCompressor.cpp:52
TAcousticCompressor.h