1
0
Fork 0

Make sure that takeoff distance calculations are done in the correct frame of reference. Additionally, add some experimental lead-in distance clipping code (although the latter needs more sophistication, because it leads to a considerable increase of spinning around waypoints when on ground.

This commit is contained in:
Durk Talsma 2010-07-04 20:57:25 +02:00
parent 07d055b4de
commit b78bf2e9e6
3 changed files with 59 additions and 16 deletions

View file

@ -629,7 +629,12 @@ bool FGAIAircraft::leadPointReached(FGAIFlightPlan::waypoint* curr) {
// << dist_to_go << ": Lead distance " // << dist_to_go << ": Lead distance "
// << lead_dist << " " << curr->name // << lead_dist << " " << curr->name
// << " Ground target speed " << groundTargetSpeed << endl; // << " Ground target speed " << groundTargetSpeed << endl;
if (trafficRef) {
if (trafficRef->getCallSign() == "Transavia7584") {
cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " "
<< _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << curr->name << endl;
}
}
return dist_to_go < lead_dist; return dist_to_go < lead_dist;
} }

View file

@ -149,7 +149,7 @@ private:
void createClimb(FGAIAircraft *, bool, FGAirport *, double, double, const string&); void createClimb(FGAIAircraft *, bool, FGAirport *, double, double, const string&);
void createCruise(FGAIAircraft *, bool, FGAirport*, FGAirport*, double, double, double, double, const string&); void createCruise(FGAIAircraft *, bool, FGAirport*, FGAirport*, double, double, double, double, const string&);
void createDecent(FGAIAircraft *, FGAirport *, const string&); void createDecent(FGAIAircraft *, FGAirport *, const string&);
void createLanding(FGAIAircraft *, FGAirport *); void createLanding(FGAIAircraft *, FGAirport *, const string&);
void createParking(FGAIAircraft *, FGAirport *, double radius); void createParking(FGAIAircraft *, FGAirport *, double radius);
void deleteWaypoints(); void deleteWaypoints();
void resetWaypoints(); void resetWaypoints();

View file

@ -75,7 +75,7 @@ void FGAIFlightPlan::create(FGAIAircraft *ac, FGAirport *dep, FGAirport *arr, in
createDecent(ac, arr, fltType); createDecent(ac, arr, fltType);
break; break;
case 7: case 7:
createLanding(ac, arr); createLanding(ac, arr, fltType);
break; break;
case 8: case 8:
createLandingTaxi(ac, arr, radius, fltType, aircraftType, airline); createLandingTaxi(ac, arr, radius, fltType, aircraftType, airline);
@ -366,23 +366,36 @@ void FGAIFlightPlan::createLandingTaxi(FGAIAircraft *ac, FGAirport *apt,
/******************************************************************* /*******************************************************************
* CreateTakeOff * CreateTakeOff
* initialize the Aircraft at the parking location * A note on units:
* - Speed -> knots -> nm/hour
* - distance along runway =-> meters
* - accel / decel -> is given as knots/hour, but this is highly questionable:
* for a jet_transport performance class, a accel / decel rate of 5 / 2 is
* given respectively. According to performance data.cxx, a value of kts / second seems
* more likely however.
*
******************************************************************/ ******************************************************************/
void FGAIFlightPlan::createTakeOff(FGAIAircraft *ac, bool firstFlight, FGAirport *apt, double speed, const string &fltType) void FGAIFlightPlan::createTakeOff(FGAIAircraft *ac, bool firstFlight, FGAirport *apt, double speed, const string &fltType)
{ {
double accel = ac->getPerformance()->acceleration(); double accel = ac->getPerformance()->acceleration();
double vTaxi = ac->getPerformance()->vTaxi(); double vTaxi = ac->getPerformance()->vTaxi();
double vRotate = ac->getPerformance()->vRotate(); double vRotate = ac->getPerformance()->vRotate();
// double vTakeoff = ac->getPerformance()->vTakeoff(); double vTakeoff = ac->getPerformance()->vTakeoff();
double vClimb = ac->getPerformance()->vClimb(); double vClimb = ac->getPerformance()->vClimb();
double accelMetric = (accel * SG_NM_TO_METER) / 3600;
double vTaxiMetric = (vTaxi * SG_NM_TO_METER) / 3600;
double vRotateMetric = (vRotate * SG_NM_TO_METER) / 3600;
double vTakeoffMetric = (vTakeoff * SG_NM_TO_METER) / 3600;
double vClimbMetric = (vClimb * SG_NM_TO_METER) / 3600;
// Acceleration = dV / dT // Acceleration = dV / dT
// Acceleration X dT = dV // Acceleration X dT = dV
// dT = dT / Acceleration // dT = dT / Acceleration
//d = (Vf^2 - Vo^2) / (2*a) //d = (Vf^2 - Vo^2) / (2*a)
// double accelTime = (vRotate - vTaxi) / accel; //double accelTime = (vRotate - vTaxi) / accel;
//cerr << "Using " << accelTime << " as total acceleration time" << endl; //cerr << "Using " << accelTime << " as total acceleration time" << endl;
double accelDistance = (vRotate*vRotate - vTaxi*vTaxi) / (2*accel); double accelDistance = (vRotateMetric*vRotateMetric - vTaxiMetric*vTaxiMetric) / (2*accelMetric);
//cerr << "Using " << accelDistance << " " << accel << " " << vRotate << endl; cerr << "Using " << accelDistance << " " << accelMetric << " " << vRotateMetric << endl;
waypoint *wpt; waypoint *wpt;
// Get the current active runway, based on code from David Luff // Get the current active runway, based on code from David Luff
// This should actually be unified and extended to include // This should actually be unified and extended to include
@ -400,14 +413,20 @@ void FGAIFlightPlan::createTakeOff(FGAIAircraft *ac, bool firstFlight, FGAirport
double airportElev = apt->getElevation(); double airportElev = apt->getElevation();
// Acceleration point, 105 meters into the runway, // Acceleration point, 105 meters into the runway,
SGGeod accelPoint = rwy->pointOnCenterline(105.0); SGGeod accelPoint = rwy->pointOnCenterline(105.0);
wpt = createOnGround(ac, "accel", accelPoint, airportElev, vClimb); wpt = createOnGround(ac, "accel", accelPoint, airportElev, vRotate);
waypoints.push_back(wpt); waypoints.push_back(wpt);
//Start Climbing to 3000 ft. Let's do this
// at the center of the runway for now: accelDistance = (vTakeoffMetric*vTakeoffMetric - vTaxiMetric*vTaxiMetric) / (2*accelMetric);
SGGeod rotate = rwy->pointOnCenterline(105.0+accelDistance); cerr << "Using " << accelDistance << " " << accelMetric << " " << vTakeoffMetric << endl;
wpt = cloneWithPos(ac, wpt, "SOC", rotate); accelPoint = rwy->pointOnCenterline(105.0+accelDistance);
wpt->altitude = airportElev+1000; wpt = createOnGround(ac, "rotate", accelPoint, airportElev, vTakeoff);
waypoints.push_back(wpt);
accelDistance = ((vTakeoffMetric*1.1)*(vTakeoffMetric*1.1) - vTaxiMetric*vTaxiMetric) / (2*accelMetric);
cerr << "Using " << accelDistance << " " << accelMetric << " " << vTakeoffMetric << endl;
accelPoint = rwy->pointOnCenterline(105.0+accelDistance);
wpt = createOnGround(ac, "rotate", accelPoint, airportElev+1000, vTakeoff*1.1);
wpt->on_ground = false; wpt->on_ground = false;
waypoints.push_back(wpt); waypoints.push_back(wpt);
@ -471,7 +490,7 @@ void FGAIFlightPlan::createDecent(FGAIAircraft *ac, FGAirport *apt, const string
{ {
// Ten thousand ft. Slowing down to 240 kts // Ten thousand ft. Slowing down to 240 kts
waypoint *wpt; waypoint *wpt;
double vDecent = ac->getPerformance()->vDescent(); double vDecent = ac->getPerformance()->vDescent();
double vApproach = ac->getPerformance()->vApproach(); double vApproach = ac->getPerformance()->vApproach();
//Beginning of Decent //Beginning of Decent
@ -499,13 +518,31 @@ double vDecent = ac->getPerformance()->vDescent();
* CreateLanding * CreateLanding
* initialize the Aircraft at the parking location * initialize the Aircraft at the parking location
******************************************************************/ ******************************************************************/
void FGAIFlightPlan::createLanding(FGAIAircraft *ac, FGAirport *apt) void FGAIFlightPlan::createLanding(FGAIAircraft *ac, FGAirport *apt, const string &fltType)
{ {
double vTouchdown = ac->getPerformance()->vTouchdown(); double vTouchdown = ac->getPerformance()->vTouchdown();
double vTaxi = ac->getPerformance()->vTaxi(); double vTaxi = ac->getPerformance()->vTaxi();
string rwyClass = getRunwayClassFromTrafficType(fltType);
double heading = ac->getTrafficRef()->getCourse();
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
rwy = apt->getRunwayByIdent(activeRunway);
waypoint *wpt; waypoint *wpt;
double aptElev = apt->getElevation(); double aptElev = apt->getElevation();
SGGeod coord;
char buffer[12];
for (int i = 1; i < 10; i++) {
snprintf(buffer, 12, "wpt%d", i);
coord = rwy->pointOnCenterline(rwy->lengthM() * (i/10.0));
wpt = createOnGround(ac, buffer, coord, aptElev, (vTouchdown/i));
wpt->crossat = apt->getElevation();
waypoints.push_back(wpt);
}
/*
//Runway Threshold //Runway Threshold
wpt = createOnGround(ac, "Threshold", rwy->threshold(), aptElev, vTouchdown); wpt = createOnGround(ac, "Threshold", rwy->threshold(), aptElev, vTouchdown);
wpt->crossat = apt->getElevation(); wpt->crossat = apt->getElevation();
@ -519,6 +556,7 @@ void FGAIFlightPlan::createLanding(FGAIAircraft *ac, FGAirport *apt)
wpt = createOnGround(ac, "Roll Out", rollOut, aptElev, vTaxi); wpt = createOnGround(ac, "Roll Out", rollOut, aptElev, vTaxi);
wpt->crossat = apt->getElevation(); wpt->crossat = apt->getElevation();
waypoints.push_back(wpt); waypoints.push_back(wpt);
*/
} }
/******************************************************************* /*******************************************************************