OpenWAM
TCDExterno.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 
31 #include "TCDExterno.h"
32 
33 //---------------------------------------------------------------------------
34 //---------------------------------------------------------------------------
35 
36 TCDExterno::TCDExterno() :
37  TTipoValvula(nmCalcExtern) {
38 
39 }
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
42 
43 TCDExterno::~TCDExterno() {
44 
45 }
46 //---------------------------------------------------------------------------
47 //---------------------------------------------------------------------------
48 
49 TCDExterno::TCDExterno(TCDExterno *Origen, int Valvula) :
50  TTipoValvula(nmCalcExtern) {
51 
52  FCDEInicial = Origen->FCDEInicial;
53  FCDSInicial = Origen->FCDSInicial;
54  FCTorbInicial = Origen->FCTorbInicial;
55 
56 //Se utilizara el diametro del tubo.
57  FDiamRef = -1;
58 
59  FNumeroOrden = Origen->FNumeroOrden;
60  FValvula = Valvula;
61 }
62 
63 //---------------------------------------------------------------------------
64 //---------------------------------------------------------------------------
65 
66 void TCDExterno::LeeDatosIniciales(const char *FileWAM, fpos_t &filepos, int norden, bool HayMotor,
67  TBloqueMotor *Engine) {
68  try {
69  FILE *fich = fopen(FileWAM, "r");
70  fsetpos(fich, &filepos);
71 
72  fscanf(fich, "%lf %lf %lf ", &FCDEInicial, &FCDSInicial, &FCTorbInicial);
73 
74  fgetpos(fich, &filepos);
75  fclose(fich);
76 
77  } catch(exception &N) {
78  std::cout << "ERROR: LeeDatosIniciales CDExterno" << std::endl;
79  //std::cout << "Tipo de error: " << N.what().scr() << std::endl;
80  throw Exception(N.what());
81 
82  }
83 }
84 
85 //---------------------------------------------------------------------------
86 //---------------------------------------------------------------------------
87 
88 void TCDExterno::CalculaCD() {
89  try {
90  FCDTubVol = FCDEntMatlab;
91  FCDVolTub = FCDSalMatlab;
92  FCTorb = FCTorMatlab;
93  } catch(exception &N) {
94  std::cout << "ERROR: CalculaCD CDExterno" << std::endl;
95  //std::cout << "Tipo de error: " << N.what().scr() << std::endl;
96  throw Exception(N.what());
97 
98  }
99 }
100 
101 #pragma package(smart_init)
TTipoValvula
Definition: TTipoValvula.h:53
Exception
Custom exception class.
Definition: Exception.hpp:39
TBloqueMotor
Definition: TBloqueMotor.h:43
TCDExterno
Definition: TCDExterno.h:43