void createPushBack(bool, FGAirport*, double, double, double, const string&, const string&, const string&);
void createTaxi(bool, int, FGAirport *, double, double, double, const string&, const string&, const string&);
- void createTakeOff(bool, FGAirport *, double);
- void createClimb(bool, FGAirport *, double, double);
- void createCruise(bool, FGAirport*, FGAirport*, double, double, double, double);
- void createDecent(FGAirport *);
+ void createTakeOff(bool, FGAirport *, double, const string&);
+ void createClimb(bool, FGAirport *, double, double, const string&);
+ void createCruise(bool, FGAirport*, FGAirport*, double, double, double, double, const string&);
+ void createDecent(FGAirport *, const string&);
void createLanding(FGAirport *);
void createParking(FGAirport *, double radius);
void deleteWaypoints();
void resetWaypoints();
+ string getRunwayClassFromTrafficType(string fltType);
+
//void createCruiseFallback(bool, FGAirport*, FGAirport*, double, double, double, double);
void evaluateRoutePart(double deplat, double deplon, double arrlat, double arrlon);
};
radius, fltType, aircraftType, airline);
break;
case 3:
- createTakeOff(firstFlight, dep, speed);
+ createTakeOff(firstFlight, dep, speed, fltType);
break;
case 4:
- createClimb(firstFlight, dep, speed, alt);
+ createClimb(firstFlight, dep, speed, alt, fltType);
break;
case 5:
- createCruise(firstFlight, dep,arr, latitude, longitude, speed, alt);
+ createCruise(firstFlight, dep,arr, latitude, longitude, speed, alt, fltType);
break;
case 6:
- createDecent(arr);
+ createDecent(arr, fltType);
break;
case 7:
createLanding(arr);
//wpt->on_ground = true;
//waypoints.push_back(wpt);
}
- // "NOTE: this is currently fixed to "com" for commercial traffic
- // Should be changed to be used dynamically to allow "gen" and "mil"
- // as well
- apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
+ string rwyClass = getRunwayClassFromTrafficType(fltType);
+ apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway);
if (!(globals->get_runways()->search(apt->getId(),
activeRunway,
&rwy)))
{
SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
activeRunway <<
- " at airport " << apt->getId());
+ " at airport " << apt->getId() << " of class " << rwyClass << " (1)");
exit(1);
}
* CreateTakeOff
* initialize the Aircraft at the parking location
******************************************************************/
-void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed)
+void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed, const string &fltType)
{
double heading;
double lat, lon, az;
if (firstFlight)
{
//string name;
- // "NOTE: this is currently fixed to "com" for commercial traffic
- // Should be changed to be used dynamically to allow "gen" and "mil"
- // as well
- apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
+ string rwyClass = getRunwayClassFromTrafficType(fltType);
+ apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway);
if (!(globals->get_runways()->search(apt->getId(),
activeRunway,
&rwy)))
{
SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
activeRunway <<
- " at airport " << apt->getId());
+ " at airport " << apt->getId()<< " of class " << rwyClass << " (2)");
exit(1);
}
}
* CreateClimb
* initialize the Aircraft at the parking location
******************************************************************/
-void FGAIFlightPlan::createClimb(bool firstFlight, FGAirport *apt, double speed, double alt)
+void FGAIFlightPlan::createClimb(bool firstFlight, FGAirport *apt, double speed, double alt, const string &fltType)
{
double heading;
//FGRunway rwy;
if (firstFlight)
{
//string name;
- // "NOTE: this is currently fixed to "com" for commercial traffic
- // Should be changed to be used dynamically to allow "gen" and "mil"
- // as well
- apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
+ string rwyClass = getRunwayClassFromTrafficType(fltType);
+ apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway);
if (!(globals->get_runways()->search(apt->getId(),
activeRunway,
&rwy)))
{
SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
activeRunway <<
- " at airport " << apt->getId());
+ " at airport " << apt->getId()<< " of class " << rwyClass << " (3)");
exit(1);
}
}
* CreateDecent
* initialize the Aircraft at the parking location
******************************************************************/
-void FGAIFlightPlan::createDecent(FGAirport *apt)
+void FGAIFlightPlan::createDecent(FGAirport *apt, const string &fltType)
{
// Ten thousand ft. Slowing down to 240 kts
//Beginning of Decent
//string name;
// allow "mil" and "gen" as well
- apt->getDynamics()->getActiveRunway("com", 2, activeRunway);
+ string rwyClass = getRunwayClassFromTrafficType(fltType);
+ apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway);
if (!(globals->get_runways()->search(apt->getId(),
activeRunway,
&rwy)))
{
SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
activeRunway <<
- " at airport " << apt->getId());
+ " at airport " << apt->getId()<< " of class " << rwyClass << " (4)");
exit(1);
}
wpt->routeIndex = 0;
waypoints.push_back(wpt);
}
+
+/**
+ *
+ * @param fltType a string describing the type of
+ * traffic, normally used for gate assignments
+ * @return a converted string that gives the runway
+ * preference schedule to be used at aircraft having
+ * a preferential runway schedule implemented (i.e.
+ * having a rwyprefs.xml file
+ *
+ * Currently valid traffic types for gate assignment:
+ * - gate (commercial gate)
+ * - cargo (commercial gargo),
+ * - ga (general aviation) ,
+ * - ul (ultralight),
+ * - mil-fighter (military - fighter),
+ * - mil-transport (military - transport)
+ *
+ * Valid runway classes:
+ * - com (commercial traffic: jetliners, passenger and cargo)
+ * - gen (general aviation)
+ * - ul (ultralight: I can imagine that these may share a runway with ga on some airports)
+ * - mil (all military traffic)
+ */
+string FGAIFlightPlan::getRunwayClassFromTrafficType(string fltType)
+{
+ if ((fltType == "gate") || (fltType == "cargo")) {
+ return string("com");
+ }
+ if (fltType == "ga") {
+ return string ("gen");
+ }
+ if (fltType == "ul") {
+ return string("ul");
+ }
+ if ((fltType == "mil-fighter") || (fltType == "mil-transport")) {
+ return string("mil");
+ }
+}