Added stall hysteresis modeling, nose should fall through nicely in a stall now.
This commit is contained in:
parent
cd041af9d8
commit
be71e0f555
4 changed files with 36 additions and 6 deletions
|
@ -103,8 +103,9 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
|
|||
{
|
||||
Name = "FGAircraft";
|
||||
WingIncidence = 0.0;
|
||||
impending_stall = 0.0;
|
||||
impending_stall = stall_hyst = 0.0;
|
||||
alphaclmin = alphaclmax = 0.0;
|
||||
alphahystmin = alphahystmax = 0.0;
|
||||
HTailArea = VTailArea = 0.0;
|
||||
HTailArm = VTailArm = 0.0;
|
||||
lbarh = lbarv = 0.0;
|
||||
|
@ -130,6 +131,7 @@ FGAircraft::~FGAircraft()
|
|||
bool FGAircraft::Run(void)
|
||||
{
|
||||
double twovel;
|
||||
double alpha;
|
||||
|
||||
if (!FGModel::Run()) { // if false then execute this Run()
|
||||
vForces.InitMatrix();
|
||||
|
@ -158,13 +160,25 @@ bool FGAircraft::Run(void)
|
|||
|
||||
alphaw = Translation->Getalpha() + WingIncidence;
|
||||
|
||||
alpha=Translation->Getalpha();
|
||||
|
||||
if (alphaclmax != 0) {
|
||||
if (Translation->Getalpha() > 0.85*alphaclmax) {
|
||||
impending_stall = 10*(Translation->Getalpha()/alphaclmax - 0.85);
|
||||
if (alpha > 0.85*alphaclmax) {
|
||||
impending_stall = 10*(alpha/alphaclmax - 0.85);
|
||||
} else {
|
||||
impending_stall = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(alphahystmax != 0.0 && alphahystmin != 0.0) {
|
||||
if( alpha > alphahystmax ) {
|
||||
stall_hyst = 1;
|
||||
} else if(alpha < alphahystmin) {
|
||||
stall_hyst = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
} else { // skip Run() execution this time
|
||||
|
@ -256,6 +270,11 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
|
|||
if (debug_lvl > 0) cout << " Maximum Alpha: " << alphaclmax
|
||||
<< " Minimum Alpha: " << alphaclmin
|
||||
<< endl;
|
||||
} else if (parameter == "AC_HYSTLIMITS") {
|
||||
*AC_cfg >> alphahystmin >> alphahystmax;
|
||||
if (debug_lvl > 0) cout << " Hysteresis Start: " << alphahystmax
|
||||
<< " Hysteresis End: " << alphahystmin
|
||||
<< endl;
|
||||
} else if (parameter == "AC_POINTMASS") {
|
||||
*AC_cfg >> pmWt >> pmX >> pmY >> pmZ;
|
||||
MassBalance->AddPointMass(pmWt, pmX, pmY, pmZ);
|
||||
|
@ -346,6 +365,9 @@ void FGAircraft::bind(void)
|
|||
&FGAircraft::GetAlphaW);
|
||||
PropertyManager->Tie("systems/stall-warn-norm", this,
|
||||
&FGAircraft::GetStallWarn);
|
||||
PropertyManager->Tie("aero/stall-hyst-norm", this,
|
||||
&FGAircraft::GetHysteresisParm);
|
||||
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -160,6 +160,11 @@ public:
|
|||
inline double GetXYZep(int idx) const { return vXYZep(idx); }
|
||||
inline double GetAlphaCLMax(void) const { return alphaclmax; }
|
||||
inline double GetAlphaCLMin(void) const { return alphaclmin; }
|
||||
|
||||
inline double GetAlphaHystMax(void) const { return alphahystmax; }
|
||||
inline double GetAlphaHystMin(void) const { return alphahystmin; }
|
||||
inline double GetHysteresisParm(void) const { return stall_hyst; }
|
||||
|
||||
|
||||
inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
|
||||
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
|
||||
|
@ -193,7 +198,8 @@ private:
|
|||
double HTailArea, VTailArea, HTailArm, VTailArm;
|
||||
double lbarh,lbarv,vbarh,vbarv;
|
||||
double alphaclmax,alphaclmin;
|
||||
double impending_stall;
|
||||
double alphahystmax, alphahystmin;
|
||||
double impending_stall, stall_hyst;
|
||||
double bi2vel, ci2vel,alphaw;
|
||||
string AircraftName;
|
||||
|
||||
|
|
|
@ -164,7 +164,8 @@ enum eParam {
|
|||
FG_VBARH, //horizontal tail volume
|
||||
FG_VBARV, //vertical tail volume
|
||||
FG_GEAR_CMD,
|
||||
FG_GEAR_POS
|
||||
FG_GEAR_POS,
|
||||
FG_HYSTPARM
|
||||
};
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -575,6 +575,7 @@ 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";
|
||||
ParamNameToProp[ "FG_HYSTPARM" ]="aero/stall-hyst-norm";
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
Loading…
Add table
Reference in a new issue