OpenWAM
TRemansoMatlab.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 "TRemansoMatlab.h"
32 
33 //---------------------------------------------------------------------------
34 //---------------------------------------------------------------------------
35 
36 TRemansoMatlab::TRemansoMatlab() {
37 
38 }
39 
40 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
42 
43 TRemansoMatlab::~TRemansoMatlab() {
44 
45 }
46 
47 //---------------------------------------------------------------------------
48 //---------------------------------------------------------------------------
49 
50 void TRemansoMatlab::CalculaRemanso(double TiempoActual) {
51  try {
52 
53  if(TiempoActual < 1.92) {
54  FPressure = 1.;
55  FTemperature = 30.;
56  } else if(TiempoActual > 3.52) {
57  FPressure = 2.5;
58  FTemperature = 55.;
59  } else {
60  FPressure = 1. - 0.045 * (TiempoActual - 1.92) + 1.74 * pow2(TiempoActual - 1.92) - 0.705 * pow3(TiempoActual - 1.92);
61  FTemperature = 45.;
62  }
63  } catch(exception &N) {
64  std::cout << "ERROR: TRemansoMatlab::CalculaRemanso (DLL)" << std::endl;
65  std::cout << "Tipo de error: " << N.what() << std::endl;
66  throw Exception(N.what());
67  }
68 }
69 
70 //---------------------------------------------------------------------------
71 //---------------------------------------------------------------------------
72 
73 #pragma package(smart_init)
pow3
T pow3(T x)
Returns x to the power of 3.
Definition: Math_wam.h:101
Exception
Custom exception class.
Definition: Exception.hpp:39
pow2
T pow2(T x)
Returns x to the power of 2.
Definition: Math_wam.h:88