WingIncidence=0;
impending_stall = 0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
FGAircraft::~FGAircraft()
{
- if (debug_lvl & 2) cout << "Destroyed: FGAircraft" << endl;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::Load(FGConfigFile* AC_cfg)
-{
- string token;
-
- if (!ReadPrologue(AC_cfg)) return false;
-
- while ((AC_cfg->GetNextConfigLine() != string("EOF")) &&
- (token = AC_cfg->GetValue()) != string("/FDM_CONFIG")) {
- if (token == "METRICS") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
- if (!ReadMetrics(AC_cfg)) return false;
- } else if (token == "AERODYNAMICS") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
- if (!ReadAerodynamics(AC_cfg)) return false;
- } else if (token == "UNDERCARRIAGE") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Landing Gear" << fgdef << endl;
- if (!ReadUndercarriage(AC_cfg)) return false;
- } else if (token == "PROPULSION") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Propulsion" << fgdef << endl;
- if (!ReadPropulsion(AC_cfg)) return false;
- } else if (token == "FLIGHT_CONTROL") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Flight Control" << fgdef << endl;
- if (!ReadFlightControls(AC_cfg)) return false;
- } else if (token == "OUTPUT") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Output directives" << fgdef << endl;
- if (!ReadOutput(AC_cfg)) return false;
- }
- }
-
- return true;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGAircraft::ReadPrologue(FGConfigFile* AC_cfg)
-{
- string token = AC_cfg->GetValue();
- string scratch;
- AircraftName = AC_cfg->GetValue("NAME");
- if (debug_lvl > 0) cout << underon << "Reading Aircraft Configuration File"
- << underoff << ": " << highint << AircraftName << normint << endl;
- scratch = AC_cfg->GetValue("VERSION").c_str();
-
- CFGVersion = AC_cfg->GetValue("VERSION");
-
- if (debug_lvl > 0)
- cout << " Version: " << highint << CFGVersion
- << normint << endl;
- if (CFGVersion != needed_cfg_version) {
- cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
- " RESULTS WILL BE UNPREDICTABLE !!" << endl;
- cerr << "Current version needed is: " << needed_cfg_version << endl;
- cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
+bool FGAircraft::Load(FGConfigFile* AC_cfg)
{
string token = "";
string parameter;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// 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
-bool FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg)
+void FGAircraft::Debug(int from)
{
- if (!Propulsion->Load(AC_cfg)) {
- cerr << " Propulsion not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ if (debug_lvl <= 0) return;
-bool FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg)
-{
- if (!FCS->Load(AC_cfg)) {
- cerr << " Flight Controls not successfully loaded" << endl;
- return false;
+ if (debug_lvl & 1) { // Standard console startup message output
+ if (from == 0) { // Constructor
+ }
}
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg)
-{
- if (!Aerodynamics->Load(AC_cfg)) {
- cerr << " Aerodynamics not successfully loaded" << endl;
- return false;
+ if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+ if (from == 0) cout << "Instantiated: FGAircraft" << endl;
+ if (from == 1) cout << "Destroyed: FGAircraft" << endl;
}
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg)
-{
- if (!GroundReactions->Load(AC_cfg)) {
- cerr << " Ground Reactions not successfully loaded" << endl;
- return false;
+ if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadOutput(FGConfigFile* AC_cfg)
-{
- if (!Output->Load(AC_cfg)) {
- cerr << " Output not successfully loaded" << endl;
- return false;
+ if (debug_lvl & 8 ) { // Runtime state variables
+ }
+ if (debug_lvl & 16) { // Sanity checking
+ }
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
}
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGAircraft::Debug(int from)
-{
- //TODO: Add your source code here
}