| 1 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 | |
| 3 | Header: FGThruster.h |
| 4 | Author: Jon S. Berndt |
| 5 | Date started: 08/23/00 |
| 6 | |
| 7 | ------------- Copyright (C) 2000 Jon S. Berndt ([email protected]) ------------- |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify it under |
| 10 | the terms of the GNU Lesser General Public License as published by the Free Software |
| 11 | Foundation; either version 2 of the License, or (at your option) any later |
| 12 | version. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 17 | details. |
| 18 | |
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | |
| 23 | Further information about the GNU Lesser General Public License can also be found on |
| 24 | the world wide web at http://www.gnu.org. |
| 25 | |
| 26 | HISTORY |
| 27 | -------------------------------------------------------------------------------- |
| 28 | 08/24/00 JSB Created |
| 29 | |
| 30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 31 | SENTRY |
| 32 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 33 | |
| 34 | #ifndef FGTHRUSTER_H |
| 35 | #define FGTHRUSTER_H |
| 36 | |
| 37 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 38 | INCLUDES |
| 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 40 | |
| 41 | #include "FGForce.h" |
| 42 | #include "math/FGColumnVector3.h" |
| 43 | #include <string> |
| 44 | |
| 45 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 46 | FORWARD DECLARATIONS |
| 47 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 48 | |
| 49 | namespace JSBSim { |
| 50 | |
| 51 | class Element; |
| 52 | class FGPropertyManager; |
| 53 | |
| 54 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 55 | CLASS DOCUMENTATION |
| 56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 57 | |
| 58 | /** Base class for specific thrusting devices such as propellers, nozzles, etc. |
| 59 | |
| 60 | <h3>reverser angle:</h3> |
| 61 | |
| 62 | "Reverser angle" as used here is a way to manipulate the thrust vector, |
| 63 | along the thrust axis ONLY, during run time. This should not be confused |
| 64 | with a thrust vectoring nozzle. The angle is defined in radians, and is |
| 65 | used thus: Final_thrust = cosine( reverser_angle ) * unmodified_thrust. |
| 66 | Therefore a reverser angle of 0 results in no change, and a reverser angle |
| 67 | of 3.14 (pi) results in a completely reversed thrust vector. An angle of |
| 68 | 1.57 (pi/2) results in no thrust at all. |
| 69 | |
| 70 | @author Jon Berndt |
| 71 | */ |
| 72 | |
| 73 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 | CLASS DECLARATION |
| 75 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 76 | |
| 77 | class FGThruster : public FGForce { |
| 78 | |
| 79 | public: |
| 80 | /// Constructor |
| 81 | FGThruster(FGFDMExec *FDMExec, Element *el, int num ); |
| 82 | /// Destructor |
| 83 | virtual ~FGThruster(); |
| 84 | |
| 85 | enum eType {ttNozzle, ttRotor, ttPropeller, ttDirect}; |
| 86 | |
| 87 | virtual double Calculate(double tt) { |
| 88 | Thrust = cos(ReverserAngle)*tt; |
| 89 | vFn(1) = Thrust; |
| 90 | return Thrust; |
| 91 | } |
| 92 | void SetName(std::string name) {Name = name;} |
| 93 | virtual void SetRPM(double rpm) {}; |
| 94 | virtual void SetEngineRPM(double rpm) {}; |
| 95 | virtual double GetPowerRequired(void) {return 0.0;} |
| 96 | double GetThrust(void) const {return Thrust;} |
| 97 | eType GetType(void) {return Type;} |
| 98 | std::string GetName(void) {return Name;} |
| 99 | void SetReverserAngle(double angle) {ReverserAngle = angle;} |
| 100 | double GetReverserAngle(void) const {return ReverserAngle;} |
| 101 | virtual double GetRPM(void) const { return 0.0; }; |
| 102 | virtual double GetEngineRPM(void) const { return 0.0; }; |
| 103 | double GetGearRatio(void) {return GearRatio; } |
| 104 | virtual std::string GetThrusterLabels(int id, const std::string& delimeter); |
| 105 | virtual std::string GetThrusterValues(int id, const std::string& delimeter); |
| 106 | |
| 107 | virtual void ResetToIC(void); |
| 108 | |
| 109 | struct Inputs { |
| 110 | double TotalDeltaT; |
| 111 | double H_agl; |
| 112 | FGColumnVector3 PQRi; |
| 113 | FGColumnVector3 AeroPQR; |
| 114 | FGColumnVector3 AeroUVW; |
| 115 | double Density; |
| 116 | double Pressure; |
| 117 | double Soundspeed; |
| 118 | double Alpha; |
| 119 | double Beta; |
| 120 | double Vt; |
| 121 | } in; |
| 122 | |
| 123 | protected: |
| 124 | eType Type; |
| 125 | std::string Name; |
| 126 | double Thrust; |
| 127 | double PowerRequired; |
| 128 | double GearRatio; |
| 129 | double ThrustCoeff; |
| 130 | double ReverserAngle; |
| 131 | int EngineNum; |
| 132 | virtual void Debug(int from); |
| 133 | }; |
| 134 | } |
| 135 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 136 | #endif |