Branch data Line data Source code
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 : : #include "input_output/FGXMLElement.h"
43 : :
44 : : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 : : DEFINITIONS
46 : : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 : :
48 : : #define ID_ELECTRIC "$Id: FGElectric.h,v 1.9 2010/08/21 18:07:59 jberndt Exp $";
49 : :
50 : : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 : : FORWARD DECLARATIONS
52 : : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 : :
54 : : namespace JSBSim {
55 : :
56 : : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 : : CLASS DOCUMENTATION
58 : : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 : :
60 : : /** Models an electric motor.
61 : : FGElectric models an electric motor based on the configuration file
62 : : \<power> parameter. The throttle controls motor output linearly from
63 : : zero to \<power>. This power value (converted internally to horsepower)
64 : : is then used by FGPropeller to apply torque to the propeller. At present
65 : : there is no battery model available, so this motor does not consume any
66 : : energy. There is no internal friction.
67 : : @author David Culp
68 : : @version "$Id: FGElectric.h,v 1.9 2010/08/21 18:07:59 jberndt Exp $"
69 : : */
70 : :
71 : : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 : : CLASS DECLARATION
73 : : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74 : :
75 : : class FGElectric : public FGEngine
76 : : {
77 : : public:
78 : : /// Constructor
79 : : FGElectric(FGFDMExec* exec, Element *el, int engine_number);
80 : : /// Destructor
81 : : ~FGElectric();
82 : :
83 : : void Calculate(void);
84 : 0 : double GetPowerAvailable(void) {return PowerAvailable;}
85 : : double getRPM(void) {return RPM;}
86 : : std::string GetEngineLabels(const std::string& delimiter);
87 : : std::string GetEngineValues(const std::string& delimiter);
88 : :
89 : : private:
90 : :
91 : : double CalcFuelNeed(void);
92 : :
93 : : double BrakeHorsePower;
94 : : double PowerAvailable;
95 : :
96 : : // timestep
97 : : double dt;
98 : :
99 : : // constants
100 : : double hptowatts;
101 : :
102 : : double PowerWatts; // maximum engine power
103 : : double RPM; // revolutions per minute
104 : : double HP;
105 : :
106 : : void Debug(int from);
107 : : };
108 : : }
109 : : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110 : : #endif
|