2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
Module: FGCoefficient.cpp
|
|
|
|
Author: Jon S. Berndt
|
|
|
|
Date started: 12/28/98
|
|
|
|
Purpose: Encapsulates the stability derivative class FGCoefficient;
|
|
|
|
Called by: FGAircraft
|
|
|
|
|
|
|
|
------------- 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 stability derivative coefficient lookup tables or
|
|
|
|
equations. Note that the coefficients need not be calculated each delta-t.
|
|
|
|
|
|
|
|
Note that the values in a row which index into the table must be the same value
|
|
|
|
for each column of data, so the first column of numbers for each altitude are
|
|
|
|
seen to be equal, and there are the same number of values for each altitude.
|
|
|
|
|
|
|
|
See the header file FGCoefficient.h for the values of the identifiers.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/28/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
|
|
|
|
2002-09-22 15:31:09 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
#include "FGCoefficient.h"
|
|
|
|
#include "FGState.h"
|
|
|
|
#include "FGFDMExec.h"
|
2002-03-20 12:45:02 +00:00
|
|
|
#include "FGPropertyManager.h"
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-04-17 21:19:54 +00:00
|
|
|
#ifndef FGFS
|
2001-10-05 20:19:59 +00:00
|
|
|
# if defined(sgi) && !defined(__GNUC__)
|
|
|
|
# include <iomanip.h>
|
|
|
|
# else
|
|
|
|
# include <iomanip>
|
|
|
|
# endif
|
2001-04-17 21:19:54 +00:00
|
|
|
#else
|
|
|
|
# include STL_IOMANIP
|
|
|
|
#endif
|
2000-11-14 20:31:58 +00:00
|
|
|
|
2003-01-24 12:55:28 +00:00
|
|
|
namespace JSBSim {
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
static const char *IdSrc = "$Id$";
|
2001-06-05 20:58:48 +00:00
|
|
|
static const char *IdHdr = ID_COEFFICIENT;
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS IMPLEMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-07-23 20:31:59 +00:00
|
|
|
FGCoefficient::FGCoefficient( FGFDMExec* fdex )
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
2001-03-30 01:04:50 +00:00
|
|
|
FDMExec = fdex;
|
|
|
|
State = FDMExec->GetState();
|
|
|
|
Table = 0;
|
2001-12-17 15:36:20 +00:00
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
PropertyManager = FDMExec->GetPropertyManager();
|
|
|
|
|
2002-04-16 13:15:29 +00:00
|
|
|
Table = (FGTable*)0L;
|
2002-03-20 12:45:02 +00:00
|
|
|
LookupR = LookupC = 0;
|
2002-04-16 13:15:29 +00:00
|
|
|
numInstances = 0;
|
|
|
|
rows = columns = 0;
|
|
|
|
|
|
|
|
StaticValue = 0.0;
|
|
|
|
totalValue = 0.0;
|
|
|
|
bias = 0.0;
|
|
|
|
gain = 1.0;
|
2002-07-11 00:19:19 +00:00
|
|
|
SD = 0.0;
|
2002-04-16 13:15:29 +00:00
|
|
|
|
|
|
|
filename.erase();
|
|
|
|
description.erase();
|
|
|
|
name.erase();
|
|
|
|
method.erase();
|
|
|
|
multparms.erase();
|
|
|
|
multparmsRow.erase();
|
|
|
|
multparmsCol.erase();
|
|
|
|
|
|
|
|
Debug(0);
|
2001-07-23 20:31:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
FGCoefficient::~FGCoefficient()
|
|
|
|
{
|
|
|
|
if (Table) delete Table;
|
2002-04-16 13:15:29 +00:00
|
|
|
Debug(1);
|
2001-07-23 20:31:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
bool FGCoefficient::Load(FGConfigFile *AC_cfg)
|
|
|
|
{
|
2001-07-23 20:31:59 +00:00
|
|
|
int start, end, n;
|
2002-09-24 12:54:43 +00:00
|
|
|
string mult;
|
2001-07-23 20:31:59 +00:00
|
|
|
|
2000-04-24 23:49:06 +00:00
|
|
|
if (AC_cfg) {
|
|
|
|
name = AC_cfg->GetValue("NAME");
|
|
|
|
method = AC_cfg->GetValue("TYPE");
|
|
|
|
AC_cfg->GetNextConfigLine();
|
|
|
|
*AC_cfg >> description;
|
|
|
|
if (method == "EQUATION") type = EQUATION;
|
|
|
|
else if (method == "TABLE") type = TABLE;
|
|
|
|
else if (method == "VECTOR") type = VECTOR;
|
|
|
|
else if (method == "VALUE") type = VALUE;
|
|
|
|
else type = UNKNOWN;
|
|
|
|
|
|
|
|
if (type == VECTOR || type == TABLE) {
|
|
|
|
*AC_cfg >> rows;
|
1999-03-02 01:02:51 +00:00
|
|
|
if (type == TABLE) {
|
2000-04-24 23:49:06 +00:00
|
|
|
*AC_cfg >> columns;
|
2001-03-30 01:04:50 +00:00
|
|
|
Table = new FGTable(rows, columns);
|
|
|
|
} else {
|
|
|
|
Table = new FGTable(rows);
|
1999-06-21 05:01:31 +00:00
|
|
|
}
|
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
*AC_cfg >> multparmsRow;
|
2002-09-24 12:54:43 +00:00
|
|
|
LookupR = PropertyManager->GetNode( multparmsRow );
|
2000-04-24 23:49:06 +00:00
|
|
|
}
|
1999-06-21 05:01:31 +00:00
|
|
|
|
2000-04-24 23:49:06 +00:00
|
|
|
if (type == TABLE) {
|
2001-12-13 04:48:34 +00:00
|
|
|
*AC_cfg >> multparmsCol;
|
2002-03-20 12:45:02 +00:00
|
|
|
|
2002-09-24 12:54:43 +00:00
|
|
|
LookupC = PropertyManager->GetNode( multparmsCol );
|
2000-04-24 23:49:06 +00:00
|
|
|
}
|
1999-06-21 05:01:31 +00:00
|
|
|
|
2000-04-24 23:49:06 +00:00
|
|
|
// Here, read in the line of the form (e.g.) FG_MACH|FG_QBAR|FG_ALPHA
|
|
|
|
// where each non-dimensionalizing parameter for this coefficient is
|
|
|
|
// separated by a | character
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2002-09-24 12:54:43 +00:00
|
|
|
string line=AC_cfg->GetCurrentLine();
|
|
|
|
unsigned j=0;
|
|
|
|
char tmp[255];
|
|
|
|
for(unsigned i=0;i<line.length(); i++ ) {
|
|
|
|
if( !isspace(line[i]) ) {
|
|
|
|
tmp[j]=line[i];
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tmp[j]='\0'; multparms=tmp;
|
|
|
|
end = multparms.length();
|
1999-05-08 03:19:08 +00:00
|
|
|
|
2000-04-24 23:49:06 +00:00
|
|
|
n = multparms.find("|");
|
2000-10-02 23:07:30 +00:00
|
|
|
start = 0;
|
2002-09-24 12:54:43 +00:00
|
|
|
if (multparms != string("none")) {
|
2001-07-23 20:31:59 +00:00
|
|
|
while (n < end && n >= 0) {
|
|
|
|
n -= start;
|
|
|
|
mult = multparms.substr(start,n);
|
2002-09-24 12:54:43 +00:00
|
|
|
multipliers.push_back( resolveSymbol( mult ) );
|
2001-07-23 20:31:59 +00:00
|
|
|
start += n+1;
|
|
|
|
n = multparms.find("|",start);
|
|
|
|
}
|
2002-03-20 12:45:02 +00:00
|
|
|
mult = multparms.substr(start,n);
|
2002-09-24 12:54:43 +00:00
|
|
|
multipliers.push_back( resolveSymbol( mult ) );
|
2001-07-23 20:31:59 +00:00
|
|
|
// End of non-dimensionalizing parameter read-in
|
2000-04-24 23:49:06 +00:00
|
|
|
}
|
2002-09-24 12:54:43 +00:00
|
|
|
AC_cfg->GetNextConfigLine();
|
2001-12-13 04:48:34 +00:00
|
|
|
if (type == VALUE) {
|
2000-04-24 23:49:06 +00:00
|
|
|
*AC_cfg >> StaticValue;
|
2001-12-13 04:48:34 +00:00
|
|
|
} else if (type == VECTOR || type == TABLE) {
|
2001-03-30 01:04:50 +00:00
|
|
|
*Table << *AC_cfg;
|
2001-12-13 04:48:34 +00:00
|
|
|
} else {
|
2000-10-02 23:07:30 +00:00
|
|
|
cerr << "Unimplemented coefficient type: " << type << endl;
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
2001-12-13 04:48:34 +00:00
|
|
|
|
2000-04-24 23:49:06 +00:00
|
|
|
AC_cfg->GetNextConfigLine();
|
2001-12-17 15:36:20 +00:00
|
|
|
FGCoefficient::Debug(2);
|
2001-12-13 04:48:34 +00:00
|
|
|
|
2001-07-23 20:31:59 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
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-11-20 22:34:24 +00:00
|
|
|
double FGCoefficient::Value(double rVal, double cVal)
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
double Value;
|
2001-03-30 01:04:50 +00:00
|
|
|
unsigned int midx;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-12-17 15:36:20 +00:00
|
|
|
SD = Value = gain*Table->GetValue(rVal, cVal) + bias;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
for (midx=0; midx < multipliers.size(); midx++) {
|
2002-03-20 12:45:02 +00:00
|
|
|
Value *= multipliers[midx]->getDoubleValue();
|
1999-02-05 21:26:01 +00:00
|
|
|
}
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGCoefficient::Value(double Val)
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
double Value;
|
2002-09-22 15:31:09 +00:00
|
|
|
|
2001-12-17 15:36:20 +00:00
|
|
|
SD = Value = gain*Table->GetValue(Val) + bias;
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
for (unsigned int midx=0; midx < multipliers.size(); midx++)
|
2002-03-20 12:45:02 +00:00
|
|
|
Value *= multipliers[midx]->getDoubleValue();
|
2000-10-02 23:07:30 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGCoefficient::Value(void)
|
1999-05-08 03:19:08 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
double Value;
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2001-12-17 15:36:20 +00:00
|
|
|
SD = Value = gain*StaticValue + bias;
|
1999-05-08 03:19:08 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
for (unsigned int midx=0; midx < multipliers.size(); midx++)
|
2002-03-20 12:45:02 +00:00
|
|
|
Value *= multipliers[midx]->getDoubleValue();
|
1999-05-08 03:19:08 +00:00
|
|
|
|
|
|
|
return Value;
|
|
|
|
}
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
double FGCoefficient::TotalValue(void)
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
|
|
|
switch(type) {
|
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
case UNKNOWN:
|
|
|
|
totalValue = -1;
|
|
|
|
break;
|
1999-12-30 18:01:59 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
case VALUE:
|
|
|
|
totalValue = Value();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VECTOR:
|
|
|
|
totalValue = Value( LookupR->getDoubleValue() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TABLE:
|
|
|
|
totalValue = Value( LookupR->getDoubleValue(),
|
|
|
|
LookupC->getDoubleValue() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EQUATION:
|
|
|
|
totalValue = 0.0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return totalValue;
|
1999-12-30 18:01:59 +00:00
|
|
|
}
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2001-07-23 20:31:59 +00:00
|
|
|
void FGCoefficient::DisplayCoeffFactors(void)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
cout << " Non-Dimensionalized by: ";
|
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
if (multipliers.size() == 0) {
|
2001-07-23 20:31:59 +00:00
|
|
|
cout << "none" << endl;
|
|
|
|
} else {
|
2001-12-13 04:48:34 +00:00
|
|
|
for (i=0; i<multipliers.size(); i++)
|
2002-03-20 12:45:02 +00:00
|
|
|
cout << multipliers[i]->getName() << " ";
|
2001-07-23 20:31:59 +00:00
|
|
|
}
|
|
|
|
cout << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
string FGCoefficient::GetSDstring(void)
|
2001-12-13 04:48:34 +00:00
|
|
|
{
|
2001-07-23 20:31:59 +00:00
|
|
|
char buffer[10];
|
|
|
|
string value;
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
sprintf(buffer,"%9.6f",SD);
|
|
|
|
value = string(buffer);
|
2001-07-23 20:31:59 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2002-04-16 13:15:29 +00:00
|
|
|
void FGCoefficient::bind(FGPropertyManager *parent)
|
|
|
|
{
|
2002-03-20 12:45:02 +00:00
|
|
|
string mult;
|
|
|
|
unsigned i;
|
|
|
|
|
2003-03-23 15:12:35 +00:00
|
|
|
node = parent->GetNode(name,true);
|
2002-03-20 12:45:02 +00:00
|
|
|
|
|
|
|
node->SetString("description",description);
|
2002-04-16 13:15:29 +00:00
|
|
|
if (LookupR) node->SetString("row-parm",LookupR->getName() );
|
|
|
|
if (LookupC) node->SetString("column-parm",LookupC->getName() );
|
2002-03-20 12:45:02 +00:00
|
|
|
|
|
|
|
mult="";
|
2002-04-16 13:15:29 +00:00
|
|
|
if (multipliers.size() == 0)
|
2002-03-23 00:29:21 +00:00
|
|
|
mult="none";
|
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
for (i=0; i<multipliers.size(); i++) {
|
|
|
|
mult += multipliers[i]->getName();
|
2002-04-16 13:15:29 +00:00
|
|
|
if ( i < multipliers.size()-1 ) mult += " ";
|
2002-03-20 12:45:02 +00:00
|
|
|
}
|
|
|
|
node->SetString("multipliers",mult);
|
|
|
|
|
|
|
|
node->Tie("SD-norm",this,&FGCoefficient::GetSD );
|
|
|
|
node->Tie("value-lbs",this,&FGCoefficient::GetValue );
|
|
|
|
|
|
|
|
node->Tie("bias", this, &FGCoefficient::getBias,
|
|
|
|
&FGCoefficient::setBias );
|
|
|
|
|
|
|
|
node->Tie("gain", this, &FGCoefficient::getGain,
|
|
|
|
&FGCoefficient::setGain );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2002-04-16 13:15:29 +00:00
|
|
|
void FGCoefficient::unbind(void)
|
|
|
|
{
|
2002-03-20 12:45:02 +00:00
|
|
|
node->Untie("SD-norm");
|
|
|
|
node->Untie("value-lbs");
|
|
|
|
node->Untie("bias");
|
|
|
|
node->Untie("gain");
|
2002-04-16 13:15:29 +00:00
|
|
|
}
|
2002-09-24 12:54:43 +00:00
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2003-03-23 15:12:35 +00:00
|
|
|
FGPropertyManager* FGCoefficient::resolveSymbol(string name)
|
|
|
|
{
|
|
|
|
FGPropertyManager* tmpn;
|
|
|
|
|
|
|
|
tmpn = PropertyManager->GetNode(name,false);
|
|
|
|
if ( !tmpn ) {
|
|
|
|
cerr << "Coefficient multipliers cannot create properties, check spelling?" << endl;
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
return tmpn;
|
2002-09-24 12:54:43 +00:00
|
|
|
}
|
|
|
|
|
2001-07-23 20:31:59 +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 FGCoefficient::Debug(int from)
|
|
|
|
{
|
|
|
|
if (debug_lvl <= 0) return;
|
|
|
|
|
|
|
|
if (debug_lvl & 1) { // Standard console startup message output
|
2001-12-17 15:36:20 +00:00
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
if (from == 2) { // Loading
|
|
|
|
cout << "\n " << highint << underon << name << underoff << normint << endl;
|
|
|
|
cout << " " << description << endl;
|
|
|
|
cout << " " << method << endl;
|
|
|
|
|
|
|
|
if (type == VECTOR || type == TABLE) {
|
|
|
|
cout << " Rows: " << rows << " ";
|
|
|
|
if (type == TABLE) {
|
|
|
|
cout << "Cols: " << columns;
|
|
|
|
}
|
2002-03-20 12:45:02 +00:00
|
|
|
cout << endl << " Row indexing parameter: " << LookupR->getName() << endl;
|
2001-12-13 04:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (type == TABLE) {
|
2002-03-20 12:45:02 +00:00
|
|
|
cout << " Column indexing parameter: " << LookupC->getName() << endl;
|
2001-12-13 04:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (type == VALUE) {
|
|
|
|
cout << " Value = " << StaticValue << endl;
|
|
|
|
} else if (type == VECTOR || type == TABLE) {
|
|
|
|
Table->Print();
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayCoeffFactors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
|
|
|
if (from == 0) cout << "Instantiated: FGCoefficient" << endl;
|
|
|
|
if (from == 1) cout << "Destroyed: FGCoefficient" << 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
|
|
|
|
}
|
2001-12-24 13:54:55 +00:00
|
|
|
if (debug_lvl & 64) {
|
|
|
|
if (from == 0) { // Constructor
|
|
|
|
cout << IdSrc << endl;
|
|
|
|
cout << IdHdr << endl;
|
|
|
|
}
|
|
|
|
}
|
2001-12-13 04:48:34 +00:00
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
|
2003-01-24 12:55:28 +00:00
|
|
|
} // namespace JSBSim
|