1999-02-05 21:26:01 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
|
|
|
|
Module: FGOutput.cpp
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/02/98
|
|
|
|
Purpose: Manage output of sim parameters to file or stdout
|
|
|
|
Called by: FGSimExec
|
|
|
|
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
FUNCTIONAL DESCRIPTION
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
This is the place where you create output routines to dump data for perusal
|
|
|
|
later. Some machines may not support the ncurses console output. Borland is one
|
|
|
|
of those environments which does not, so the ncurses stuff is commented out.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/02/98 JSB Created
|
|
|
|
|
|
|
|
********************************************************************************
|
|
|
|
INCLUDES
|
|
|
|
*******************************************************************************/
|
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
#include "FGOutput.h"
|
|
|
|
#include "FGState.h"
|
|
|
|
#include "FGFDMExec.h"
|
|
|
|
#include "FGAtmosphere.h"
|
|
|
|
#include "FGFCS.h"
|
|
|
|
#include "FGAircraft.h"
|
|
|
|
#include "FGTranslation.h"
|
|
|
|
#include "FGRotation.h"
|
|
|
|
#include "FGPosition.h"
|
|
|
|
#include "FGAuxiliary.h"
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
************************************ CODE **************************************
|
|
|
|
*******************************************************************************/
|
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
1999-02-26 22:09:10 +00:00
|
|
|
Name = "FGOutput";
|
1999-02-05 21:26:01 +00:00
|
|
|
FirstPass = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FGOutput::~FGOutput(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FGOutput::Run(void)
|
|
|
|
{
|
|
|
|
if (!FGModel::Run()) {
|
1999-09-07 23:15:45 +00:00
|
|
|
DelimitedOutput("JSBSimData.csv");
|
1999-02-05 21:26:01 +00:00
|
|
|
} else {
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FGOutput::DelimitedOutput(void)
|
|
|
|
{
|
|
|
|
if (FirstPass) {
|
|
|
|
cout << "Time,";
|
|
|
|
cout << "Altitude,";
|
|
|
|
cout << "Phi,";
|
|
|
|
cout << "Tht,";
|
|
|
|
cout << "Psi,";
|
|
|
|
cout << "Rho,";
|
|
|
|
cout << "Vtotal,";
|
|
|
|
cout << "U,";
|
|
|
|
cout << "V,";
|
|
|
|
cout << "W,";
|
|
|
|
cout << "Vn,";
|
|
|
|
cout << "Ve,";
|
|
|
|
cout << "Vd,";
|
|
|
|
cout << "Udot,";
|
|
|
|
cout << "Vdot,";
|
|
|
|
cout << "Wdot,";
|
|
|
|
cout << "Fx,";
|
|
|
|
cout << "Fy,";
|
|
|
|
cout << "Fz,";
|
|
|
|
cout << "Latitude,";
|
|
|
|
cout << "Longitude,";
|
|
|
|
cout << "QBar,";
|
1999-06-28 17:39:20 +00:00
|
|
|
cout << "Alpha,";
|
|
|
|
cout << "L,";
|
|
|
|
cout << "M,";
|
1999-05-08 03:19:08 +00:00
|
|
|
cout << "N";
|
1999-02-05 21:26:01 +00:00
|
|
|
cout << endl;
|
|
|
|
FirstPass = false;
|
|
|
|
}
|
1999-07-31 04:55:23 +00:00
|
|
|
|
|
|
|
cout << State->Getsim_time() << ",";
|
|
|
|
cout << State->Geth() << ",";
|
|
|
|
cout << Rotation->Getphi() << ",";
|
|
|
|
cout << Rotation->Gettht() << ",";
|
|
|
|
cout << Rotation->Getpsi() << ",";
|
|
|
|
cout << Atmosphere->Getrho() << ",";
|
|
|
|
cout << State->GetVt() << ",";
|
|
|
|
cout << Translation->GetU() << ",";
|
|
|
|
cout << Translation->GetV() << ",";
|
|
|
|
cout << Translation->GetW() << ",";
|
|
|
|
cout << Position->GetVn() << ",";
|
|
|
|
cout << Position->GetVe() << ",";
|
|
|
|
cout << Position->GetVd() << ",";
|
|
|
|
cout << Translation->GetUdot() << ",";
|
|
|
|
cout << Translation->GetVdot() << ",";
|
|
|
|
cout << Translation->GetWdot() << ",";
|
|
|
|
cout << Aircraft->GetFx() << ",";
|
|
|
|
cout << Aircraft->GetFy() << ",";
|
|
|
|
cout << Aircraft->GetFz() << ",";
|
|
|
|
cout << State->Getlatitude() << ",";
|
|
|
|
cout << State->Getlongitude() << ",";
|
|
|
|
cout << State->Getqbar() << ",";
|
|
|
|
cout << Translation->Getalpha() << ",";
|
|
|
|
cout << Aircraft->GetL() << ",";
|
|
|
|
cout << Aircraft->GetM() << ",";
|
|
|
|
cout << Aircraft->GetN() << "";
|
|
|
|
cout << endl;
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
1999-09-07 23:15:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
void FGOutput::DelimitedOutput(string fname)
|
|
|
|
{
|
|
|
|
if (FirstPass) {
|
|
|
|
datafile.open(fname.c_str());
|
|
|
|
datafile << "Time,";
|
|
|
|
datafile << "Altitude,";
|
|
|
|
datafile << "Phi,";
|
|
|
|
datafile << "Tht,";
|
|
|
|
datafile << "Psi,";
|
|
|
|
datafile << "Rho,";
|
|
|
|
datafile << "Vtotal,";
|
|
|
|
datafile << "U,";
|
|
|
|
datafile << "V,";
|
|
|
|
datafile << "W,";
|
|
|
|
datafile << "Vn,";
|
|
|
|
datafile << "Ve,";
|
|
|
|
datafile << "Vd,";
|
|
|
|
datafile << "Udot,";
|
|
|
|
datafile << "Vdot,";
|
|
|
|
datafile << "Wdot,";
|
|
|
|
datafile << "Fx,";
|
|
|
|
datafile << "Fy,";
|
|
|
|
datafile << "Fz,";
|
|
|
|
datafile << "Latitude,";
|
|
|
|
datafile << "Longitude,";
|
|
|
|
datafile << "QBar,";
|
|
|
|
datafile << "Alpha,";
|
|
|
|
datafile << "L,";
|
|
|
|
datafile << "M,";
|
|
|
|
datafile << "N";
|
|
|
|
datafile << endl;
|
|
|
|
FirstPass = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
datafile << State->Getsim_time() << ",";
|
|
|
|
datafile << State->Geth() << ",";
|
|
|
|
datafile << Rotation->Getphi() << ",";
|
|
|
|
datafile << Rotation->Gettht() << ",";
|
|
|
|
datafile << Rotation->Getpsi() << ",";
|
|
|
|
datafile << Atmosphere->Getrho() << ",";
|
|
|
|
datafile << State->GetVt() << ",";
|
|
|
|
datafile << Translation->GetU() << ",";
|
|
|
|
datafile << Translation->GetV() << ",";
|
|
|
|
datafile << Translation->GetW() << ",";
|
|
|
|
datafile << Position->GetVn() << ",";
|
|
|
|
datafile << Position->GetVe() << ",";
|
|
|
|
datafile << Position->GetVd() << ",";
|
|
|
|
datafile << Translation->GetUdot() << ",";
|
|
|
|
datafile << Translation->GetVdot() << ",";
|
|
|
|
datafile << Translation->GetWdot() << ",";
|
|
|
|
datafile << Aircraft->GetFx() << ",";
|
|
|
|
datafile << Aircraft->GetFy() << ",";
|
|
|
|
datafile << Aircraft->GetFz() << ",";
|
|
|
|
datafile << State->Getlatitude() << ",";
|
|
|
|
datafile << State->Getlongitude() << ",";
|
|
|
|
datafile << State->Getqbar() << ",";
|
|
|
|
datafile << Translation->Getalpha() << ",";
|
|
|
|
datafile << Aircraft->GetL() << ",";
|
|
|
|
datafile << Aircraft->GetM() << ",";
|
|
|
|
datafile << Aircraft->GetN() << "";
|
|
|
|
datafile << endl;
|
|
|
|
datafile.flush();
|
|
|
|
}
|
|
|
|
|