--------- Copyright (C) 2004 David Culp (davidculp2@comcast.net) -------------
This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
+ the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
- You should have received a copy of the GNU General Public License along with
+ You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
- Further information about the GNU General Public License can also be found on
+ Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGElectric.h"
-#include <models/FGPropulsion.h>
+#include "models/FGPropulsion.h"
+#include "models/propulsion/FGThruster.h"
+
+#include <iostream>
+#include <sstream>
+
+using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGElectric.cpp,v 1.9 2010/08/21 17:13:48 jberndt Exp $";
static const char *IdHdr = ID_ELECTRIC;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PowerWatts = 745.7;
hptowatts = 745.7;
- dt = State->Getdt();
+ dt = FDMExec->GetDeltaT();
if (el->FindElement("power"))
PowerWatts = el->FindElementValueAsNumberConvertTo("power","WATTS");
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGElectric::Calculate(void)
+void FGElectric::Calculate(void)
{
+ RunPreFunctions();
+
Throttle = FCS->GetThrottlePos(EngineNumber);
RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
- return Thruster->Calculate(PowerAvailable);
+ Thruster->Calculate(PowerAvailable);
+
+ RunPostFunctions();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGElectric::GetEngineLabels(string delimeter)
+string FGElectric::GetEngineLabels(const string& delimiter)
{
- return ""; // currently no labels are returned for this engine
+ std::ostringstream buf;
+
+ buf << Name << " HP (engine " << EngineNumber << ")" << delimiter
+ << Thruster->GetThrusterLabels(EngineNumber, delimiter);
+
+ return buf.str();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGElectric::GetEngineValues(string delimeter)
+string FGElectric::GetEngineValues(const string& delimiter)
{
- return ""; // currently no values are returned for this engine
+ std::ostringstream buf;
+
+ buf << HP << delimiter
+ << Thruster->GetThrusterValues(EngineNumber, delimiter);
+
+ return buf.str();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%