1
0
Fork 0

[JSBSim] Add Windmilling flag

The flag allows to disable the windmilling of Turbine engines.
This commit is contained in:
Bertrand Coconnier 2019-05-08 16:39:26 +02:00
parent 0635380708
commit b486273e0b
4 changed files with 47 additions and 4 deletions

View file

@ -424,6 +424,28 @@ double Element::FindElementValueAsNumber(const string& el)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool Element::FindElementValueAsBoolean(const string& el)
{
Element* element = FindElement(el);
if (element) {
// check value as an ordinary number
double value = element->GetDataAsNumber();
// now check how it should return data
if (value == 0) {
return false;
} else {
return true;
}
} else {
cerr << ReadFrom() << "Attempting to get non-existent element " << el << " ;returning false"
<< endl;
return false;
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string Element::FindElementValue(const string& el)
{
Element* element = FindElement(el);

View file

@ -273,6 +273,16 @@ public:
data is missing. */
double FindElementValueAsNumber(const std::string& el="");
/** Searches for the named element and returns the data belonging to it as a bool.
This function allows the data belonging to a named element to be returned
as a bool. If no element is found, false is returned. If no
argument is supplied, the data for the first element is returned.
@param el the name of the element being searched for (the empty string by
default)
@return the data value for the named element as a bool, or false if the
data is missing. Zero will be false, while any other number will be true. */
bool FindElementValueAsBoolean(const std::string& el="");
/** Searches for the named element and converts and returns the data belonging to it.
This function allows the data belonging to a named element to be returned
as a double. If no element is found, HUGE_VAL is returned. If no

View file

@ -75,6 +75,7 @@ FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number, struct Inp
InjectionTime = 30.0;
InjectionTimer = InjWaterNorm = 0.0;
EPR = 1.0;
disableWindmill = false;
Load(exec, el);
Debug(0);
@ -187,8 +188,14 @@ double FGTurbine::Off(void)
{
Running = false;
FuelFlow_pph = Seek(&FuelFlow_pph, 0, 1000.0, 10000.0);
N1 = Seek(&N1, in.qbar/10.0, N1/2.0, N1/N1_spindown);
N2 = Seek(&N2, in.qbar/15.0, N2/2.0, N2/N2_spindown);
// some engines have inlets that close when they are off. So, if a flag is true disable windmilling
if (disableWindmill == false) {
N1 = Seek(&N1, in.qbar/10.0, N1/2.0, N1/N1_spindown);
N2 = Seek(&N2, in.qbar/15.0, N2/2.0, N2/N2_spindown);
} else {
N1 = Seek(&N1, 0, N1/2.0, N1/N1_spindown);
N2 = Seek(&N2, 0, N2/2.0, N2/N2_spindown);
}
EGT_degC = Seek(&EGT_degC, in.TAT_c, 11.7, 7.3);
OilTemp_degK = Seek(&OilTemp_degK, in.TAT_c + 273.0, 0.2, 0.2);
OilPressure_psi = N2 * 0.62;
@ -263,7 +270,7 @@ double FGTurbine::Run()
InjectionTimer += in.TotalDeltaT;
if (InjectionTimer < InjectionTime) {
thrust = thrust * InjectionLookup->GetValue();
InjWaterNorm = 1.0 - (InjectionTimer/InjectionTime);
InjWaterNorm = 1.0 - (InjectionTimer/InjectionTime);
} else {
Injection = false;
InjWaterNorm = 0.0;
@ -487,7 +494,8 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
InjN1increment = el->FindElementValueAsNumber("injection-N1-inc");
if (el->FindElement("injection-N2-inc"))
InjN2increment = el->FindElementValueAsNumber("injection-N2-inc");
if (el->FindElement("disable-windmill"))
disableWindmill = el->FindElementValueAsBoolean("disable-windmill");
string property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
IdleThrustLookup = GetPreFunction(property_prefix+"/IdleThrust");

View file

@ -105,6 +105,7 @@ CLASS DOCUMENTATION
<augmethod> {0 | 1 | 2} </augmethod>
<injected> {0 | 1} </injected>
<injection-time> {number} </injection-time>
<disable-windmill> {0 | 1}</disable-windmill>
</turbine_engine>
@endcode
@ -142,6 +143,7 @@ CLASS DOCUMENTATION
injection-time - Time, in seconds, of water injection duration
InjN1increment - % increase in N1 when injection is taking place
InjN2increment - % increase in N2 when injection is taking place
disable-windmill - flag that disables engine windmilling when off if true
</pre>
<h3>NOTES:</h3>
@ -276,6 +278,7 @@ private:
bool Augmentation;
bool Reversed;
bool Cutoff;
bool disableWindmill; ///< flag to disable windmilling of engine in Off phase
int Injected; ///< = 1 if water injection installed
int Ignition;
int Augmented; ///< = 1 if augmentation installed