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)
102 cout << "Longitude,";
112 cout << State->Getsim_time() << ",";
113 cout << State->Geth() << ",";
114 cout << Rotation->Getphi() << ",";
115 cout << Rotation->Gettht() << ",";
116 cout << Rotation->Getpsi() << ",";
117 cout << Atmosphere->Getrho() << ",";
118 cout << State->GetVt() << ",";
119 cout << Translation->GetU() << ",";
120 cout << Translation->GetV() << ",";
121 cout << Translation->GetW() << ",";
122 cout << Position->GetVn() << ",";
123 cout << Position->GetVe() << ",";
124 cout << Position->GetVd() << ",";
125 cout << Translation->GetUdot() << ",";
126 cout << Translation->GetVdot() << ",";
127 cout << Translation->GetWdot() << ",";
128 cout << Aircraft->GetFx() << ",";
129 cout << Aircraft->GetFy() << ",";
130 cout << Aircraft->GetFz() << ",";
131 cout << State->Getlatitude() << ",";
132 cout << State->Getlongitude() << ",";
133 cout << State->Getqbar() << ",";
134 cout << Translation->Getalpha() << ",";
135 cout << Aircraft->GetL() << ",";
136 cout << Aircraft->GetM() << ",";
137 cout << Aircraft->GetN() << "";
143 void FGOutput::DelimitedOutput(string fname)
146 datafile.open(fname.c_str());
148 datafile << "Altitude,";
153 datafile << "Vtotal,";
166 datafile << "Latitude,";
167 datafile << "Longitude,";
169 datafile << "Alpha,";
177 datafile << State->Getsim_time() << ",";
178 datafile << State->Geth() << ",";
179 datafile << Rotation->Getphi() << ",";
180 datafile << Rotation->Gettht() << ",";
181 datafile << Rotation->Getpsi() << ",";
182 datafile << Atmosphere->Getrho() << ",";
183 datafile << State->GetVt() << ",";
184 datafile << Translation->GetU() << ",";
185 datafile << Translation->GetV() << ",";
186 datafile << Translation->GetW() << ",";
187 datafile << Position->GetVn() << ",";
188 datafile << Position->GetVe() << ",";
189 datafile << Position->GetVd() << ",";
190 datafile << Translation->GetUdot() << ",";
191 datafile << Translation->GetVdot() << ",";
192 datafile << Translation->GetWdot() << ",";
193 datafile << Aircraft->GetFx() << ",";
194 datafile << Aircraft->GetFy() << ",";
195 datafile << Aircraft->GetFz() << ",";
196 datafile << State->Getlatitude() << ",";
197 datafile << State->Getlongitude() << ",";
198 datafile << State->Getqbar() << ",";
199 datafile << Translation->Getalpha() << ",";
200 datafile << Aircraft->GetL() << ",";
201 datafile << Aircraft->GetM() << ",";
202 datafile << Aircraft->GetN() << "";