Allow a "fuel" attribute in the approach and cruise tags to have
values other than the defaults (20% and 50%, respectively)
This commit is contained in:
parent
a6129a38d0
commit
500b081ca5
3 changed files with 12 additions and 16 deletions
|
@ -170,27 +170,23 @@ void Airplane::updateGearState()
|
|||
}
|
||||
}
|
||||
|
||||
void Airplane::setApproach(float speed, float altitude)
|
||||
{
|
||||
// The zero AoA will become a calculated stall AoA in compile()
|
||||
setApproach(speed, altitude, 0);
|
||||
}
|
||||
|
||||
void Airplane::setApproach(float speed, float altitude, float aoa)
|
||||
void Airplane::setApproach(float speed, float altitude, float aoa, float fuel)
|
||||
{
|
||||
_approachSpeed = speed;
|
||||
_approachP = Atmosphere::getStdPressure(altitude);
|
||||
_approachT = Atmosphere::getStdTemperature(altitude);
|
||||
_approachAoA = aoa;
|
||||
_approachFuel = fuel;
|
||||
}
|
||||
|
||||
void Airplane::setCruise(float speed, float altitude)
|
||||
void Airplane::setCruise(float speed, float altitude, float fuel)
|
||||
{
|
||||
_cruiseSpeed = speed;
|
||||
_cruiseP = Atmosphere::getStdPressure(altitude);
|
||||
_cruiseT = Atmosphere::getStdTemperature(altitude);
|
||||
_cruiseAoA = 0;
|
||||
_tailIncidence = 0;
|
||||
_cruiseFuel = fuel;
|
||||
}
|
||||
|
||||
void Airplane::setElevatorControl(int control)
|
||||
|
@ -780,8 +776,7 @@ void Airplane::runCruise()
|
|||
Math::mul3(-1, _cruiseState.v, wind);
|
||||
Math::vmul33(_cruiseState.orient, wind, wind);
|
||||
|
||||
// Cruise is by convention at 50% tank capacity
|
||||
setFuelFraction(0.5);
|
||||
setFuelFraction(_cruiseFuel);
|
||||
|
||||
// Set up the thruster parameters and iterate until the thrust
|
||||
// stabilizes.
|
||||
|
@ -824,7 +819,7 @@ void Airplane::runApproach()
|
|||
Math::vmul33(_approachState.orient, wind, wind);
|
||||
|
||||
// Approach is by convention at 20% tank capacity
|
||||
setFuelFraction(0.2f);
|
||||
setFuelFraction(_approachFuel);
|
||||
|
||||
// Run the thrusters until they get to a stable setting. FIXME:
|
||||
// this is lots of wasted work.
|
||||
|
|
|
@ -48,9 +48,8 @@ public:
|
|||
int addWeight(float* pos, float size);
|
||||
void setWeight(int handle, float mass);
|
||||
|
||||
void setApproach(float speed, float altitude);
|
||||
void setApproach(float speed, float altitude, float aoa);
|
||||
void setCruise(float speed, float altitude);
|
||||
void setApproach(float speed, float altitude, float aoa, float fuel);
|
||||
void setCruise(float speed, float altitude, float fuel);
|
||||
|
||||
void setElevatorControl(int control);
|
||||
void addApproachControl(int control, float val);
|
||||
|
@ -134,6 +133,7 @@ private:
|
|||
float _cruiseT;
|
||||
float _cruiseSpeed;
|
||||
float _cruiseWeight;
|
||||
float _cruiseFuel;
|
||||
|
||||
Vector _approachControls;
|
||||
State _approachState;
|
||||
|
@ -142,6 +142,7 @@ private:
|
|||
float _approachSpeed;
|
||||
float _approachAoA;
|
||||
float _approachWeight;
|
||||
float _approachFuel;
|
||||
|
||||
int _solutionIterations;
|
||||
float _dragFactor;
|
||||
|
|
|
@ -118,12 +118,12 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
|
|||
float spd = attrf(a, "speed") * KTS2MPS;
|
||||
float alt = attrf(a, "alt", 0) * FT2M;
|
||||
float aoa = attrf(a, "aoa", 0) * DEG2RAD;
|
||||
_airplane.setApproach(spd, alt, aoa);
|
||||
_airplane.setApproach(spd, alt, aoa, attrf(a, "fuel", 0.2));
|
||||
_cruiseCurr = false;
|
||||
} else if(eq(name, "cruise")) {
|
||||
float spd = attrf(a, "speed") * KTS2MPS;
|
||||
float alt = attrf(a, "alt") * FT2M;
|
||||
_airplane.setCruise(spd, alt);
|
||||
_airplane.setCruise(spd, alt, attrf(a, "fuel", 0.5));
|
||||
_cruiseCurr = true;
|
||||
} else if(eq(name, "cockpit")) {
|
||||
v[0] = attrf(a, "x");
|
||||
|
|
Loading…
Add table
Reference in a new issue