2001-11-09 04:38:53 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
Module: FGFCS.cpp
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/12/98
|
|
|
|
Purpose: Model the flight controls
|
|
|
|
Called by: FDMExec
|
|
|
|
|
|
|
|
------------- 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 class models the flight controls for a specific airplane
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/12/98 JSB Created
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
INCLUDES
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
#include "FGFCS.h"
|
|
|
|
#include "FGState.h"
|
|
|
|
#include "FGFDMExec.h"
|
|
|
|
#include "FGAtmosphere.h"
|
|
|
|
#include "FGAircraft.h"
|
|
|
|
#include "FGTranslation.h"
|
|
|
|
#include "FGRotation.h"
|
|
|
|
#include "FGPosition.h"
|
|
|
|
#include "FGAuxiliary.h"
|
|
|
|
#include "FGOutput.h"
|
|
|
|
|
|
|
|
#include "filtersjb/FGFilter.h"
|
|
|
|
#include "filtersjb/FGDeadBand.h"
|
|
|
|
#include "filtersjb/FGGain.h"
|
|
|
|
#include "filtersjb/FGGradient.h"
|
|
|
|
#include "filtersjb/FGSwitch.h"
|
|
|
|
#include "filtersjb/FGSummer.h"
|
2001-12-03 22:24:40 +00:00
|
|
|
#include "filtersjb/FGKinemat.h"
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
static const char *IdSrc = "$Id$";
|
|
|
|
static const char *IdHdr = ID_FCS;
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS IMPLEMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
|
|
|
|
{
|
|
|
|
Name = "FGFCS";
|
|
|
|
|
|
|
|
DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = PTrimCmd = 0.0;
|
|
|
|
DaPos = DePos = DrPos = DfPos = DsbPos = DspPos = 0.0;
|
2001-12-03 22:24:40 +00:00
|
|
|
GearCmd = GearPos = 1; // default to gear down
|
2001-11-09 04:38:53 +00:00
|
|
|
LeftBrake = RightBrake = CenterBrake = 0.0;
|
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
Debug(0);
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
FGFCS::~FGFCS()
|
|
|
|
{
|
|
|
|
ThrottleCmd.clear();
|
|
|
|
ThrottlePos.clear();
|
|
|
|
MixtureCmd.clear();
|
|
|
|
MixturePos.clear();
|
2001-12-05 03:10:20 +00:00
|
|
|
PropAdvanceCmd.clear();
|
|
|
|
PropAdvance.clear();
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
unsigned int i;
|
|
|
|
|
2001-11-30 17:49:37 +00:00
|
|
|
for (i=0;i<Components.size();i++) delete Components[i];
|
2001-12-13 04:48:34 +00:00
|
|
|
Debug(1);
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
bool FGFCS::Run(void)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (!FGModel::Run()) {
|
|
|
|
for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = ThrottleCmd[i];
|
|
|
|
for (i=0; i<MixturePos.size(); i++) MixturePos[i] = MixtureCmd[i];
|
2001-12-05 03:10:20 +00:00
|
|
|
for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = PropAdvanceCmd[i];
|
2001-11-09 04:38:53 +00:00
|
|
|
for (i=0; i<Components.size(); i++) Components[i]->Run();
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGFCS::SetThrottleCmd(int engineNum, double setting)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
2001-11-09 04:38:53 +00:00
|
|
|
if (engineNum < 0) {
|
2001-11-20 22:34:24 +00:00
|
|
|
for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
|
2001-11-09 04:38:53 +00:00
|
|
|
} else {
|
|
|
|
ThrottleCmd[engineNum] = setting;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
|
|
|
|
<< " engines exist, but attempted throttle command is for engine "
|
|
|
|
<< engineNum << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGFCS::SetThrottlePos(int engineNum, double setting)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
2001-11-09 04:38:53 +00:00
|
|
|
if (engineNum < 0) {
|
2001-11-20 22:34:24 +00:00
|
|
|
for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
|
2001-11-09 04:38:53 +00:00
|
|
|
} else {
|
|
|
|
ThrottlePos[engineNum] = setting;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
|
|
|
|
<< " engines exist, but attempted throttle position setting is for engine "
|
|
|
|
<< engineNum << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGFCS::GetThrottleCmd(int engineNum)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
2001-11-09 04:38:53 +00:00
|
|
|
if (engineNum < 0) {
|
|
|
|
cerr << "Cannot get throttle value for ALL engines" << endl;
|
|
|
|
} else {
|
|
|
|
return ThrottleCmd[engineNum];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
|
|
|
|
<< " engines exist, but throttle setting for engine " << engineNum
|
2001-12-05 03:10:20 +00:00
|
|
|
<< " is selected" << endl;
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
2001-12-03 22:24:40 +00:00
|
|
|
return 0.0;
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGFCS::GetThrottlePos(int engineNum)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
2001-11-09 04:38:53 +00:00
|
|
|
if (engineNum < 0) {
|
|
|
|
cerr << "Cannot get throttle value for ALL engines" << endl;
|
|
|
|
} else {
|
|
|
|
return ThrottlePos[engineNum];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
|
|
|
|
<< " engines exist, but attempted throttle position setting is for engine "
|
|
|
|
<< engineNum << endl;
|
|
|
|
}
|
2001-12-03 22:24:40 +00:00
|
|
|
return 0.0;
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGFCS::SetMixtureCmd(int engineNum, double setting)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
|
|
|
if (engineNum < 0) {
|
|
|
|
for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
|
|
|
|
} else {
|
|
|
|
MixtureCmd[engineNum] = setting;
|
|
|
|
}
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGFCS::SetMixturePos(int engineNum, double setting)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
|
|
|
if (engineNum < 0) {
|
|
|
|
for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
|
|
|
|
} else {
|
|
|
|
MixturePos[engineNum] = setting;
|
|
|
|
}
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-12-05 03:10:20 +00:00
|
|
|
void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
|
2001-12-03 22:24:40 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
|
|
|
if (engineNum < 0) {
|
2001-12-05 03:10:20 +00:00
|
|
|
for (ctr=0;ctr<PropAdvanceCmd.size();ctr++) PropAdvanceCmd[ctr] = setting;
|
2001-12-03 22:24:40 +00:00
|
|
|
} else {
|
2001-12-05 03:10:20 +00:00
|
|
|
PropAdvanceCmd[engineNum] = setting;
|
2001-12-03 22:24:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-12-05 03:10:20 +00:00
|
|
|
void FGFCS::SetPropAdvance(int engineNum, double setting)
|
2001-12-03 22:24:40 +00:00
|
|
|
{
|
|
|
|
unsigned int ctr;
|
|
|
|
|
|
|
|
if (engineNum < (int)ThrottlePos.size()) {
|
|
|
|
if (engineNum < 0) {
|
2001-12-05 03:10:20 +00:00
|
|
|
for (ctr=0;ctr<=PropAdvanceCmd.size();ctr++) PropAdvance[ctr] = PropAdvanceCmd[ctr];
|
2001-12-03 22:24:40 +00:00
|
|
|
} else {
|
2001-12-05 03:10:20 +00:00
|
|
|
PropAdvance[engineNum] = setting;
|
2001-12-03 22:24:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-09 04:38:53 +00:00
|
|
|
bool FGFCS::Load(FGConfigFile* AC_cfg)
|
|
|
|
{
|
|
|
|
string token;
|
|
|
|
|
|
|
|
Name = Name + ":" + AC_cfg->GetValue("NAME");
|
|
|
|
if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
|
|
|
|
AC_cfg->GetNextConfigLine();
|
2001-11-20 22:34:24 +00:00
|
|
|
while ((token = AC_cfg->GetValue()) != string("/FLIGHT_CONTROL")) {
|
2001-11-09 04:38:53 +00:00
|
|
|
if (token == "COMPONENT") {
|
|
|
|
token = AC_cfg->GetValue("TYPE");
|
|
|
|
if (debug_lvl > 0) cout << " Loading Component \""
|
|
|
|
<< AC_cfg->GetValue("NAME")
|
2001-12-05 03:10:20 +00:00
|
|
|
<< "\" of type: " << token << endl;
|
2001-11-09 04:38:53 +00:00
|
|
|
if ((token == "LAG_FILTER") ||
|
|
|
|
(token == "LEAD_LAG_FILTER") ||
|
|
|
|
(token == "SECOND_ORDER_FILTER") ||
|
|
|
|
(token == "WASHOUT_FILTER") ||
|
|
|
|
(token == "INTEGRATOR") ) {
|
|
|
|
Components.push_back(new FGFilter(this, AC_cfg));
|
|
|
|
} else if ((token == "PURE_GAIN") ||
|
|
|
|
(token == "SCHEDULED_GAIN") ||
|
|
|
|
(token == "AEROSURFACE_SCALE") ) {
|
|
|
|
|
|
|
|
Components.push_back(new FGGain(this, AC_cfg));
|
|
|
|
|
|
|
|
} else if (token == "SUMMER") {
|
|
|
|
Components.push_back(new FGSummer(this, AC_cfg));
|
|
|
|
} else if (token == "DEADBAND") {
|
|
|
|
Components.push_back(new FGDeadBand(this, AC_cfg));
|
|
|
|
} else if (token == "GRADIENT") {
|
|
|
|
Components.push_back(new FGGradient(this, AC_cfg));
|
|
|
|
} else if (token == "SWITCH") {
|
|
|
|
Components.push_back(new FGSwitch(this, AC_cfg));
|
2001-12-03 22:24:40 +00:00
|
|
|
} else if (token == "KINEMAT") {
|
|
|
|
Components.push_back(new FGKinemat(this, AC_cfg));
|
2001-11-09 04:38:53 +00:00
|
|
|
} else {
|
|
|
|
cerr << "Unknown token [" << token << "] in FCS portion of config file" << endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
AC_cfg->GetNextConfigLine();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGFCS::GetComponentOutput(eParam idx) {
|
2001-11-09 04:38:53 +00:00
|
|
|
return Components[idx]->GetOutput();
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
string FGFCS::GetComponentName(int idx) {
|
|
|
|
return Components[idx]->GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
|
|
|
|
{
|
2001-11-09 04:38:53 +00:00
|
|
|
switch (bg) {
|
|
|
|
case FGLGear::bgLeft:
|
|
|
|
return LeftBrake;
|
|
|
|
case FGLGear::bgRight:
|
|
|
|
return RightBrake;
|
|
|
|
case FGLGear::bgCenter:
|
|
|
|
return CenterBrake;
|
|
|
|
default:
|
|
|
|
cerr << "GetBrake asked to return a bogus brake value" << endl;
|
|
|
|
}
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
string FGFCS::GetComponentStrings(void)
|
|
|
|
{
|
|
|
|
unsigned int comp;
|
|
|
|
string CompStrings = "";
|
|
|
|
bool firstime = true;
|
|
|
|
|
|
|
|
for (comp = 0; comp < Components.size(); comp++) {
|
|
|
|
if (firstime) firstime = false;
|
|
|
|
else CompStrings += ", ";
|
|
|
|
|
|
|
|
CompStrings += Components[comp]->GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CompStrings;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
string FGFCS::GetComponentValues(void)
|
|
|
|
{
|
|
|
|
unsigned int comp;
|
|
|
|
string CompValues = "";
|
|
|
|
char buffer[10];
|
|
|
|
bool firstime = true;
|
|
|
|
|
|
|
|
for (comp = 0; comp < Components.size(); comp++) {
|
|
|
|
if (firstime) firstime = false;
|
|
|
|
else CompValues += ", ";
|
|
|
|
|
|
|
|
sprintf(buffer, "%9.6f", Components[comp]->GetOutput());
|
|
|
|
CompValues += string(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CompValues;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
void FGFCS::AddThrottle(void)
|
|
|
|
{
|
|
|
|
ThrottleCmd.push_back(0.0);
|
|
|
|
ThrottlePos.push_back(0.0);
|
2001-12-05 03:10:20 +00:00
|
|
|
MixtureCmd.push_back(0.0); // assume throttle and mixture are coupled
|
2001-11-09 04:38:53 +00:00
|
|
|
MixturePos.push_back(0.0);
|
2001-12-05 03:10:20 +00:00
|
|
|
PropAdvanceCmd.push_back(0.0); // assume throttle and prop pitch are coupled
|
|
|
|
PropAdvance.push_back(0.0);
|
2001-11-09 04:38:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2001-12-13 04:48:34 +00:00
|
|
|
// The bitmasked value choices are as follows:
|
|
|
|
// unset: In this case (the default) JSBSim would only print
|
|
|
|
// out the normally expected messages, essentially echoing
|
|
|
|
// the config files as they are read. If the environment
|
|
|
|
// variable is not set, debug_lvl is set to 1 internally
|
|
|
|
// 0: This requests JSBSim not to output any messages
|
|
|
|
// whatsoever.
|
|
|
|
// 1: This value explicity requests the normal JSBSim
|
|
|
|
// startup messages
|
|
|
|
// 2: This value asks for a message to be printed out when
|
|
|
|
// a class is instantiated
|
|
|
|
// 4: When this value is set, a message is displayed when a
|
|
|
|
// FGModel object executes its Run() method
|
|
|
|
// 8: When this value is set, various runtime state variables
|
|
|
|
// are printed out periodically
|
|
|
|
// 16: When set various parameters are sanity checked and
|
|
|
|
// a message is printed out when they go out of bounds
|
|
|
|
|
|
|
|
void FGFCS::Debug(int from)
|
2001-11-09 04:38:53 +00:00
|
|
|
{
|
2001-12-13 04:48:34 +00:00
|
|
|
if (debug_lvl <= 0) return;
|
|
|
|
|
|
|
|
if (debug_lvl & 1) { // Standard console startup message output
|
|
|
|
if (from == 0) { // Constructor
|
2001-11-09 04:38:53 +00:00
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
|
|
|
if (from == 0) cout << "Instantiated: FGFCS" << endl;
|
|
|
|
if (from == 1) cout << "Destroyed: FGFCS" << endl;
|
|
|
|
}
|
|
|
|
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
|
|
|
}
|
|
|
|
if (debug_lvl & 8 ) { // Runtime state variables
|
|
|
|
}
|
|
|
|
if (debug_lvl & 16) { // Sanity checking
|
|
|
|
}
|
|
|
|
}
|