Latest JSBSim fixes, including Dave Luff's mixture improvements for
the JSBSim piston-engine model.
This commit is contained in:
parent
a623adaa30
commit
304ff21697
4 changed files with 55 additions and 16 deletions
|
@ -154,19 +154,23 @@ double FGPiston::Calculate(double PowerRequired)
|
|||
|
||||
IAS = Auxiliary->GetVcalibratedKTS();
|
||||
|
||||
if (Mixture >= 0.3) {
|
||||
doEngineStartup();
|
||||
doManifoldPressure();
|
||||
doAirFlow();
|
||||
doFuelFlow();
|
||||
doEnginePower();
|
||||
|
||||
//Now that the fuel flow is done check if the mixture is too lean to run the engine
|
||||
//Assume lean limit at 22 AFR for now - thats a thi of 0.668
|
||||
//This might be a bit generous, but since there's currently no audiable warning of impending
|
||||
//cutout in the form of misfiring and/or rough running its probably reasonable for now.
|
||||
if(equivalence_ratio < 0.668)
|
||||
Running = false;
|
||||
|
||||
doEnginePower();
|
||||
doEGT();
|
||||
doCHT();
|
||||
doOilTemperature();
|
||||
doOilPressure();
|
||||
} else {
|
||||
HP = 0;
|
||||
}
|
||||
|
||||
PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
|
||||
return PowerAvailable;
|
||||
|
@ -227,11 +231,16 @@ void FGPiston::doEngineStartup(void)
|
|||
|
||||
if ((!Running) && (spark) && (fuel)) {
|
||||
// start the engine if revs high enough
|
||||
if ((RPM > 450) && (crank_counter > 175)) {
|
||||
// For now just instantaneously start but later we should maybe crank for
|
||||
// a bit
|
||||
Running = true;
|
||||
// RPM = 600;
|
||||
if(Cranking) {
|
||||
if ((RPM > 450) && (crank_counter > 175)) {
|
||||
//Add a little delay to startup on the starter
|
||||
Running = true;
|
||||
}
|
||||
} else {
|
||||
if (RPM > 450) {
|
||||
Running = true;
|
||||
//This allows us to in-air start when windmilling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
protected:
|
||||
/// Pilot/Aircraft, FCS, Autopilot inputs
|
||||
enum eInputType {itPilotAC, itFCS, itAP} InputType;
|
||||
enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
|
||||
FGFCS* fcs;
|
||||
string Type;
|
||||
string Name;
|
||||
|
|
|
@ -54,6 +54,7 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
|||
eParam tmpInputIndex;
|
||||
|
||||
clip = false;
|
||||
Bias = 0.0;
|
||||
InputIndices.clear();
|
||||
InputTypes.clear();
|
||||
|
||||
|
@ -73,6 +74,10 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
|||
tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
|
||||
InputIndices.push_back(tmpInputIndex);
|
||||
InputTypes.push_back(itPilotAC);
|
||||
} else if (token.find(".") != token.npos) { // bias
|
||||
*AC_cfg >> Bias;
|
||||
InputIndices.push_back((eParam)0);
|
||||
InputTypes.push_back(itBias);
|
||||
} else {
|
||||
*AC_cfg >> tmpInputIndex;
|
||||
InputIndices.push_back(tmpInputIndex);
|
||||
|
@ -119,6 +124,9 @@ bool FGSummer::Run(void )
|
|||
case itFCS:
|
||||
Output += fcs->GetComponentOutput(InputIndices[idx]);
|
||||
break;
|
||||
case itBias:
|
||||
Output += Bias;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
HISTORY
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
SENTRY
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
@ -57,11 +53,31 @@ INCLUDES
|
|||
#include "../FGConfigFile.h"
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
DEFINES
|
||||
DEFINITIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#define ID_SUMMER "$Id$"
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
FORWARD DECLARATIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
CLASS DOCUMENTATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
/** Models a flight control system summing component.
|
||||
The Summer component sums multiple inputs. These can be pilot control inputs,
|
||||
state variables, or even floating point numbers (e.g. for a bias).
|
||||
@author Jon S. Berndt
|
||||
@version $Id$
|
||||
@see
|
||||
*/
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
CLASS DECLARATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
@ -69,9 +85,14 @@ CLASS DECLARATION
|
|||
class FGSummer : public FGFCSComponent
|
||||
{
|
||||
public:
|
||||
/** Constructor.
|
||||
@param fcs a pointer to the parent FGFCS object.
|
||||
@param AC_cfg a pointer to the configuration file object. */
|
||||
FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg);
|
||||
/// Destructor
|
||||
~FGSummer();
|
||||
|
||||
/// The execution method for this FCS component.
|
||||
bool Run(void);
|
||||
|
||||
private:
|
||||
|
@ -80,6 +101,7 @@ private:
|
|||
vector <int> InputTypes;
|
||||
bool clip;
|
||||
double clipmin,clipmax;
|
||||
double Bias;
|
||||
void Debug(int from);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue