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 *******************************************************************************/
51 #include "FGFDMExec.h"
52 #include "FGAtmosphere.h"
54 #include "FGAircraft.h"
55 #include "FGTranslation.h"
56 #include "FGRotation.h"
57 #include "FGPosition.h"
58 #include "FGAuxiliary.h"
60 /*******************************************************************************
61 ************************************ CODE **************************************
62 *******************************************************************************/
64 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
66 strcpy(Name, "FGOutput");
76 FGOutput::~FGOutput(void)
81 bool FGOutput::Run(void)
83 if (!FGModel::Run()) {
92 void FGOutput::ConsoleOutput(void)
98 move(1,1); insstr("Quaternions");
99 move(2,5); insstr("Q0");
100 move(2,16); insstr("Q1");
101 move(2,27); insstr("Q2");
102 move(2,38); insstr("Q3");
104 move(3,1); sprintf(buffer,"%4.4f",Rotation->GetQ0()); insstr(buffer);
105 move(3,12); sprintf(buffer,"%4.4f",Rotation->GetQ1()); insstr(buffer);
106 move(3,23); sprintf(buffer,"%4.4f",Rotation->GetQ2()); insstr(buffer);
107 move(3,34); sprintf(buffer,"%4.4f",Rotation->GetQ3()); insstr(buffer);
109 move(0,0); insstr("Time: ");
110 move(0,6); insstr(gcvt(State->Getsim_time(),6,buffer));
112 move(2,46); insstr("Phi");
113 move(2,55); insstr("Tht");
114 move(2,64); insstr("Psi");
116 move(3,45); sprintf(buffer,"%3.3f",Rotation->Getphi()); insstr(buffer);
117 move(3,54); sprintf(buffer,"%3.3f",Rotation->Gettht()); insstr(buffer);
118 move(3,63); sprintf(buffer,"%3.3f",Rotation->Getpsi()); insstr(buffer);
120 move(5,47); insstr("U");
121 move(5,56); insstr("V");
122 move(5,65); insstr("W");
124 move(6,45); sprintf(buffer,"%5.2f",Translation->GetU()); insstr(buffer);
125 move(6,54); sprintf(buffer,"%5.2f",Translation->GetV()); insstr(buffer);
126 move(6,63); sprintf(buffer,"%5.2f",Translation->GetW()); insstr(buffer);
128 move(8,47); insstr("Fx");
129 move(8,56); insstr("Fy");
130 move(8,65); insstr("Fz");
132 move(9,45); sprintf(buffer,"%5.2f",Aircraft->GetFx()); insstr(buffer);
133 move(9,54); sprintf(buffer,"%5.2f",Aircraft->GetFy()); insstr(buffer);
134 move(9,63); sprintf(buffer,"%5.2f",Aircraft->GetFz()); insstr(buffer);
136 move(11,47); insstr("Fn");
137 move(11,56); insstr("Fe");
138 move(11,65); insstr("Fd");
140 move(12,45); sprintf(buffer,"%5.2f",Position->GetFn()); insstr(buffer);
141 move(12,54); sprintf(buffer,"%5.2f",Position->GetFe()); insstr(buffer);
142 move(12,63); sprintf(buffer,"%5.2f",Position->GetFd()); insstr(buffer);
144 move(14,47); insstr("Latitude");
145 move(14,57); insstr("Longitude");
146 move(14,67); insstr("Altitude");
148 move(15,47); sprintf(buffer,"%5.2f",State->Getlatitude()); insstr(buffer);
149 move(15,57); sprintf(buffer,"%5.2f",State->Getlongitude()); insstr(buffer);
150 move(15,67); sprintf(buffer,"%5.2f",State->Geth()); insstr(buffer);
160 void FGOutput::DelimitedOutput(void)
183 cout << "Longitude,";
189 cout << State->Getsim_time() << ",";
190 cout << State->Geth() << ",";
191 cout << Rotation->Getphi() << ",";
192 cout << Rotation->Gettht() << ",";
193 cout << Rotation->Getpsi() << ",";
194 cout << Atmosphere->Getrho() << ",";
195 cout << State->GetVt() << ",";
196 cout << Translation->GetU() << ",";
197 cout << Translation->GetV() << ",";
198 cout << Translation->GetW() << ",";
199 cout << Position->GetVn() << ",";
200 cout << Position->GetVe() << ",";
201 cout << Position->GetVd() << ",";
202 cout << Translation->GetUdot() << ",";
203 cout << Translation->GetVdot() << ",";
204 cout << Translation->GetWdot() << ",";
205 cout << Aircraft->GetFx() << ",";
206 cout << Aircraft->GetFy() << ",";
207 cout << Aircraft->GetFz() << ",";
208 cout << State->Getlatitude() << ",";
209 cout << State->Getlongitude() << ",";
210 cout << State->Getqbar() << ",";
211 cout << Translation->Getalpha() << "";