}
}
-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)
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.
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.
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);
float _cruiseT;
float _cruiseSpeed;
float _cruiseWeight;
+ float _cruiseFuel;
Vector _approachControls;
State _approachState;
float _approachSpeed;
float _approachAoA;
float _approachWeight;
+ float _approachFuel;
int _solutionIterations;
float _dragFactor;
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");