OpenWAM
TDeposito.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 // ---------------------------------------------------------------------------
29 #pragma hdrstop
30 #include "TDeposito.h"
31 
32 #include "TCCDeposito.h"
33 #include "TCCUnionEntreDepositos.h"
34 #include "TCCCompresor.h"
35 #include "TCompresor.h"
36 #include "TTubo.h"
37 #include "TDPF.h"
38 #include "TCanalDPF.h"
39 
40 // ---------------------------------------------------------------------------
41 // ---------------------------------------------------------------------------
42 
43 TDeposito::TDeposito(int i, nmTipoDeposito TipoDeposito, nmTipoCalculoEspecies SpeciesModel, int numeroespecies,
44  nmCalculoGamma GammaCalculation, bool ThereIsEGR) {
45 
46  FCalculoEspecies = SpeciesModel;
47  FNumeroEspecies = numeroespecies;
48  FCalculoGamma = GammaCalculation;
49  FFraccionMasicaEspecie = NULL;
50  FMasaEspecie = NULL;
51 
52  FHayEGR = ThereIsEGR;
53  if(FHayEGR)
54  FIntEGR = 0;
55  else
56  FIntEGR = 1;
57 
58  FPresRef = 1.;
59  FUnion = NULL;
60  FNumConductos = NULL;
61  FNumNodos = NULL;
62  FSentidoFlujo = NULL;
63  asgFUnion = false;
64  asgFNumUniones = false;
65  asgFNumConductos = false;
66  asgFSentidoFlujo = false;
67  FNumeroDeposito = i + 1;
68  FTipoDeposito = TipoDeposito;
69  FUpdated = false;
70  FNUnionesED = 0;
71  FNumeroUnionesED = 0;
72  FNumeroUniones = 0;
73  FHayCompresor = false;
74  FTime = 0.;
75  FEstudioEstabilidadRealizado = false;
76 
77  FCCDeposito = NULL;
78  FCCUnionEntreDep = NULL;
79 
80  FResMediosDep.Pressure = false;
81  FResMediosDep.PresionSUM = 0.;
82  FResMediosDep.PresionMED = 1.;
83  FResMediosDep.Temperature = false;
84  FResMediosDep.TemperaturaSUM = 0.;
85  FResMediosDep.TemperaturaMED = 0.;
86  FResMediosDep.TiempoSUM = 0.;
87  FResMediosDep.Tiempo0 = 0.;
88  FResMediosDep.FraccionMasicaEspecies = false;
89  FResMediosDep.FraccionMED = new double[FNumeroEspecies - FIntEGR];
90  FResMediosDep.FraccionSUM = new double[FNumeroEspecies - FIntEGR];
91 
92  FResInstantDep.Pressure = false;
93  FResInstantDep.Temperature = false;
94  FResInstantDep.Volumen = false;
95  FResInstantDep.Masa = false;
96  FResInstantDep.PresionINS = 1.;
97  FResInstantDep.TemperaturaINS = 0.;
98  FResInstantDep.VolumenINS = 1.;
99  FResInstantDep.MasaINS = 1.;
100  FResInstantDep.FraccionMasicaEspecies = false;
101  FResInstantDep.FraccionINS = new double[FNumeroEspecies - FIntEGR];
102  FResInstantDep.Gamma = false;
103  FResInstantDep.GammaINS = 1.4;
104 
105  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
106  FResInstantDep.FraccionINS[i] = 0.;
107  FResMediosDep.FraccionSUM[i] = 0.;
108  FResMediosDep.FraccionMED[i] = 0.;
109  }
110 
111  FHeatPower = 0;
112 
113 }
114 
115 // ---------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
117 
118 TDeposito::~TDeposito() {
119  if(FUnion != NULL)
120  delete[] FUnion;
121  if(FSentidoFlujo != NULL)
122  delete[] FSentidoFlujo;
123  if(FNumConductos != NULL)
124  delete[] FNumConductos;
125  if(FNumNodos != NULL)
126  delete[] FNumNodos;
127 
128  if(FFraccionMasicaEspecie != NULL)
129  delete[] FFraccionMasicaEspecie;
130  if(FMasaEspecie != NULL)
131  delete[] FMasaEspecie;
132 
133  if(FCCDeposito != NULL)
134  delete[] FCCDeposito;
135  if(FCCUnionEntreDep != NULL)
136  delete[] FCCUnionEntreDep;
137 
138  if(FResMediosDep.FraccionMED != NULL)
139  delete[] FResMediosDep.FraccionMED;
140 
141  if(FResMediosDep.FraccionSUM != NULL)
142  delete[] FResMediosDep.FraccionSUM;
143 
144  if(FResInstantDep.FraccionINS != NULL)
145  delete[] FResInstantDep.FraccionINS;
146 }
147 
148 // ---------------------------------------------------------------------------
149 // ---------------------------------------------------------------------------
150 
151 void TDeposito::LeeDatosGeneralesDepositos(const char *FileWAM, fpos_t &filepos) {
152  try {
153  double fracciontotal = 0.;
154 
155  FILE *fich = fopen(FileWAM, "r");
156  fsetpos(fich, &filepos);
157 
158  FFraccionMasicaEspecie = new double[FNumeroEspecies - FIntEGR];
159  FMasaEspecie = new double[FNumeroEspecies - FIntEGR];
160  for(int i = 0; i < FNumeroEspecies - 1; i++) {
161  fscanf(fich, "%lf ", &FFraccionMasicaEspecie[i]);
162  fracciontotal += FFraccionMasicaEspecie[i];
163  }
164  if(FHayEGR) {
165  if(FCalculoEspecies == nmCalculoCompleto) {
166  if(FFraccionMasicaEspecie[0] > 0.2)
167  FFraccionMasicaEspecie[FNumeroEspecies - 1] = 0.;
168  else
169  FFraccionMasicaEspecie[FNumeroEspecies - 1] = 1.;
170  } else {
171  if(FFraccionMasicaEspecie[0] > 0.5)
172  FFraccionMasicaEspecie[FNumeroEspecies - 1] = 1.;
173  else
174  FFraccionMasicaEspecie[FNumeroEspecies - 1] = 0.;
175  }
176  }
177 
178  if(fracciontotal > 1 + 1.e-10 && fracciontotal < 1 - 1e-10) {
179  std::cout << "ERROR: Total mass fraction cannot be different than 1. Check input data in plenum " << FNumeroDeposito <<
180  std::endl;
181  throw Exception(" ");
182  }
183 
184  if(FTipoDeposito != nmDepVolVble) {
185  fscanf(fich, "%lf %lf %lf ", &FVolumen, &FPressure, &FTemperature);
186  if(FCalculoEspecies == nmCalculoCompleto) {
187 
188  FRMezcla = CalculoCompletoRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
189  FCalculoGamma, nmMEP);
190  FCpMezcla = CalculoCompletoCpMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
191  __units::degCToK(FTemperature), FCalculoGamma, nmMEP);
192  FGamma = CalculoCompletoGamma(FRMezcla, FCpMezcla, FCalculoGamma);
193 
194  } else if(FCalculoEspecies == nmCalculoSimple) {
195 
196  FRMezcla = CalculoSimpleRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FCalculoGamma, nmMEP);
197  FCvMezcla = CalculoSimpleCvMezcla(__units::degCToK(FTemperature), FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1],
198  FCalculoGamma, nmMEP);
199  FGamma = CalculoSimpleGamma(FRMezcla, FCvMezcla, FCalculoGamma);
200 
201  }
202  FPresionIsen = pow(FPressure / FPresRef, __Gamma::G5(FGamma));
203  FAsonido = sqrt(FGamma * FRMezcla * __units::degCToK(FTemperature)) / __cons::ARef;
204  FMasa = FVolumen * FGamma * __units::BarToPa(FPressure) / pow2(FAsonido * __cons::ARef);
205  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
206  FMasaEspecie[j] = FMasa * FFraccionMasicaEspecie[j];
207  }
208  } else {
209  fscanf(fich, " %lf %lf ", &FPressure, &FTemperature);
210  if(FCalculoEspecies == nmCalculoCompleto) {
211 
212  FRMezcla = CalculoCompletoRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
213  FCalculoGamma, nmMEP);
214  FCpMezcla = CalculoCompletoCpMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
215  __units::degCToK(FTemperature), FCalculoGamma, nmMEP);
216  FGamma = CalculoCompletoGamma(FRMezcla, FCpMezcla, FCalculoGamma);
217 
218  } else if(FCalculoEspecies == nmCalculoSimple) {
219 
220  FRMezcla = CalculoSimpleRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FCalculoGamma, nmMEP);
221  FCvMezcla = CalculoSimpleCvMezcla(__units::degCToK(FTemperature), FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1],
222  FCalculoGamma, nmMEP);
223  FGamma = CalculoSimpleGamma(FRMezcla, FCvMezcla, FCalculoGamma);
224 
225  }
226  FPresionIsen = pow(FPressure / FPresRef, __Gamma::G5(FGamma));
227  FAsonido = sqrt(FGamma * FRMezcla * __units::degCToK(FTemperature)) / __cons::ARef;
228  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
229  FMasaEspecie[j] = FMasa * FFraccionMasicaEspecie[j];
230  }
231  }
232 
233  fgetpos(fich, &filepos);
234  fclose(fich);
235 
236  } catch(exception & N) {
237  std::cout << "ERROR: TDeposito::LeeDatosGeneralesDepositos en el deposito: " << FNumeroDeposito << std::endl;
238  std::cout << "Tipo de error: " << N.what() << std::endl;
239  throw Exception(N.what());
240  }
241 }
242 
243 // ---------------------------------------------------------------------------
244 // ---------------------------------------------------------------------------
245 
246 void TDeposito::AsignacionCC(TCondicionContorno **BC, int numCC) {
247  try {
248 
249  bool UnionAsignada;
250  bool UnionEDAsignada;
251  /* Union Deposito-Pipe */
252  for(int i = 0; i < numCC; i++) {
253  if(BC[i]->getTipoCC() == nmPipeToPlenumConnection) {
254  if(FNumeroDeposito == dynamic_cast<TCCDeposito*>(BC[i])->getNumeroDeposito()) {
255  FNumeroUniones++;
256  }
257  } else if(BC[i]->getTipoCC() == nmCompresor) {
258  if((dynamic_cast<TCCCompresor*>(BC[i])->getCompressor())->getModeloCompresor() == nmCompOriginal) {
259  if(FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDeposito()) {
260  FNumeroUniones++;
261  }
262  }
263  }
264  }
265 
266  /* Comprobacion que los depositos especiales tienen el numero de entradas que les corresponden. */
267  if(FTipoDeposito == nmTurbinaSimple) {
268  if(FNumeroUniones != 2) {
269  std::cout << "ERROR: A single turbine must have 2 connections. Plenum: " << FNumeroDeposito << std::endl;
270  std::cout << "Total number of connections: " << FNumeroUniones << std::endl;
271  throw Exception("");
272  }
273  } else if(FTipoDeposito == nmTurbinaTwin) {
274  if(FNumeroUniones != 3) {
275  std::cout << "ERROR: A twin turbine must have 3 connections. Plenum: " << FNumeroDeposito << std::endl;
276  std::cout << "Total number of connections: " << FNumeroUniones << std::endl;
277  throw Exception("");
278  }
279  } else if(FTipoDeposito == nmVenturi) {
280  if(FNumeroUniones != 3) {
281  std::cout << "ERROR: A venturi must have 3 connections. Plenum: " << FNumeroDeposito << std::endl;
282  std::cout << "Total number of connections: " << FNumeroUniones << std::endl;
283  throw Exception("");
284  }
285  } else if(FTipoDeposito == nmUnionDireccional) {
286  if(FNumeroUniones != 3) {
287  std::cout << "ERROR: A directional junction must have 3 connections. Planum: " << FNumeroDeposito << std::endl;
288  std::cout << "Total number of connections: " << FNumeroUniones << std::endl;
289  throw Exception("");
290  }
291  }
292 
293  if(FNumeroUniones != 0)
294  FCCDeposito = new TCondicionContorno*[FNumeroUniones];
295 
296  bool *CCasignadaD;
297  CCasignadaD = new bool[numCC];
298  for(int i = 0; i < numCC; i++)
299  CCasignadaD[i] = false;
300 
301  for(int j = 0; j < FNumeroUniones; j++) {
302  UnionAsignada = false;
303  for(int i = 0; i < numCC; i++) {
304  if(BC[i]->getTipoCC() == nmPipeToPlenumConnection) {
305  if(FNumeroDeposito == dynamic_cast<TCCDeposito*>(BC[i])->getNumeroDeposito() && !CCasignadaD[i] && !UnionAsignada) {
306  FCCDeposito[j] = BC[i];
307  UnionAsignada = true;
308  CCasignadaD[i] = true;
309  }
310  }
311  if(BC[i]->getTipoCC() == nmCompresor) {
312  if(dynamic_cast<TCCCompresor*>(BC[i])->getCompressor()->getModeloCompresor() == nmCompOriginal) {
313  if(FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDeposito() && !CCasignadaD[i] && !UnionAsignada) {
314  FCCDeposito[j] = BC[i];
315  UnionAsignada = true;
316  CCasignadaD[i] = true;
317  }
318  }
319  }
320  }
321  }
322 
323  delete[] CCasignadaD;
324 
325  /* Union Deposito-Deposito */
326 
327  for(int i = 0; i < numCC; i++) {
328  if(BC[i]->getTipoCC() == nmUnionEntreDepositos) {
329  if(FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(BC[i])->getNumeroDeposito1()
330  || FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(BC[i])->getNumeroDeposito2()) {
331  FNumeroUnionesED++;
332  }
333  }
334  if(BC[i]->getTipoCC() == nmCompresor) {
335  if(dynamic_cast<TCCCompresor*>(BC[i])->getCompressor()->getModeloCompresor() == nmCompPlenums) {
336  if(FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDepositoRot()
337  || FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDepositoEst()) {
338  FNumeroUnionesED++;
339  }
340  }
341  }
342  }
343 
344  if((FTipoDeposito == nmTurbinaSimple || FTipoDeposito == nmTurbinaTwin) & FNumeroUnionesED != 0) {
345  std::cout << "ERROR: Una turbina no puede estar unida directamente a un deposito. Deposito:" << std::endl;
346  std::cout << " Revisa la entrada de datos el apartado de uniones entre depositos" << std::endl;
347  throw Exception("");
348  } else if(FTipoDeposito == nmVenturi & FNumeroUnionesED != 0) {
349  std::cout << "ERROR: Un venturi no puede estar unido directamente a un deposito. Deposito:" << std::endl;
350  std::cout << " Revisa la entrada de datos el apartado de uniones entre depositos" << std::endl;
351  throw Exception("");
352  } else if(FTipoDeposito == nmUnionDireccional & FNumeroUnionesED != 0) {
353  std::cout << "ERROR: Una union direccional no puede estar unido directamente a un deposito" << std::endl;
354  std::cout << " Revisa la entrada de datos el apartado de uniones entre depositos" << std::endl;
355  throw Exception("");
356  }
357 
358  if(FNumeroUnionesED != 0)
359  FCCUnionEntreDep = new TCondicionContorno*[FNumeroUnionesED];
360 
361  bool *CCasignadaUD;
362  CCasignadaUD = new bool[numCC];
363  for(int i = 0; i < numCC; i++)
364  CCasignadaUD[i] = false;
365 
366  for(int j = 0; j < FNumeroUnionesED; j++) {
367  UnionEDAsignada = false;
368  for(int i = 0; i < numCC; i++) {
369  if(BC[i]->getTipoCC() == nmUnionEntreDepositos) {
370  if((FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(BC[i])->getNumeroDeposito1()
371  || FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(BC[i])->getNumeroDeposito2()) && !CCasignadaUD[i]
372  && !UnionEDAsignada) {
373  FCCUnionEntreDep[j] = BC[i];
374  CCasignadaUD[i] = true;
375  UnionEDAsignada = true;
376  }
377  }
378  if(BC[i]->getTipoCC() == nmCompresor) {
379  if(dynamic_cast<TCCCompresor*>(BC[i])->getCompressor()->getModeloCompresor() == nmCompPlenums) {
380  if((FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDepositoRot()
381  || FNumeroDeposito == dynamic_cast<TCCCompresor*>(BC[i])->getNumeroDepositoEst()) && !CCasignadaUD[i]
382  && !UnionEDAsignada) {
383  FCCUnionEntreDep[j] = BC[i];
384  CCasignadaUD[i] = true;
385  UnionEDAsignada = true;
386  }
387  }
388  }
389  }
390  }
391 
392  delete[] CCasignadaUD;
393 
394  } catch(exception & N) {
395  std::cout << "ERROR: TDeposito::AsignacionCC en el deposito: " << FNumeroDeposito << std::endl;
396  std::cout << "Tipo de error: " << N.what() << std::endl;
397  throw Exception(N.what());
398  }
399 }
400 
401 // ---------------------------------------------------------------------------
402 // ---------------------------------------------------------------------------
403 
404 double TDeposito::EntalpiaEntrada(double ASonidoE, double VelocidadE, double MasaE, double ASonidoD, double MasaD,
405  double Gamma) {
406  try {
407 
408  double xx = 0., yy = 0., ret_val = 0.;
409 
410  if(fabs(MasaE) != 0.) {
411  xx = (ASonidoE * ASonidoE / ASonidoD / ASonidoD - 1.) / __Gamma::G1(Gamma);
412  yy = VelocidadE * VelocidadE / ASonidoD / ASonidoD / 2.;
413  ret_val = Gamma * MasaE * (xx + yy) / MasaD;
414  } else {
415  ret_val = 0.;
416  }
417  return ret_val;
418  } catch(exception & N) {
419  std::cout << "ERROR: TDeposito:EntalpiaEntrada en el deposito: " << FNumeroDeposito << std::endl;
420  std::cout << "Tipo de error: " << N.what() << std::endl;
421  throw Exception(N.what());
422  }
423 }
424 
425 // ---------------------------------------------------------------------------
426 // ---------------------------------------------------------------------------
427 
428 void TDeposito::AsignaCompresor(TCompresor *Compressor, int sentido) {
429  try {
430  if(FHayCompresor) {
431  std::cout << "ERROR: Each plenum only can have one compressor connected" << std::endl;
432  std::cout << " Check the input data" << std::endl;
433  throw Exception("");
434  } else {
435  if(FTipoDeposito != nmDepVolCte) {
436  std::cout << "ERROR: Compressor only can be connected to constant volume plenums" << std::endl;
437  std::cout << " Check the input data" << std::endl;
438  throw Exception("");
439  } else {
440  FHayCompresor = true;
441  FCompresor = Compressor;
442  FCompresorSentido = sentido;
443  }
444  }
445  } catch(exception & N) {
446  std::cout << "ERROR: TDeposito:AsignaCompresor en el deposito: " << FNumeroDeposito << std::endl;
447  std::cout << "Tipo de error: " << N.what() << std::endl;
448  throw Exception(N.what());
449  }
450 }
451 
452 // ---------------------------------------------------------------------------
453 // ---------------------------------------------------------------------------
454 
455 void TDeposito::CreaUnionED(int numero, int sentido) {
456  try {
457  if(FTipoDeposito == nmTurbinaSimple || FTipoDeposito == nmTurbinaTwin) {
458  std::cout << "ERROR: Turbines can not be connected to plenums directly" << std::endl;
459  std::cout << " Check the input data for connections between plenums" << std::endl;
460  throw Exception("");
461  } else if(FTipoDeposito == nmVenturi) {
462  std::cout << "ERROR: Venturis can not be connected to plenums directly" << std::endl;
463  std::cout << " Check the input data for connections between plenums" << std::endl;
464  throw Exception("");
465  } else if(FTipoDeposito == nmUnionDireccional) {
466  std::cout << "ERROR: Directional junctions can not be connected to plenums directly" << std::endl;
467  std::cout << " Check the input data for connections between plenums" << std::endl;
468  throw Exception("");
469  } else {
470  FNUnionesED++;
471  FUnionED.push_back(numero);
472  FSentidoUED.push_back(sentido);
473  }
474  } catch(exception & N) {
475  std::cout << "ERROR: TDeposito:CreaUnionED en el deposito: " << FNumeroDeposito << std::endl;
476  std::cout << "Tipo de error: " << N.what() << std::endl;
477  throw Exception(N.what());
478  }
479 }
480 
481 // ---------------------------------------------------------------------------
482 // ---------------------------------------------------------------------------
483 
484 void TDeposito::PutNUniones(int value) {
485  try {
486  if(!asgFNumUniones) {
487  FNumeroUniones = value;
488  asgFNumUniones = true;
489  if(FUnion == NULL) {
490  FUnion = new int[FNumeroUniones];
491  for(int i = 0; i < FNumeroUniones; i++) {
492  FUnion[i] = -1;
493  }
494  } else {
495  std::cout << "ERROR: The connections vector is already allocated" << std::endl;
496  throw Exception("");
497  }
498  if(FNumConductos == NULL) {
499  FNumConductos = new int[FNumeroUniones];
500  for(int i = 0; i < FNumeroUniones; i++) {
501  FNumConductos[i] = -1;
502  }
503  } else {
504  std::cout << "ERROR: The pipes vector is already allocated" << std::endl;
505  throw Exception("");
506  }
507  if(FNumNodos == NULL) {
508  FNumNodos = new int[FNumeroUniones];
509  for(int i = 0; i < FNumeroUniones; i++) {
510  FNumNodos[i] = -1;
511  }
512  } else {
513  std::cout << "ERROR: The nodes number vector is already allocated" << std::endl;
514  throw Exception("");
515  }
516  if(FSentidoFlujo == NULL) {
517  FSentidoFlujo = new int[FNumeroUniones];
518  for(int i = 0; i < FNumeroUniones; i++) {
519  FSentidoFlujo[i] = 0;
520  }
521  } else {
522  std::cout << "ERROR: The flow sense vector is already allocated" << std::endl;
523  throw Exception("");
524  }
525  } else {
526  std::cout << "ERROR: All connections of plenum " << FNumeroDeposito << " are already asigned" << std::endl;
527  throw Exception("");
528  }
529  } catch(exception & N) {
530  std::cout << "ERROR: TDeposito:PutNUniones en el deposito: " << FNumeroDeposito << std::endl;
531  std::cout << "Tipo de error: " << N.what() << std::endl;
532  throw Exception(N.what());
533  }
534 }
535 
536 // ---------------------------------------------------------------------------
537 // ---------------------------------------------------------------------------
538 
539 void TDeposito::PutUnion(int indice, int valor) {
540  try {
541  if(!asgFUnion) {
542  if(indice < FNumeroUniones) {
543  FUnion[indice] = valor;
544  }
545  asgFUnion = true;
546  for(int i = 0; i < FNumeroUniones; i++) {
547  if(FUnion[i] == -1) {
548  asgFUnion = false;
549  return;
550  }
551  }
552  } else {
553  std::cout << "ERROR: Se intentan definir mas nodos de los que se han declarado" << std::endl;
554  throw Exception("");
555  }
556  } catch(exception & N) {
557  std::cout << "ERROR: PutUnion en el depositito: " << FNumeroDeposito << std::endl;
558  std::cout << "Tipo de error: " << N.what() << std::endl;
559  throw Exception(N.what());
560  }
561 }
562 
563 // ---------------------------------------------------------------------------
564 // ---------------------------------------------------------------------------
565 
566 // ---------------------------------------------------------------------------
567 // ---------------------------------------------------------------------------
568 
569 void TDeposito::PutSentidoFlujo(int indice, int valor) {
570  try {
571  if(!asgFSentidoFlujo) {
572  if(indice < FNumeroUniones) {
573  FSentidoFlujo[indice] = valor;
574  }
575  asgFSentidoFlujo = true;
576  for(int i = 0; i < FNumeroUniones; i++) {
577  if(FSentidoFlujo[i] == 0) {
578  asgFSentidoFlujo = false;
579  return;
580  }
581  }
582  } else {
583  std::cout << "ERROR: Se intentan definir mas nodos de los que se han declarado" << std::endl;
584  throw Exception("");
585  }
586  } catch(exception & N) {
587  std::cout << "ERROR: PutSentidoFlujo en el depositito: " << FNumeroDeposito << std::endl;
588  std::cout << "Tipo de error: " << N.what() << std::endl;
589  throw Exception(N.what());
590  }
591 }
592 
593 // ---------------------------------------------------------------------------
594 // ---------------------------------------------------------------------------
595 
596 void TDeposito::PutNumConductos(int indice, int valor) {
597  try {
598  if(!asgFNumConductos) {
599  if(indice < FNumeroUniones) {
600  FNumConductos[indice] = valor;
601  } else {
602  std::cout << "ERROR: Se intentan definir mas nodos de los que se han declarado" << std::endl;
603  throw Exception("");
604  }
605  asgFNumConductos = true;
606  for(int i = 0; i < FNumeroUniones; i++) {
607  if(FNumConductos[indice] == -1) {
608  asgFNumConductos = false;
609  return;
610  }
611  }
612  } else {
613  std::cout << "ERROR: All pipes are already asigned" << std::endl;
614  throw Exception("");
615  }
616  } catch(exception & N) {
617  std::cout << "ERROR: PutNumConductos en el depositito: " << FNumeroDeposito << std::endl;
618  std::cout << "Tipo de error: " << N.what() << std::endl;
619  throw Exception(N.what());
620  }
621 }
622 
623 // ---------------------------------------------------------------------------
624 // ---------------------------------------------------------------------------
625 
626 void TDeposito::PutNumNodos(int indice, int valor) {
627  try {
628  if(!asgFNumNodos) {
629  if(indice < FNumeroUniones) {
630  FNumNodos[indice] = valor;
631  } else {
632  std::cout << "ERROR: The number of connection to the plenum is lower" << std::endl;
633  throw Exception("");
634  }
635  asgFNumNodos = true;
636  for(int i = 0; i < FNumeroUniones; i++) {
637  if(FNumNodos[indice] == -1) {
638  asgFNumNodos = false;
639  return;
640  }
641  }
642  } else {
643  std::cout << "ERROR: All connections are already asigned" << std::endl;
644  throw Exception("");
645  }
646  } catch(exception & N) {
647  std::cout << "ERROR: PutNumConductos en el deposito: " << FNumeroDeposito << std::endl;
648  std::cout << "Tipo de error: " << N.what() << std::endl;
649  throw Exception(N.what());
650  }
651 }
652 
653 // ---------------------------------------------------------------------------
654 // ---------------------------------------------------------------------------
655 
656 void TDeposito::ResultadosInstantaneosDep() {
657  try {
658  if(FResInstantDep.Pressure)
659  FResInstantDep.PresionINS = FPressure;
660  if(FResInstantDep.Temperature)
661  FResInstantDep.TemperaturaINS = __units::KTodegC(pow2(FAsonido * __cons::ARef) / (FGamma * FRMezcla));
662  if(FResInstantDep.Volumen)
663  FResInstantDep.VolumenINS = FVolumen;
664  if(FResInstantDep.Masa)
665  FResInstantDep.MasaINS = FMasa;
666  if(FResInstantDep.FraccionMasicaEspecies) {
667  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
668  FResInstantDep.FraccionINS[i] = FFraccionMasicaEspecie[i];
669  }
670  }
671  if(FResInstantDep.Gamma)
672  FResInstantDep.GammaINS = FGamma;
673 
674  } catch(exception & N) {
675  std::cout << "ERROR: TDeposito::ResultadosInstantaneosDep en el deposito: " << FNumeroDeposito << std::endl;
676  std::cout << "Tipo de error: " << N.what() << std::endl;
677  throw Exception(N.what());
678  }
679 }
680 
681 // ---------------------------------------------------------------------------
682 // ---------------------------------------------------------------------------
683 
684 void TDeposito::AcumulaResultadosMedios(double Actual) {
685  try {
686  double Delta = Actual - FResMediosDep.Tiempo0;
687  if(FResMediosDep.Pressure) {
688  FResMediosDep.PresionSUM += FPressure * Delta;
689  }
690  if(FResMediosDep.Temperature) {
691  FResMediosDep.TemperaturaSUM += __units::KTodegC(pow2(FAsonido * __cons::ARef) / (FGamma * FRMezcla)) * Delta;
692  }
693  if(FResMediosDep.FraccionMasicaEspecies) {
694  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
695  FResMediosDep.FraccionSUM[i] += FFraccionMasicaEspecie[i] * Delta;
696  }
697  }
698 
699  FResMediosDep.TiempoSUM += Delta;
700  FResMediosDep.Tiempo0 = Actual;
701  } catch(exception & N) {
702  std::cout << "ERROR: TDeposito::AcumulaResultadosMedios en el deposito: " << FNumeroDeposito << std::endl;
703  std::cout << "Tipo de error: " << N.what() << std::endl;
704  throw Exception(N.what());
705  }
706 }
707 
708 // ---------------------------------------------------------------------------
709 // ---------------------------------------------------------------------------
710 
711 void TDeposito::ResultadosMediosDep() {
712  try {
713  if(FNumResMed > 0) {
714  if(FResMediosDep.Pressure) {
715  FResMediosDep.PresionMED = FResMediosDep.PresionSUM / FResMediosDep.TiempoSUM;
716  FResMediosDep.PresionSUM = 0.;
717  }
718  if(FResMediosDep.Temperature) {
719  FResMediosDep.TemperaturaMED = FResMediosDep.TemperaturaSUM / FResMediosDep.TiempoSUM;
720  FResMediosDep.TemperaturaSUM = 0.;
721  }
722  if(FResMediosDep.FraccionMasicaEspecies) {
723  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
724  FResMediosDep.FraccionMED[i] = FResMediosDep.FraccionSUM[i] / FResMediosDep.TiempoSUM;
725  FResMediosDep.FraccionSUM[i] = 0.;
726  }
727  }
728  FResMediosDep.TiempoSUM = 0;
729  }
730  } catch(exception & N) {
731  std::cout << "ERROR: TDeposito::ResultadosMediosDep en el deposito: " << FNumeroDeposito << std::endl;
732  std::cout << "Tipo de error: " << N.what() << std::endl;
733  throw Exception(N.what());
734  }
735 }
736 
737 // ---------------------------------------------------------------------------
738 // ---------------------------------------------------------------------------
739 
740 void TDeposito::ReadInstantaneousResultsDep(const char *FileWAM, fpos_t &filepos) {
741  int nvars = 0, var = 0;
742  try {
743  FILE *fich = fopen(FileWAM, "r");
744  fsetpos(fich, &filepos);
745 
746  fscanf(fich, "%d ", &nvars);
747  for(int i = 0; i < nvars; i++) {
748  fscanf(fich, "%d ", &var);
749  switch(var) {
750  case 0:
751  FResInstantDep.Pressure = true;
752  break;
753  case 1:
754  FResInstantDep.Temperature = true;
755  break;
756  case 2:
757  FResInstantDep.Volumen = true;
758  break;
759  case 3:
760  FResInstantDep.Masa = true;
761  break;
762  case 4:
763  FResInstantDep.FraccionMasicaEspecies = true;
764  break;
765  case 5:
766  FResInstantDep.Gamma = true;
767  break;
768  default:
769  std::cout << "Instantaneous results in plenum " << FNumeroDeposito << " does not exist " << std::endl;
770  }
771  }
772 
773  fgetpos(fich, &filepos);
774  fclose(fich);
775  } catch(exception & N) {
776  std::cout << "ERROR: TDeposito::ReadInstantaneousResultsDep en el deposito: " << FNumeroDeposito << std::endl;
777  std::cout << "Tipo de error: " << N.what() << std::endl;
778  throw Exception(N.what());
779  }
780 }
781 
782 // ---------------------------------------------------------------------------
783 // ---------------------------------------------------------------------------
784 
785 void TDeposito::ReadAverageResultsDep(const char *FileWAM, fpos_t &filepos) {
786  int nvars = 0, var = 0;
787  try {
788  FILE *fich = fopen(FileWAM, "r");
789  fsetpos(fich, &filepos);
790 
791  fscanf(fich, "%d ", &FNumResMed);
792  for(int i = 0; i < FNumResMed; i++) {
793  fscanf(fich, "%d ", &var);
794  switch(var) {
795  case 0:
796  FResMediosDep.Pressure = true;
797  break;
798  case 1:
799  FResMediosDep.Temperature = true;
800  break;
801  case 2:
802  FResMediosDep.FraccionMasicaEspecies = true;
803  break;
804  default:
805  std::cout << "Average result in plenum " << FNumeroDeposito << " does not exist " << std::endl;
806  }
807  }
808 
809  fgetpos(fich, &filepos);
810  fclose(fich);
811  } catch(exception & N) {
812  std::cout << "ERROR: TDeposito::ReadAverageResultsDep en el deposito: " << FNumeroDeposito << std::endl;
813  std::cout << "Tipo de error: " << N.what() << std::endl;
814  throw Exception(N.what());
815  }
816 }
817 
818 // ---------------------------------------------------------------------------
819 // ---------------------------------------------------------------------------
820 
821 void TDeposito::HeaderInstantaneousResultsDep(stringstream& insoutput, stEspecies *DatosEspecies) {
822  try {
823  // FILE *fich=fopen(FileSALIDA,"a");
824  std::string Label;
825 
826  if(FResInstantDep.Pressure) {
827  Label = "\t" + PutLabel(501) + std::to_string(FNumeroDeposito) + PutLabel(908);
828  insoutput << Label.c_str();
829  }
830  if(FResInstantDep.Temperature) {
831  Label = "\t" + PutLabel(502) + std::to_string(FNumeroDeposito) + PutLabel(910);
832  insoutput << Label.c_str();
833  }
834  if(FResInstantDep.Volumen) {
835  Label = "\t" + PutLabel(503) + std::to_string(FNumeroDeposito) + PutLabel(912);
836  insoutput << Label.c_str();
837  }
838  if(FResInstantDep.Masa) {
839  Label = "\t" + PutLabel(504) + std::to_string(FNumeroDeposito) + PutLabel(913);
840  insoutput << Label.c_str();
841  }
842  if(FResInstantDep.FraccionMasicaEspecies) {
843  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
844  Label = "\t" + PutLabel(505) + DatosEspecies[i].Nombre + PutLabel(506) + std::to_string(FNumeroDeposito) + PutLabel(
845  901);
846  insoutput << Label.c_str();
847  }
848  }
849  if(FResInstantDep.Gamma) {
850  Label = "\t" + PutLabel(507) + std::to_string(FNumeroDeposito) + PutLabel(901);
851  insoutput << Label.c_str();
852  }
853 
854  // fclose(fich);
855  } catch(exception & N) {
856  std::cout << "ERROR: TDeposito::CabeceraResultadosInstaneosDep en el deposito: " << FNumeroDeposito << std::endl;
857  std::cout << "Tipo de error: " << N.what() << std::endl;
858  throw Exception(N.what());
859  }
860 }
861 
862 // ---------------------------------------------------------------------------
863 // ---------------------------------------------------------------------------
864 
865 void TDeposito::ImprimeResultadosInstantaneosDep(stringstream& insoutput) {
866  try {
867  // FILE *fich=fopen(FileSALIDA,"a");
868 
869  if(FResInstantDep.Pressure)
870  insoutput << "\t" << FResInstantDep.PresionINS;
871  if(FResInstantDep.Temperature)
872  insoutput << "\t" << FResInstantDep.TemperaturaINS;
873  if(FResInstantDep.Volumen)
874  insoutput << "\t" << FResInstantDep.VolumenINS;
875  if(FResInstantDep.Masa)
876  insoutput << "\t" << FResInstantDep.MasaINS;
877  if(FResInstantDep.FraccionMasicaEspecies) {
878  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
879  insoutput << "\t" << FResInstantDep.FraccionINS[i];
880  }
881  }
882  if(FResInstantDep.Gamma)
883  insoutput << "\t" << FResInstantDep.GammaINS;
884 
885  // fclose(fich);
886  } catch(exception & N) {
887  std::cout << "ERROR: TDeposito::ImprimeResultadosInstaneosDep en el deposito: " << FNumeroDeposito << std::endl;
888  std::cout << "Tipo de error: " << N.what() << std::endl;
889  throw Exception(N.what());
890  }
891 }
892 
893 // ---------------------------------------------------------------------------
894 // ---------------------------------------------------------------------------
895 
896 void TDeposito::HeaderAverageResultsDep(stringstream& medoutput, stEspecies *DatosEspecies) {
897  try {
898  // FILE *fich=fopen(FileSALIDA,"a");
899  std::string Label;
900  if(FNumResMed > 0) {
901  if(FResMediosDep.Pressure) {
902  Label = "\t" + PutLabel(501) + std::to_string(FNumeroDeposito) + PutLabel(908);
903  medoutput << Label.c_str();
904  }
905  if(FResMediosDep.Temperature) {
906  Label = "\t" + PutLabel(502) + std::to_string(FNumeroDeposito) + PutLabel(910);
907  medoutput << Label.c_str();
908  }
909  if(FResMediosDep.FraccionMasicaEspecies) {
910  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
911  Label = "\t" + PutLabel(505) + DatosEspecies[i].Nombre + PutLabel(506) + std::to_string(FNumeroDeposito) + PutLabel(
912  901);
913  medoutput << Label.c_str();
914  }
915  }
916  }
917  // fclose(fich);
918  } catch(exception & N) {
919  std::cout << "ERROR: TDeposito::HeaderAverageResultsDep en el deposito: " << FNumeroDeposito << std::endl;
920  std::cout << "Tipo de error: " << N.what() << std::endl;
921  throw Exception(N.what());
922  }
923 }
924 
925 // ---------------------------------------------------------------------------
926 // ---------------------------------------------------------------------------
927 
928 void TDeposito::ImprimeResultadosMediosDep(stringstream& medoutput) {
929  try {
930  // FILE *fich=fopen(FileSALIDA,"a");
931  if(FNumResMed > 0) {
932  if(FResMediosDep.Pressure)
933  medoutput << "\t" << FResMediosDep.PresionMED;
934  if(FResMediosDep.Temperature)
935  medoutput << "\t" << FResMediosDep.TemperaturaMED;
936  if(FResMediosDep.FraccionMasicaEspecies) {
937  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
938  medoutput << "\t" << FResMediosDep.FraccionMED[i];
939  }
940  }
941  }
942  // fclose(fich);
943  } catch(exception & N) {
944  std::cout << "ERROR: TDeposito::ImprimeResultadosMediosDep en el deposito: " << FNumeroDeposito << std::endl;
945  std::cout << "Tipo de error: " << N.what() << std::endl;
946  throw Exception(N.what());
947  }
948 }
949 
950 // ---------------------------------------------------------------------------
951 // ---------------------------------------------------------------------------
952 
953 double TDeposito::CriterioEstabilidad(double TMinimo) {
954  double DeltTMin = 0., MasaFinal = 0., g = 0.;
955  int SignoFlujoED = 0;
956 
957  try {
958 
959  DeltTMin = TMinimo - FTime;
960  MasaFinal = 0.;
961  for(int i = 0; i < FNumeroUniones; i++) {
962  if(FCCDeposito[i]->getTipoCC() == nmPipeToPlenumConnection) {
963  g = (double) - dynamic_cast<TCCDeposito*>(FCCDeposito[i])->getMassflow();
964  if(!(FCCDeposito[i]->getUnionDPF())) {
965  MasaFinal += g * DeltTMin * FCCDeposito[i]->GetTuboExtremo(0).Pipe->getNumeroConductos();
966  } else if(FCCDeposito[i]->getUnionDPF()) {
967 #ifdef ParticulateFilter
968  MasaFinal += g * DeltTMin * FCCDeposito[i]->GetTuboExtremo(0).DPF->GetCanal(FCCDeposito[i]->GetTuboExtremo(0).NumeroHaz,
969  0)->getNumeroCanales();
970 #endif
971  }
972  }
973  }
974  for(int i = 1; i < FNumeroUnionesED; i++) {
975  if(FCCUnionEntreDep[i]->getTipoCC() == nmUnionEntreDepositos) {
976  if(FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(FCCUnionEntreDep[i])->getNumeroDeposito1()) {
977  SignoFlujoED = dynamic_cast<TCCUnionEntreDepositos*>(FCCUnionEntreDep[i])->getSentidoFlujoED1();
978  } else if(FNumeroDeposito == dynamic_cast<TCCUnionEntreDepositos*>(FCCUnionEntreDep[i])->getNumeroDeposito2()) {
979  SignoFlujoED = dynamic_cast<TCCUnionEntreDepositos*>(FCCUnionEntreDep[i])->getSentidoFlujoED2();
980  }
981  g = (double) SignoFlujoED * dynamic_cast<TCCDeposito*>(FCCDeposito[i])->getMassflow();
982  MasaFinal += g * DeltTMin;
983  }
984  }
985 
986  if(FHayCompresor) {
987  g = (double) FCompresorSentido * FCompresor->getMassflow();
988  MasaFinal += g * DeltTMin;
989  }
990 
991  MasaFinal += FMasa;
992  return MasaFinal;
993  } catch(exception & N) {
994  std::cout << "ERROR: TDeposito::CriterioEstabilidad en el deposito: " << FNumeroDeposito << std::endl;
995  std::cout << "Tipo de error: " << N.what() << std::endl;
996  throw Exception(N.what());
997  }
998 }
999 
1000 // ---------------------------------------------------------------------------
1001 // ---------------------------------------------------------------------------
1002 
1003 void TDeposito::SalidaGeneralDep(stEspecies *DatosEspecies) {
1004  try {
1005 
1006  if(FNumResMed > 0) {
1007  std::cout << std::endl;
1008  std::cout << "***************************************" << std::endl;
1009  std::cout << "****** AVERAGE VALUES IN PLENUMS ******" << std::endl;
1010  std::cout << "***************************************" << std::endl << std::endl;
1011  std::cout << "In plenum: " << FNumeroDeposito << std::endl;
1012  if(FResMediosDep.Pressure)
1013  std::cout << " Pressure: " << FResMediosDep.PresionMED << " bares" << std::endl;
1014  if(FResMediosDep.Temperature)
1015  std::cout << " Temperature: " << FResMediosDep.TemperaturaMED << " degC" << std::endl << std::endl;
1016  if(FResMediosDep.FraccionMasicaEspecies) {
1017  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
1018  std::cout << " Average mass fraction of " << DatosEspecies[i].Nombre << ": " << FResMediosDep.FraccionMED[i] << " (-)"
1019  << std::endl;
1020  }
1021  }
1022  std::cout << std::endl;
1023  }
1024 
1025  } catch(exception & N) {
1026  std::cout << "ERROR: TDeposito::SalidaGeneralDep en el deposito: " << FNumeroDeposito << std::endl;
1027  std::cout << "Tipo de error: " << N.what() << std::endl;
1028  throw Exception(N.what());
1029  }
1030 }
1031 
1032 // ---------------------------------------------------------------------------
1033 // ---------------------------------------------------------------------------
1034 
1035 TCondicionContorno* TDeposito::GetCCUnionEntreDep(int i) {
1036  try {
1037  return FCCUnionEntreDep[i];
1038  } catch(exception & N) {
1039  std::cout << "ERROR: TDeposito::GetCCUnionEntreDep en el deposito: " << FNumeroDeposito << std::endl;
1040  std::cout << "Tipo de error: " << N.what() << std::endl;
1041  throw Exception(N.what());
1042  }
1043 }
1044 
1045 // ---------------------------------------------------------------------------
1046 // ---------------------------------------------------------------------------
1047 
1048 TCondicionContorno* TDeposito::GetCCDeposito(int i) {
1049  try {
1050  return FCCDeposito[i];
1051  } catch(exception & N) {
1052  std::cout << "ERROR: TDeposito::GetCCDeposito en el deposito: " << FNumeroDeposito << std::endl;
1053  std::cout << "Tipo de error: " << N.what() << std::endl;
1054  throw Exception(N.what());
1055  }
1056 }
1057 
1058 // ---------------------------------------------------------------------------
1059 // ---------------------------------------------------------------------------
1060 //
1062 // try {
1063 //
1064 // FCalculadoPaso = valor;
1065 //
1066 // }
1067 // catch(Exception & N) {
1068 // std::cout << "ERROR: TDeposito::PutCalculadoPaso en el deposito: " << FNumeroDeposito << std::endl;
1069 // std::cout << "Tipo de error: " << N.what() << std::endl;
1070 // throw Exception(N.what());
1071 // }
1072 //}
1073 
1074 // ---------------------------------------------------------------------------
1075 // ---------------------------------------------------------------------------
1076 
1077 void TDeposito::ActualizaTiempo(double TiempoActual) {
1078  try {
1079 
1080  FTime = TiempoActual;
1081 
1082  } catch(exception & N) {
1083  std::cout << "ERROR: TDeposito::PutCalculadoPaso en el deposito: " << FNumeroDeposito << std::endl;
1084  std::cout << "Tipo de error: " << N.what() << std::endl;
1085  throw Exception(N.what());
1086  }
1087 }
1088 // ---------------------------------------------------------------------------
1089 // ---------------------------------------------------------------------------
1090 
1091 double TDeposito::GetFraccionMasicaEspecie(int i) {
1092  try {
1093  return FFraccionMasicaEspecie[i];
1094  } catch(exception & N) {
1095  std::cout << "ERROR: TDeposito::GetConcentracionEspecie en la condicion de contorno: " << FNumeroDeposito << std::endl;
1096  std::cout << "Tipo de error: " << N.what() << std::endl;
1097  throw Exception(N.what());
1098  }
1099 }
1100 // ---------------------------------------------------------------------------
1101 // ---------------------------------------------------------------------------
1102 
1103 #pragma package(smart_init)
stEspecies
Definition: Globales.h:297
TCCUnionEntreDepositos
Definition: TCCUnionEntreDepositos.h:41
TCompresor
Definition: TCompresor.h:47
TCondicionContorno
Definition: TCondicionContorno.h:54
PutLabel
std::string PutLabel(int idx)
Returns an integer.
Definition: labels.cpp:475
Exception
Custom exception class.
Definition: Exception.hpp:39
TCCCompresor
Definition: TCCCompresor.h:44
TTubo.h
TCCDeposito
Definition: TCCDeposito.h:40
pow2
T pow2(T x)
Returns x to the power of 2.
Definition: Math_wam.h:88