From: david Date: Tue, 16 Apr 2002 13:15:29 +0000 (+0000) Subject: Latest JSBSim changes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=adcb4fc30ec52bcdab526edd2ebcd6cfdfd49b0b;p=flightgear.git Latest JSBSim changes. --- diff --git a/src/FDM/JSBSim/FGAerodynamics.cpp b/src/FDM/JSBSim/FGAerodynamics.cpp index 9ec9edc89..8cc13af21 100644 --- a/src/FDM/JSBSim/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/FGAerodynamics.cpp @@ -112,7 +112,7 @@ bool FGAerodynamics::Run(void) } //correct signs of drag and lift to wind axes convention //positive forward, right, down - if( Translation->Getqbar() > 0) { + if ( Translation->Getqbar() > 0) { clsq = vFs(eLift) / (Aircraft->GetWingArea()*Translation->Getqbar()); clsq *= clsq; } @@ -161,7 +161,7 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg) axis = AC_cfg->GetValue("NAME"); AC_cfg->GetNextConfigLine(); while ((token = AC_cfg->GetValue()) != string("/AXIS")) { - if( token == "COEFFICIENT" ) { + if ( token == "COEFFICIENT" ) { ca.push_back( new FGCoefficient(FDMExec) ); ca.back()->Load(AC_cfg); } else if ( token == "GROUP" ) { @@ -223,8 +223,8 @@ string FGAerodynamics::GetCoefficientValues(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGAerodynamics::bind(void){ - +void FGAerodynamics::bind(void) +{ PropertyManager->Tie("forces/fbx-aero-lbs", this,1, &FGAerodynamics::GetForces); PropertyManager->Tie("forces/fby-aero-lbs", this,2, @@ -251,24 +251,25 @@ void FGAerodynamics::bind(void){ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGAerodynamics::bindModel(void) { - +void FGAerodynamics::bindModel(void) +{ unsigned i,j; FGPropertyManager* node; string axis_node_name; node = PropertyManager->GetNode("aero/buildup",true); - for(i=0;iGetNode( string(AxisNames[i]),true ); + for (i=0;iGetNode( string(AxisNames[i]),true ); for (j=0; j < Coeff[i].size(); j++) { Coeff[i][j]->bind(node); } - node=(FGPropertyManager*)node->getParent(); + node = (FGPropertyManager*)node->getParent(); } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGAerodynamics::unbind(void){ +void FGAerodynamics::unbind(void) +{ unsigned i,j; PropertyManager->Untie("forces/fbx-aero-lbs"); @@ -283,7 +284,7 @@ void FGAerodynamics::unbind(void){ PropertyManager->Untie("forces/lod-norm"); PropertyManager->Untie("aero/cl-squared-norm"); - for( i=0; iunbind(); diff --git a/src/FDM/JSBSim/FGAerodynamics.h b/src/FDM/JSBSim/FGAerodynamics.h index 0fa843abf..7c0eb7728 100644 --- a/src/FDM/JSBSim/FGAerodynamics.h +++ b/src/FDM/JSBSim/FGAerodynamics.h @@ -115,17 +115,17 @@ public: /** Gets the total aerodynamic force vector. @return a force vector reference. */ FGColumnVector3& GetForces(void) {return vForces;} - double GetForces(int n) const {return vForces(n);} + inline double GetForces(int n) const {return vForces(n);} /** Gets the total aerodynamic moment vector. @return a moment vector reference. */ FGColumnVector3& GetMoments(void) {return vMoments;} - double GetMoments(int n) const {return vMoments(n);} + inline double GetMoments(int n) const {return vMoments(n);} - FGColumnVector3& GetvLastFs(void) { return vLastFs; } - double GetvLastFs(int axis) const { return vLastFs(axis); } - FGColumnVector3& GetvFs(void) { return vFs; } - double GetvFs(int axis) const { return vFs(axis); } + inline FGColumnVector3& GetvLastFs(void) { return vLastFs; } + inline double GetvLastFs(int axis) const { return vLastFs(axis); } + inline FGColumnVector3& GetvFs(void) { return vFs; } + inline double GetvFs(int axis) const { return vFs(axis); } inline double GetLoD(void) const { return lod; } inline double GetClSquared(void) const { return clsq; } diff --git a/src/FDM/JSBSim/FGAtmosphere.cpp b/src/FDM/JSBSim/FGAtmosphere.cpp index c8dea78b7..30c172cff 100644 --- a/src/FDM/JSBSim/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/FGAtmosphere.cpp @@ -175,13 +175,13 @@ void FGAtmosphere::Calculate(double altitude) i = lastIndex-1; while (htab[i] > altitude) i--; } - } else if (altitude > htab[lastIndex+1]){ - if (altitude >= htab[7]){ + } else if (altitude > htab[lastIndex+1]) { + if (altitude >= htab[7]) { i = 7; altitude = htab[7]; } else { i = lastIndex+1; - while(htab[i+1] < altitude) i++; + while (htab[i+1] < altitude) i++; } } diff --git a/src/FDM/JSBSim/FGAuxiliary.cpp b/src/FDM/JSBSim/FGAuxiliary.cpp index 8bdcaffe3..de8230b1c 100644 --- a/src/FDM/JSBSim/FGAuxiliary.cpp +++ b/src/FDM/JSBSim/FGAuxiliary.cpp @@ -150,7 +150,7 @@ bool FGAuxiliary::Run() // The radius R is calculated below in the vector vToEyePt. vPilotAccel.InitMatrix(); - if( Translation->GetVt() > 1 ) { + if ( Translation->GetVt() > 1 ) { vToEyePt = Aircraft->GetXYZep() - MassBalance->GetXYZcg(); vToEyePt *= inchtoft; vPilotAccel = Aerodynamics->GetForces() @@ -197,6 +197,60 @@ double FGAuxiliary::GetCrossWind(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGAuxiliary::bind(void) +{ + PropertyManager->Tie("velocities/vc-fps", this, + &FGAuxiliary::GetVcalibratedFPS); + PropertyManager->Tie("velocities/vc-kts", this, + &FGAuxiliary::GetVcalibratedKTS); + PropertyManager->Tie("velocities/ve-fps", this, + &FGAuxiliary::GetVequivalentFPS); + PropertyManager->Tie("velocities/ve-kts", this, + &FGAuxiliary::GetVequivalentKTS); + PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this,1, + &FGAuxiliary::GetPilotAccel); + PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this,2, + &FGAuxiliary::GetPilotAccel); + PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this,3, + &FGAuxiliary::GetPilotAccel); + PropertyManager->Tie("accelerations/n-pilot-x-norm", this,1, + &FGAuxiliary::GetNpilot); + PropertyManager->Tie("accelerations/n-pilot-y-norm", this,2, + &FGAuxiliary::GetNpilot); + PropertyManager->Tie("accelerations/n-pilot-z-norm", this,3, + &FGAuxiliary::GetNpilot); + PropertyManager->Tie("position/epa-rad", this, + &FGAuxiliary::GetEarthPositionAngle); + /* PropertyManager->Tie("atmosphere/headwind-fps", this, + &FGAuxiliary::GetHeadWind, + true); + PropertyManager->Tie("atmosphere/crosswind-fps", this, + &FGAuxiliary::GetCrossWind, + true); */ +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGAuxiliary::unbind(void) +{ + PropertyManager->Untie("velocities/vc-fps"); + PropertyManager->Untie("velocities/vc-kts"); + PropertyManager->Untie("velocities/ve-fps"); + PropertyManager->Untie("velocities/ve-kts"); + PropertyManager->Untie("accelerations/a-pilot-x-ft_sec2"); + PropertyManager->Untie("accelerations/a-pilot-y-ft_sec2"); + PropertyManager->Untie("accelerations/a-pilot-z-ft_sec2"); + PropertyManager->Untie("accelerations/n-pilot-x-norm"); + PropertyManager->Untie("accelerations/n-pilot-y-norm"); + PropertyManager->Untie("accelerations/n-pilot-z-norm"); + PropertyManager->Untie("position/epa-rad"); + /* PropertyManager->Untie("atmosphere/headwind-fps"); + PropertyManager->Untie("atmosphere/crosswind-fps"); */ + +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + void FGAuxiliary::GetState(void) { qbar = Translation->Getqbar(); @@ -252,51 +306,3 @@ void FGAuxiliary::Debug(int from) } } -void FGAuxiliary::bind(void){ - PropertyManager->Tie("velocities/vc-fps", this, - &FGAuxiliary::GetVcalibratedFPS); - PropertyManager->Tie("velocities/vc-kts", this, - &FGAuxiliary::GetVcalibratedKTS); - PropertyManager->Tie("velocities/ve-fps", this, - &FGAuxiliary::GetVequivalentFPS); - PropertyManager->Tie("velocities/ve-kts", this, - &FGAuxiliary::GetVequivalentKTS); - PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this,1, - &FGAuxiliary::GetPilotAccel); - PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this,2, - &FGAuxiliary::GetPilotAccel); - PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this,3, - &FGAuxiliary::GetPilotAccel); - PropertyManager->Tie("accelerations/n-pilot-x-norm", this,1, - &FGAuxiliary::GetNpilot); - PropertyManager->Tie("accelerations/n-pilot-y-norm", this,2, - &FGAuxiliary::GetNpilot); - PropertyManager->Tie("accelerations/n-pilot-z-norm", this,3, - &FGAuxiliary::GetNpilot); - PropertyManager->Tie("position/epa-rad", this, - &FGAuxiliary::GetEarthPositionAngle); - /* PropertyManager->Tie("atmosphere/headwind-fps", this, - &FGAuxiliary::GetHeadWind, - true); - PropertyManager->Tie("atmosphere/crosswind-fps", this, - &FGAuxiliary::GetCrossWind, - true); */ - -} - -void FGAuxiliary::unbind(void){ - PropertyManager->Untie("velocities/vc-fps"); - PropertyManager->Untie("velocities/vc-kts"); - PropertyManager->Untie("velocities/ve-fps"); - PropertyManager->Untie("velocities/ve-kts"); - PropertyManager->Untie("accelerations/a-pilot-x-ft_sec2"); - PropertyManager->Untie("accelerations/a-pilot-y-ft_sec2"); - PropertyManager->Untie("accelerations/a-pilot-z-ft_sec2"); - PropertyManager->Untie("accelerations/n-pilot-x-norm"); - PropertyManager->Untie("accelerations/n-pilot-y-norm"); - PropertyManager->Untie("accelerations/n-pilot-z-norm"); - PropertyManager->Untie("position/epa-rad"); - /* PropertyManager->Untie("atmosphere/headwind-fps"); - PropertyManager->Untie("atmosphere/crosswind-fps"); */ - -} diff --git a/src/FDM/JSBSim/FGCoefficient.cpp b/src/FDM/JSBSim/FGCoefficient.cpp index 11deb848a..e2bee88db 100644 --- a/src/FDM/JSBSim/FGCoefficient.cpp +++ b/src/FDM/JSBSim/FGCoefficient.cpp @@ -68,21 +68,31 @@ CLASS IMPLEMENTATION FGCoefficient::FGCoefficient( FGFDMExec* fdex ) { - FDMExec = fdex; State = FDMExec->GetState(); Table = 0; PropertyManager = FDMExec->GetPropertyManager(); - bias=0; - gain=1; - + Table = (FGTable*)0L; LookupR = LookupC = 0; - - totalValue = 0; - - if (debug_lvl & 2) cout << "Instantiated: FGCoefficient" << endl; + numInstances = 0; + rows = columns = 0; + + StaticValue = 0.0; + totalValue = 0.0; + bias = 0.0; + gain = 1.0; + + filename.erase(); + description.erase(); + name.erase(); + method.erase(); + multparms.erase(); + multparmsRow.erase(); + multparmsCol.erase(); + + Debug(0); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -90,7 +100,7 @@ FGCoefficient::FGCoefficient( FGFDMExec* fdex ) FGCoefficient::~FGCoefficient() { if (Table) delete Table; - if (debug_lvl & 2) cout << "Destroyed: FGCoefficient" << endl; + Debug(1); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -284,23 +294,24 @@ string FGCoefficient::GetCoefficientValues(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGCoefficient::bind(FGPropertyManager *parent) { +void FGCoefficient::bind(FGPropertyManager *parent) +{ string mult; unsigned i; node=parent->GetNode(name,true); node->SetString("description",description); - if(LookupR) node->SetString("row-parm",LookupR->getName() ); - if(LookupC) node->SetString("column-parm",LookupC->getName() ); + if (LookupR) node->SetString("row-parm",LookupR->getName() ); + if (LookupC) node->SetString("column-parm",LookupC->getName() ); mult=""; - if(multipliers.size() == 0) + if (multipliers.size() == 0) mult="none"; for (i=0; igetName(); - if( i < multipliers.size()-1 ) mult += " "; + if ( i < multipliers.size()-1 ) mult += " "; } node->SetString("multipliers",mult); @@ -317,12 +328,14 @@ void FGCoefficient::bind(FGPropertyManager *parent) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGCoefficient::unbind(void) { +void FGCoefficient::unbind(void) +{ node->Untie("SD-norm"); node->Untie("value-lbs"); node->Untie("bias"); node->Untie("gain"); -} +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print diff --git a/src/FDM/JSBSim/FGCoefficient.h b/src/FDM/JSBSim/FGCoefficient.h index 0ddbeb696..f447e2297 100644 --- a/src/FDM/JSBSim/FGCoefficient.h +++ b/src/FDM/JSBSim/FGCoefficient.h @@ -131,13 +131,17 @@ public: virtual void bind(FGPropertyManager *parent); virtual void unbind(void); +protected: + FGFDMExec* FDMExec; + string description; + string name; + FGPropertyManager *node; + private: enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION}; int numInstances; string filename; - string description; - string name; string method; string multparms; string multparmsRow; @@ -149,7 +153,6 @@ private: double totalValue; double bias,gain; FGPropertyManager *LookupR, *LookupC; - FGPropertyManager *node; MultVec multipliers; int rows, columns; @@ -157,7 +160,6 @@ private: double SD; // Actual stability derivative (or other coefficient) value FGTable *Table; - FGFDMExec* FDMExec; FGState* State; FGAtmosphere* Atmosphere; FGFCS* FCS; diff --git a/src/FDM/JSBSim/FGConfigFile.h b/src/FDM/JSBSim/FGConfigFile.h index e1b7e55c0..ea3faf6c6 100644 --- a/src/FDM/JSBSim/FGConfigFile.h +++ b/src/FDM/JSBSim/FGConfigFile.h @@ -136,7 +136,7 @@ private: string LineComment; bool CommentsOn; bool Opened; - unsigned int CurrentIndex; + unsigned int CurrentIndex; void Debug(int from); }; diff --git a/src/FDM/JSBSim/FGFCS.cpp b/src/FDM/JSBSim/FGFCS.cpp index 58a683c60..a9b071b52 100644 --- a/src/FDM/JSBSim/FGFCS.cpp +++ b/src/FDM/JSBSim/FGFCS.cpp @@ -76,12 +76,12 @@ FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex) DoNormalize=true; bind(); - for(i=0;i<=NForms;i++) { + for (i=0;i<=NForms;i++) { DePos[i] = DaLPos[i] = DaRPos[i] = DrPos[i] = 0.0; DfPos[i] = DsbPos[i] = DspPos[i] = 0.0; } - for(i=0;iRun(); - if(DoNormalize) Normalize(); + if (DoNormalize) Normalize(); } else { } @@ -265,7 +265,7 @@ bool FGFCS::Load(FGConfigFile* AC_cfg) Name = Name + ":" + AC_cfg->GetValue("NAME"); if (debug_lvl > 0) cout << " Control System Name: " << Name << endl; - if( AC_cfg->GetValue("NORMALIZE") == "FALSE") { + if ( AC_cfg->GetValue("NORMALIZE") == "FALSE") { DoNormalize=false; cout << " Automatic Control Surface Normalization Disabled" << endl; } @@ -307,13 +307,13 @@ bool FGFCS::Load(FGConfigFile* AC_cfg) } //collect information for normalizing control surfaces string nodeName; - for(i=0;iGetType() == "AEROSURFACE_SCALE" + if ( (Components[i]->GetType() == "AEROSURFACE_SCALE" || Components[i]->GetType() == "KINEMAT") && Components[i]->GetOutputNode() ) { nodeName= Components[i]->GetOutputNode()->GetName(); - if( nodeName == "elevator-pos-rad" ) { + if ( nodeName == "elevator-pos-rad" ) { ToNormalize[iDe]=i; } else if ( nodeName == "left-aileron-pos-rad" || nodeName == "aileron-pos-rad" ) { @@ -424,31 +424,31 @@ void FGFCS::Normalize(void) { //those that are have an index >=0 in the ToNormalize array //ToNormalize is filled in Load() - if( ToNormalize[iDe] > -1 ) { + if ( ToNormalize[iDe] > -1 ) { DePos[ofNorm] = Components[ToNormalize[iDe]]->GetOutputPct(); } - if( ToNormalize[iDaL] > -1 ) { + if ( ToNormalize[iDaL] > -1 ) { DaLPos[ofNorm] = Components[ToNormalize[iDaL]]->GetOutputPct(); } - if( ToNormalize[iDaR] > -1 ) { + if ( ToNormalize[iDaR] > -1 ) { DaRPos[ofNorm] = Components[ToNormalize[iDaR]]->GetOutputPct(); } - if( ToNormalize[iDr] > -1 ) { + if ( ToNormalize[iDr] > -1 ) { DrPos[ofNorm] = Components[ToNormalize[iDr]]->GetOutputPct(); } - if( ToNormalize[iDsb] > -1 ) { + if ( ToNormalize[iDsb] > -1 ) { DsbPos[ofNorm] = Components[ToNormalize[iDsb]]->GetOutputPct(); } - if( ToNormalize[iDsp] > -1 ) { + if ( ToNormalize[iDsp] > -1 ) { DspPos[ofNorm] = Components[ToNormalize[iDsp]]->GetOutputPct(); } - if( ToNormalize[iDf] > -1 ) { + if ( ToNormalize[iDf] > -1 ) { DfPos[ofNorm] = Components[ToNormalize[iDf]]->GetOutputPct(); } @@ -464,7 +464,8 @@ void FGFCS::Normalize(void) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGFCS::bind(void){ +void FGFCS::bind(void) +{ PropertyManager->Tie("fcs/aileron-cmd-norm", this, &FGFCS::GetDaCmd, &FGFCS::SetDaCmd, @@ -598,11 +599,14 @@ void FGFCS::bind(void){ &FGFCS::SetGearPos, true); } + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGFCS::bindModel(void){ +void FGFCS::bindModel(void) +{ unsigned i; - for(i=0;iTie("fcs/throttle-cmd-norm",this,i, &FGFCS::GetThrottleCmd, &FGFCS::SetThrottleCmd, @@ -611,7 +615,7 @@ void FGFCS::bindModel(void){ &FGFCS::GetThrottlePos, &FGFCS::SetThrottlePos, true ); - if( MixtureCmd.size() > i ) { + if ( MixtureCmd.size() > i ) { PropertyManager->Tie("fcs/mixture-cmd-norm",this,i, &FGFCS::GetMixtureCmd, &FGFCS::SetMixtureCmd, @@ -621,7 +625,7 @@ void FGFCS::bindModel(void){ &FGFCS::SetMixturePos, true ); } - if( PropAdvanceCmd.size() > i ) { + if ( PropAdvanceCmd.size() > i ) { PropertyManager->Tie("fcs/advance-cmd-norm",this,i, &FGFCS::GetPropAdvanceCmd, &FGFCS::SetPropAdvanceCmd, @@ -636,7 +640,8 @@ void FGFCS::bindModel(void){ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGFCS::unbind(void){ +void FGFCS::unbind(void) +{ PropertyManager->Untie("fcs/aileron-cmd-norm"); PropertyManager->Untie("fcs/elevator-cmd-norm"); PropertyManager->Untie("fcs/rudder-cmd-norm"); @@ -670,8 +675,6 @@ void FGFCS::unbind(void){ PropertyManager->Untie("gear/gear-pos-norm"); } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index c0e9f8f52..84945690d 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -210,7 +210,7 @@ bool FGFDMExec::Allocate(void) if (!Aircraft->InitModel()) { cerr << fgred << "Aircraft model init failed" << fgdef << endl; Error+=128;} - if (!Translation->InitModel()){ + if (!Translation->InitModel()) { cerr << fgred << "Translation model init failed" << fgdef << endl; Error+=256;} if (!Rotation->InitModel()) { diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h index 5ced2e4c3..5355aaab5 100644 --- a/src/FDM/JSBSim/FGFDMExec.h +++ b/src/FDM/JSBSim/FGFDMExec.h @@ -69,6 +69,10 @@ CLASS DOCUMENTATION /** Encapsulates the JSBSim simulation executive. @author Jon S. Berndt @version $Id$ + @see + Header File + @see + Source File @doc This class is the interface class through which all other simulation classes are instantiated, initialized, and run. When integrated with FlightGear (or diff --git a/src/FDM/JSBSim/FGFactorGroup.cpp b/src/FDM/JSBSim/FGFactorGroup.cpp index 32a8d4e71..156210935 100644 --- a/src/FDM/JSBSim/FGFactorGroup.cpp +++ b/src/FDM/JSBSim/FGFactorGroup.cpp @@ -121,7 +121,6 @@ double FGFactorGroup::TotalValue(void) totalValue += sum[i]->TotalValue(); SDtotal += sum[i]->GetSD(); } - //cout << totalValue << " " << FGCoefficient::TotalValue() << endl; totalValue *= FGCoefficient::TotalValue(); SDtotal *= FGCoefficient::GetSD(); Debug(2); @@ -130,13 +129,10 @@ double FGFactorGroup::TotalValue(void) /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -void FGFactorGroup::bind(FGPropertyManager* parent) { - - cout << "In FGFactorGroup::bind" << endl; - cout << parent->getName() << endl; +void FGFactorGroup::bind(FGPropertyManager* parent) +{ unsigned i; node=parent->GetNode(name,true); - cout << node->getName() << endl; node->SetString("description",description); FGCoefficient::bind(node); for (i=0; i < sum.size(); i++) { @@ -148,7 +144,8 @@ void FGFactorGroup::bind(FGPropertyManager* parent) { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -void FGFactorGroup::unbind(void) { +void FGFactorGroup::unbind(void) +{ unsigned i; FGCoefficient::unbind(); diff --git a/src/FDM/JSBSim/FGFactorGroup.h b/src/FDM/JSBSim/FGFactorGroup.h index 2b4b7ae43..dda152e01 100644 --- a/src/FDM/JSBSim/FGFactorGroup.h +++ b/src/FDM/JSBSim/FGFactorGroup.h @@ -95,31 +95,29 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGFactorGroup: public FGCoefficient { - public: - FGFactorGroup(FGFDMExec* fdmex); - ~FGFactorGroup(); - - bool Load(FGConfigFile *AC_cfg); - double TotalValue(void); - inline double GetValue(void) const { return totalValue; } - //string GetCoefficientStrings(void); - //string GetCoefficientValues(void); - inline double GetSD(void) { return SDtotal; } - inline double GetFactorSD(void) { return FGCoefficient::GetSD(); } - - void bind(FGPropertyManager* parent); - void unbind(void); - private: - FGFDMExec *FDMExec; - string name; - string description; - typedef vector CoeffArray; - CoeffArray sum; - double SDtotal; - double totalValue; - FGPropertyManager* node; - void Debug(int from); +class FGFactorGroup: public FGCoefficient +{ +public: + FGFactorGroup(FGFDMExec* fdmex); + ~FGFactorGroup(); + + bool Load(FGConfigFile *AC_cfg); + double TotalValue(void); + inline double GetValue(void) const { return totalValue; } + //string GetCoefficientStrings(void); + //string GetCoefficientValues(void); + inline double GetSD(void) { return SDtotal; } + inline double GetFactorSD(void) { return FGCoefficient::GetSD(); } + + void bind(FGPropertyManager* parent); + void unbind(void); + +private: + typedef vector CoeffArray; + CoeffArray sum; + double SDtotal; + double totalValue; + void Debug(int from); }; #endif diff --git a/src/FDM/JSBSim/FGGroundReactions.cpp b/src/FDM/JSBSim/FGGroundReactions.cpp index db38bd24d..46602a049 100644 --- a/src/FDM/JSBSim/FGGroundReactions.cpp +++ b/src/FDM/JSBSim/FGGroundReactions.cpp @@ -163,6 +163,39 @@ string FGGroundReactions::GetGroundReactionValues(void) return GroundReactionValues; } +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGGroundReactions::bind(void) +{ + PropertyManager->Tie("gear/num-units", this, + &FGGroundReactions::GetNumGearUnits); + PropertyManager->Tie("moments/l-gear-lbsft", this,1, + &FGGroundReactions::GetMoments); + PropertyManager->Tie("moments/m-gear-lbsft", this,2, + &FGGroundReactions::GetMoments); + PropertyManager->Tie("moments/n-gear-lbsft", this,3, + &FGGroundReactions::GetMoments); + PropertyManager->Tie("forces/fbx-gear-lbs", this,1, + &FGGroundReactions::GetForces); + PropertyManager->Tie("forces/fby-gear-lbs", this,2, + &FGGroundReactions::GetForces); + PropertyManager->Tie("forces/fbz-gear-lbs", this,3, + &FGGroundReactions::GetForces); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGGroundReactions::unbind(void) +{ + PropertyManager->Untie("gear/num-units"); + PropertyManager->Untie("moments/l-gear-lbsft"); + PropertyManager->Untie("moments/m-gear-lbsft"); + PropertyManager->Untie("moments/n-gear-lbsft"); + PropertyManager->Untie("forces/fbx-gear-lbs"); + PropertyManager->Untie("forces/fby-gear-lbs"); + PropertyManager->Untie("forces/fbz-gear-lbs"); +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print @@ -209,30 +242,3 @@ void FGGroundReactions::Debug(int from) } } -void FGGroundReactions::bind(void){ - - PropertyManager->Tie("gear/num-units", this, - &FGGroundReactions::GetNumGearUnits); - PropertyManager->Tie("moments/l-gear-lbsft", this,1, - &FGGroundReactions::GetMoments); - PropertyManager->Tie("moments/m-gear-lbsft", this,2, - &FGGroundReactions::GetMoments); - PropertyManager->Tie("moments/n-gear-lbsft", this,3, - &FGGroundReactions::GetMoments); - PropertyManager->Tie("forces/fbx-gear-lbs", this,1, - &FGGroundReactions::GetForces); - PropertyManager->Tie("forces/fby-gear-lbs", this,2, - &FGGroundReactions::GetForces); - PropertyManager->Tie("forces/fbz-gear-lbs", this,3, - &FGGroundReactions::GetForces); -} - -void FGGroundReactions::unbind(void){ - PropertyManager->Untie("gear/num-units"); - PropertyManager->Untie("moments/l-gear-lbsft"); - PropertyManager->Untie("moments/m-gear-lbsft"); - PropertyManager->Untie("moments/n-gear-lbsft"); - PropertyManager->Untie("forces/fbx-gear-lbs"); - PropertyManager->Untie("forces/fby-gear-lbs"); - PropertyManager->Untie("forces/fbz-gear-lbs"); -} diff --git a/src/FDM/JSBSim/FGInertial.cpp b/src/FDM/JSBSim/FGInertial.cpp index 1475a6b93..f76274036 100644 --- a/src/FDM/JSBSim/FGInertial.cpp +++ b/src/FDM/JSBSim/FGInertial.cpp @@ -125,6 +125,27 @@ bool FGInertial::LoadInertial(FGConfigFile* AC_cfg) return true; } +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGInertial::bind(void) +{ + PropertyManager->Tie("forces/fbx-inertial-lbs", this,1, + &FGInertial::GetForces); + PropertyManager->Tie("forces/fby-inertial-lbs", this,2, + &FGInertial::GetForces); + PropertyManager->Tie("forces/fbz-inertial-lbs", this,3, + &FGInertial::GetForces); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGInertial::unbind(void) +{ + PropertyManager->Untie("forces/fbx-inertial-lbs"); + PropertyManager->Untie("forces/fby-inertial-lbs"); + PropertyManager->Untie("forces/fbz-inertial-lbs"); +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print @@ -171,17 +192,3 @@ void FGInertial::Debug(int from) } } -void FGInertial::bind(void){ - PropertyManager->Tie("forces/fbx-inertial-lbs", this,1, - &FGInertial::GetForces); - PropertyManager->Tie("forces/fby-inertial-lbs", this,2, - &FGInertial::GetForces); - PropertyManager->Tie("forces/fbz-inertial-lbs", this,3, - &FGInertial::GetForces); -} - -void FGInertial::unbind(void){ - PropertyManager->Untie("forces/fbx-inertial-lbs"); - PropertyManager->Untie("forces/fby-inertial-lbs"); - PropertyManager->Untie("forces/fbz-inertial-lbs"); -} diff --git a/src/FDM/JSBSim/FGMassBalance.cpp b/src/FDM/JSBSim/FGMassBalance.cpp index 5d14dae02..54f39639a 100644 --- a/src/FDM/JSBSim/FGMassBalance.cpp +++ b/src/FDM/JSBSim/FGMassBalance.cpp @@ -188,6 +188,48 @@ double FGMassBalance::GetPMIxz(void) return I; } +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGMassBalance::bind(void) +{ + PropertyManager->Tie("inertia/mass-slugs", this, + &FGMassBalance::GetMass); + PropertyManager->Tie("inertia/weight-lbs", this, + &FGMassBalance::GetWeight); + PropertyManager->Tie("inertia/ixx-lbsft2", this, + &FGMassBalance::GetIxx); + PropertyManager->Tie("inertia/iyy-lbsft2", this, + &FGMassBalance::GetIyy); + PropertyManager->Tie("inertia/izz-lbsft2", this, + &FGMassBalance::GetIzz); + PropertyManager->Tie("inertia/ixy-lbsft2", this, + &FGMassBalance::GetIxy); + PropertyManager->Tie("inertia/ixz-lbsft2", this, + &FGMassBalance::GetIxz); + PropertyManager->Tie("inertia/cg-x-ft", this,1, + &FGMassBalance::GetXYZcg); + PropertyManager->Tie("inertia/cg-y-ft", this,2, + &FGMassBalance::GetXYZcg); + PropertyManager->Tie("inertia/cg-z-ft", this,3, + &FGMassBalance::GetXYZcg); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGMassBalance::unbind(void) +{ + PropertyManager->Untie("inertia/mass-slugs"); + PropertyManager->Untie("inertia/weight-lbs"); + PropertyManager->Untie("inertia/ixx-lbsft2"); + PropertyManager->Untie("inertia/iyy-lbsft2"); + PropertyManager->Untie("inertia/izz-lbsft2"); + PropertyManager->Untie("inertia/ixy-lbsft2"); + PropertyManager->Untie("inertia/ixz-lbsft2"); + PropertyManager->Untie("inertia/cg-x-ft"); + PropertyManager->Untie("inertia/cg-y-ft"); + PropertyManager->Untie("inertia/cg-z-ft"); +} + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print @@ -242,38 +284,3 @@ void FGMassBalance::Debug(int from) } } -void FGMassBalance::bind(void){ - PropertyManager->Tie("inertia/mass-slugs", this, - &FGMassBalance::GetMass); - PropertyManager->Tie("inertia/weight-lbs", this, - &FGMassBalance::GetWeight); - PropertyManager->Tie("inertia/ixx-lbsft2", this, - &FGMassBalance::GetIxx); - PropertyManager->Tie("inertia/iyy-lbsft2", this, - &FGMassBalance::GetIyy); - PropertyManager->Tie("inertia/izz-lbsft2", this, - &FGMassBalance::GetIzz); - PropertyManager->Tie("inertia/ixy-lbsft2", this, - &FGMassBalance::GetIxy); - PropertyManager->Tie("inertia/ixz-lbsft2", this, - &FGMassBalance::GetIxz); - PropertyManager->Tie("inertia/cg-x-ft", this,1, - &FGMassBalance::GetXYZcg); - PropertyManager->Tie("inertia/cg-y-ft", this,2, - &FGMassBalance::GetXYZcg); - PropertyManager->Tie("inertia/cg-z-ft", this,3, - &FGMassBalance::GetXYZcg); -} - -void FGMassBalance::unbind(void){ - PropertyManager->Untie("inertia/mass-slugs"); - PropertyManager->Untie("inertia/weight-lbs"); - PropertyManager->Untie("inertia/ixx-lbsft2"); - PropertyManager->Untie("inertia/iyy-lbsft2"); - PropertyManager->Untie("inertia/izz-lbsft2"); - PropertyManager->Untie("inertia/ixy-lbsft2"); - PropertyManager->Untie("inertia/ixz-lbsft2"); - PropertyManager->Untie("inertia/cg-x-ft"); - PropertyManager->Untie("inertia/cg-y-ft"); - PropertyManager->Untie("inertia/cg-z-ft"); -} diff --git a/src/FDM/JSBSim/FGMatrix33.cpp b/src/FDM/JSBSim/FGMatrix33.cpp index dc88dc2a3..830e99ddd 100644 --- a/src/FDM/JSBSim/FGMatrix33.cpp +++ b/src/FDM/JSBSim/FGMatrix33.cpp @@ -328,7 +328,7 @@ FGMatrix33 FGMatrix33::operator/(const double scalar) { FGMatrix33 Quot; - if( scalar != 0 ) { + if ( scalar != 0 ) { double tmp = 1.0/scalar; Quot(1,1) = data[1][1] * tmp; Quot(1,2) = data[1][2] * tmp; @@ -351,7 +351,7 @@ FGMatrix33 FGMatrix33::operator/(const double scalar) void FGMatrix33::operator/=(const double scalar) { - if( scalar != 0 ) { + if ( scalar != 0 ) { double tmp = 1.0/scalar; data[1][1] *= tmp; data[1][2] *= tmp; diff --git a/src/FDM/JSBSim/FGModel.cpp b/src/FDM/JSBSim/FGModel.cpp index d8b019381..6520196e6 100644 --- a/src/FDM/JSBSim/FGModel.cpp +++ b/src/FDM/JSBSim/FGModel.cpp @@ -91,7 +91,6 @@ FGModel::FGModel(FGFDMExec* fdmex) //must be brought up now. PropertyManager = FDMExec->GetPropertyManager(); - exe_ctr = 1; if (debug_lvl & 2) cout << " FGModel Base Class" << endl; diff --git a/src/FDM/JSBSim/FGModel.h b/src/FDM/JSBSim/FGModel.h index f9bf7e86f..740f4521b 100644 --- a/src/FDM/JSBSim/FGModel.h +++ b/src/FDM/JSBSim/FGModel.h @@ -97,6 +97,10 @@ CLASS DOCUMENTATION /** Base class for all scheduled JSBSim models @author Jon S. Berndt + @see + Header File + @see + Source File */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGOutput.cpp b/src/FDM/JSBSim/FGOutput.cpp index e7efe9cfb..4d9e94919 100644 --- a/src/FDM/JSBSim/FGOutput.cpp +++ b/src/FDM/JSBSim/FGOutput.cpp @@ -117,7 +117,7 @@ void FGOutput::SetType(string type) Type = otSocket; } else if (type == "TERMINAL") { Type = otTerminal; - } else if (type != string("NONE")){ + } else if (type != string("NONE")) { Type = otUnknown; cerr << "Unknown type of output specified in config file" << endl; } diff --git a/src/FDM/JSBSim/FGPiston.cpp b/src/FDM/JSBSim/FGPiston.cpp index e96146cb9..46eaaccf1 100644 --- a/src/FDM/JSBSim/FGPiston.cpp +++ b/src/FDM/JSBSim/FGPiston.cpp @@ -163,7 +163,7 @@ double FGPiston::Calculate(double PowerRequired) //Assume lean limit at 22 AFR for now - thats a thi of 0.668 //This might be a bit generous, but since there's currently no audiable warning of impending //cutout in the form of misfiring and/or rough running its probably reasonable for now. - if(equivalence_ratio < 0.668) + if (equivalence_ratio < 0.668) Running = false; doEnginePower(); @@ -231,7 +231,7 @@ void FGPiston::doEngineStartup(void) if ((!Running) && (spark) && (fuel)) { // start the engine if revs high enough - if(Cranking) { + if (Cranking) { if ((RPM > 450) && (crank_counter > 175)) { //Add a little delay to startup on the starter Running = true; @@ -355,7 +355,7 @@ void FGPiston::doFuelFlow(void) void FGPiston::doEnginePower(void) { ManifoldPressure_inHg *= p_amb / p_amb_sea_level; - if(Running) { + if (Running) { double ManXRPM = ManifoldPressure_inHg * RPM; // FIXME: this needs to be generalized Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0; diff --git a/src/FDM/JSBSim/FGPosition.cpp b/src/FDM/JSBSim/FGPosition.cpp index 1fcd1e561..01a36c649 100644 --- a/src/FDM/JSBSim/FGPosition.cpp +++ b/src/FDM/JSBSim/FGPosition.cpp @@ -229,52 +229,9 @@ void FGPosition::SetDistanceAGL(double tt) { } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -// 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 FGPosition::Debug(int from) +void FGPosition::bind(void) { - if (debug_lvl <= 0) return; - - if (debug_lvl & 1) { // Standard console startup message output - if (from == 0) { // Constructor - - } - } - if (debug_lvl & 2 ) { // Instantiation/Destruction notification - if (from == 0) cout << "Instantiated: FGPosition" << endl; - if (from == 1) cout << "Destroyed: FGPosition" << 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 - } - if (debug_lvl & 64) { - if (from == 0) { // Constructor - cout << IdSrc << endl; - cout << IdHdr << endl; - } - } -} - -void FGPosition::bind(void){ PropertyManager->Tie("velocities/v-north-fps", this, &FGPosition::GetVn); PropertyManager->Tie("velocities/v-east-fps", this, @@ -319,7 +276,10 @@ void FGPosition::bind(void){ &FGPosition::GetHOverBMAC); } -void FGPosition::unbind(void){ +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGPosition::unbind(void) +{ PropertyManager->Untie("velocities/v-north-fps"); PropertyManager->Untie("velocities/v-east-fps"); PropertyManager->Untie("velocities/v-down-fps"); @@ -338,3 +298,50 @@ void FGPosition::unbind(void){ PropertyManager->Untie("aero/h_b-cg-ft"); PropertyManager->Untie("aero/h_b-mac-ft"); } + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +// 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 FGPosition::Debug(int from) +{ + if (debug_lvl <= 0) return; + + if (debug_lvl & 1) { // Standard console startup message output + if (from == 0) { // Constructor + + } + } + if (debug_lvl & 2 ) { // Instantiation/Destruction notification + if (from == 0) cout << "Instantiated: FGPosition" << endl; + if (from == 1) cout << "Destroyed: FGPosition" << 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 + } + if (debug_lvl & 64) { + if (from == 0) { // Constructor + cout << IdSrc << endl; + cout << IdHdr << endl; + } + } +} + diff --git a/src/FDM/JSBSim/FGPropulsion.cpp b/src/FDM/JSBSim/FGPropulsion.cpp index 39f278a96..7a31a46aa 100644 --- a/src/FDM/JSBSim/FGPropulsion.cpp +++ b/src/FDM/JSBSim/FGPropulsion.cpp @@ -131,9 +131,9 @@ bool FGPropulsion::GetSteadyState(void) PowerAvailable = Engines[i]->Calculate(Thrusters[i]->GetPowerRequired()); lastThrust = currentThrust; currentThrust = Thrusters[i]->Calculate(PowerAvailable); - if(fabs(lastThrust-currentThrust) < 0.0001) { + if (fabs(lastThrust-currentThrust) < 0.0001) { steady_count++; - if(steady_count > 120) { steady=true; } + if (steady_count > 120) { steady=true; } } else { steady_count=0; } @@ -548,7 +548,8 @@ double FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGPropulsion::bind(void){ +void FGPropulsion::bind(void) +{ /* PropertyManager->Tie("propulsion/num-engines", this, &FGPropulsion::GetNumEngines); PropertyManager->Tie("propulsion/num-tanks", this, @@ -575,7 +576,8 @@ void FGPropulsion::bind(void){ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGPropulsion::unbind(void){ +void FGPropulsion::unbind(void) +{ /* PropertyManager->Untie("propulsion/num-engines"); PropertyManager->Untie("propulsion/num-tanks"); */ PropertyManager->Untie("propulsion/num-sel-fuel-tanks"); diff --git a/src/FDM/JSBSim/FGRotation.cpp b/src/FDM/JSBSim/FGRotation.cpp index d07c973e5..18ce859ae 100644 --- a/src/FDM/JSBSim/FGRotation.cpp +++ b/src/FDM/JSBSim/FGRotation.cpp @@ -155,60 +155,9 @@ void FGRotation::GetState(void) } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -// 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 FGRotation::Debug(int from) +void FGRotation::bind(void) { - if (debug_lvl <= 0) return; - - if (debug_lvl & 1) { // Standard console startup message output - if (from == 0) { // Constructor - - } - } - if (debug_lvl & 2 ) { // Instantiation/Destruction notification - if (from == 0) cout << "Instantiated: FGRotation" << endl; - if (from == 1) cout << "Destroyed: FGRotation" << 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 check variables - if (from == 2) { - if (fabs(vPQR(eP)) > 100) - cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl; - if (fabs(vPQR(eQ)) > 100) - cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl; - if (fabs(vPQR(eR)) > 100) - cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl; - } - } - if (debug_lvl & 64) { - if (from == 0) { // Constructor - cout << IdSrc << endl; - cout << IdHdr << endl; - } - } -} - -void FGRotation::bind(void){ PropertyManager->Tie("velocities/p-rad_sec", this,1, &FGRotation::GetPQR); PropertyManager->Tie("velocities/q-rad_sec", this,2, @@ -247,7 +196,10 @@ void FGRotation::bind(void){ &FGRotation::Getpsi); } -void FGRotation::unbind(void){ +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGRotation::unbind(void) +{ PropertyManager->Untie("velocities/p-rad_sec"); PropertyManager->Untie("velocities/q-rad_sec"); PropertyManager->Untie("velocities/r-rad_sec"); @@ -267,3 +219,58 @@ void FGRotation::unbind(void){ PropertyManager->Untie("attitude/theta-rad"); PropertyManager->Untie("attitude/psi-true-rad"); } + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +// 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 FGRotation::Debug(int from) +{ + if (debug_lvl <= 0) return; + + if (debug_lvl & 1) { // Standard console startup message output + if (from == 0) { // Constructor + + } + } + if (debug_lvl & 2 ) { // Instantiation/Destruction notification + if (from == 0) cout << "Instantiated: FGRotation" << endl; + if (from == 1) cout << "Destroyed: FGRotation" << 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 check variables + if (from == 2) { + if (fabs(vPQR(eP)) > 100) + cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl; + if (fabs(vPQR(eQ)) > 100) + cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl; + if (fabs(vPQR(eR)) > 100) + cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl; + } + } + if (debug_lvl & 64) { + if (from == 0) { // Constructor + cout << IdSrc << endl; + cout << IdHdr << endl; + } + } +} + diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index 3359a8549..956922022 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -233,8 +233,8 @@ void FGState::Initialize(double U, double V, double W, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::Initialize(FGInitialCondition *FGIC) { - +void FGState::Initialize(FGInitialCondition *FGIC) +{ double tht,psi,phi; double U, V, W, h; double latitude, longitude; @@ -263,7 +263,8 @@ void FGState::Initialize(FGInitialCondition *FGIC) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::InitMatrices(double phi, double tht, double psi) { +void FGState::InitMatrices(double phi, double tht, double psi) +{ double thtd2, psid2, phid2; double Sthtd2, Spsid2, Sphid2; double Cthtd2, Cpsid2, Cphid2; @@ -299,7 +300,8 @@ void FGState::InitMatrices(double phi, double tht, double psi) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::CalcMatrices(void) { +void FGState::CalcMatrices(void) +{ double Q0Q0, Q1Q1, Q2Q2, Q3Q3; double Q0Q1, Q0Q2, Q0Q3, Q1Q2; double Q1Q3, Q2Q3; @@ -331,7 +333,8 @@ void FGState::CalcMatrices(void) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::IntegrateQuat(FGColumnVector3 vPQR, int rate) { +void FGState::IntegrateQuat(FGColumnVector3 vPQR, int rate) +{ vQdot(1) = -0.5*(vQtrn(2)*vPQR(eP) + vQtrn(3)*vPQR(eQ) + vQtrn(4)*vPQR(eR)); vQdot(2) = 0.5*(vQtrn(1)*vPQR(eP) + vQtrn(3)*vPQR(eR) - vQtrn(4)*vPQR(eQ)); vQdot(3) = 0.5*(vQtrn(1)*vPQR(eQ) + vQtrn(4)*vPQR(eP) - vQtrn(2)*vPQR(eR)); @@ -345,7 +348,8 @@ void FGState::IntegrateQuat(FGColumnVector3 vPQR, int rate) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -FGColumnVector3& FGState::CalcEuler(void) { +FGColumnVector3& FGState::CalcEuler(void) +{ if (mTl2b(3,3) == 0.0) mTl2b(3,3) = 0.0000001; if (mTl2b(1,1) == 0.0) mTl2b(1,1) = 0.0000001; @@ -427,16 +431,18 @@ void FGState::ReportState(void) FDMExec->GetMassBalance()->GetXYZcg(2), FDMExec->GetMassBalance()->GetXYZcg(3)); cout << out; - if( FCS->GetDfPos() <= 0.01) + if ( FCS->GetDfPos() <= 0.01) snprintf(flap,10,"Up"); else snprintf(flap,10,"%2.0f",FCS->GetDfPos()); - if(FCS->GetGearPos() < 0.01) + + if (FCS->GetGearPos() < 0.01) snprintf(gear,12,"Up"); - else if(FCS->GetGearPos() > 0.99) + else if (FCS->GetGearPos() > 0.99) snprintf(gear,12,"Down"); else - snprintf(gear,12,"In Transit"); + snprintf(gear,12,"In Transit"); + snprintf(out,80, " Flaps: %3s Gear: %12s\n",flap,gear); cout << out; snprintf(out,80, " Speed: %4.0f KCAS Mach: %5.2f\n", @@ -491,7 +497,8 @@ void FGState::ReportState(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::InitPropertyMaps(void) { +void FGState::InitPropertyMaps(void) +{ ParamNameToProp[ "FG_TIME" ]="sim-time-sec"; ParamNameToProp[ "FG_QBAR" ]="aero/qbar-psf"; ParamNameToProp[ "FG_WINGAREA" ]="metrics/Sw-sqft"; @@ -568,24 +575,23 @@ void FGState::InitPropertyMaps(void) { ParamNameToProp[ "FG_VBARV" ]="metrics/vbarv-norm"; ParamNameToProp[ "FG_GEAR_CMD" ]="gear/gear-cmd-norm"; ParamNameToProp[ "FG_GEAR_POS" ]="gear/gear-pos-norm"; - } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::bind(void) { +void FGState::bind(void) +{ PropertyManager->Tie("sim-time-sec",this, &FGState::Getsim_time); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGState::unbind(void) { +void FGState::unbind(void) +{ PropertyManager->Untie("sim-time-sec"); } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print @@ -632,4 +638,3 @@ void FGState::Debug(int from) } } - diff --git a/src/FDM/JSBSim/FGTable.cpp b/src/FDM/JSBSim/FGTable.cpp index 20e0fdd18..3f8155893 100644 --- a/src/FDM/JSBSim/FGTable.cpp +++ b/src/FDM/JSBSim/FGTable.cpp @@ -115,7 +115,8 @@ double FGTable::GetValue(double key) int r; for (r=1; r<=nRows; r++) if (Data[r][0] >= key) break; - r = r < 2 ? 2 : (r > nRows ? nRows : r); + r = Clamp(2, r, nRows); + key = Clamp(Data[1][0], key, Data[nRows][0]); // make sure denominator below does not go to zero. @@ -140,10 +141,12 @@ double FGTable::GetValue(double rowKey, double colKey) int r, c; for (r=1;r<=nRows;r++) if (Data[r][0] >= rowKey) break; - for (c=1;c<=nCols;c++) if (Data[0][c] >= colKey) break; + r = Clamp(2, r, nRows); + rowKey = Clamp(Data[1][0], rowKey, Data[nRows][0]); - c = c < 2 ? 2 : (c > nCols ? nCols : c); - r = r < 2 ? 2 : (r > nRows ? nRows : r); + for (c=1;c<=nCols;c++) if (Data[0][c] >= colKey) break; + c = Clamp(2, c, nCols); + colKey = Clamp(Data[0][1], colKey, Data[0][nCols]); rFactor = (rowKey - Data[r-1][0]) / (Data[r][0] - Data[r-1][0]); cFactor = (colKey - Data[0][c-1]) / (Data[0][c] - Data[0][c-1]); diff --git a/src/FDM/JSBSim/FGTable.h b/src/FDM/JSBSim/FGTable.h index 9325a6021..5ca463083 100644 --- a/src/FDM/JSBSim/FGTable.h +++ b/src/FDM/JSBSim/FGTable.h @@ -98,10 +98,11 @@ public: void operator<<(FGConfigFile&); FGTable& operator<<(const double n); FGTable& operator<<(const int n); -// FGTable& operator<<(const double n); inline double GetElement(int r, int c) {return Data[r][c];} void Print(void); - + template T Clamp(T lower, T value, T upper) + {return value < lower ? lower : (value > upper ? upper : value);} + private: enum type {tt1D, tt2D} Type; double** Data; diff --git a/src/FDM/JSBSim/FGTranslation.cpp b/src/FDM/JSBSim/FGTranslation.cpp index bee3a0adf..4223e557a 100644 --- a/src/FDM/JSBSim/FGTranslation.cpp +++ b/src/FDM/JSBSim/FGTranslation.cpp @@ -162,70 +162,9 @@ bool FGTranslation::Run(void) } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -// 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 FGTranslation::Debug(int from) +void FGTranslation::bind(void) { - if (debug_lvl <= 0) return; - - if (debug_lvl & 1) { // Standard console startup message output - if (from == 0) { // Constructor - - } - } - if (debug_lvl & 2 ) { // Instantiation/Destruction notification - if (from == 0) cout << "Instantiated: FGTranslation" << endl; - if (from == 1) cout << "Destroyed: FGTranslation" << 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 - if (fabs(vUVW(eU)) > 1e6) - cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl; - if (fabs(vUVW(eV)) > 1e6) - cout << "FGTranslation::V velocity out of bounds: " << vUVW(eV) << endl; - if (fabs(vUVW(eW)) > 1e6) - cout << "FGTranslation::W velocity out of bounds: " << vUVW(eW) << endl; - if (fabs(vUVWdot(eU)) > 1e4) - cout << "FGTranslation::U acceleration out of bounds: " << vUVWdot(eU) << endl; - if (fabs(vUVWdot(eV)) > 1e4) - cout << "FGTranslation::V acceleration out of bounds: " << vUVWdot(eV) << endl; - if (fabs(vUVWdot(eW)) > 1e4) - cout << "FGTranslation::W acceleration out of bounds: " << vUVWdot(eW) << endl; - if (Mach > 100 || Mach < 0.00) - cout << "FGTranslation::Mach is out of bounds: " << Mach << endl; - if (qbar > 1e6 || qbar < 0.00) - cout << "FGTranslation::qbar is out of bounds: " << qbar << endl; - } - if (debug_lvl & 64) { - if (from == 0) { // Constructor - cout << IdSrc << endl; - cout << IdHdr << endl; - } - } -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -void FGTranslation::bind(void){ PropertyManager->Tie("velocities/u-fps", this,1, &FGTranslation::GetUVW /*, &FGTranslation::SetUVW, @@ -284,7 +223,8 @@ void FGTranslation::bind(void){ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGTranslation::unbind(void){ +void FGTranslation::unbind(void) +{ PropertyManager->Untie("velocities/u-fps"); PropertyManager->Untie("velocities/v-fps"); PropertyManager->Untie("velocities/w-fps"); @@ -302,3 +242,66 @@ void FGTranslation::unbind(void){ PropertyManager->Untie("aero/alphadot-rad_sec"); PropertyManager->Untie("aero/betadot-rad_sec"); } + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +// 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 FGTranslation::Debug(int from) +{ + if (debug_lvl <= 0) return; + + if (debug_lvl & 1) { // Standard console startup message output + if (from == 0) { // Constructor + + } + } + if (debug_lvl & 2 ) { // Instantiation/Destruction notification + if (from == 0) cout << "Instantiated: FGTranslation" << endl; + if (from == 1) cout << "Destroyed: FGTranslation" << 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 + if (fabs(vUVW(eU)) > 1e6) + cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl; + if (fabs(vUVW(eV)) > 1e6) + cout << "FGTranslation::V velocity out of bounds: " << vUVW(eV) << endl; + if (fabs(vUVW(eW)) > 1e6) + cout << "FGTranslation::W velocity out of bounds: " << vUVW(eW) << endl; + if (fabs(vUVWdot(eU)) > 1e4) + cout << "FGTranslation::U acceleration out of bounds: " << vUVWdot(eU) << endl; + if (fabs(vUVWdot(eV)) > 1e4) + cout << "FGTranslation::V acceleration out of bounds: " << vUVWdot(eV) << endl; + if (fabs(vUVWdot(eW)) > 1e4) + cout << "FGTranslation::W acceleration out of bounds: " << vUVWdot(eW) << endl; + if (Mach > 100 || Mach < 0.00) + cout << "FGTranslation::Mach is out of bounds: " << Mach << endl; + if (qbar > 1e6 || qbar < 0.00) + cout << "FGTranslation::qbar is out of bounds: " << qbar << endl; + } + if (debug_lvl & 64) { + if (from == 0) { // Constructor + cout << IdSrc << endl; + cout << IdHdr << endl; + } + } +} + diff --git a/src/FDM/JSBSim/JSBSim.hxx b/src/FDM/JSBSim/JSBSim.hxx index 67bdae4cf..2f8b362c8 100644 --- a/src/FDM/JSBSim/JSBSim.hxx +++ b/src/FDM/JSBSim/JSBSim.hxx @@ -89,6 +89,10 @@ CLASS DOCUMENTATION @author Tony Peden (Maintained and refined) @version $Id$ @see main in file JSBSim.cpp (use main() wrapper for standalone usage) + @see + Header File + @see + Source File */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/Makefile.am b/src/FDM/JSBSim/Makefile.am index a1552a0b7..f1fb2a722 100644 --- a/src/FDM/JSBSim/Makefile.am +++ b/src/FDM/JSBSim/Makefile.am @@ -48,7 +48,7 @@ libJSBSim_a_SOURCES = \ FGEngine.cpp FGEngine.h \ FGTank.cpp FGTank.h \ FGfdmSocket.cpp FGfdmSocket.h \ - FGPropertyManager.h \ + FGPropertyManager.h \ JSBSim.cxx JSBSim.hxx diff --git a/src/FDM/JSBSim/filtersjb/FGKinemat.cpp b/src/FDM/JSBSim/filtersjb/FGKinemat.cpp index 404522601..ea91f734d 100644 --- a/src/FDM/JSBSim/filtersjb/FGKinemat.cpp +++ b/src/FDM/JSBSim/filtersjb/FGKinemat.cpp @@ -79,7 +79,7 @@ FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), } } else if ( token == "DETENTS" ) { *AC_cfg >> NumDetents; - for(int i=0;i> tmpDetent; *AC_cfg >> tmpTime; Detents.push_back(tmpDetent); @@ -114,13 +114,13 @@ bool FGKinemat::Run(void ) { InputCmd = Input*Detents[NumDetents-1]; OutputPos = OutputNode->getDoubleValue(); - if(InputCmd < Detents[0]) { + if (InputCmd < Detents[0]) { fi=0; InputCmd=Detents[0]; lastInputCmd=InputCmd; OutputPos=Detents[0]; Output=OutputPos; - } else if(InputCmd > Detents[NumDetents-1]) { + } else if (InputCmd > Detents[NumDetents-1]) { fi=NumDetents-1; InputCmd=Detents[fi]; lastInputCmd=InputCmd; @@ -128,32 +128,32 @@ bool FGKinemat::Run(void ) { Output=OutputPos; } else { //cout << "FGKinemat::Run Handle: " << InputCmd << " Position: " << OutputPos << endl; - if(dt <= 0) + if (dt <= 0) OutputPos=InputCmd; else { - if(InputCmd != lastInputCmd) { + if (InputCmd != lastInputCmd) { InTransit=1; } //cout << "FGKinemat::Run, InTransit: " << InTransit << endl; - if(InTransit) { + if (InTransit) { //fprintf(stderr,"InputCmd: %g, OutputPos: %g\n",InputCmd,OutputPos); fi=0; - while(Detents[fi] < InputCmd) { + while (Detents[fi] < InputCmd) { fi++; } - if(OutputPos < InputCmd) { - if(TransitionTimes[fi] > 0) + if (OutputPos < InputCmd) { + if (TransitionTimes[fi] > 0) output_transit_rate=(Detents[fi] - Detents[fi-1])/TransitionTimes[fi]; else output_transit_rate=(Detents[fi] - Detents[fi-1])/5; //cout << "FGKinemat::Run, output_transit_rate: " << output_transit_rate << endl; } else { - if(TransitionTimes[fi+1] > 0) + if (TransitionTimes[fi+1] > 0) output_transit_rate=(Detents[fi] - Detents[fi+1])/TransitionTimes[fi+1]; else output_transit_rate=(Detents[fi] - Detents[fi+1])/5; } - if(fabs(OutputPos - InputCmd) > fabs(dt*output_transit_rate) ) { + if (fabs(OutputPos - InputCmd) > fabs(dt*output_transit_rate) ) { OutputPos+=output_transit_rate*dt; //cout << "FGKinemat::Run, OutputPos: " << OutputPos // << " dt: " << dt << endl; @@ -167,7 +167,7 @@ bool FGKinemat::Run(void ) { Output = OutputPos; } - if( Detents[NumDetents-1] > 0 ) { + if ( Detents[NumDetents-1] > 0 ) { OutputPct = Output / Detents[NumDetents-1]; } @@ -204,7 +204,7 @@ void FGKinemat::Debug(int from) cout << " ID: " << ID << endl; cout << " INPUT: " << InputNode->getName() << endl; cout << " DETENTS: " << NumDetents << endl; - for(int i=0;igetName() << endl; diff --git a/src/FDM/JSBSim/filtersjb/FGSummer.cpp b/src/FDM/JSBSim/filtersjb/FGSummer.cpp index df77ceaa8..5fb742a77 100644 --- a/src/FDM/JSBSim/filtersjb/FGSummer.cpp +++ b/src/FDM/JSBSim/filtersjb/FGSummer.cpp @@ -110,7 +110,7 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), FGSummer::~FGSummer() { unsigned i; - for(i=0;i