#include "FGPosition.h"
#include "FGAuxiliary.h"
#include "FGOutput.h"
+#include "FGPropertyManager.h"
+
+namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
{
Name = "FGAircraft";
- alphaclmin = alphaclmax = 0;
- HTailArea = VTailArea = HTailArm = VTailArm = 0.0;
- lbarh = lbarv = vbarh = vbarv = 0.0;
- WingIncidence=0;
- impending_stall = 0;
+ WingSpan = 0.0;
+ HTailArea = VTailArea = 0.0;
+ HTailArm = VTailArm = 0.0;
+ lbarh = lbarv = 0.0;
+ vbarh = vbarv = 0.0;
+ WingIncidence = 0.0;
+
+ bind();
Debug(0);
}
FGAircraft::~FGAircraft()
{
+ unbind();
Debug(1);
}
vNwcg = State->GetTb2s() * vNcg;
vNwcg(3) = -1*vNwcg(3) + 1;
- 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;
float FGAircraft::GetNlf(void)
{
- return vNwcg(3);
+ return -1*Aerodynamics->GetvFs(3)/MassBalance->GetWeight();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
} 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);
if (debug_lvl > 0) cout << " Point Mass Object: " << pmWt << " lbs. at "
<< "X, Y, Z (in.): " << pmX << " " << pmY << " " << pmZ
<< endl;
return true;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::bind(void)
+{
+ typedef double (FGAircraft::*PMF)(int) const;
+ PropertyManager->Tie("metrics/Sw-sqft", this,
+ &FGAircraft::GetWingArea);
+ PropertyManager->Tie("metrics/bw-ft", this,
+ &FGAircraft::GetWingSpan);
+ PropertyManager->Tie("metrics/cbarw-ft", this,
+ &FGAircraft::Getcbar);
+ PropertyManager->Tie("metrics/iw-deg", this,
+ &FGAircraft::GetWingIncidence);
+ PropertyManager->Tie("metrics/Sh-sqft", this,
+ &FGAircraft::GetHTailArea);
+ PropertyManager->Tie("metrics/lh-ft", this,
+ &FGAircraft::GetHTailArm);
+ PropertyManager->Tie("metrics/Sv-sqft", this,
+ &FGAircraft::GetVTailArea);
+ PropertyManager->Tie("metrics/lv-ft", this,
+ &FGAircraft::GetVTailArm);
+ PropertyManager->Tie("metrics/lh-norm", this,
+ &FGAircraft::Getlbarh);
+ PropertyManager->Tie("metrics/lv-norm", this,
+ &FGAircraft::Getlbarv);
+ PropertyManager->Tie("metrics/vbarh-norm", this,
+ &FGAircraft::Getvbarh);
+ PropertyManager->Tie("metrics/vbarv-norm", this,
+ &FGAircraft::Getvbarv);
+ PropertyManager->Tie("moments/l-total-lbsft", this,1,
+ (PMF)&FGAircraft::GetMoments);
+ PropertyManager->Tie("moments/m-total-lbsft", this,2,
+ (PMF)&FGAircraft::GetMoments);
+ PropertyManager->Tie("moments/n-total-lbsft", this,3,
+ (PMF)&FGAircraft::GetMoments);
+ PropertyManager->Tie("forces/fbx-total-lbs", this,1,
+ (PMF)&FGAircraft::GetForces);
+ PropertyManager->Tie("forces/fby-total-lbs", this,2,
+ (PMF)&FGAircraft::GetForces);
+ PropertyManager->Tie("forces/fbz-total-lbs", this,3,
+ (PMF)&FGAircraft::GetForces);
+ PropertyManager->Tie("metrics/aero-rp-x-ft", this,1,
+ (PMF)&FGAircraft::GetXYZrp);
+ PropertyManager->Tie("metrics/aero-rp-y-ft", this,2,
+ (PMF)&FGAircraft::GetXYZrp);
+ PropertyManager->Tie("metrics/aero-rp-z-ft", this,3,
+ (PMF)&FGAircraft::GetXYZrp);
+ PropertyManager->Tie("metrics/eyepoint-x-ft", this,1,
+ (PMF)&FGAircraft::GetXYZep);
+ PropertyManager->Tie("metrics/eyepoint-y-ft", this,2,
+ (PMF)&FGAircraft::GetXYZep);
+ PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
+ (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);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::unbind(void)
+{
+ PropertyManager->Untie("metrics/Sw-sqft");
+ PropertyManager->Untie("metrics/bw-ft");
+ PropertyManager->Untie("metrics/cbarw-ft");
+ PropertyManager->Untie("metrics/iw-deg");
+ PropertyManager->Untie("metrics/Sh-sqft");
+ PropertyManager->Untie("metrics/lh-ft");
+ PropertyManager->Untie("metrics/Sv-sqft");
+ PropertyManager->Untie("metrics/lv-ft");
+ PropertyManager->Untie("metrics/lh-norm");
+ PropertyManager->Untie("metrics/lv-norm");
+ PropertyManager->Untie("metrics/vbarh-norm");
+ PropertyManager->Untie("metrics/vbarv-norm");
+ PropertyManager->Untie("moments/l-total-lbsft");
+ PropertyManager->Untie("moments/m-total-lbsft");
+ PropertyManager->Untie("moments/n-total-lbsft");
+ PropertyManager->Untie("forces/fbx-total-lbs");
+ PropertyManager->Untie("forces/fby-total-lbs");
+ PropertyManager->Untie("forces/fbz-total-lbs");
+ PropertyManager->Untie("metrics/aero-rp-x-ft");
+ PropertyManager->Untie("metrics/aero-rp-y-ft");
+ PropertyManager->Untie("metrics/aero-rp-z-ft");
+ PropertyManager->Untie("metrics/eyepoint-x-ft");
+ PropertyManager->Untie("metrics/eyepoint-y-ft");
+ PropertyManager->Untie("metrics/eyepoint-z-ft");
+ PropertyManager->Untie("metrics/visualrefpoint-x-in");
+ PropertyManager->Untie("metrics/visualrefpoint-y-in");
+ PropertyManager->Untie("metrics/visualrefpoint-z-in");
+}
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
}
}
+} // namespace JSBSim