1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header:       FGElectric.h
4  Author:       David Culp
5  Date started: 04/07/2004
6 
7  ----- Copyright (C) 2004  David P. Culp (davidculp2@comcast.net) --------------
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 04/07/2004  DPC  Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGELECTRIC_H
35 #define FGELECTRIC_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "FGEngine.h"
42 
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 FORWARD DECLARATIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 
47 namespace JSBSim {
48 
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 CLASS DOCUMENTATION
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 
53 /** Models an electric motor.
54     FGElectric models an electric motor based on the configuration file
55     \<power> parameter.  The throttle controls motor output linearly from
56     zero to \<power>.  This power value (converted internally to horsepower)
57     is then used by FGPropeller to apply torque to the propeller.  At present
58     there is no battery model available, so this motor does not consume any
59     energy.  There is no internal friction.
60     @author David Culp
61   */
62 
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 CLASS DECLARATION
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66 
67 class FGElectric : public FGEngine
68 {
69 public:
70   /// Constructor
71   FGElectric(FGFDMExec* exec, Element *el, int engine_number, FGEngine::Inputs& input);
72   /// Destructor
73   ~FGElectric();
74 
75   void Calculate(void);
GetPowerAvailable(void)76   double GetPowerAvailable(void) {return (HP * hptoftlbssec);}
getRPM(void)77   double getRPM(void) {return RPM;}
78   std::string GetEngineLabels(const std::string& delimiter);
79   std::string GetEngineValues(const std::string& delimiter);
80 
81 private:
82 
83   double CalcFuelNeed(void);
84 
85   //double BrakeHorsePower;
86 
87   // constants
88   double hptowatts;
89 
90   double PowerWatts;         // maximum engine power
91   double RPM;                // revolutions per minute
92   double HP;                 // engine output, in horsepower
93 
94   void Debug(int from);
95 };
96 }
97 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 #endif
99