2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
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
|
2000-05-02 18:25:30 +00:00
|
|
|
later.
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/02/98 JSB Created
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
INCLUDES
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
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"
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
static const char *IdSrc = "$Id$";
|
2000-10-14 02:10:10 +00:00
|
|
|
static const char *IdHdr = ID_OUTPUT;
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
extern short debug_lvl;
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS IMPLEMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
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-12-20 20:24:49 +00:00
|
|
|
sFirstPass = dFirstPass = true;
|
2000-01-10 21:07:00 +00:00
|
|
|
socket = 0;
|
2000-05-02 18:25:30 +00:00
|
|
|
Type = otNone;
|
|
|
|
Filename = "JSBSim.out";
|
|
|
|
SubSystems = 0;
|
2000-10-10 17:44:35 +00:00
|
|
|
enabled = true;
|
2000-05-02 18:25:30 +00:00
|
|
|
|
2000-01-11 17:26:43 +00:00
|
|
|
#ifdef FG_WITH_JSBSIM_SOCKET
|
1999-12-20 20:24:49 +00:00
|
|
|
socket = new FGfdmSocket("localhost",1138);
|
2000-01-11 17:26:43 +00:00
|
|
|
#endif
|
2001-03-30 01:04:50 +00:00
|
|
|
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
FGOutput::~FGOutput()
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
1999-12-20 20:24:49 +00:00
|
|
|
if (socket) delete socket;
|
2001-03-30 01:04:50 +00:00
|
|
|
if (debug_lvl & 2) cout << "Destroyed: FGOutput" << endl;
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
bool FGOutput::Run(void)
|
|
|
|
{
|
2000-10-02 23:07:30 +00:00
|
|
|
if (enabled) {
|
|
|
|
if (!FGModel::Run()) {
|
|
|
|
|
|
|
|
if (Type == otSocket) {
|
|
|
|
SocketOutput();
|
|
|
|
} else if (Type == otCSV) {
|
|
|
|
if (Filename != "COUT" && Filename != "cout" && Filename.size() > 0) {
|
|
|
|
DelimitedOutput(Filename);
|
|
|
|
} else {
|
|
|
|
DelimitedOutput();
|
|
|
|
}
|
|
|
|
} else if (Type == otTerminal) {
|
|
|
|
// Not done yet
|
|
|
|
} else if (Type == otNone) {
|
|
|
|
// Do nothing
|
2000-05-02 18:25:30 +00:00
|
|
|
} else {
|
2000-10-02 23:07:30 +00:00
|
|
|
// Not a valid type of output
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2000-05-02 18:25:30 +00:00
|
|
|
} else {
|
|
|
|
}
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2000-05-02 18:25:30 +00:00
|
|
|
void FGOutput::SetType(string type)
|
|
|
|
{
|
|
|
|
if (type == "CSV") {
|
|
|
|
Type = otCSV;
|
|
|
|
} else if (type == "TABULAR") {
|
|
|
|
Type = otTab;
|
|
|
|
} else if (type == "SOCKET") {
|
|
|
|
Type = otSocket;
|
|
|
|
} else if (type == "TERMINAL") {
|
|
|
|
Type = otTerminal;
|
|
|
|
} else if (type != "NONE"){
|
|
|
|
Type = otUnknown;
|
|
|
|
cerr << "Unknown type of output specified in config file" << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-05-02 18:25:30 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
void FGOutput::DelimitedOutput(void)
|
|
|
|
{
|
1999-12-20 20:24:49 +00:00
|
|
|
if (dFirstPass) {
|
2000-05-02 18:25:30 +00:00
|
|
|
cout << "Time";
|
|
|
|
if (SubSystems & FGAircraft::ssSimulation) {
|
|
|
|
// Nothing here, yet
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "Throttle, ";
|
|
|
|
cout << "Aileron Cmd, ";
|
|
|
|
cout << "Elevator Cmd, ";
|
|
|
|
cout << "Rudder Cmd, ";
|
|
|
|
cout << "Aileron Pos, ";
|
|
|
|
cout << "Elevator Pos, ";
|
|
|
|
cout << "Rudder Pos";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssRates) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "P, Q, R";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssVelocities) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "QBar, ";
|
|
|
|
cout << "Vtotal, ";
|
|
|
|
cout << "U, V, W, ";
|
|
|
|
cout << "Vn, Ve, Vd";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssForces) {
|
|
|
|
cout << ", ";
|
2001-04-17 21:19:54 +00:00
|
|
|
cout << "Drag, Side, Lift, ";
|
|
|
|
cout << "L/D, ";
|
2000-05-02 18:25:30 +00:00
|
|
|
cout << "Xforce, Yforce, Zforce";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMoments) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "L, M, N";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAtmosphere) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "Rho";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMassProps) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "Ixx, ";
|
|
|
|
cout << "Iyy, ";
|
|
|
|
cout << "Izz, ";
|
|
|
|
cout << "Ixz, ";
|
|
|
|
cout << "Mass, ";
|
|
|
|
cout << "Xcg, Ycg, Zcg";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssPosition) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << "Altitude, ";
|
|
|
|
cout << "Phi, Tht, Psi, ";
|
|
|
|
cout << "Alpha, ";
|
|
|
|
cout << "Latitude, ";
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
cout << "Longitude, ";
|
|
|
|
cout << "Distance AGL, ";
|
|
|
|
cout << "Runway Radius";
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssCoefficients) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetCoefficientStrings();
|
|
|
|
}
|
2000-05-27 05:48:14 +00:00
|
|
|
if (SubSystems & FGAircraft::ssGroundReactions) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetGroundReactionStrings();
|
|
|
|
}
|
2001-04-06 22:59:31 +00:00
|
|
|
if (SubSystems & FGAircraft::ssPropulsion) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Propulsion->GetPropulsionStrings();
|
|
|
|
}
|
2000-05-02 18:25:30 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
cout << endl;
|
1999-12-20 20:24:49 +00:00
|
|
|
dFirstPass = false;
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
1999-07-31 04:55:23 +00:00
|
|
|
|
2000-05-02 18:25:30 +00:00
|
|
|
cout << State->Getsim_time();
|
|
|
|
if (SubSystems & FGAircraft::ssSimulation) {
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << FCS->GetThrottlePos(0) << ", ";
|
|
|
|
cout << FCS->GetDaCmd() << ", ";
|
|
|
|
cout << FCS->GetDeCmd() << ", ";
|
|
|
|
cout << FCS->GetDrCmd() << ", ";
|
|
|
|
cout << FCS->GetDaPos() << ", ";
|
|
|
|
cout << FCS->GetDePos() << ", ";
|
|
|
|
cout << FCS->GetDrPos();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssRates) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Rotation->GetPQR();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssVelocities) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Translation->Getqbar() << ", ";
|
|
|
|
cout << Translation->GetVt() << ", ";
|
|
|
|
cout << Translation->GetUVW() << ", ";
|
|
|
|
cout << Position->GetVel();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssForces) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetvFs() << ", ";
|
2001-04-17 21:19:54 +00:00
|
|
|
cout << Aircraft->GetLoD() << ", ";
|
2000-05-02 18:25:30 +00:00
|
|
|
cout << Aircraft->GetForces();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMoments) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetMoments();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAtmosphere) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Atmosphere->GetDensity();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMassProps) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetIxx() << ", ";
|
|
|
|
cout << Aircraft->GetIyy() << ", ";
|
|
|
|
cout << Aircraft->GetIzz() << ", ";
|
|
|
|
cout << Aircraft->GetIxz() << ", ";
|
|
|
|
cout << Aircraft->GetMass() << ", ";
|
|
|
|
cout << Aircraft->GetXYZcg();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssPosition) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Position->Geth() << ", ";
|
|
|
|
cout << Rotation->GetEuler() << ", ";
|
|
|
|
cout << Translation->Getalpha() << ", ";
|
|
|
|
cout << Position->GetLatitude() << ", ";
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
cout << Position->GetLongitude() << ", ";
|
|
|
|
cout << Position->GetDistanceAGL() << ", ";
|
|
|
|
cout << Position->GetRunwayRadius();
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssCoefficients) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetCoefficientValues();
|
|
|
|
}
|
2000-05-27 05:48:14 +00:00
|
|
|
if (SubSystems & FGAircraft::ssGroundReactions) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Aircraft->GetGroundReactionValues();
|
|
|
|
}
|
2001-04-06 22:59:31 +00:00
|
|
|
if (SubSystems & FGAircraft::ssPropulsion) {
|
|
|
|
cout << ", ";
|
|
|
|
cout << Propulsion->GetPropulsionValues();
|
|
|
|
}
|
|
|
|
|
1999-07-31 04:55:23 +00:00
|
|
|
cout << endl;
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
1999-09-07 23:15:45 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-09-07 23:15:45 +00:00
|
|
|
|
|
|
|
void FGOutput::DelimitedOutput(string fname)
|
|
|
|
{
|
1999-12-20 20:24:49 +00:00
|
|
|
if (sFirstPass) {
|
1999-09-07 23:15:45 +00:00
|
|
|
datafile.open(fname.c_str());
|
2000-05-02 18:25:30 +00:00
|
|
|
datafile << "Time";
|
|
|
|
if (SubSystems & FGAircraft::ssSimulation) {
|
|
|
|
// Nothing here, yet
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "Throttle, ";
|
|
|
|
datafile << "Aileron Cmd, ";
|
|
|
|
datafile << "Elevator Cmd, ";
|
|
|
|
datafile << "Rudder Cmd, ";
|
|
|
|
datafile << "Aileron Pos, ";
|
|
|
|
datafile << "Elevator Pos, ";
|
|
|
|
datafile << "Rudder Pos";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssRates) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "P, Q, R";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssVelocities) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "QBar, ";
|
|
|
|
datafile << "Vtotal, ";
|
|
|
|
datafile << "U, V, W, ";
|
|
|
|
datafile << "Vn, Ve, Vd";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssForces) {
|
|
|
|
datafile << ", ";
|
2001-04-17 21:19:54 +00:00
|
|
|
datafile << "Drag, Side, Lift, ";
|
|
|
|
datafile << "L/D, ";
|
2000-05-02 18:25:30 +00:00
|
|
|
datafile << "Xforce, Yforce, Zforce";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMoments) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "L, M, N";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAtmosphere) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "Rho";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMassProps) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "Ixx, ";
|
|
|
|
datafile << "Iyy, ";
|
|
|
|
datafile << "Izz, ";
|
|
|
|
datafile << "Ixz, ";
|
|
|
|
datafile << "Mass, ";
|
|
|
|
datafile << "Xcg, Ycg, Zcg";
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssPosition) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << "Altitude, ";
|
|
|
|
datafile << "Phi, Tht, Psi, ";
|
|
|
|
datafile << "Alpha, ";
|
|
|
|
datafile << "Latitude, ";
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
datafile << "Longitude, ";
|
|
|
|
datafile << "Distance AGL, ";
|
|
|
|
datafile << "Runway Radius";
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssCoefficients) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetCoefficientStrings();
|
|
|
|
}
|
2000-05-27 05:48:14 +00:00
|
|
|
if (SubSystems & FGAircraft::ssGroundReactions) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetGroundReactionStrings();
|
|
|
|
}
|
2000-11-14 20:31:58 +00:00
|
|
|
if (SubSystems & FGAircraft::ssFCS) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << FCS->GetComponentStrings();
|
|
|
|
}
|
2001-04-06 22:59:31 +00:00
|
|
|
if (SubSystems & FGAircraft::ssPropulsion) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Propulsion->GetPropulsionStrings();
|
|
|
|
}
|
1999-09-07 23:15:45 +00:00
|
|
|
datafile << endl;
|
1999-12-20 20:24:49 +00:00
|
|
|
sFirstPass = false;
|
1999-09-07 23:15:45 +00:00
|
|
|
}
|
|
|
|
|
2000-05-02 18:25:30 +00:00
|
|
|
datafile << State->Getsim_time();
|
|
|
|
if (SubSystems & FGAircraft::ssSimulation) {
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << FCS->GetThrottlePos(0) << ", ";
|
|
|
|
datafile << FCS->GetDaCmd() << ", ";
|
|
|
|
datafile << FCS->GetDeCmd() << ", ";
|
|
|
|
datafile << FCS->GetDrCmd() << ", ";
|
|
|
|
datafile << FCS->GetDaPos() << ", ";
|
|
|
|
datafile << FCS->GetDePos() << ", ";
|
|
|
|
datafile << FCS->GetDrPos();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssRates) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Rotation->GetPQR();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssVelocities) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Translation->Getqbar() << ", ";
|
|
|
|
datafile << Translation->GetVt() << ", ";
|
|
|
|
datafile << Translation->GetUVW() << ", ";
|
|
|
|
datafile << Position->GetVel();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssForces) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetvFs() << ", ";
|
2001-04-17 21:19:54 +00:00
|
|
|
datafile << Aircraft->GetLoD() << ", ";
|
2000-05-02 18:25:30 +00:00
|
|
|
datafile << Aircraft->GetForces();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMoments) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetMoments();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssAtmosphere) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Atmosphere->GetDensity();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssMassProps) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetIxx() << ", ";
|
|
|
|
datafile << Aircraft->GetIyy() << ", ";
|
|
|
|
datafile << Aircraft->GetIzz() << ", ";
|
|
|
|
datafile << Aircraft->GetIxz() << ", ";
|
|
|
|
datafile << Aircraft->GetMass() << ", ";
|
|
|
|
datafile << Aircraft->GetXYZcg();
|
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssPosition) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Position->Geth() << ", ";
|
|
|
|
datafile << Rotation->GetEuler() << ", ";
|
|
|
|
datafile << Translation->Getalpha() << ", ";
|
|
|
|
datafile << Position->GetLatitude() << ", ";
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
datafile << Position->GetLongitude() << ", ";
|
|
|
|
datafile << Position->GetDistanceAGL() << ", ";
|
|
|
|
datafile << Position->GetRunwayRadius();
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
if (SubSystems & FGAircraft::ssCoefficients) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetCoefficientValues();
|
|
|
|
}
|
2000-05-27 05:48:14 +00:00
|
|
|
if (SubSystems & FGAircraft::ssGroundReactions) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Aircraft->GetGroundReactionValues();
|
|
|
|
}
|
2000-11-14 20:31:58 +00:00
|
|
|
if (SubSystems & FGAircraft::ssFCS) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << FCS->GetComponentValues();
|
|
|
|
}
|
2001-04-06 22:59:31 +00:00
|
|
|
if (SubSystems & FGAircraft::ssPropulsion) {
|
|
|
|
datafile << ", ";
|
|
|
|
datafile << Propulsion->GetPropulsionValues();
|
|
|
|
}
|
1999-09-07 23:15:45 +00:00
|
|
|
datafile << endl;
|
|
|
|
datafile.flush();
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-04-24 23:49:06 +00:00
|
|
|
|
1999-12-20 20:24:49 +00:00
|
|
|
void FGOutput::SocketOutput(void)
|
|
|
|
{
|
|
|
|
string asciiData;
|
2000-04-24 23:49:06 +00:00
|
|
|
/*
|
2000-10-02 23:07:30 +00:00
|
|
|
if (socket == NULL) return;
|
1999-12-20 20:24:49 +00:00
|
|
|
|
|
|
|
socket->Clear();
|
|
|
|
if (sFirstPass) {
|
|
|
|
socket->Append("<LABELS>");
|
|
|
|
socket->Append("Time");
|
|
|
|
socket->Append("Altitude");
|
|
|
|
socket->Append("Phi");
|
|
|
|
socket->Append("Tht");
|
|
|
|
socket->Append("Psi");
|
|
|
|
socket->Append("Rho");
|
|
|
|
socket->Append("Vtotal");
|
|
|
|
socket->Append("U");
|
|
|
|
socket->Append("V");
|
|
|
|
socket->Append("W");
|
|
|
|
socket->Append("Vn");
|
|
|
|
socket->Append("Ve");
|
|
|
|
socket->Append("Vd");
|
|
|
|
socket->Append("Udot");
|
|
|
|
socket->Append("Vdot");
|
|
|
|
socket->Append("Wdot");
|
|
|
|
socket->Append("P");
|
|
|
|
socket->Append("Q");
|
|
|
|
socket->Append("R");
|
|
|
|
socket->Append("PDot");
|
|
|
|
socket->Append("QDot");
|
|
|
|
socket->Append("RDot");
|
|
|
|
socket->Append("Fx");
|
|
|
|
socket->Append("Fy");
|
|
|
|
socket->Append("Fz");
|
|
|
|
socket->Append("Latitude");
|
|
|
|
socket->Append("Longitude");
|
|
|
|
socket->Append("QBar");
|
|
|
|
socket->Append("Alpha");
|
|
|
|
socket->Append("L");
|
|
|
|
socket->Append("M");
|
|
|
|
socket->Append("N");
|
2000-01-10 21:07:00 +00:00
|
|
|
socket->Append("Throttle");
|
|
|
|
socket->Append("Aileron");
|
|
|
|
socket->Append("Elevator");
|
|
|
|
socket->Append("Rudder");
|
1999-12-20 20:24:49 +00:00
|
|
|
sFirstPass = false;
|
|
|
|
socket->Send();
|
|
|
|
}
|
|
|
|
|
|
|
|
socket->Clear();
|
|
|
|
socket->Append(State->Getsim_time());
|
2000-04-28 19:59:46 +00:00
|
|
|
socket->Append(Position->Geth());
|
1999-12-20 20:24:49 +00:00
|
|
|
socket->Append(Rotation->Getphi());
|
|
|
|
socket->Append(Rotation->Gettht());
|
|
|
|
socket->Append(Rotation->Getpsi());
|
|
|
|
socket->Append(Atmosphere->GetDensity());
|
2000-04-28 19:59:46 +00:00
|
|
|
socket->Append(Translation->GetVt());
|
1999-12-20 20:24:49 +00:00
|
|
|
socket->Append(Translation->GetU());
|
|
|
|
socket->Append(Translation->GetV());
|
|
|
|
socket->Append(Translation->GetW());
|
|
|
|
socket->Append(Position->GetVn());
|
|
|
|
socket->Append(Position->GetVe());
|
|
|
|
socket->Append(Position->GetVd());
|
|
|
|
socket->Append(Translation->GetUdot());
|
|
|
|
socket->Append(Translation->GetVdot());
|
|
|
|
socket->Append(Translation->GetWdot());
|
|
|
|
socket->Append(Rotation->GetP());
|
|
|
|
socket->Append(Rotation->GetQ());
|
|
|
|
socket->Append(Rotation->GetR());
|
|
|
|
socket->Append(Rotation->GetPdot());
|
|
|
|
socket->Append(Rotation->GetQdot());
|
|
|
|
socket->Append(Rotation->GetRdot());
|
|
|
|
socket->Append(Aircraft->GetFx());
|
|
|
|
socket->Append(Aircraft->GetFy());
|
|
|
|
socket->Append(Aircraft->GetFz());
|
2000-04-28 19:59:46 +00:00
|
|
|
socket->Append(Position->GetLatitude());
|
|
|
|
socket->Append(Position->GetLongitude());
|
|
|
|
socket->Append(Translation->Getqbar());
|
1999-12-20 20:24:49 +00:00
|
|
|
socket->Append(Translation->Getalpha());
|
|
|
|
socket->Append(Aircraft->GetL());
|
|
|
|
socket->Append(Aircraft->GetM());
|
|
|
|
socket->Append(Aircraft->GetN());
|
2000-01-10 21:07:00 +00:00
|
|
|
socket->Append(FCS->GetThrottle(0));
|
|
|
|
socket->Append(FCS->GetDa());
|
|
|
|
socket->Append(FCS->GetDe());
|
|
|
|
socket->Append(FCS->GetDr());
|
2000-04-24 23:49:06 +00:00
|
|
|
socket->Send(); */
|
1999-12-20 20:24:49 +00:00
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:24:49 +00:00
|
|
|
|
|
|
|
void FGOutput::SocketStatusOutput(string out_str)
|
|
|
|
{
|
|
|
|
string asciiData;
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
if (socket == NULL) return;
|
1999-12-20 20:24:49 +00:00
|
|
|
|
|
|
|
socket->Clear();
|
|
|
|
asciiData = string("<STATUS>") + out_str;
|
|
|
|
socket->Append(asciiData.c_str());
|
|
|
|
socket->Send();
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
void FGOutput::Debug(void)
|
|
|
|
{
|
|
|
|
//TODO: Add your source code here
|
|
|
|
}
|
|
|
|
|