INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+#include <fstream>
+#include <sstream>
+#include <iomanip>
+
#include "FGFCS.h"
#include "FGFDMExec.h"
#include "FGGroundReactions.h"
#include "input_output/FGPropertyManager.h"
-#include <fstream>
-#include <sstream>
-#include <iomanip>
#include "models/flight_control/FGFilter.h"
#include "models/flight_control/FGDeadBand.h"
namespace JSBSim {
-static const char *IdSrc = "$Id: FGFCS.cpp,v 1.71 2010/09/28 02:54:03 jberndt Exp $";
+static const char *IdSrc = "$Id: FGFCS.cpp,v 1.77 2011/09/25 14:05:40 bcoconni Exp $";
static const char *IdHdr = ID_FCS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DaCmd = DeCmd = DrCmd = DsCmd = DfCmd = DsbCmd = DspCmd = 0;
PTrimCmd = YTrimCmd = RTrimCmd = 0.0;
GearCmd = GearPos = 1; // default to gear down
- LeftBrake = RightBrake = CenterBrake = 0.0;
+ BrakePos.resize(FGLGear::bgNumBrakeGroups);
TailhookPos = WingFoldPos = 0.0;
bind();
{
unsigned int i;
- if (!FGModel::InitModel()) return false;
-
for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = 0.0;
for (i=0; i<MixturePos.size(); i++) MixturePos[i] = 0.0;
for (i=0; i<ThrottleCmd.size(); i++) ThrottleCmd[i] = 0.0;
return true;
}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCS::LateBind(void)
-{
- unsigned int i;
-
- for (i=0; i<Systems.size(); i++) Systems[i]->LateBind();
- for (i=0; i<APComponents.size(); i++) APComponents[i]->LateBind();
- for (i=0; i<FCSComponents.size(); i++) FCSComponents[i]->LateBind();
-}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Notes: In this logic the default engine commands are set. This is simply a
// actually present in the flight_control or autopilot section will override
// these simple assignments.
-bool FGFCS::Run(void)
+bool FGFCS::Run(bool Holding)
{
unsigned int i;
- if (FGModel::Run()) return true; // fast exit if nothing to do
- if (FDMExec->Holding()) return false;
+ if (FGModel::Run(Holding)) return true; // fast exit if nothing to do
+ if (Holding) return false;
RunPreFunctions();
// Set the default steering angle
for (i=0; i<SteerPosDeg.size(); i++) {
- FGLGear* gear = GroundReactions->GetGearUnit(i);
+ FGLGear* gear = FDMExec->GetGroundReactions()->GetGearUnit(i);
SteerPosDeg[i] = gear->GetDefaultSteerAngle( GetDsCmd() );
}
channel_element = document->FindNextElement("channel");
}
+ PostLoad(document, PropertyManager);
+
ResetParser();
return true;
double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
{
- 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;
+ return BrakePos[bg];
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGFCS::GetComponentStrings(const string& delimiter)
+string FGFCS::GetComponentStrings(const string& delimiter) const
{
unsigned int comp;
string CompStrings = "";
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGFCS::GetComponentValues(const string& delimiter)
+string FGFCS::GetComponentValues(const string& delimiter) const
{
std::ostringstream buf;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFCS::AddGear(void)
+void FGFCS::AddGear(unsigned int NumGear)
{
- SteerPosDeg.push_back(0.0);
+ SteerPosDeg.clear();
+ for (unsigned int i=0; i<NumGear; i++) SteerPosDeg.push_back(0.0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string tmp;
for (i=0; i<SteerPosDeg.size(); i++) {
- if (GroundReactions->GetGearUnit(i)->GetSteerable()) {
+ if (FDMExec->GetGroundReactions()->GetGearUnit(i)->GetSteerable()) {
tmp = CreateIndexedPropertyName("fcs/steer-pos-deg", i);
PropertyManager->Tie( tmp.c_str(), this, i, &FGFCS::GetSteerPosDeg, &FGFCS::SetSteerPosDeg);
}