1 /*******************************************************************************
6 Purpose: Manage output of sim parameters to file or stdout
9 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23 Place - Suite 330, Boston, MA 02111-1307, USA.
25 Further information about the GNU General Public License can also be found on
26 the world wide web at http://www.gnu.org.
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 This is the place where you create output routines to dump data for perusal
31 later. Some machines may not support the ncurses console output. Borland is one
32 of those environments which does not, so the ncurses stuff is commented out.
35 --------------------------------------------------------------------------------
38 ********************************************************************************
40 *******************************************************************************/
44 #include "FGFDMExec.h"
45 #include "FGAtmosphere.h"
47 #include "FGAircraft.h"
48 #include "FGTranslation.h"
49 #include "FGRotation.h"
50 #include "FGPosition.h"
51 #include "FGAuxiliary.h"
53 /*******************************************************************************
54 ************************************ CODE **************************************
55 *******************************************************************************/
57 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
64 FGOutput::~FGOutput(void)
69 bool FGOutput::Run(void)
71 if (!FGModel::Run()) {
72 DelimitedOutput("JSBSimData.csv");
79 void FGOutput::DelimitedOutput(void)
108 cout << "Longitude,";
118 cout << State->Getsim_time() << ",";
119 cout << State->Geth() << ",";
120 cout << Rotation->Getphi() << ",";
121 cout << Rotation->Gettht() << ",";
122 cout << Rotation->Getpsi() << ",";
123 cout << Atmosphere->GetDensity() << ",";
124 cout << State->GetVt() << ",";
125 cout << Translation->GetU() << ",";
126 cout << Translation->GetV() << ",";
127 cout << Translation->GetW() << ",";
128 cout << Position->GetVn() << ",";
129 cout << Position->GetVe() << ",";
130 cout << Position->GetVd() << ",";
131 cout << Translation->GetUdot() << ",";
132 cout << Translation->GetVdot() << ",";
133 cout << Translation->GetWdot() << ",";
134 cout << Rotation->GetP() << ",";
135 cout << Rotation->GetQ() << ",";
136 cout << Rotation->GetR() << ",";
137 cout << Rotation->GetPdot() << ",";
138 cout << Rotation->GetQdot() << ",";
139 cout << Rotation->GetRdot() << ",";
140 cout << Aircraft->GetFx() << ",";
141 cout << Aircraft->GetFy() << ",";
142 cout << Aircraft->GetFz() << ",";
143 cout << State->Getlatitude() << ",";
144 cout << State->Getlongitude() << ",";
145 cout << State->Getqbar() << ",";
146 cout << Translation->Getalpha() << ",";
147 cout << Aircraft->GetL() << ",";
148 cout << Aircraft->GetM() << ",";
149 cout << Aircraft->GetN() << "";
155 void FGOutput::DelimitedOutput(string fname)
158 datafile.open(fname.c_str());
160 datafile << "Altitude,";
165 datafile << "Vtotal,";
184 datafile << "Latitude,";
185 datafile << "Longitude,";
187 datafile << "Alpha,";
195 datafile << State->Getsim_time() << ",";
196 datafile << State->Geth() << ",";
197 datafile << Rotation->Getphi() << ",";
198 datafile << Rotation->Gettht() << ",";
199 datafile << Rotation->Getpsi() << ",";
200 datafile << Atmosphere->GetDensity() << ",";
201 datafile << State->GetVt() << ",";
202 datafile << Translation->GetU() << ",";
203 datafile << Translation->GetV() << ",";
204 datafile << Translation->GetW() << ",";
205 datafile << Position->GetVn() << ",";
206 datafile << Position->GetVe() << ",";
207 datafile << Position->GetVd() << ",";
208 datafile << Translation->GetUdot() << ",";
209 datafile << Translation->GetVdot() << ",";
210 datafile << Translation->GetWdot() << ",";
211 datafile << Rotation->GetP() << ",";
212 datafile << Rotation->GetQ() << ",";
213 datafile << Rotation->GetR() << ",";
214 datafile << Rotation->GetPdot() << ",";
215 datafile << Rotation->GetQdot() << ",";
216 datafile << Rotation->GetRdot() << ",";
217 datafile << Aircraft->GetFx() << ",";
218 datafile << Aircraft->GetFy() << ",";
219 datafile << Aircraft->GetFz() << ",";
220 datafile << State->Getlatitude() << ",";
221 datafile << State->Getlongitude() << ",";
222 datafile << State->Getqbar() << ",";
223 datafile << Translation->Getalpha() << ",";
224 datafile << Aircraft->GetL() << ",";
225 datafile << Aircraft->GetM() << ",";
226 datafile << Aircraft->GetN() << "";