33 #include "TCCDeposito.h"
35 #include "TTipoValvula.h"
40 TVenturi::TVenturi(
int i, nmTipoCalculoEspecies SpeciesModel,
int numeroespecies, nmCalculoGamma GammaCalculation,
42 TDepVolCteBase(i, nmVenturi, SpeciesModel, numeroespecies, GammaCalculation, ThereIsEGR) {
44 asgNumeroVenturi =
false;
46 FResInstantVenturi.PresionEntrada =
false;
47 FResInstantVenturi.PresionGarganta =
false;
48 FResInstantVenturi.MachEntrada =
false;
49 FResInstantVenturi.MachGarganta =
false;
50 FResInstantVenturi.VelEntrada =
false;
51 FResInstantVenturi.VelLateral =
false;
52 FResInstantVenturi.GastoEntrada =
false;
53 FResInstantVenturi.GastoLateral =
false;
55 FResMediosVenturi.PresionEntrada =
false;
56 FResMediosVenturi.PresionGarganta =
false;
57 FResMediosVenturi.MachEntrada =
false;
58 FResMediosVenturi.MachGarganta =
false;
59 FResMediosVenturi.VelEntrada =
false;
60 FResMediosVenturi.VelLateral =
false;
61 FResMediosVenturi.GastoEntrada =
false;
62 FResMediosVenturi.GastoLateral =
false;
64 FResMediosVenturi.Tiempo0 = 0.;
65 FResMediosVenturi.TiempoSUM = 0.;
66 FResMediosVenturi.PresionEntradaSUM = 0.;
67 FResMediosVenturi.PresionGargantaSUM = 0.;
68 FResMediosVenturi.MachEntradaSUM = 0.;
69 FResMediosVenturi.MachGargantaSUM = 0.;
70 FResMediosVenturi.VelEntradaSUM = 0.;
71 FResMediosVenturi.VelLateralSUM = 0.;
72 FResMediosVenturi.GastoEntradaSUM = 0.;
73 FResMediosVenturi.GastoLateralSUM = 0.;
80 TVenturi::~TVenturi() {
86 void TVenturi::LeeDatosVenturi(
const char *FileWAM, fpos_t &filepos) {
89 FILE *fich = fopen(FileWAM,
"r");
90 fsetpos(fich, &filepos);
92 fscanf(fich,
"%d ", &numid);
93 fscanf(fich,
"%d %d %d ", &FNodoEntrada, &FNodoSalida, &FNodoLateral);
94 fscanf(fich,
"%lf %lf %lf ", &FRelacionSecciones, &FRendimientoVenturi, &FPerdidasCalor);
96 fgetpos(fich, &filepos);
99 }
catch(exception & N) {
100 std::cout <<
"ERROR: TVenturi::LeeDatosVenturi en el deposito: " << FNumeroDeposito << std::endl;
109 void TVenturi::ActualizaPropiedades(
double TimeCalculo) {
113 double MasaEntrante, FraccionMasicaAcum = 0.;
115 double g = 0., v = 0., a = 0., m = 0.;
122 DeltaT = TimeCalculo - FTime;
124 if(FCalculoEspecies == nmCalculoCompleto) {
126 FRMezcla = CalculoCompletoRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
127 FCalculoGamma, nmMEP);
128 FCpMezcla = CalculoCompletoCpMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FFraccionMasicaEspecie[2], 0,
129 __units::degCToK(FTemperature), FCalculoGamma, nmMEP);
130 FGamma = CalculoCompletoGamma(FRMezcla, FCpMezcla, FCalculoGamma);
132 }
else if(FCalculoEspecies == nmCalculoSimple) {
134 FRMezcla = CalculoSimpleRMezcla(FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1], FCalculoGamma, nmMEP);
135 FCvMezcla = CalculoSimpleCvMezcla(__units::degCToK(FTemperature), FFraccionMasicaEspecie[0], FFraccionMasicaEspecie[1],
136 FCalculoGamma, nmMEP);
137 FGamma = CalculoSimpleGamma(FRMezcla, FCvMezcla, FCalculoGamma);
141 FGamma1 = __Gamma::G1(FGamma);
142 FGamma2 = __Gamma::G2(FGamma);
143 FGamma3 = __Gamma::G3(FGamma);
144 FGamma5 = __Gamma::G5(FGamma);
145 FGamma6 = __Gamma::G6(FGamma);
147 bool Converge =
false;
148 bool FirstStep =
true;
150 double Asonido0 = FAsonido;
151 double Asonido1 = FAsonido;
157 for(
int i = 0; i < FNumeroUniones; i++) {
158 if(
dynamic_cast<TCCDeposito*
>(FCCDeposito[i])->getSentidoFlujo() == nmEntrante) {
160 }
else if(
dynamic_cast<TCCDeposito*
>(FCCDeposito[i])->getSentidoFlujo() == nmSaliente) {
163 g = (double) -
dynamic_cast<TCCDeposito*
>(FCCDeposito[i])->getMassflow();
164 v = (double) SignoFlujo *
dynamic_cast<TCCDeposito*
>(FCCDeposito[i])->getVelocity();
165 a =
dynamic_cast<TCCDeposito*
>(FCCDeposito[i])->getSpeedSound();
166 m = g * DeltaT * FCCDeposito[i]->GetTuboExtremo(0).Pipe->getNumeroConductos();
169 for(
int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
170 FMasaEspecie[j] += FCCDeposito[i]->GetFraccionMasicaEspecie(j) * m;
174 H += EntalpiaEntrada(a, v, m, Asonido1, FMasa, FCCDeposito[i]->getGamma());
179 FMasa = FMasa0 + MasaEntrante;
180 for(
int j = 0; j < FNumeroEspecies - 2; j++) {
181 FFraccionMasicaEspecie[j] = FMasaEspecie[j] / FMasa;
182 FraccionMasicaAcum += FFraccionMasicaEspecie[j];
184 FFraccionMasicaEspecie[FNumeroEspecies - 2] = 1. - FraccionMasicaAcum;
186 FFraccionMasicaEspecie[FNumeroEspecies - 1] = FMasaEspecie[FNumeroEspecies - 1] / FMasa;
191 Energia = pow(FMasa / FMasa0 * exp((H + H0) / 2), FGamma1);
192 Asonido1 = FAsonido * sqrt(Energia);
193 Error = (Diff = Asonido1 - Asonido0, fabs(Diff)) / Asonido1;
201 FTemperature = __units::KTodegC(
pow2(FAsonido * __cons::ARef) / (FGamma * FRMezcla));
202 FPressure = __units::PaToBar(
pow2(__cons::ARef * FAsonido) / FGamma / FVolumen * FMasa);
203 FPresionIsen = pow(FPressure / FPresRef, FGamma5);
205 }
catch(exception & N) {
206 std::cout <<
"ERROR: TVenturi::ActualizaPropiedades en el venturi: " << FNumeroVenturi << std::endl;
207 std::cout <<
"Tipo de error: " << N.what() << std::endl;
215 void TVenturi::AsignaEntradaSalidaLateralCC() {
218 if(FTipoDeposito == nmVenturi) {
219 for(
int i = 0; i < FNumeroUniones; i++) {
220 if(FCCDeposito[i]->getNumeroCC() == FNodoEntrada) {
221 FCCEntrada = FCCDeposito[i];
222 }
else if(FCCDeposito[i]->getNumeroCC() == FNodoSalida) {
223 FCCSalida = FCCDeposito[i];
224 }
else if(FCCDeposito[i]->getNumeroCC() == FNodoLateral) {
225 FCCLateral = FCCDeposito[i];
230 }
catch(exception & N) {
231 std::cout <<
"ERROR: TVenturi::AsignaEntradaSalidaLateralCC en el venturi " << FNumeroVenturi << std::endl;
232 std::cout <<
"Tipo de error: " << N.what() << std::endl;
240 void TVenturi::CalculaVenturi() {
246 double Velocity = 0., Speedsound = 0.;
247 double Converge = 0., VelGarganta0 = 0., VelGarganta1 = 0.;
248 double Mach0 = 0., Mach1 = 0.;
250 double TempGarganta = 0., TempEntrada = 0.;
251 int SentidoEntrada = 0, SentidoSalida = 0;
253 TempEntrada = __units::degCToK(FTemperature);
255 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmEntrante) {
257 }
else if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmSaliente) {
261 Velocity = SentidoEntrada *
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getVelocity();
262 Speedsound =
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSpeedSound();
266 dynamic_cast<TCCDeposito*
>(FCCEntrada)->putMachVenturi(Velocity / Speedsound);
267 dynamic_cast<TCCDeposito*
>(FCCSalida)->putMachVenturi(0.);
271 if(
dynamic_cast<TCCDeposito*
>(FCCSalida)->getSentidoFlujo() == nmEntrante) {
273 }
else if(
dynamic_cast<TCCDeposito*
>(FCCSalida)->getSentidoFlujo() == nmSaliente) {
276 Velocity = SentidoSalida *
dynamic_cast<TCCDeposito*
>(FCCSalida)->getVelocity();
277 Speedsound =
dynamic_cast<TCCDeposito*
>(FCCSalida)->getSpeedSound();
278 dynamic_cast<TCCDeposito*
>(FCCEntrada)->putMachVenturi(0.);
280 dynamic_cast<TCCDeposito*
>(FCCSalida)->putMachVenturi(Velocity / Speedsound);
285 Mach0 = Velocity / FAsonido;
286 Mach1 = Mach0 * FRelacionSecciones;
288 FCpMezcla = FGamma * FRMezcla / FGamma1;
290 TempGarganta = TempEntrada - pow((FRelacionSecciones - 1.) * Velocity * __cons::ARef, 2.) / (2. * FCpMezcla);
293 VelGarganta0 = Velocity;
294 VelGarganta1 = Velocity;
296 if(Velocity > 0. && FRelacionSecciones > 0.) {
297 while(Converge < 0.99999 || Converge > 1.00001) {
298 if(Mach1 > 0.99999999) {
300 printf(
"N. de Mach en el venturi situado en el deposito %d = 1. ", FNumeroDeposito);
301 printf(
"Velocity = %g (m/s) \t", VelGarganta1 * __cons::ARef);
302 printf(
"Temperature = %g (degC)\n", TempGarganta);
303 }
else if(Mach1 == 1.) {
304 VelGarganta1 = sqrt(((1. + FGamma1 / 2. *
pow2(Mach0)) / (FGamma2 *
pow2(Mach0) / 2.) *
pow2(Velocity)));
306 VelGarganta1 = FRelacionSecciones * Velocity * pow(TempEntrada / TempGarganta, FGamma6);
309 TempGarganta = TempEntrada - (
pow2(VelGarganta1 * __cons::ARef) -
pow2(Velocity * __cons::ARef)) / (2. * FCpMezcla);
311 Mach1 = VelGarganta1 * __cons::ARef / sqrt(FGamma * FRMezcla * TempGarganta);
312 Converge = VelGarganta1 / VelGarganta0;
313 VelGarganta0 = VelGarganta1;
315 VelGarganta0 = sqrt((FRendimientoVenturi *
pow2(VelGarganta0) - FPerdidasCalor * 2.));
317 dynamic_cast<TCCDeposito*
>(FCCLateral)->putMachVenturi((VelGarganta0 * __cons::ARef) / pow(
318 FGamma * FRMezcla * TempGarganta, 0.5));
321 dynamic_cast<TCCDeposito*
>(FCCLateral)->putMachVenturi(0.);
324 }
catch(exception & N) {
325 std::cout <<
"ERROR: TVenturi::CalculaVenturi en el venturi: " << FNumeroVenturi << std::endl;
326 std::cout <<
"Tipo de error: " << N.what() << std::endl;
355 void TVenturi::LeeResultadosInstantVenturi(
const char *FileWAM, fpos_t &filepos) {
357 int nvars = 0, var = 0;
360 FILE *fich = fopen(FileWAM,
"r");
361 fsetpos(fich, &filepos);
363 fscanf(fich,
"%d ", &nvars);
364 for(
int i = 0; i < nvars; ++i) {
365 fscanf(fich,
"%d ", &var);
368 FResInstantVenturi.PresionEntrada =
true;
371 FResInstantVenturi.PresionGarganta =
true;
374 FResInstantVenturi.MachEntrada =
true;
377 FResInstantVenturi.MachGarganta =
true;
380 FResInstantVenturi.VelEntrada =
true;
383 FResInstantVenturi.VelLateral =
true;
386 FResInstantVenturi.GastoEntrada =
true;
389 FResInstantVenturi.GastoLateral =
true;
392 std::cout <<
"Resultados instantaneos en venturi " << FNumeroVenturi <<
" no implementados " << std::endl;
396 fgetpos(fich, &filepos);
398 }
catch(exception & N) {
399 std::cout <<
"ERROR: TVenturi::LeeResultadosInstantVenturi en el venturi: " << FNumeroVenturi << std::endl;
400 std::cout <<
"Tipo de error: " << N.what() << std::endl;
408 void TVenturi::CabeceraResultadosInstantVenturi(stringstream& insoutput) {
413 if(FResInstantVenturi.PresionEntrada) {
414 Label =
"\t" +
PutLabel(521) + std::to_string(FNumeroVenturi) +
PutLabel(908);
415 insoutput << Label.c_str();
417 if(FResInstantVenturi.PresionGarganta) {
418 Label =
"\t" +
PutLabel(522) + std::to_string(FNumeroVenturi) +
PutLabel(908);
419 insoutput << Label.c_str();
421 if(FResInstantVenturi.MachEntrada) {
422 Label =
"\t" +
PutLabel(523) + std::to_string(FNumeroVenturi) +
PutLabel(901);
423 insoutput << Label.c_str();
425 if(FResInstantVenturi.MachGarganta) {
426 Label =
"\t" +
PutLabel(524) + std::to_string(FNumeroVenturi) +
PutLabel(901);
427 insoutput << Label.c_str();
429 if(FResInstantVenturi.VelEntrada) {
430 Label =
"\t" +
PutLabel(525) + std::to_string(FNumeroVenturi) +
PutLabel(909);
431 insoutput << Label.c_str();
433 if(FResInstantVenturi.VelLateral) {
434 Label =
"\t" +
PutLabel(526) + std::to_string(FNumeroVenturi) +
PutLabel(909);
435 insoutput << Label.c_str();
437 if(FResInstantVenturi.GastoEntrada) {
438 Label =
"\t" +
PutLabel(527) + std::to_string(FNumeroVenturi) +
PutLabel(904);
439 insoutput << Label.c_str();
441 if(FResInstantVenturi.GastoLateral) {
442 Label =
"\t" +
PutLabel(528) + std::to_string(FNumeroVenturi) +
PutLabel(904);
443 insoutput << Label.c_str();
447 }
catch(exception & N) {
448 std::cout <<
"ERROR: TVenturi::CabeceraResultadosInstantVenturi en el venturi: " << FNumeroVenturi << std::endl;
449 std::cout <<
"Tipo de error: " << N.what() << std::endl;
457 void TVenturi::ImprimeResultadosInstantVenturi(stringstream& insoutput) {
461 if(FResInstantVenturi.PresionEntrada)
462 insoutput <<
"\t" << FResInstantVenturi.PresionEntradaINS;
463 if(FResInstantVenturi.PresionGarganta)
464 insoutput <<
"\t" << FResInstantVenturi.PresionGargantaINS;
465 if(FResInstantVenturi.MachEntrada)
466 insoutput <<
"\t" << FResInstantVenturi.MachEntradaINS;
467 if(FResInstantVenturi.MachGarganta)
468 insoutput <<
"\t" << FResInstantVenturi.MachGargantaINS;
469 if(FResInstantVenturi.VelEntrada)
470 insoutput <<
"\t" << FResInstantVenturi.VelEntradaINS;
471 if(FResInstantVenturi.VelLateral)
472 insoutput <<
"\t" << FResInstantVenturi.VelLateralINS;
473 if(FResInstantVenturi.GastoEntrada)
474 insoutput <<
"\t" << FResInstantVenturi.GastoEntradaINS;
475 if(FResInstantVenturi.GastoLateral)
476 insoutput <<
"\t" << FResInstantVenturi.GastoLateralINS;
479 }
catch(exception & N) {
480 std::cout <<
"ERROR: TVenturi::ImprimeResultadosInstantVenturi en el venturi: " << FNumeroVenturi << std::endl;
481 std::cout <<
"Tipo de error: " << N.what() << std::endl;
489 void TVenturi::CalculaResultadosVenturi() {
491 int SentidoEntrada = 0, SentidoLateral = 0, SentidoSalida = 0;
492 if(FResInstantVenturi.PresionEntrada) {
493 FResInstantVenturi.PresionEntradaINS = FPressure;
495 if(FResInstantVenturi.PresionGarganta) {
496 FResInstantVenturi.PresionGargantaINS = FPressure / pow(1 + FGamma1 / 2 *
pow2(
dynamic_cast<TCCDeposito*
>
497 (FCCLateral)->getMachVenturi()), FGamma / FGamma1);
499 if(FResInstantVenturi.MachEntrada) {
500 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMachVenturi() != 0) {
501 FResInstantVenturi.MachEntradaINS = fabs(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMachVenturi());
503 FResInstantVenturi.MachEntradaINS = -fabs(
dynamic_cast<TCCDeposito*
>(FCCSalida)->getMachVenturi());
506 if(FResInstantVenturi.MachGarganta) {
507 FResInstantVenturi.MachGargantaINS = fabs(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getMachVenturi());
509 if(FResInstantVenturi.VelEntrada) {
510 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMachVenturi() != 0) {
511 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmEntrante) {
513 }
else if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmSaliente) {
516 FResInstantVenturi.VelEntradaINS = SentidoEntrada * __cons::ARef *
dynamic_cast<TCCDeposito*
>
517 (FCCEntrada)->getVelocity();
519 if(
dynamic_cast<TCCDeposito*
>(FCCSalida)->getSentidoFlujo() == nmEntrante) {
521 }
else if(
dynamic_cast<TCCDeposito*
>(FCCSalida)->getSentidoFlujo() == nmSaliente) {
524 FResInstantVenturi.VelEntradaINS = SentidoSalida * __cons::ARef *
dynamic_cast<TCCDeposito*
>(FCCSalida)->getVelocity();
528 if(FResInstantVenturi.VelLateral) {
529 if(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getSentidoFlujo() == nmEntrante) {
531 }
else if(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getSentidoFlujo() == nmSaliente) {
534 FResInstantVenturi.VelLateralINS = SentidoLateral * __cons::ARef *
dynamic_cast<TCCDeposito*
>
535 (FCCLateral)->getVelocity();
537 if(FResInstantVenturi.GastoEntrada) {
538 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMachVenturi() != 0) {
539 FResInstantVenturi.GastoEntradaINS = -
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMassflow();
541 FResInstantVenturi.GastoEntradaINS = -
dynamic_cast<TCCDeposito*
>(FCCSalida)->getMassflow();
544 if(FResInstantVenturi.GastoLateral) {
545 FResInstantVenturi.GastoLateralINS = -
dynamic_cast<TCCDeposito*
>(FCCLateral)->getMassflow();
548 }
catch(exception & N) {
549 std::cout <<
"ERROR: TVenturi::CalculaResultadosVenturi en el venturi: " << FNumeroVenturi << std::endl;
550 std::cout <<
"Tipo de error: " << N.what() << std::endl;
558 void TVenturi::ReadAverageResultsVenturi(
const char *FileWAM, fpos_t &filepos) {
559 int nvars = 0, var = 0;
562 FILE *fich = fopen(FileWAM,
"r");
563 fsetpos(fich, &filepos);
565 fscanf(fich,
"%d ", &nvars);
566 for(
int i = 0; i < nvars; ++i) {
567 fscanf(fich,
"%d ", &var);
570 FResMediosVenturi.PresionEntrada =
true;
573 FResMediosVenturi.PresionGarganta =
true;
576 FResMediosVenturi.MachEntrada =
true;
579 FResMediosVenturi.MachGarganta =
true;
582 FResMediosVenturi.VelEntrada =
true;
585 FResMediosVenturi.VelLateral =
true;
588 FResMediosVenturi.GastoEntrada =
true;
591 FResMediosVenturi.GastoLateral =
true;
594 std::cout <<
"Resultados medios en venturi " << FNumeroVenturi <<
" no implementados " << std::endl;
597 fgetpos(fich, &filepos);
599 }
catch(exception & N) {
600 std::cout <<
"ERROR: TVenturi::ReadAverageResultsVenturi en el venturi: " << FNumeroVenturi << std::endl;
601 std::cout <<
"Tipo de error: " << N.what() << std::endl;
609 void TVenturi::HeaderAverageResultsVenturi(stringstream& medoutput) {
614 if(FResMediosVenturi.PresionEntrada) {
615 Label =
"\t" +
PutLabel(521) + std::to_string(FNumeroVenturi) +
PutLabel(908);
616 medoutput << Label.c_str();
618 if(FResMediosVenturi.PresionGarganta) {
619 Label =
"\t" +
PutLabel(522) + std::to_string(FNumeroVenturi) +
PutLabel(908);
620 medoutput << Label.c_str();
622 if(FResMediosVenturi.MachEntrada) {
623 Label =
"\t" +
PutLabel(523) + std::to_string(FNumeroVenturi) +
PutLabel(901);
624 medoutput << Label.c_str();
626 if(FResMediosVenturi.MachGarganta) {
627 Label =
"\t" +
PutLabel(524) + std::to_string(FNumeroVenturi) +
PutLabel(901);
628 medoutput << Label.c_str();
630 if(FResMediosVenturi.VelEntrada) {
631 Label =
"\t" +
PutLabel(525) + std::to_string(FNumeroVenturi) +
PutLabel(909);
632 medoutput << Label.c_str();
634 if(FResMediosVenturi.VelLateral) {
635 Label =
"\t" +
PutLabel(526) + std::to_string(FNumeroVenturi) +
PutLabel(909);
636 medoutput << Label.c_str();
638 if(FResMediosVenturi.GastoEntrada) {
639 Label =
"\t" +
PutLabel(527) + std::to_string(FNumeroVenturi) +
PutLabel(904);
640 medoutput << Label.c_str();
642 if(FResMediosVenturi.GastoLateral) {
643 Label =
"\t" +
PutLabel(528) + std::to_string(FNumeroVenturi) +
PutLabel(904);
644 medoutput << Label.c_str();
648 }
catch(exception & N) {
649 std::cout <<
"ERROR: TVenturi::HeaderAverageResultsVenturi en el venturi: " << FNumeroVenturi << std::endl;
650 std::cout <<
"Tipo de error: " << N.what() << std::endl;
658 void TVenturi::AcumulaResultadosMediosVenturi(
double Actual) {
660 int SentidoEntrada = 0, SentidoLateral = 0;
661 double Delta = Actual - FResMediosVenturi.Tiempo0;
663 if(FResMediosVenturi.PresionEntrada) {
664 FResMediosVenturi.PresionEntradaSUM += FPressure * Delta;
666 if(FResMediosVenturi.PresionGarganta) {
667 FResMediosVenturi.PresionGargantaSUM += (FPressure / pow(1 + FGamma1 / 2 * pow(
dynamic_cast<TCCDeposito*
>
668 (FCCLateral)->getMachVenturi(), 2.), FGamma / FGamma1)) * Delta;
670 if(FResMediosVenturi.MachEntrada) {
671 FResMediosVenturi.MachEntradaSUM += fabs(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMachVenturi()) * Delta;
673 if(FResMediosVenturi.MachGarganta) {
674 FResMediosVenturi.MachGargantaSUM += fabs(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getMachVenturi()) * Delta;
676 if(FResMediosVenturi.VelEntrada) {
677 if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmEntrante) {
679 }
else if(
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getSentidoFlujo() == nmSaliente) {
682 FResMediosVenturi.VelEntradaSUM += SentidoEntrada * __cons::ARef * Delta *
dynamic_cast<TCCDeposito*
>
683 (FCCEntrada)->getVelocity();
685 if(FResMediosVenturi.VelLateral) {
686 if(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getSentidoFlujo() == nmEntrante) {
688 }
else if(
dynamic_cast<TCCDeposito*
>(FCCLateral)->getSentidoFlujo() == nmSaliente) {
691 FResMediosVenturi.VelLateralSUM += SentidoLateral * __cons::ARef * Delta *
dynamic_cast<TCCDeposito*
>
692 (FCCLateral)->getVelocity();
695 if(FResMediosVenturi.GastoEntrada) {
696 FResMediosVenturi.GastoEntradaSUM += -Delta *
dynamic_cast<TCCDeposito*
>(FCCEntrada)->getMassflow();
698 if(FResMediosVenturi.GastoLateral) {
699 FResMediosVenturi.GastoLateralSUM += -Delta *
dynamic_cast<TCCDeposito*
>(FCCLateral)->getMassflow();
702 FResMediosVenturi.TiempoSUM += Delta;
703 FResMediosVenturi.Tiempo0 = Actual;
704 }
catch(exception & N) {
705 std::cout <<
"ERROR: TVenturi::AcumulaResultadosMediosVenturi en el venturi: " << FNumeroVenturi << std::endl;
706 std::cout <<
"Tipo de error: " << N.what() << std::endl;
714 void TVenturi::ResultadosMediosVenturi() {
716 if(FResMediosVenturi.PresionEntrada) {
717 FResMediosVenturi.PresionEntradaMED = FResMediosVenturi.PresionEntradaSUM / FResMediosVenturi.TiempoSUM;
718 FResMediosVenturi.PresionEntradaSUM = 0.;
720 if(FResMediosVenturi.PresionGarganta) {
721 FResMediosVenturi.PresionGargantaMED = FResMediosVenturi.PresionGargantaSUM / FResMediosVenturi.TiempoSUM;
722 FResMediosVenturi.PresionGargantaSUM = 0.;
724 if(FResMediosVenturi.MachEntrada) {
725 FResMediosVenturi.MachEntradaMED = FResMediosVenturi.MachEntradaSUM / FResMediosVenturi.TiempoSUM;
726 FResMediosVenturi.MachEntradaSUM = 0.;
728 if(FResMediosVenturi.MachGarganta) {
729 FResMediosVenturi.MachGargantaMED = FResMediosVenturi.MachGargantaSUM / FResMediosVenturi.TiempoSUM;
730 FResMediosVenturi.MachGargantaSUM = 0.;
732 if(FResMediosVenturi.VelEntrada) {
733 FResMediosVenturi.VelEntradaMED = FResMediosVenturi.VelEntradaSUM / FResMediosVenturi.TiempoSUM;
734 FResMediosVenturi.VelEntradaSUM = 0.;
736 if(FResMediosVenturi.VelLateral) {
737 FResMediosVenturi.VelLateralMED = FResMediosVenturi.VelLateralSUM / FResMediosVenturi.TiempoSUM;
738 FResMediosVenturi.VelLateralSUM = 0.;
740 if(FResMediosVenturi.GastoEntrada) {
741 FResMediosVenturi.GastoEntradaMED = FResMediosVenturi.GastoEntradaSUM / FResMediosVenturi.TiempoSUM;
742 FResMediosVenturi.GastoEntradaSUM = 0.;
744 if(FResMediosVenturi.GastoLateral) {
745 FResMediosVenturi.GastoLateralMED = FResMediosVenturi.GastoLateralSUM / FResMediosVenturi.TiempoSUM;
746 FResMediosVenturi.GastoLateralSUM = 0.;
748 FResMediosVenturi.TiempoSUM = 0;
749 }
catch(exception & N) {
750 std::cout <<
"ERROR: TVenturi::ResultadosMediosVenturi en el venturi: " << FNumeroVenturi << std::endl;
751 std::cout <<
"Tipo de error: " << N.what() << std::endl;
759 void TVenturi::ImprimeResultadosMediosVenturi(stringstream& medoutput) {
763 if(FResMediosVenturi.PresionEntrada)
764 medoutput <<
"\t" << FResMediosVenturi.PresionEntradaMED;
765 if(FResMediosVenturi.PresionGarganta)
766 medoutput <<
"\t" << FResMediosVenturi.PresionGargantaMED;
767 if(FResMediosVenturi.MachEntrada)
768 medoutput <<
"\t" << FResMediosVenturi.MachEntradaMED;
769 if(FResMediosVenturi.MachGarganta)
770 medoutput <<
"\t" << FResMediosVenturi.MachGargantaMED;
771 if(FResMediosVenturi.VelEntrada)
772 medoutput <<
"\t" << FResMediosVenturi.VelEntradaMED;
773 if(FResMediosVenturi.VelLateral)
774 medoutput <<
"\t" << FResMediosVenturi.VelLateralMED;
775 if(FResMediosVenturi.GastoEntrada)
776 medoutput <<
"\t" << FResMediosVenturi.GastoEntradaMED;
777 if(FResMediosVenturi.GastoLateral)
778 medoutput <<
"\t" << FResMediosVenturi.GastoLateralMED;
781 }
catch(exception & N) {
782 std::cout <<
"ERROR: TVenturi::ImprimeResultadosMediosVenturi en el venturi: " << FNumeroVenturi << std::endl;
783 std::cout <<
"Tipo de error: " << N.what() << std::endl;
788 void TVenturi::UpdateProperties0DModel(
double TimeCalculo) {
789 ActualizaPropiedades(TimeCalculo);
793 AcumulaResultadosMediosVenturi(TimeCalculo);
795 AcumulaResultadosMedios(TimeCalculo);
802 #pragma package(smart_init)