From be71e0f555c87799f405e6ce4c9d8e70d41fd5f9 Mon Sep 17 00:00:00 2001 From: tony Date: Sat, 4 May 2002 17:38:06 +0000 Subject: [PATCH] Added stall hysteresis modeling, nose should fall through nicely in a stall now. --- src/FDM/JSBSim/FGAircraft.cpp | 30 ++++++++++++++++++++++++++---- src/FDM/JSBSim/FGAircraft.h | 8 +++++++- src/FDM/JSBSim/FGJSBBase.h | 3 ++- src/FDM/JSBSim/FGState.cpp | 1 + 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index 073afba3d..a84cc09d0 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -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); + } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGAircraft.h b/src/FDM/JSBSim/FGAircraft.h index 8438aba13..891ec53b8 100644 --- a/src/FDM/JSBSim/FGAircraft.h +++ b/src/FDM/JSBSim/FGAircraft.h @@ -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; diff --git a/src/FDM/JSBSim/FGJSBBase.h b/src/FDM/JSBSim/FGJSBBase.h index d7349476b..8a6de13ca 100644 --- a/src/FDM/JSBSim/FGJSBBase.h +++ b/src/FDM/JSBSim/FGJSBBase.h @@ -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 }; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index 956922022..850d8812b 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -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"; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- 2.39.5