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();
|
IAS = Auxiliary->GetVcalibratedKTS();
|
||||||
|
|
||||||
if (Mixture >= 0.3) {
|
|
||||||
doEngineStartup();
|
doEngineStartup();
|
||||||
doManifoldPressure();
|
doManifoldPressure();
|
||||||
doAirFlow();
|
doAirFlow();
|
||||||
doFuelFlow();
|
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();
|
doEGT();
|
||||||
doCHT();
|
doCHT();
|
||||||
doOilTemperature();
|
doOilTemperature();
|
||||||
doOilPressure();
|
doOilPressure();
|
||||||
} else {
|
|
||||||
HP = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
|
PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
|
||||||
return PowerAvailable;
|
return PowerAvailable;
|
||||||
|
@ -227,11 +231,16 @@ void FGPiston::doEngineStartup(void)
|
||||||
|
|
||||||
if ((!Running) && (spark) && (fuel)) {
|
if ((!Running) && (spark) && (fuel)) {
|
||||||
// start the engine if revs high enough
|
// start the engine if revs high enough
|
||||||
if ((RPM > 450) && (crank_counter > 175)) {
|
if(Cranking) {
|
||||||
// For now just instantaneously start but later we should maybe crank for
|
if ((RPM > 450) && (crank_counter > 175)) {
|
||||||
// a bit
|
//Add a little delay to startup on the starter
|
||||||
Running = true;
|
Running = true;
|
||||||
// RPM = 600;
|
}
|
||||||
|
} else {
|
||||||
|
if (RPM > 450) {
|
||||||
|
Running = true;
|
||||||
|
//This allows us to in-air start when windmilling
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Pilot/Aircraft, FCS, Autopilot inputs
|
/// Pilot/Aircraft, FCS, Autopilot inputs
|
||||||
enum eInputType {itPilotAC, itFCS, itAP} InputType;
|
enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
|
||||||
FGFCS* fcs;
|
FGFCS* fcs;
|
||||||
string Type;
|
string Type;
|
||||||
string Name;
|
string Name;
|
||||||
|
|
|
@ -54,6 +54,7 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
eParam tmpInputIndex;
|
eParam tmpInputIndex;
|
||||||
|
|
||||||
clip = false;
|
clip = false;
|
||||||
|
Bias = 0.0;
|
||||||
InputIndices.clear();
|
InputIndices.clear();
|
||||||
InputTypes.clear();
|
InputTypes.clear();
|
||||||
|
|
||||||
|
@ -73,6 +74,10 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
|
tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
|
||||||
InputIndices.push_back(tmpInputIndex);
|
InputIndices.push_back(tmpInputIndex);
|
||||||
InputTypes.push_back(itPilotAC);
|
InputTypes.push_back(itPilotAC);
|
||||||
|
} else if (token.find(".") != token.npos) { // bias
|
||||||
|
*AC_cfg >> Bias;
|
||||||
|
InputIndices.push_back((eParam)0);
|
||||||
|
InputTypes.push_back(itBias);
|
||||||
} else {
|
} else {
|
||||||
*AC_cfg >> tmpInputIndex;
|
*AC_cfg >> tmpInputIndex;
|
||||||
InputIndices.push_back(tmpInputIndex);
|
InputIndices.push_back(tmpInputIndex);
|
||||||
|
@ -119,6 +124,9 @@ bool FGSummer::Run(void )
|
||||||
case itFCS:
|
case itFCS:
|
||||||
Output += fcs->GetComponentOutput(InputIndices[idx]);
|
Output += fcs->GetComponentOutput(InputIndices[idx]);
|
||||||
break;
|
break;
|
||||||
|
case itBias:
|
||||||
|
Output += Bias;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
HISTORY
|
HISTORY
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
COMMENTS, REFERENCES, and NOTES
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
SENTRY
|
SENTRY
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
@ -57,11 +53,31 @@ INCLUDES
|
||||||
#include "../FGConfigFile.h"
|
#include "../FGConfigFile.h"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINES
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_SUMMER "$Id$"
|
#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
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
@ -69,9 +85,14 @@ CLASS DECLARATION
|
||||||
class FGSummer : public FGFCSComponent
|
class FGSummer : public FGFCSComponent
|
||||||
{
|
{
|
||||||
public:
|
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);
|
FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg);
|
||||||
|
/// Destructor
|
||||||
~FGSummer();
|
~FGSummer();
|
||||||
|
|
||||||
|
/// The execution method for this FCS component.
|
||||||
bool Run(void);
|
bool Run(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -80,6 +101,7 @@ private:
|
||||||
vector <int> InputTypes;
|
vector <int> InputTypes;
|
||||||
bool clip;
|
bool clip;
|
||||||
double clipmin,clipmax;
|
double clipmin,clipmax;
|
||||||
|
double Bias;
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue