[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flightgear-cvs
Subject:    [Flightgear-cvslogs] CVS: source/src/AIModel AIAircraft.cxx, 1.80,
From:       Durk Talsma <durk () baron ! flightgear ! org>
Date:       2009-01-30 18:48:48
Message-ID: 200901301848.n0UImmB9026363 () baron ! flightgear ! org
[Download RAW message or body]

Update of /var/cvs/FlightGear-0.9/source/src/AIModel
In directory baron.flightgear.org:/tmp/cvs-serv26299/AIModel

Modified Files:
	AIAircraft.cxx AIAircraft.hxx AIFlightPlan.cxx 
	AIFlightPlan.hxx AIFlightPlanCreate.cxx performancedata.hxx 
	performancedb.cxx 
Log Message:
Development for two new features:
 * Some support for geometry information provided by the custom scenery
   project. Current support is for AI groundnets and runway use files only
   since this is a switch that involves a lot of data verification and
   updating, during the transistion the actual path where the data can be
   read from is user configurable. setting the property

   /sim/traffic-manager/use-custom-scenery-data to true

  will cause flightgear to read the ground networks from the scenery
  directory (--{fg-scenery}/Airports/[I]/[C]/[A]/[ICAO].groundnet.xml to be
  precise). Setting this property to false will retain the original 
  behvior. 
* For departing aircraft, runway takeoff calculations will be done on the
  basis of the performance database. For testing purposes, a performance  
 estimate for a heavy jet has been added.


Index: AIAircraft.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIAircraft.cxx,v
retrieving revision 1.80
retrieving revision 1.81
diff -C 2 -r1.80 -r1.81
*** AIAircraft.cxx	26 Dec 2008 12:28:05 -0000	1.80
--- AIAircraft.cxx	30 Jan 2009 18:48:44 -0000	1.81
***************
*** 354,358 ****
          }
          setCallSign(trafficRef->getCallSign());
- 	//props->setStringValue("callsign", callsign.c_str());
          leg = 1;
          fp->setLeg(leg);
--- 354,357 ----
***************
*** 367,374 ****
          double cruiseAlt = trafficRef->getCruiseAlt() * 100;
  
!         fp->create (dep,
                      arr,
                      leg,
!                     cruiseAlt,           //(trafficRef->getCruiseAlt() * 100), // \
convert from FL to feet  trafficRef->getSpeed(),
                      _getLatitude(),
--- 366,374 ----
          double cruiseAlt = trafficRef->getCruiseAlt() * 100;
  
!         fp->create (this,
!                     dep,
                      arr,
                      leg,
!                     cruiseAlt,
                      trafficRef->getSpeed(),
                      _getLatitude(),

Index: AIAircraft.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIAircraft.hxx,v
retrieving revision 1.39
retrieving revision 1.40
diff -C 2 -r1.39 -r1.40
*** AIAircraft.hxx	10 Dec 2008 16:04:10 -0000	1.39
--- AIAircraft.hxx	30 Jan 2009 18:48:44 -0000	1.40
***************
*** 77,80 ****
--- 77,81 ----
  
      // included as performance data needs them, who else?
+     inline PerformanceData* getPerformance() { return _performance; };
      inline bool onGround() const { return no_roll; };
      inline double getSpeed() const { return speed; };

Index: AIFlightPlan.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIFlightPlan.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -C 2 -r1.32 -r1.33
*** AIFlightPlan.cxx	6 Jan 2009 17:05:46 -0000	1.32
--- AIFlightPlan.cxx	30 Jan 2009 18:48:44 -0000	1.33
***************
*** 102,106 ****
  // as setting speeds and altitude computed by the
  // traffic manager. 
! FGAIFlightPlan::FGAIFlightPlan(const std::string& p,
  			       double course,
  			       time_t start,
--- 102,107 ----
  // as setting speeds and altitude computed by the
  // traffic manager. 
! FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac,
!                                const std::string& p,
  			       double course,
  			       time_t start,
***************
*** 203,207 ****
        SG_LOG(SG_GENERAL, SG_INFO, "Route from " << dep->getId() << " to " << \
arr->getId() << ". Set leg to : " << leg);  wpt_iterator = waypoints.begin();
!       create(dep,arr, leg, alt, speed, lat, lon,
  	     firstLeg, radius, fltType, acType, airline);
        wpt_iterator = waypoints.begin();
--- 204,208 ----
        SG_LOG(SG_GENERAL, SG_INFO, "Route from " << dep->getId() << " to " << \
arr->getId() << ". Set leg to : " << leg);  wpt_iterator = waypoints.begin();
!       create(ac, dep,arr, leg, alt, speed, lat, lon,
  	     firstLeg, radius, fltType, acType, airline);
        wpt_iterator = waypoints.begin();

Index: AIFlightPlan.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIFlightPlan.hxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -C 2 -r1.30 -r1.31
*** AIFlightPlan.hxx	30 Dec 2008 07:41:15 -0000	1.30
--- AIFlightPlan.hxx	30 Jan 2009 18:48:44 -0000	1.31
***************
*** 24,27 ****
--- 24,28 ----
  #include <string>
  
+ 
  #include <Airports/simple.hxx>
  #include <Navaids/awynet.hxx>
***************
*** 29,32 ****
--- 30,35 ----
  #include "AIBase.hxx"
  
+ 
+ 
  using std::vector;
  using std::string;
***************
*** 34,37 ****
--- 37,41 ----
  class FGTaxiRoute;
  class FGRunway;
+ class FGAIAircraft;
  
  class FGAIFlightPlan {
***************
*** 57,61 ****
  
    FGAIFlightPlan(const string& filename);
!   FGAIFlightPlan(const std::string& p,
  		 double course,
  		 time_t start,
--- 61,66 ----
  
    FGAIFlightPlan(const string& filename);
!   FGAIFlightPlan(FGAIAircraft *,
!                  const std::string& p,
  		 double course,
  		 time_t start,
***************
*** 87,91 ****
    time_t getStartTime() const { return start_time; }
  
!   void    create(FGAirport *dep, FGAirport *arr, int leg, double alt, double speed, \
                double lat, double lon,
  		 bool firstLeg, double radius, const string& fltType, const string& aircraftType, \
const string& airline);  
--- 92,96 ----
    time_t getStartTime() const { return start_time; }
  
!   void    create(FGAIAircraft *, FGAirport *dep, FGAirport *arr, int leg, double \
                alt, double speed, double lat, double lon,
  		 bool firstLeg, double radius, const string& fltType, const string& aircraftType, \
const string& airline);  
***************
*** 127,131 ****
    void createPushBack(bool, FGAirport*, double, double, double, const string&, \
const string&, const string&);  void createPushBackFallBack(bool, FGAirport*, double, \
                double, double, const string&, const string&, const string&);
!   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&);
--- 132,136 ----
    void createPushBack(bool, FGAirport*, double, double, double, const string&, \
const string&, const string&);  void createPushBackFallBack(bool, FGAirport*, double, \
                double, double, const string&, const string&, const string&);
!   void createTakeOff(FGAIAircraft *, bool, FGAirport *, double, const string&);
    void createClimb(bool, FGAirport *, double, double, const string&);
    void createCruise(bool, FGAirport*, FGAirport*, double, double, double, double, \
const string&);

Index: AIFlightPlanCreate.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIFlightPlanCreate.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -C 2 -r1.23 -r1.24
*** AIFlightPlanCreate.cxx	3 Jan 2009 16:15:48 -0000	1.23
--- AIFlightPlanCreate.cxx	30 Jan 2009 18:48:44 -0000	1.24
***************
*** 27,30 ****
--- 27,32 ----
  #include <Airports/runways.hxx>
  #include <Airports/dynamics.hxx>
+ #include <AIAircraft.hxx>
+ #include <performancedata.hxx>
  
  #include <Environment/environment_mgr.hxx>
***************
*** 42,46 ****
  
  // Check lat/lon values during initialization;
! void FGAIFlightPlan::create(FGAirport *dep, FGAirport *arr, int legNr, 
  			    double alt, double speed, double latitude, 
  			    double longitude, bool firstFlight,double radius, 
--- 44,48 ----
  
  // Check lat/lon values during initialization;
! void FGAIFlightPlan::create(FGAIAircraft *ac, FGAirport *dep, FGAirport *arr, int \
legNr,   double alt, double speed, double latitude, 
  			    double longitude, bool firstFlight,double radius, 
***************
*** 59,63 ****
        break;
      case 3: 
!       createTakeOff(firstFlight, dep, speed, fltType);
        break;
      case 4: 
--- 61,65 ----
        break;
      case 3: 
!       createTakeOff(ac, firstFlight, dep, speed, fltType);
        break;
      case 4: 
***************
*** 337,377 ****
   * initialize the Aircraft at the parking location
   ******************************************************************/
! void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed, \
const string &fltType)  {
!   waypoint *wpt;
!   
!   // Get the current active runway, based on code from David Luff
!   // This should actually be unified and extended to include 
!   // Preferential runway use schema's 
!   if (firstFlight)
!  {
!    string rwyClass = getRunwayClassFromTrafficType(fltType);
!    apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway);
!    rwy = apt->getRunwayByIdent(activeRunway);
!  }
!   
!  double airportElev = apt->getElevation();
!  // Acceleration point, 105 meters into the runway,
!  SGGeod accelPoint = rwy->pointOnCenterline(105.0);
!  wpt = createOnGround("accel", accelPoint, airportElev, speed);
!  waypoints.push_back(wpt); 
   
!  //Start Climbing to 3000 ft. Let's do this 
!  // at the center of the runway for now:
!  wpt = cloneWithPos(wpt, "SOC", rwy->geod());
!  wpt->altitude  = airportElev+1000;
!  wpt->on_ground = false;
!  waypoints.push_back(wpt);
! 
!  wpt = cloneWithPos(wpt, "3000 ft", rwy->end());
!  wpt->altitude  = airportElev+3000;
!  waypoints.push_back(wpt);
! 
! // Finally, add two more waypoints, so that aircraft will remain under
!  // Tower control until they have reached the 3000 ft climb point
!  SGGeod pt = rwy->pointOnCenterline(5000 + rwy->lengthM() * 0.5);
!  wpt = cloneWithPos(wpt, "5000 ft", pt);
!  wpt->altitude  = airportElev+5000;
!   waypoints.push_back(wpt);  
  }
    
--- 339,391 ----
   * initialize the Aircraft at the parking location
   ******************************************************************/
! void FGAIFlightPlan::createTakeOff(FGAIAircraft *ac, bool firstFlight, FGAirport \
*apt, double speed, const string &fltType)  {
!     double accel   = ac->getPerformance()->acceleration();
!     double vRotate = ac->getPerformance()->vRotate();
!     // Acceleration = dV / dT
!     // Acceleration X dT = dV
!     // dT = dT / Acceleration
!     //d = (Vf^2 - Vo^2) / (2*a)
!     double accelTime = (vRotate - 15) / accel;
!     cerr << "Using " << accelTime << " as total acceleration time" << endl;
!     double accelDistance = (vRotate*vRotate - 15*15) / (2*accel);
!     cerr << "Using " << accelDistance << " " << accel << " " << vRotate << endl;
!     waypoint *wpt;
!     // Get the current active runway, based on code from David Luff
!     // This should actually be unified and extended to include 
!     // Preferential runway use schema's 
!     // NOTE: DT (2009-01-18: IIRC, this is currently already the case, 
!     // because the getActive runway function takes care of that.
!     if (firstFlight)
!     {
!         string rwyClass = getRunwayClassFromTrafficType(fltType);
!         apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway);
!         rwy = apt->getRunwayByIdent(activeRunway);
!     }
! 
!     double airportElev = apt->getElevation();
!     // Acceleration point, 105 meters into the runway,
!     SGGeod accelPoint = rwy->pointOnCenterline(105.0);
!     wpt = createOnGround("accel", accelPoint, airportElev, speed);
!     waypoints.push_back(wpt); 
   
!     //Start Climbing to 3000 ft. Let's do this 
!     // at the center of the runway for now:
!     SGGeod rotate = rwy->pointOnCenterline(105.0+accelDistance);
!     wpt = cloneWithPos(wpt, "SOC", rotate);
!     wpt->altitude  = airportElev+1000;
!     wpt->on_ground = false;
!     waypoints.push_back(wpt);
! 
!     wpt = cloneWithPos(wpt, "3000 ft", rwy->end());
!     wpt->altitude  = airportElev+3000;
!     waypoints.push_back(wpt);
! 
!     // Finally, add two more waypoints, so that aircraft will remain under
!     // Tower control until they have reached the 3000 ft climb point
!     SGGeod pt = rwy->pointOnCenterline(5000 + rwy->lengthM() * 0.5);
!     wpt = cloneWithPos(wpt, "5000 ft", pt);
!     wpt->altitude  = airportElev+5000;
!     waypoints.push_back(wpt);
  }
    

Index: performancedata.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/performancedata.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -r1.1 -r1.2
*** performancedata.hxx	28 Jun 2007 07:47:20 -0000	1.1
--- performancedata.hxx	30 Jan 2009 18:48:44 -0000	1.2
***************
*** 10,14 ****
  Data storage for aircraft performance data. This is used to properly simulate the \
flight of AIAircrafts.  
! 	@author Thomas Förster <t.foerster@biologie.hu-berlin.de>
  */
  class PerformanceData
--- 10,14 ----
  Data storage for aircraft performance data. This is used to properly simulate the \
flight of AIAircrafts.  
! 	@author Thomas F�rster <t.foerster@biologie.hu-berlin.de>
  */
  class PerformanceData
***************
*** 39,46 ****
      bool gearExtensible(const FGAIAircraft* ac);
  
!     inline double climbRate() { return _climbRate; };
!     inline double descentRate() { return _descentRate; };
!     inline double vRotate() { return _vRotate; };
!     inline double maximumBankAngle() { return _maxbank; };
      
  private:
--- 39,47 ----
      bool gearExtensible(const FGAIAircraft* ac);
  
!     inline double climbRate        () { return _climbRate; };
!     inline double descentRate      () { return _descentRate; };
!     inline double vRotate          () { return _vRotate; };
!     inline double maximumBankAngle () { return _maxbank; };
!     inline double acceleration     () { return _acceleration; };
      
  private:

Index: performancedb.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/performancedb.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -r1.1 -r1.2
*** performancedb.cxx	28 Jun 2007 07:47:20 -0000	1.1
--- performancedb.cxx	30 Jan 2009 18:48:44 -0000	1.2
***************
*** 4,7 ****
--- 4,10 ----
  {
      // these are the 6 classes originally defined in the PERFSTRUCT
+     // Plus a few more for testing
+     registerPerformanceData("heavy_jet", new PerformanceData(
+         4.0, 2.0,  3000.0, 1500.0,  150.0, 160.0,  300.0, 430.0,  300.0,  170.0, \
150.0, 15.0));  registerPerformanceData("light", new PerformanceData(
          2.0, 2.0,  450.0, 1000.0,  70.0, 70.0,  80.0, 100.0,  80.0,  70.0, 60.0, \
15.0));



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_______________________________________________
Flightgear-cvslogs mailing list
Flightgear-cvslogs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-cvslogs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic