From: Durk Talsma Date: Mon, 10 Oct 2011 19:55:09 +0000 (+0200) Subject: Finetuning of AI Aircraft landing performance. Aircraft slow down to taxi speeds... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=835334bd4f7fb820e35219f0ea45b5781a03ae1e;p=flightgear.git Finetuning of AI Aircraft landing performance. Aircraft slow down to taxi speeds just before leaving the runway. Increased vTaxi on the runway to further reduce time on the runway and slow down to vTouchdown well ahead of touching down. --- diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 6abe6af54..a87a94fe6 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -887,17 +887,17 @@ bool FGAIAircraft::handleAirportEndPoints(FGAIWaypoint* prev, time_t now) { // fp->shortenToFirst(2, "legend"); // } //} - /*if (prev->contains(string("final"))) { - - cerr << getCallSign() << " " - << fp->getPreviousWaypoint()->getName() - << ". Alt = " << altitude_ft - << " vs " << vs - << " horizontal speed " << speed - << "Previous crossAT " << fp->getPreviousWaypoint()->getCrossat() - << "Airport elevation" << getTrafficRef()->getArrivalAirport()->getElevation() - << "Altitude difference " << (altitude_ft - fp->getPreviousWaypoint()->getCrossat()) << endl; - }*/ + //if (prev->contains(string("final"))) { + // + // cerr << getCallSign() << " " + // << fp->getPreviousWaypoint()->getName() + // << ". Alt = " << altitude_ft + // << " vs " << vs + // << " horizontal speed " << speed + // << "Previous crossAT " << fp->getPreviousWaypoint()->getCrossat() + // << "Airport elevation" << getTrafficRef()->getArrivalAirport()->getElevation() + // << "Altitude difference " << (altitude_ft - fp->getPreviousWaypoint()->getCrossat()) << endl; + //q} // This is the last taxi waypoint, and marks the the end of the flight plan // so, the schedule should update and wait for the next departure time. if (prev->contains("END")) { diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index 215d3fb17..305125819 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -575,6 +575,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt, FGAIWaypoint *wpt; double vDescent = ac->getPerformance()->vDescent(); double vApproach = ac->getPerformance()->vApproach(); + double vTouchdown = ac->getPerformance()->vTouchdown(); //Beginning of Descent @@ -821,6 +822,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt, // The approach leg should bring the aircraft to approximately 4-6 nm out, after which the landing phase should take over. //cerr << "Phase 3: Approach" << endl; + double tgt_speed = vApproach; distanceOut -= distanceCovered; double touchDownPoint = 0; //(rwy->lengthM() * 0.1); for (int i = 1; i < nPoints; i++) { @@ -831,7 +833,10 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt, double alt = currentAltitude - (i * 2000 / (nPoints - 1)); snprintf(buffer, 16, "final%03d", i); result = rwy->pointOnCenterline((-distanceOut) + currentDist + touchDownPoint); - wpt = createInAir(ac, buffer, result, alt, vApproach); + if (i == nPoints - 30) { + tgt_speed = vTouchdown; + } + wpt = createInAir(ac, buffer, result, alt, tgt_speed); wpt->setCrossat(alt); wpt->setTrackLength((distanceOut / nPoints)); // account for the extra distance due to an extended downwind leg @@ -891,7 +896,7 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt, { double vTouchdown = ac->getPerformance()->vTouchdown(); double vTaxi = ac->getPerformance()->vTaxi(); - double decel = ac->getPerformance()->deceleration() * 1.5; + double decel = ac->getPerformance()->deceleration() * 1.4; double vTouchdownMetric = (vTouchdown * SG_NM_TO_METER) / 3600; double vTaxiMetric = (vTaxi * SG_NM_TO_METER) / 3600; @@ -936,16 +941,17 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt, }*/ double rolloutDistance = (vTouchdownMetric * vTouchdownMetric - vTaxiMetric * vTaxiMetric) / (2 * decelMetric); - //cerr << " touchdown speed = " << vTouchdown << ". Rollout distance " << rolloutDistance << endl; + cerr << " touchdown speed = " << vTouchdown << ". Rollout distance " << rolloutDistance << endl; int nPoints = 50; for (int i = 1; i < nPoints; i++) { snprintf(buffer, 12, "landing03%d", i); coord = rwy->pointOnCenterline((rolloutDistance * ((double) i / (double) nPoints))); - wpt = createOnGround(ac, buffer, coord, currElev, vTaxi); + wpt = createOnGround(ac, buffer, coord, currElev, 2*vTaxi); wpt->setCrossat(currElev); waypoints.push_back(wpt); } + wpt->setSpeed(vTaxi); double mindist = 1.1 * rolloutDistance; double maxdist = rwy->lengthM(); //cerr << "Finding nearest exit" << endl; diff --git a/src/AIModel/performancedata.cxx b/src/AIModel/performancedata.cxx index 2a2919671..1c7b02912 100644 --- a/src/AIModel/performancedata.cxx +++ b/src/AIModel/performancedata.cxx @@ -6,6 +6,13 @@ #include "performancedata.hxx" #include "AIAircraft.hxx" + +// For now, make this a define +// Later on, additional class variables can simulate settings such as braking power +// also, the performance parameters can be tweaked a little to add some personality +// to the AIAircraft. +#define BRAKE_SETTING 1.6 + PerformanceData::PerformanceData(double acceleration, double deceleration, double climbRate, @@ -59,7 +66,7 @@ double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double d } else if (speed_diff < 0.0) { // decelerate if (ac->onGround()) { // deceleration performance is better due to wheel brakes. - speed -= 3 * _deceleration * dt; + speed -= BRAKE_SETTING * _deceleration * dt; } else { speed -= _deceleration * dt; }