OpenWAM
Constantes.h
Go to the documentation of this file.
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 
53 //---------------------------------------------------------------------------
54 #ifndef ConstantesH
55 #define ConstantesH
56 //#include "TBloqueMotor.h"
57 #ifdef __BORLANDC__
58 #include <vcl.h>
59 #endif
60 
61 #include <limits>
62 #define _USE_MATH_DEFINES
63 #include <cmath>
64 //---------------------------------------------------------------------------
65 
66 //Gas constant
67 namespace __R {
68  const double Universal = 8314.4; // [J / (mol *K)]
69  const double Air = 287.;
70  const double Fuel = 55.95;
71  const double Burnt = 285.4;
72  const double O2 = 259.825;
73  const double CO2 = 188.9207;
74  const double H2O = 461.398;
75  const double N2 = 296.837;
76  const double Ar = 208.12;
77  const double Diesel = 55.95;
78  const double Gasoline = 72.42;
79 }
80 ;
81 // [J / (kg * K)]
82 
83 //Molecular weight
84 namespace __PM {
85  const double O2 = 32.;
86  const double CO2 = 44.01;
87  const double H2O = 18.02;
88  const double N2 = 28.01;
89  const double Ar = 39.95;
90  const double C = 12.01;
91  const double NO2 = 46;
92  const double NO = 30;
93  const double CO = 28.01;
94  const double UHC = 55.04;
95  const double Diesel = 148.4;
96  const double Gasoline = 114.8;
97 }
98 ;
99 // [g]
100 
101 namespace __cons {
102  const double Pi = 3.14159265358979323846;
103  const double Pi_2 = Pi / 2;
104  const double Pi_4 = Pi / 4;
105  const double Pi_x_2 = 2 * Pi;
106  const double _1_Pi = 1 / Pi;
107  const double _2_Pi = 2 / Pi;
108  const double _4_Pi = 4 / Pi;
109  const double SQR_4_Pi = sqrt(_4_Pi);
110  const double Sigma = 5.670373e-8;
111  const double ARef = 343.11;
112  const double ARef2 = ARef * ARef;
113  const double TRef = 292.99271;
114  const double PRef = 1.0;
115 }
116 ;
117 
118 //const double Gamma = 1.4; ///< Air specific heat capacities ratio.
119 //const double ARef = 343.11; ///< Reference speed of sound. [m / s]
120 //const double TRef = 292.99271; ///< Reference temperature. [K]
121 //const double ARef2 = 117724.4721;
122 //const double PRef = 1.0; ///< Reference pressure. [bar]
123 
124 namespace __units {
125 
126  const double _DegToRad = 2 * __cons::Pi / 360;
127 //GENERAL
128  inline double To_kilo(double p) {
129  return p * 0.001;
130  }
131  inline double From_kilo(double p) {
132  return p * 1000;
133  }
134 //ANGLE
135  inline double DegToRad(double p) {
136  return p * _DegToRad;
137  }
138 // PRESSURE
139  inline double BarToPa(double p) {
140  return p * 1e5;
141  }
142  inline double PaToBar(double p) {
143  return p * 1e-5;
144  }
145 //ROTATIONAL SPEED
146  inline double RPMToRPS(double p) {
147  return p * 0.016666666666667;
148  }
149  inline double RPMToRad_s(double p) {
150  return p * 0.104719755119660;
151  }
152  inline double Rad_sToRPM(double p) {
153  return p * 9.549296585513721;
154  }
155 //SPEED
156  inline double m_sTokm_h(double p) {
157  return p * 3.6;
158  }
159 //TEMPERATURE
160  inline double degCToK(double p) {
161  return p + 273.15;
162  }
163  inline double KTodegC(double p) {
164  return p - 273.15;
165  }
166 }
167 ;
168 
169 //stUN __UN;
170 
171 //const double Kb = 1.38054e-23; ///< Boltzmann constant. [J / K]
172 
173 namespace __HFormacion {
174  const double CO2 = -393510;
175  const double CO = -110530;
176  const double NO2 = 33100;
177  const double NO = 90290;
178  const double H2O = -241830;
179 }
180 ;
181 
182 namespace __geom {
183  inline double Circle_area(double d) {
184  return d * d * __cons::Pi_4;
185  }
186  inline double Cylinder_volume(double d, double l) {
187  return Circle_area(d) * l;
188  }
189  inline double Ring_area(double din, double dout) {
190  return (dout * dout - din * din) * __cons::Pi_4;
191  }
192 }
193 ;
194 
195 namespace __Gamma {
196 
197 // FOR AIR AT AMBIENT CONDITIONS
198  const double Cp = 1004.5;
199  const double G = Cp / (Cp - __R::Air);
200  const double G_1 = G - 1;
201  const double G_2 = G + 1;
202  const double G_3 = (G - 1) / 2;
203  const double G_4 = 2 * G / (G - 1);
204  const double G_5 = (G - 1) / G / 2;
205  const double G_6 = 1 / (G - 1);
206  const double G_7 = (3 - G) / (G + 1);
207  const double G_8 = (G - 1) / G;
208  const double G_9 = G / (G - 1);
209  const double Cp_x2 = 2 * Cp;
210  const double Cv = Cp - __R::Air;
211  const double gxR = G * __R::Air;
212 
213  inline double GG(double Cp, double Cv) {
214  return Cp / Cv;
215  }
216 
217  inline double G1(double g) {
218  return g - 1;
219  }
220  ;
221 
222  inline double G2(double g) {
223  return g + 1;
224  }
225  ;
226 
227  inline double G3(double g) {
228  return (g - 1) * 0.5;
229  }
230  ;
231 
232  inline double G4(double g) {
233  return 2. * g / (g - 1);
234  }
235  ;
236 
237  inline double G5(double g) {
238  return (g - 1) / 2. / g;
239  }
240  ;
241 
242  inline double G6(double g) {
243  return 1 / (g - 1);
244  }
245  ;
246 
247  inline double G7(double g) {
248  return (3 - g) / (g + 1);
249  }
250  ;
251 
252  inline double G8(double g) {
253  return (g - 1) / g;
254  }
255  ;
256 
257  inline double G9(double g) {
258  return g / (g - 1);
259  }
260 }
261 
262 #endif
TEffCorrector
Definition: TEffCorrector.h:64
TRotorTurbina
Definition: TRotorTurbina.h:48
TEjeTurbogrupo
Definition: TEjeTurbogrupo.h:47
TUnionDireccional
Definition: TUnionDireccional.h:33
TMapaComp
Definition: TMapaComp.h:40
TTubo
a Finite differences pipe.
Definition: TTubo.h:116
TCCDescargaExtremoAbierto
Definition: TCCDescargaExtremoAbierto.h:43
TEGRV
Definition: TEGRV.h:46
TMapaComp2Tub
Definition: TMapaComp2Tub.h:41
TControlFuel
Definition: TControlFuel.h:42
TCilindro4T
Definition: TCilindro4T.h:39
TTimeControl
Definition: TTimeControl.h:33
TControlInyeccion
Definition: TControlInyeccion.h:42
TIsoSpeedLine
Definition: TIsoSpeedLine.h:41
TController
Definition: TController.h:37
TDecisor
Definition: TDecisor.h:37
TCilindro
Definition: TCilindro.h:59
TTurbina
Definition: TTurbina.h:41
TCCPulso
Definition: TCCPulso.h:39
TTurbinaTwin
Definition: TTurbinaTwin.h:39
TCCExtremoInyeccion
Definition: TCCExtremoInyeccion.h:37
TCCExternalConnection
Definition: TCCExternalConnection.h:9
TTipoValvula
Definition: TTipoValvula.h:53
TOpenWAM
Definition: TOpenWAM.h:148
TCCCompresorVolumetrico
Definition: TCCCompresorVolumetrico.h:37
TCCUnionEntreDepositos
Definition: TCCUnionEntreDepositos.h:41
TAcousticTurbine
Definition: TAcousticTurbine.h:39
TDepVolCteBase
Definition: TDepVolCteBase.h:33
TControlK
Definition: TControlK.h:44
TCalculoExtern
Definition: TCalculoExtern.h:190
TWasteGate
Definition: TWasteGate.h:47
TCompTubDep
Definition: TCompTubDep.h:40
TAjusteTransCalorCil
Definition: TAjusteTransCalorCil.h:44
TValvulaContr
Definition: TValvulaContr.h:46
TPIDController
Definition: TPIDController.h:35
TLamina
Definition: TLamina.h:50
TCompresor
Definition: TCompresor.h:47
TCondicionContorno
Definition: TCondicionContorno.h:54
TCompresorDep
Definition: TCompresorDep.h:37
TCDFijo
Definition: TCDFijo.h:43
TDeposito
Definition: TDeposito.h:44
TMariposa
Definition: TMariposa.h:43
TCoefDescarga
Definition: TCoefDescarga.h:42
TCompressorMap
Definition: TCompressorMap.h:12
TValvula4T
Definition: TValvula4T.h:45
TTurbPosition
Definition: TTurbPosition.h:35
TMatlab
Definition: TMatlab.h:44
TCompIsoReg
Definition: TCompIsoReg.h:36
Exception
Custom exception class.
Definition: Exception.hpp:39
TCompTubos
Definition: TCompTubos.h:79
TTGV
Definition: TTGV.h:40
TCFDConnection
Definition: TCFDConnection.h:10
TSAEMap
Definition: TSAEMap.h:13
TCilindro2T
Definition: TCilindro2T.h:39
TCCCompresor
Definition: TCCCompresor.h:44
TCCCilindro
Foo.
Definition: TCCCilindro.h:46
TGain
Definition: TGain.h:42
TFraccionMasicaCilindro
Definition: TFraccionMasicaCilindro.h:40
TDiscoRotativo
Definition: TDiscoRotativo.h:44
TMuelle
Definition: TMuelle.h:39
TCCEntradaCompresor
Definition: TCCEntradaCompresor.h:41
TTurbineMap
Definition: TTurbineMap.h:34
TTable1D
Definition: TTable1D.h:37
TCCRamificacion
Definition: TCCRamificacion.h:37
TCCPreVble
Definition: TCCPreVble.h:39
TRegimenMotor
Definition: TRegimenMotor.h:39
TVenturi
Definition: TVenturi.h:33
TLumbrera
Definition: TLumbrera.h:45
TBloqueMotor
Definition: TBloqueMotor.h:43
TEstatorTurbina
Definition: TEstatorTurbina.h:47
TCCDeposito
Definition: TCCDeposito.h:40
TAcousticCompressor
Definition: TAcousticCompressor.h:66
TCDExterno
Definition: TCDExterno.h:43
TSensor
Definition: TSensor.h:42
TDepVolVariable
Definition: TDepVolVariable.h:35
TInterpMapaComp
Definition: TInterpMapaComp.h:35
TCCPerdidadePresion
Definition: TCCPerdidadePresion.h:44
TCCUnionEntreTubos
Definition: TCCUnionEntreTubos.h:37
TRemansoMatlab
Definition: TRemansoMatlab.h:43
TCCExtremoCerrado
Definition: TCCExtremoCerrado.h:37
TNewMapComp
Definition: TNewMapComp.h:36
TTable
Definition: TTable.h:35
TEntradaPulso
Definition: TEntradaPulso.h:42
TCCExtremoAnecoico
Definition: TCCExtremoAnecoico.h:37
TCCExternalConnectionVol
Definition: TCCExternalConnectionVol.h:9
TOutputResults
Definition: TOutputResults.h:34
TDepVolCte
Definition: TDepVolCte.h:33
TTurbinaSimple
Definition: TTurbinaSimple.h:42
Tfql
Definition: Tfql.h:51