| 1 | #pragma once |
| 2 | |
| 3 | class FGAIAircraft; |
| 4 | class SGPropertyNode; |
| 5 | |
| 6 | /** |
| 7 | Data storage for aircraft performance data. This is used to properly simulate the flight of AIAircrafts. |
| 8 | |
| 9 | @author Thomas F�rster <[email protected]> |
| 10 | */ |
| 11 | class PerformanceData |
| 12 | { |
| 13 | public: |
| 14 | PerformanceData(); |
| 15 | |
| 16 | explicit PerformanceData(const PerformanceData* clone); |
| 17 | |
| 18 | void initFromProps(SGPropertyNode* props); |
| 19 | |
| 20 | virtual ~PerformanceData() = default; |
| 21 | |
| 22 | double actualSpeed(const FGAIAircraft* ac, double tgt_speed, double dt, bool needMaxBrake); |
| 23 | double actualBankAngle(const FGAIAircraft* ac, double tgt_roll, double dt); |
| 24 | double actualPitch(const FGAIAircraft* ac, double tgt_pitch, double dt); |
| 25 | double actualHeading(const FGAIAircraft* ac, double tgt_heading, double dt); |
| 26 | double actualAltitude(const FGAIAircraft* ac, double tgt_altitude, double dt); |
| 27 | double actualVerticalSpeed(const FGAIAircraft* ac, double tgt_vs, double dt); |
| 28 | |
| 29 | bool gearExtensible(const FGAIAircraft* ac); |
| 30 | |
| 31 | double climbRate() const { return _climbRate; }; |
| 32 | double descentRate() const { return _descentRate; }; |
| 33 | double vRotate() const { return _vRotate; }; |
| 34 | double maximumBankAngle() const { return _maxbank; }; |
| 35 | double acceleration() const { return _acceleration; }; |
| 36 | double deceleration() const { return _deceleration; }; |
| 37 | double brakeDeceleration() const { return _brakeDeceleration; }; |
| 38 | double vTaxi() const { return _vTaxi; }; |
| 39 | double vTakeoff() const { return _vTakeOff; }; |
| 40 | double vClimb() const { return _vClimb; }; |
| 41 | double vDescent() const { return _vDescent; }; |
| 42 | double vApproach() const { return _vApproach; }; |
| 43 | double vTouchdown() const { return _vTouchdown; }; |
| 44 | double vCruise() const { return _vCruise; }; |
| 45 | double wingSpan() const { return _wingSpan; }; |
| 46 | double wingChord() const { return _wingChord; }; |
| 47 | double weight() const { return _weight; }; |
| 48 | |
| 49 | double decelerationOnGround() const; |
| 50 | |
| 51 | /** |
| 52 | @brief Last-resort fallback performance data. This is to avoid special-casing |
| 53 | logic in the AIAircraft code, by ensuring we always have a valid _performance pointer. |
| 54 | */ |
| 55 | static PerformanceData* getDefaultData(); |
| 56 | |
| 57 | private: |
| 58 | double _acceleration{0.0}; |
| 59 | double _deceleration{0.0}; |
| 60 | double _brakeDeceleration{0.0}; |
| 61 | double _climbRate{0.0}; |
| 62 | double _descentRate{0.0}; |
| 63 | double _vRotate{0.0}; |
| 64 | double _vTakeOff{0.0}; |
| 65 | double _vClimb{0.0}; |
| 66 | double _vCruise{0.0}; |
| 67 | double _vDescent{0.0}; |
| 68 | double _vApproach{0.0}; |
| 69 | double _vTouchdown{0.0}; |
| 70 | double _vTaxi{0.0}; |
| 71 | |
| 72 | double _rollrate{0.0}; |
| 73 | double _maxbank{0.0}; |
| 74 | |
| 75 | // Data for aerodynamic wake computation |
| 76 | double _wingSpan{0.0}; |
| 77 | double _wingChord{0.0}; |
| 78 | double _weight{0.0}; |
| 79 | }; |