45 #include "FGElectric.h" 46 #include "FGPropeller.h" 47 #include "input_output/FGXMLElement.h" 53 IDENT(IdSrc,
"$Id: FGElectric.cpp,v 1.20 2015/09/27 09:54:21 bcoconni Exp $");
54 IDENT(IdHdr,ID_ELECTRIC);
72 string base_property_name = CreateIndexedPropertyName(
"propulsion/engine",
92 if (Thruster->GetType() == FGThruster::ttPropeller) {
93 ((
FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]);
94 ((
FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]);
97 RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
99 HP = PowerWatts * in.ThrottlePos[EngineNumber] / hptowatts;
101 LoadThrusterInputs();
102 Thruster->Calculate(HP * hptoftlbssec);
109 double FGElectric::CalcFuelNeed(
void)
116 string FGElectric::GetEngineLabels(
const string& delimiter)
118 std::ostringstream buf;
120 buf << Name <<
" HP (engine " << EngineNumber <<
")" << delimiter
121 << Thruster->GetThrusterLabels(EngineNumber, delimiter);
128 string FGElectric::GetEngineValues(
const string& delimiter)
130 std::ostringstream buf;
132 buf << HP << delimiter
133 << Thruster->GetThrusterValues(EngineNumber, delimiter);
158 void FGElectric::Debug(
int from)
160 if (debug_lvl <= 0)
return;
165 cout <<
"\n Engine Name: " << Name << endl;
166 cout <<
" Power Watts: " << PowerWatts << endl;
170 if (debug_lvl & 2 ) {
171 if (from == 0) cout <<
"Instantiated: FGElectric" << endl;
172 if (from == 1) cout <<
"Destroyed: FGElectric" << endl;
174 if (debug_lvl & 4 ) {
176 if (debug_lvl & 8 ) {
178 if (debug_lvl & 16) {
180 if (debug_lvl & 64) {
182 cout << IdSrc << endl;
183 cout << IdHdr << endl;
double FindElementValueAsNumberConvertTo(const std::string &el, const std::string &target_units)
Searches for the named element and converts and returns the data belonging to it. ...
FGPropeller models a propeller given the tabular data for Ct (thrust) and Cp (power), indexed by the advance ratio "J".
Element * FindElement(const std::string &el="")
Searches for a specified element.
FGPropertyManager * GetPropertyManager(void)
Returns a pointer to the property manager object.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
void Calculate(void)
Calculates the thrust of the engine, and other engine functions.
Base class for all engines.
Encapsulates the JSBSim simulation executive.