// 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")) {
FGAIWaypoint *wpt;
double vDescent = ac->getPerformance()->vDescent();
double vApproach = ac->getPerformance()->vApproach();
+ double vTouchdown = ac->getPerformance()->vTouchdown();
//Beginning of Descent
// 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++) {
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
{
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;
}*/
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;
#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,
} 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;
}