#include "FGOutput.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
{
Name = "FGAircraft";
- WingIncidence = 0.0;
- impending_stall = 0.0;
- alphaclmin = alphaclmax = 0.0;
+ WingSpan = 0.0;
HTailArea = VTailArea = 0.0;
HTailArm = VTailArm = 0.0;
lbarh = lbarv = 0.0;
vbarh = vbarv = 0.0;
- bi2vel = ci2vel = 0.0;
- alphaw = 0.0;
+ WingIncidence = 0.0;
bind();
bool FGAircraft::Run(void)
{
- double twovel;
-
if (!FGModel::Run()) { // if false then execute this Run()
vForces.InitMatrix();
vForces += Aerodynamics->GetForces();
vNwcg = State->GetTb2s() * vNcg;
vNwcg(3) = -1*vNwcg(3) + 1;
- twovel = 2*Translation->GetVt();
- if (twovel > 0) {
- bi2vel = WingSpan / twovel;
- ci2vel = cbar / twovel;
- }
-
- alphaw = Translation->Getalpha() + WingIncidence;
-
- if (alphaclmax != 0) {
- if (Translation->Getalpha() > 0.85*alphaclmax) {
- impending_stall = 10*(Translation->Getalpha()/alphaclmax - 0.85);
- } else {
- impending_stall = 0;
- }
- }
-
return false;
} else { // skip Run() execution this time
return true;
} else if (parameter == "AC_AERORP") {
*AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
if (debug_lvl > 0) cout << " Ref Pt (x, y, z): " << vXYZrp << endl;
- } else if (parameter == "AC_ALPHALIMITS") {
- *AC_cfg >> alphaclmin >> alphaclmax;
- if (debug_lvl > 0) cout << " Maximum Alpha: " << alphaclmax
- << " Minimum Alpha: " << alphaclmin
- << endl;
+ } else if (parameter == "AC_VRP") {
+ *AC_cfg >> vXYZvrp(eX) >> vXYZvrp(eY) >> vXYZvrp(eZ);
+ if (debug_lvl > 0) cout << " Visual Ref Pt (x, y, z): " << vXYZvrp << endl;
+ Position->SetVRP(vXYZvrp);
} else if (parameter == "AC_POINTMASS") {
*AC_cfg >> pmWt >> pmX >> pmY >> pmZ;
MassBalance->AddPointMass(pmWt, pmX, pmY, pmZ);
void FGAircraft::bind(void)
{
+ typedef double (FGAircraft::*PMF)(int) const;
PropertyManager->Tie("metrics/Sw-sqft", this,
&FGAircraft::GetWingArea);
PropertyManager->Tie("metrics/bw-ft", this,
PropertyManager->Tie("metrics/vbarv-norm", this,
&FGAircraft::Getvbarv);
PropertyManager->Tie("moments/l-total-lbsft", this,1,
- &FGAircraft::GetMoments);
+ (PMF)&FGAircraft::GetMoments);
PropertyManager->Tie("moments/m-total-lbsft", this,2,
- &FGAircraft::GetMoments);
+ (PMF)&FGAircraft::GetMoments);
PropertyManager->Tie("moments/n-total-lbsft", this,3,
- &FGAircraft::GetMoments);
+ (PMF)&FGAircraft::GetMoments);
PropertyManager->Tie("forces/fbx-total-lbs", this,1,
- &FGAircraft::GetForces);
+ (PMF)&FGAircraft::GetForces);
PropertyManager->Tie("forces/fby-total-lbs", this,2,
- &FGAircraft::GetForces);
+ (PMF)&FGAircraft::GetForces);
PropertyManager->Tie("forces/fbz-total-lbs", this,3,
- &FGAircraft::GetForces);
+ (PMF)&FGAircraft::GetForces);
PropertyManager->Tie("metrics/aero-rp-x-ft", this,1,
- &FGAircraft::GetXYZrp);
+ (PMF)&FGAircraft::GetXYZrp);
PropertyManager->Tie("metrics/aero-rp-y-ft", this,2,
- &FGAircraft::GetXYZrp);
+ (PMF)&FGAircraft::GetXYZrp);
PropertyManager->Tie("metrics/aero-rp-z-ft", this,3,
- &FGAircraft::GetXYZrp);
+ (PMF)&FGAircraft::GetXYZrp);
PropertyManager->Tie("metrics/eyepoint-x-ft", this,1,
- &FGAircraft::GetXYZep);
+ (PMF)&FGAircraft::GetXYZep);
PropertyManager->Tie("metrics/eyepoint-y-ft", this,2,
- &FGAircraft::GetXYZep);
+ (PMF)&FGAircraft::GetXYZep);
PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
- &FGAircraft::GetXYZep);
- PropertyManager->Tie("metrics/alpha-max-deg", this,
- &FGAircraft::GetAlphaCLMax,
- &FGAircraft::SetAlphaCLMax,
- true);
- PropertyManager->Tie("metrics/alpha-min-deg", this,
- &FGAircraft::GetAlphaCLMin,
- &FGAircraft::SetAlphaCLMin,
- true);
- PropertyManager->Tie("aero/bi2vel", this,
- &FGAircraft::GetBI2Vel);
- PropertyManager->Tie("aero/ci2vel", this,
- &FGAircraft::GetCI2Vel);
- PropertyManager->Tie("aero/alpha-wing-rad", this,
- &FGAircraft::GetAlphaW);
- PropertyManager->Tie("systems/stall-warn-norm", this,
- &FGAircraft::GetStallWarn);
+ (PMF)&FGAircraft::GetXYZep);
+ PropertyManager->Tie("metrics/visualrefpoint-x-in", this,1,
+ (PMF)&FGAircraft::GetXYZvrp);
+ PropertyManager->Tie("metrics/visualrefpoint-y-in", this,2,
+ (PMF)&FGAircraft::GetXYZvrp);
+ PropertyManager->Tie("metrics/visualrefpoint-z-in", this,3,
+ (PMF)&FGAircraft::GetXYZvrp);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PropertyManager->Untie("metrics/eyepoint-x-ft");
PropertyManager->Untie("metrics/eyepoint-y-ft");
PropertyManager->Untie("metrics/eyepoint-z-ft");
- PropertyManager->Untie("metrics/alpha-max-deg");
- PropertyManager->Untie("metrics/alpha-min-deg");
- PropertyManager->Untie("aero/bi2vel");
- PropertyManager->Untie("aero/ci2vel");
- PropertyManager->Untie("aero/alpha-wing-rad");
- PropertyManager->Untie("systems/stall-warn-norm");
+ PropertyManager->Untie("metrics/visualrefpoint-x-in");
+ PropertyManager->Untie("metrics/visualrefpoint-y-in");
+ PropertyManager->Untie("metrics/visualrefpoint-z-in");
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
}
+} // namespace JSBSim