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 --------------------------------------------------------------------------------
39 --------------------------------------------------------------------------------
42 ********************************************************************************
44 *******************************************************************************/
47 #if !defined( __BORLANDC__ )
59 #include "FGPosition.h"
62 #include "FGPosition.h"
65 /*******************************************************************************
66 ************************************ CODE **************************************
67 *******************************************************************************/
69 FGOutput::FGOutput(void) : FGModel()
71 strcpy(Name, "FGOutput");
81 FGOutput::~FGOutput(void)
86 bool FGOutput::Run(void)
88 if (!FGModel::Run()) {
97 void FGOutput::ConsoleOutput(void)
103 move(1,1); insstr("Quaternions");
104 move(2,5); insstr("Q0");
105 move(2,16); insstr("Q1");
106 move(2,27); insstr("Q2");
107 move(2,38); insstr("Q3");
109 move(3,1); sprintf(buffer,"%4.4f",State->GetQ0()); insstr(buffer);
110 move(3,12); sprintf(buffer,"%4.4f",State->GetQ1()); insstr(buffer);
111 move(3,23); sprintf(buffer,"%4.4f",State->GetQ2()); insstr(buffer);
112 move(3,34); sprintf(buffer,"%4.4f",State->GetQ3()); insstr(buffer);
114 move(0,0); insstr("Time: ");
115 move(0,6); insstr(gcvt(State->Getsim_time(),6,buffer));
117 move(2,46); insstr("Phi");
118 move(2,55); insstr("Tht");
119 move(2,64); insstr("Psi");
121 move(3,45); sprintf(buffer,"%3.3f",State->Getphi()); insstr(buffer);
122 move(3,54); sprintf(buffer,"%3.3f",State->Gettht()); insstr(buffer);
123 move(3,63); sprintf(buffer,"%3.3f",State->Getpsi()); insstr(buffer);
125 move(5,47); insstr("U");
126 move(5,56); insstr("V");
127 move(5,65); insstr("W");
129 move(6,45); sprintf(buffer,"%5.2f",State->GetU()); insstr(buffer);
130 move(6,54); sprintf(buffer,"%5.2f",State->GetV()); insstr(buffer);
131 move(6,63); sprintf(buffer,"%5.2f",State->GetW()); insstr(buffer);
133 move(8,47); insstr("Fx");
134 move(8,56); insstr("Fy");
135 move(8,65); insstr("Fz");
137 move(9,45); sprintf(buffer,"%5.2f",State->GetFx()); insstr(buffer);
138 move(9,54); sprintf(buffer,"%5.2f",State->GetFy()); insstr(buffer);
139 move(9,63); sprintf(buffer,"%5.2f",State->GetFz()); insstr(buffer);
141 move(11,47); insstr("Fn");
142 move(11,56); insstr("Fe");
143 move(11,65); insstr("Fd");
145 move(12,45); sprintf(buffer,"%5.2f",Position->GetFn()); insstr(buffer);
146 move(12,54); sprintf(buffer,"%5.2f",Position->GetFe()); insstr(buffer);
147 move(12,63); sprintf(buffer,"%5.2f",Position->GetFd()); insstr(buffer);
149 move(14,47); insstr("Latitude");
150 move(14,57); insstr("Longitude");
151 move(14,67); insstr("Altitude");
153 move(15,47); sprintf(buffer,"%5.2f",State->Getlatitude()); insstr(buffer);
154 move(15,57); sprintf(buffer,"%5.2f",State->Getlongitude()); insstr(buffer);
155 move(15,67); sprintf(buffer,"%5.2f",State->Geth()); insstr(buffer);
165 void FGOutput::DelimitedOutput(void)
188 cout << "Longitude,";
194 cout << State->Getsim_time() << ",";
195 cout << State->Geth() << ",";
196 cout << State->Getphi() << ",";
197 cout << State->Gettht() << ",";
198 cout << State->Getpsi() << ",";
199 cout << State->Getrho() << ",";
200 cout << State->GetVt() << ",";
201 cout << State->GetU() << ",";
202 cout << State->GetV() << ",";
203 cout << State->GetW() << ",";
204 cout << State->GetVn() << ",";
205 cout << State->GetVe() << ",";
206 cout << State->GetVd() << ",";
207 cout << State->GetUdot() << ",";
208 cout << State->GetVdot() << ",";
209 cout << State->GetWdot() << ",";
210 cout << State->GetFx() << ",";
211 cout << State->GetFy() << ",";
212 cout << State->GetFz() << ",";
213 cout << State->Getlatitude() << ",";
214 cout << State->Getlongitude() << ",";
215 cout << State->Getqbar() << ",";
216 cout << State->Getalpha() << "";