Sync JSBSim again
This commit is contained in:
parent
912215e949
commit
5c7d261df5
5 changed files with 37 additions and 16 deletions
|
@ -73,7 +73,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.181 2015/10/25 21:18:29 dpculp Exp $");
|
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.182 2015/11/24 13:06:24 ehofman Exp $");
|
||||||
IDENT(IdHdr,ID_FDMEXEC);
|
IDENT(IdHdr,ID_FDMEXEC);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -1176,13 +1176,16 @@ void FGFDMExec::DoTrim(int mode)
|
||||||
if (Constructing) return;
|
if (Constructing) return;
|
||||||
|
|
||||||
if (mode < 0 || mode > JSBSim::tNone) {
|
if (mode < 0 || mode > JSBSim::tNone) {
|
||||||
cerr << endl << "Illegal trimming mode!" << endl << endl;
|
throw("Illegal trimming mode!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FGTrim trim(this, (JSBSim::TrimMode)mode);
|
FGTrim trim(this, (JSBSim::TrimMode)mode);
|
||||||
if ( !trim.DoTrim() ) cerr << endl << "Trim Failed" << endl << endl;
|
if ( !trim.DoTrim() ) {
|
||||||
|
throw("Trim Failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
trim.Report();
|
trim.Report();
|
||||||
trim_completed = 1;
|
trim_completed = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGTank.cpp,v 1.43 2015/02/02 20:49:11 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGTank.cpp,v 1.44 2015/12/02 04:23:26 dpculp Exp $");
|
||||||
IDENT(IdHdr,ID_TANK);
|
IDENT(IdHdr,ID_TANK);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -323,7 +323,7 @@ double FGTank::Calculate(double dt, double TAT_C)
|
||||||
double TempFlowFactor = 1.115; // Watts/sqft/C
|
double TempFlowFactor = 1.115; // Watts/sqft/C
|
||||||
double Tdiff = TAT_C - Temperature;
|
double Tdiff = TAT_C - Temperature;
|
||||||
double dTemp = 0.0; // Temp change due to one surface
|
double dTemp = 0.0; // Temp change due to one surface
|
||||||
if (fabs(Tdiff) > 0.1) {
|
if (fabs(Tdiff) > 0.1 && Contents > 0.01) {
|
||||||
dTemp = (TempFlowFactor * Area * Tdiff * dt) / (Contents * HeatCapacity);
|
dTemp = (TempFlowFactor * Area * Tdiff * dt) / (Contents * HeatCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.47 2015/09/27 10:07:53 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.48 2015/12/02 04:25:23 dpculp Exp $");
|
||||||
IDENT(IdHdr,ID_TURBINE);
|
IDENT(IdHdr,ID_TURBINE);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -569,7 +569,7 @@ int FGTurbine::InitRunning(void)
|
||||||
N1 = IdleN1 + ThrottlePos * N1_factor;
|
N1 = IdleN1 + ThrottlePos * N1_factor;
|
||||||
Calculate();
|
Calculate();
|
||||||
FDMExec->ResumeIntegration();
|
FDMExec->ResumeIntegration();
|
||||||
return phase==tpRun;
|
return phase=tpRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -48,6 +48,7 @@ INCLUDES
|
||||||
#include "FGTurboProp.h"
|
#include "FGTurboProp.h"
|
||||||
#include "FGPropeller.h"
|
#include "FGPropeller.h"
|
||||||
#include "FGRotor.h"
|
#include "FGRotor.h"
|
||||||
|
#include "math/FGFunction.h"
|
||||||
#include "input_output/FGXMLElement.h"
|
#include "input_output/FGXMLElement.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -63,15 +64,12 @@ CLASS IMPLEMENTATION
|
||||||
|
|
||||||
FGTurboProp::FGTurboProp(FGFDMExec* exec, Element *el, int engine_number, struct Inputs& input)
|
FGTurboProp::FGTurboProp(FGFDMExec* exec, Element *el, int engine_number, struct Inputs& input)
|
||||||
: FGEngine(engine_number, input),
|
: FGEngine(engine_number, input),
|
||||||
ITT_N1(NULL), EnginePowerRPM_N1(NULL), EnginePowerVC(NULL), CombustionEfficiency_N1(NULL),
|
ITT_N1(NULL), EnginePowerRPM_N1(NULL), EnginePowerVC(NULL), EnginePowerVCFN(NULL), CombustionEfficiency_N1(NULL),
|
||||||
FDMExec(exec)
|
FDMExec(exec)
|
||||||
{
|
{
|
||||||
FGEngine::Load(exec, el);
|
|
||||||
SetDefaults();
|
SetDefaults();
|
||||||
thrusterType = Thruster->GetType();
|
|
||||||
|
|
||||||
Load(exec, el);
|
Load(exec, el);
|
||||||
bindmodel(exec->GetPropertyManager());
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +91,24 @@ bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
|
||||||
MaxStartingTime = 999999; //very big timeout -> infinite
|
MaxStartingTime = 999999; //very big timeout -> infinite
|
||||||
Ielu_max_torque=-1;
|
Ielu_max_torque=-1;
|
||||||
|
|
||||||
|
Element* function_element = el->FindElement("function");
|
||||||
|
|
||||||
|
while(function_element) {
|
||||||
|
string name = function_element->GetAttributeValue("name");
|
||||||
|
if (name == "EnginePowerVC")
|
||||||
|
function_element->SetAttributeValue("name", string("propulsion/engine[#]/") + name);
|
||||||
|
|
||||||
|
function_element = el->FindNextElement("function");
|
||||||
|
}
|
||||||
|
|
||||||
|
FGEngine::Load(exec, el);
|
||||||
|
thrusterType = Thruster->GetType();
|
||||||
|
|
||||||
|
string property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
|
||||||
|
|
||||||
|
EnginePowerVCFN = GetPreFunction(property_prefix+"/EnginePowerVC");
|
||||||
|
|
||||||
|
|
||||||
// ToDo: Need to make sure units are properly accounted for below.
|
// ToDo: Need to make sure units are properly accounted for below.
|
||||||
|
|
||||||
if (el->FindElement("milthrust"))
|
if (el->FindElement("milthrust"))
|
||||||
|
@ -138,8 +154,9 @@ bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
|
||||||
table_element = el->FindNextElement("table");
|
table_element = el->FindNextElement("table");
|
||||||
if (!table_element) break;
|
if (!table_element) break;
|
||||||
name = table_element->GetAttributeValue("name");
|
name = table_element->GetAttributeValue("name");
|
||||||
if (name == "EnginePowerVC") {
|
if (!EnginePowerVCFN && name == "EnginePowerVC") {
|
||||||
EnginePowerVC = new FGTable(PropertyManager, table_element);
|
EnginePowerVC = new FGTable(PropertyManager, table_element);
|
||||||
|
std::cerr << "Note: Using the EnginePowerVC without enclosed <function> tag is deprecated" << std::endl;
|
||||||
} else if (name == "EnginePowerRPM_N1") {
|
} else if (name == "EnginePowerRPM_N1") {
|
||||||
EnginePowerRPM_N1 = new FGTable(PropertyManager, table_element);
|
EnginePowerRPM_N1 = new FGTable(PropertyManager, table_element);
|
||||||
} else if (name == "ITT_N1") {
|
} else if (name == "ITT_N1") {
|
||||||
|
@ -171,7 +188,7 @@ bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
|
||||||
*CombustionEfficiency_N1 << 110.0 << 6.0;
|
*CombustionEfficiency_N1 << 110.0 << 6.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bindmodel(exec->GetPropertyManager());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +338,7 @@ double FGTurboProp::Run(void)
|
||||||
N1 = ExpSeek(&N1, IdleN1 + ThrottlePos * N1_factor, Idle_Max_Delay, Idle_Max_Delay * 2.4);
|
N1 = ExpSeek(&N1, IdleN1 + ThrottlePos * N1_factor, Idle_Max_Delay, Idle_Max_Delay * 2.4);
|
||||||
|
|
||||||
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
||||||
EngPower_HP *= EnginePowerVC->GetValue();
|
EngPower_HP *= EnginePowerVCFN ? EnginePowerVCFN->GetValue() : EnginePowerVC->GetValue();
|
||||||
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
||||||
|
|
||||||
CombustionEfficiency = CombustionEfficiency_N1->GetValue(N1);
|
CombustionEfficiency = CombustionEfficiency_N1->GetValue(N1);
|
||||||
|
@ -370,7 +387,7 @@ double FGTurboProp::SpinUp(void)
|
||||||
NozzlePosition = 1.0;
|
NozzlePosition = 1.0;
|
||||||
|
|
||||||
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
||||||
EngPower_HP *= EnginePowerVC->GetValue();
|
EngPower_HP *= EnginePowerVCFN ? EnginePowerVCFN->GetValue() : EnginePowerVC->GetValue();
|
||||||
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
||||||
|
|
||||||
if (StartTime>=0) StartTime+=in.TotalDeltaT;
|
if (StartTime>=0) StartTime+=in.TotalDeltaT;
|
||||||
|
@ -394,7 +411,7 @@ double FGTurboProp::Start(void)
|
||||||
Cranking = true; // provided for sound effects signal
|
Cranking = true; // provided for sound effects signal
|
||||||
if (N1 < IdleN1) {
|
if (N1 < IdleN1) {
|
||||||
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
EngPower_HP = EnginePowerRPM_N1->GetValue(RPM,N1);
|
||||||
EngPower_HP *= EnginePowerVC->GetValue();
|
EngPower_HP *= EnginePowerVCFN ? EnginePowerVCFN->GetValue() : EnginePowerVC->GetValue();
|
||||||
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
if (EngPower_HP > MaxPower) EngPower_HP = MaxPower;
|
||||||
N1 = ExpSeek(&N1, IdleN1*1.1, Idle_Max_Delay*4, Idle_Max_Delay * 2.4);
|
N1 = ExpSeek(&N1, IdleN1*1.1, Idle_Max_Delay*4, Idle_Max_Delay * 2.4);
|
||||||
CombustionEfficiency = CombustionEfficiency_N1->GetValue(N1);
|
CombustionEfficiency = CombustionEfficiency_N1->GetValue(N1);
|
||||||
|
|
|
@ -221,6 +221,7 @@ private:
|
||||||
FGTable* ITT_N1; // ITT temperature depending on throttle command
|
FGTable* ITT_N1; // ITT temperature depending on throttle command
|
||||||
FGTable* EnginePowerRPM_N1;
|
FGTable* EnginePowerRPM_N1;
|
||||||
FGTable* EnginePowerVC;
|
FGTable* EnginePowerVC;
|
||||||
|
FGFunction* EnginePowerVCFN;
|
||||||
FGTable* CombustionEfficiency_N1;
|
FGTable* CombustionEfficiency_N1;
|
||||||
FGFDMExec* FDMExec;
|
FGFDMExec* FDMExec;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue