]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGJSBBase.cpp
Square the /environment/turbulence-norm property before scaling it for
[flightgear.git] / src / FDM / JSBSim / FGJSBBase.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGJSBBase.cpp
4  Author:       Jon S. Berndt
5  Date started: 07/01/01
6  Purpose:      Encapsulates the JSBBase object
7
8  ------------- Copyright (C) 2001  Jon S. Berndt (jsb@hal-pc.org) -------------
9
10  This program is free software; you can redistribute it and/or modify it under
11  the terms of the GNU General Public License as published by the Free Software
12  Foundation; either version 2 of the License, or (at your option) any later
13  version.
14
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18  details.
19
20  You should have received a copy of the GNU General Public License along with
21  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  Place - Suite 330, Boston, MA  02111-1307, USA.
23
24  Further information about the GNU General Public License can also be found on
25  the world wide web at http://www.gnu.org.
26
27 FUNCTIONAL DESCRIPTION
28 --------------------------------------------------------------------------------
29
30 HISTORY
31 --------------------------------------------------------------------------------
32 07/01/01  JSB  Created
33
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 INCLUDES
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37
38 #include "FGJSBBase.h"
39
40 namespace JSBSim {
41
42 static const char *IdSrc = "$Id$";
43 static const char *IdHdr = ID_JSBBASE;
44
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 CLASS IMPLEMENTATION
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49 char FGJSBBase::highint[5]  = {27, '[', '1', 'm', '\0'      };
50 char FGJSBBase::halfint[5]  = {27, '[', '2', 'm', '\0'      };
51 char FGJSBBase::normint[6]  = {27, '[', '2', '2', 'm', '\0' };
52 char FGJSBBase::reset[5]    = {27, '[', '0', 'm', '\0'      };
53 char FGJSBBase::underon[5]  = {27, '[', '4', 'm', '\0'      };
54 char FGJSBBase::underoff[6] = {27, '[', '2', '4', 'm', '\0' };
55 char FGJSBBase::fgblue[6]   = {27, '[', '3', '4', 'm', '\0' };
56 char FGJSBBase::fgcyan[6]   = {27, '[', '3', '6', 'm', '\0' };
57 char FGJSBBase::fgred[6]    = {27, '[', '3', '1', 'm', '\0' };
58 char FGJSBBase::fggreen[6]  = {27, '[', '3', '2', 'm', '\0' };
59 char FGJSBBase::fgdef[6]    = {27, '[', '3', '9', 'm', '\0' };
60
61 const double FGJSBBase::radtodeg = 57.29578;
62 const double FGJSBBase::degtorad = 1.745329E-2;
63 const double FGJSBBase::hptoftlbssec = 550.0;
64 const double FGJSBBase::psftoinhg = 0.014138;
65 const double FGJSBBase::fpstokts = 0.592484;
66 const double FGJSBBase::ktstofps = 1.68781;
67 const double FGJSBBase::inchtoft = 0.08333333;
68 const double FGJSBBase::in3tom3 = 1.638706E-5;
69 const double FGJSBBase::Reng = 1716.0;
70 const double FGJSBBase::SHRatio = 1.40;
71 const string FGJSBBase::needed_cfg_version = "1.60";
72 const string FGJSBBase::JSBSim_version = "0.9.4";
73
74 queue <FGJSBBase::Message*> FGJSBBase::Messages;
75 FGJSBBase::Message FGJSBBase::localMsg;
76 unsigned int FGJSBBase::messageId = 0; 
77 unsigned int FGJSBBase::frame = 0;
78
79 short FGJSBBase::debug_lvl  = 0;
80
81 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82
83 FGJSBBase::FGJSBBase()
84 {
85 }
86
87 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89 FGJSBBase::Message* FGJSBBase::PutMessage(Message* msg)
90 {
91   Messages.push(msg);
92   return msg;
93 }
94
95 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96
97 FGJSBBase::Message* FGJSBBase::PutMessage(string text)
98 {
99   Message *msg = new Message();
100   msg->text = text;
101   msg->messageId = messageId++;
102   msg->subsystem = "FDM";
103   msg->type = Message::eText;
104   Messages.push(msg);
105   return msg;
106 }
107
108 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109
110 FGJSBBase::Message* FGJSBBase::PutMessage(string text, bool bVal)
111 {
112   Message *msg = new Message();
113   msg->text = text;
114   msg->messageId = messageId++;
115   msg->subsystem = "FDM";
116   msg->type = Message::eBool;
117   msg->bVal = bVal;
118   Messages.push(msg);
119   return msg;
120 }
121
122 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123
124 FGJSBBase::Message* FGJSBBase::PutMessage(string text, int iVal)
125 {
126   Message *msg = new Message();
127   msg->text = text;
128   msg->messageId = messageId++;
129   msg->subsystem = "FDM";
130   msg->type = Message::eInteger;
131   msg->bVal = (iVal != 0);
132   Messages.push(msg);
133   return msg;
134 }
135
136 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137
138 FGJSBBase::Message* FGJSBBase::PutMessage(string text, double dVal)
139 {
140   Message *msg = new Message();
141   msg->text = text;
142   msg->messageId = messageId++;
143   msg->subsystem = "FDM";
144   msg->type = Message::eDouble;
145   msg->bVal = (dVal != 0.0);
146   Messages.push(msg);
147   return msg;
148 }
149
150 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151
152 FGJSBBase::Message* FGJSBBase::ReadMessage(void)
153 {
154   if (!Messages.empty()) return Messages.front();
155   else                   return NULL;
156 }
157
158 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
159
160 FGJSBBase::Message* FGJSBBase::ProcessMessage(void)
161 {
162   if (!Messages.empty())
163     localMsg = *(Messages.front());
164   else 
165     return NULL;
166   Messages.pop();
167   return &localMsg;
168 }
169
170 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171
172 void FGJSBBase::disableHighLighting(void) {
173   highint[0]='\0';
174   halfint[0]='\0';
175   normint[0]='\0';
176   reset[0]='\0';
177   underon[0]='\0';
178   underoff[0]='\0';
179   fgblue[0]='\0';
180   fgcyan[0]='\0';
181   fgred[0]='\0';
182   fggreen[0]='\0';
183   fgdef[0]='\0';
184 }
185
186 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187
188 } // namespace JSBSim
189