resync JSBSim
This commit is contained in:
parent
f2f78e3646
commit
e1d5a52a3a
16 changed files with 73 additions and 58 deletions
|
@ -70,7 +70,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.113 2011/09/07 02:37:04 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.114 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_FDMEXEC;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -441,7 +441,7 @@ void FGFDMExec::LoadInputs(unsigned int idx)
|
|||
GroundReactions->in.TotalDeltaT = dT * GroundReactions->GetRate();
|
||||
GroundReactions->in.WOW = GroundReactions->GetWOW();
|
||||
GroundReactions->in.Location = Propagate->GetLocation();
|
||||
for (unsigned int i=0; i<GroundReactions->GetNumGearUnits(); i++) {
|
||||
for (int i=0; i<GroundReactions->GetNumGearUnits(); i++) {
|
||||
GroundReactions->in.vWhlBodyVec[i] = MassBalance->StructuralToBody(GroundReactions->GetGearUnit(i)->GetLocation());
|
||||
}
|
||||
break;
|
||||
|
@ -530,7 +530,7 @@ void FGFDMExec::LoadModelConstants(void)
|
|||
Aerodynamics->in.Wingspan = Aircraft->GetWingSpan();
|
||||
Auxiliary->in.Wingspan = Aircraft->GetWingSpan();
|
||||
Auxiliary->in.Wingchord = Aircraft->Getcbar();
|
||||
for (unsigned int i=0; i<GroundReactions->GetNumGearUnits(); i++) {
|
||||
for (int i=0; i<GroundReactions->GetNumGearUnits(); i++) {
|
||||
GroundReactions->in.vWhlBodyVec[i] = MassBalance->StructuralToBody(GroundReactions->GetGearUnit(i)->GetLocation());
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,6 @@ FGJSBsim::FGJSBsim( double dt )
|
|||
temperature = fgGetNode("/environment/temperature-degc",true);
|
||||
pressure = fgGetNode("/environment/pressure-inhg",true);
|
||||
pressureSL = fgGetNode("/environment/pressure-sea-level-inhg",true);
|
||||
density = fgGetNode("/environment/density-slugft3",true);
|
||||
ground_wind = fgGetNode("/environment/config/boundary/entry[0]/wind-speed-kt",true);
|
||||
turbulence_gain = fgGetNode("/environment/turbulence/magnitude-norm",true);
|
||||
turbulence_rate = fgGetNode("/environment/turbulence/rate-hz",true);
|
||||
|
@ -368,7 +367,6 @@ void FGJSBsim::init()
|
|||
Winds->SetProbabilityOfExceedence(0.0);
|
||||
}
|
||||
|
||||
fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
|
||||
fgic->SetWindNEDFpsIC( -wind_from_north->getDoubleValue(),
|
||||
-wind_from_east->getDoubleValue(),
|
||||
-wind_from_down->getDoubleValue() );
|
||||
|
@ -376,9 +374,9 @@ void FGJSBsim::init()
|
|||
//Atmosphere->SetExTemperature(get_Static_temperature());
|
||||
//Atmosphere->SetExPressure(get_Static_pressure());
|
||||
//Atmosphere->SetExDensity(get_Density());
|
||||
SG_LOG(SG_FLIGHT,SG_INFO,"T,p,rho: " << fdmex->GetAtmosphere()->GetTemperature()
|
||||
<< ", " << fdmex->GetAtmosphere()->GetPressure()
|
||||
<< ", " << fdmex->GetAtmosphere()->GetDensity() );
|
||||
SG_LOG(SG_FLIGHT,SG_INFO,"T,p,rho: " << Atmosphere->GetTemperature()
|
||||
<< ", " << Atmosphere->GetPressure()
|
||||
<< ", " << Atmosphere->GetDensity() );
|
||||
|
||||
// deprecate egt_degf for egt-degf to have consistent naming
|
||||
// TODO: remove this for 2.6.0
|
||||
|
@ -394,7 +392,9 @@ void FGJSBsim::init()
|
|||
|
||||
FCS->SetDfPos( ofNorm, globals->get_controls()->get_flaps() );
|
||||
|
||||
needTrim = startup_trim->getBoolValue();
|
||||
common_init();
|
||||
fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() );
|
||||
|
||||
copy_to_JSBsim();
|
||||
fdmex->RunIC(); //loop JSBSim once w/o integrating
|
||||
|
@ -407,7 +407,7 @@ void FGJSBsim::init()
|
|||
}
|
||||
}
|
||||
|
||||
if ( startup_trim->getBoolValue() ) {
|
||||
if ( needTrim ) {
|
||||
FGLocation cart(fgic->GetLongitudeRadIC(), fgic->GetLatitudeRadIC(),
|
||||
get_Sea_level_radius() + fgic->GetAltitudeASLFtIC());
|
||||
double cart_pos[3], contact[3], d[3], vel[3], agl;
|
||||
|
@ -785,8 +785,8 @@ bool FGJSBsim::copy_from_JSBsim()
|
|||
|
||||
// Positions of Visual Reference Point
|
||||
FGLocation l = Auxiliary->GetLocationVRP();
|
||||
_updateGeocentricPosition( l.GetLatitude(), l.GetLongitude(),
|
||||
l.GetRadius() - get_Sea_level_radius() );
|
||||
_updatePosition(SGGeoc::fromRadFt( l.GetLongitude(), l.GetLatitude(),
|
||||
l.GetRadius() ));
|
||||
|
||||
_set_Altitude_AGL( Propagate->GetDistanceAGL() );
|
||||
{
|
||||
|
@ -1006,26 +1006,26 @@ bool FGJSBsim::ToggleDataLogging(bool state)
|
|||
void FGJSBsim::set_Latitude(double lat)
|
||||
{
|
||||
static SGConstPropertyNode_ptr altitude = fgGetNode("/position/altitude-ft");
|
||||
double alt;
|
||||
double alt = altitude->getDoubleValue();
|
||||
double sea_level_radius_meters, lat_geoc;
|
||||
|
||||
if ( altitude->getDoubleValue() > -9990 )
|
||||
alt = altitude->getDoubleValue();
|
||||
else
|
||||
alt = 0.0;
|
||||
if ( alt < -9990 ) alt = 0.0;
|
||||
|
||||
SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Latitude: " << lat );
|
||||
SG_LOG(SG_FLIGHT,SG_INFO," cur alt (ft) = " << alt );
|
||||
|
||||
sgGeodToGeoc( lat, alt * SG_FEET_TO_METER,
|
||||
&sea_level_radius_meters, &lat_geoc );
|
||||
_set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET );
|
||||
|
||||
double sea_level_radius_ft = sea_level_radius_meters * SG_METER_TO_FEET;
|
||||
_set_Sea_level_radius( sea_level_radius_ft );
|
||||
|
||||
if (needTrim) {
|
||||
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET );
|
||||
fgic->SetSeaLevelRadiusFtIC( sea_level_radius_ft );
|
||||
fgic->SetLatitudeRadIC( lat_geoc );
|
||||
}
|
||||
else {
|
||||
Propagate->SetSeaLevelRadius( sea_level_radius_ft );
|
||||
Propagate->SetLatitude(lat_geoc);
|
||||
FGInterface::set_Latitude(lat);
|
||||
}
|
||||
|
|
|
@ -274,7 +274,6 @@ private:
|
|||
SGPropertyNode_ptr temperature;
|
||||
SGPropertyNode_ptr pressure;
|
||||
SGPropertyNode_ptr pressureSL;
|
||||
SGPropertyNode_ptr density;
|
||||
SGPropertyNode_ptr ground_wind;
|
||||
SGPropertyNode_ptr turbulence_gain;
|
||||
SGPropertyNode_ptr turbulence_rate;
|
||||
|
|
|
@ -50,7 +50,7 @@ INCLUDES
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.48 2011/07/10 20:18:14 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.49 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_ATMOSPHERE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -171,6 +171,9 @@ double FGAtmosphere::ConvertToRankine(double t, eTemperature unit) const
|
|||
break;
|
||||
case eKelvin:
|
||||
targetTemp = t*9.0/5.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return targetTemp;
|
||||
|
|
|
@ -60,7 +60,7 @@ DEFINITIONS
|
|||
GLOBAL DATA
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
static const char *IdSrc = "$Id: FGLGear.cpp,v 1.88 2011/08/30 21:05:56 bcoconni Exp $";
|
||||
static const char *IdSrc = "$Id: FGLGear.cpp,v 1.89 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_LGEAR;
|
||||
|
||||
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
|
||||
|
@ -73,11 +73,11 @@ CLASS IMPLEMENTATION
|
|||
|
||||
FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs& inputs) :
|
||||
FGForce(fdmex),
|
||||
in(inputs),
|
||||
GearNumber(number),
|
||||
SteerAngle(0.0),
|
||||
Castered(false),
|
||||
StaticFriction(false),
|
||||
in(inputs)
|
||||
StaticFriction(false)
|
||||
{
|
||||
Element *force_table=0;
|
||||
Element *dampCoeff=0;
|
||||
|
|
|
@ -77,7 +77,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGOutput.cpp,v 1.59 2011/08/14 20:15:56 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGOutput.cpp,v 1.60 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_OUTPUT;
|
||||
|
||||
// (stolen from FGFS native_fdm.cxx)
|
||||
|
@ -255,7 +255,6 @@ void FGOutput::DelimitedOutput(const string& fname)
|
|||
const FGPropagate* Propagate = FDMExec->GetPropagate();
|
||||
const FGAccelerations* Accelerations = FDMExec->GetAccelerations();
|
||||
const FGFCS* FCS = FDMExec->GetFCS();
|
||||
const FGInertial* Inertial = FDMExec->GetInertial();
|
||||
const FGGroundReactions* GroundReactions = FDMExec->GetGroundReactions();
|
||||
const FGExternalReactions* ExternalReactions = FDMExec->GetExternalReactions();
|
||||
const FGBuoyantForces* BuoyantForces = FDMExec->GetBuoyantForces();
|
||||
|
@ -518,10 +517,8 @@ void FGOutput::DelimitedOutput(const string& fname)
|
|||
|
||||
void FGOutput::SocketDataFill(FGNetFDM* net)
|
||||
{
|
||||
const FGAerodynamics* Aerodynamics = FDMExec->GetAerodynamics();
|
||||
const FGAuxiliary* Auxiliary = FDMExec->GetAuxiliary();
|
||||
const FGPropulsion* Propulsion = FDMExec->GetPropulsion();
|
||||
const FGMassBalance* MassBalance = FDMExec->GetMassBalance();
|
||||
const FGPropagate* Propagate = FDMExec->GetPropagate();
|
||||
const FGFCS* FCS = FDMExec->GetFCS();
|
||||
const FGGroundReactions* GroundReactions = FDMExec->GetGroundReactions();
|
||||
|
|
|
@ -68,7 +68,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.95 2011/08/21 16:11:25 bcoconni Exp $";
|
||||
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.96 2011/09/17 15:36:35 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_PROPAGATE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -552,10 +552,10 @@ void FGPropagate::bind(void)
|
|||
|
||||
PropertyManager->Tie("position/h-sl-ft", this, &FGPropagate::GetAltitudeASL, &FGPropagate::SetAltitudeASL, true);
|
||||
PropertyManager->Tie("position/h-sl-meters", this, &FGPropagate::GetAltitudeASLmeters, &FGPropagate::SetAltitudeASLmeters, true);
|
||||
PropertyManager->Tie("position/lat-gc-rad", this, &FGPropagate::GetLatitude, &FGPropagate::SetLatitude);
|
||||
PropertyManager->Tie("position/long-gc-rad", this, &FGPropagate::GetLongitude, &FGPropagate::SetLongitude);
|
||||
PropertyManager->Tie("position/lat-gc-deg", this, &FGPropagate::GetLatitudeDeg, &FGPropagate::SetLatitudeDeg);
|
||||
PropertyManager->Tie("position/long-gc-deg", this, &FGPropagate::GetLongitudeDeg, &FGPropagate::SetLongitudeDeg);
|
||||
PropertyManager->Tie("position/lat-gc-rad", this, &FGPropagate::GetLatitude, &FGPropagate::SetLatitude, false);
|
||||
PropertyManager->Tie("position/long-gc-rad", this, &FGPropagate::GetLongitude, &FGPropagate::SetLongitude, false);
|
||||
PropertyManager->Tie("position/lat-gc-deg", this, &FGPropagate::GetLatitudeDeg, &FGPropagate::SetLatitudeDeg, false);
|
||||
PropertyManager->Tie("position/long-gc-deg", this, &FGPropagate::GetLongitudeDeg, &FGPropagate::SetLongitudeDeg, false);
|
||||
PropertyManager->Tie("position/lat-geod-rad", this, &FGPropagate::GetGeodLatitudeRad);
|
||||
PropertyManager->Tie("position/lat-geod-deg", this, &FGPropagate::GetGeodLatitudeDeg);
|
||||
PropertyManager->Tie("position/geod-alt-ft", this, &FGPropagate::GetGeodeticAltitude);
|
||||
|
|
|
@ -66,7 +66,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.50 2011/08/03 03:21:06 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.51 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_PROPULSION;
|
||||
|
||||
extern short debug_lvl;
|
||||
|
@ -368,7 +368,6 @@ void FGPropulsion::InitRunning(int n)
|
|||
bool FGPropulsion::Load(Element* el)
|
||||
{
|
||||
string type, engine_filename;
|
||||
bool ThrottleAdded = false;
|
||||
|
||||
Debug(2);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ INCLUDES
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.18 2011/08/17 23:56:01 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.19 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_STANDARDATMOSPHERE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -58,8 +58,8 @@ CLASS IMPLEMENTATION
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
FGStandardAtmosphere::FGStandardAtmosphere(FGFDMExec* fdmex) : FGAtmosphere(fdmex),
|
||||
TemperatureDeltaGradient(0.0),
|
||||
TemperatureBias(0.0)
|
||||
TemperatureBias(0.0),
|
||||
TemperatureDeltaGradient(0.0)
|
||||
{
|
||||
Name = "FGStandardAtmosphere";
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGWinds.cpp,v 1.4 2011/09/07 02:37:04 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGWinds.cpp,v 1.5 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_WINDS;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -284,8 +284,8 @@ void FGWinds::Turbulence(double h)
|
|||
double
|
||||
T_V = in.totalDeltaT, // for compatibility of nomenclature
|
||||
sig_p = 1.9/sqrt(L_w*b_w)*sig_w, // Yeager1998, eq. (8)
|
||||
sig_q = sqrt(M_PI/2/L_w/b_w), // eq. (14)
|
||||
sig_r = sqrt(2*M_PI/3/L_w/b_w), // eq. (17)
|
||||
//sig_q = sqrt(M_PI/2/L_w/b_w), // eq. (14)
|
||||
//sig_r = sqrt(2*M_PI/3/L_w/b_w), // eq. (17)
|
||||
L_p = sqrt(L_w*b_w)/2.6, // eq. (10)
|
||||
tau_u = L_u/in.V, // eq. (6)
|
||||
tau_w = L_w/in.V, // eq. (3)
|
||||
|
@ -416,6 +416,8 @@ void FGWinds::CosineGust()
|
|||
// this is the native frame - and the default.
|
||||
oneMinusCosineGust.vWindTransformed = oneMinusCosineGust.vWind;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.33 2011/06/21 04:41:54 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.34 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_FCSCOMPONENT;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -223,7 +223,7 @@ bool FGFCSComponent::Run(void)
|
|||
void FGFCSComponent::Delay(void)
|
||||
{
|
||||
output_array[index] = Output;
|
||||
if (index == delay-1) index = 0;
|
||||
if ((unsigned int)index == delay-1) index = 0;
|
||||
else index++;
|
||||
Output = output_array[index];
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.46 2011/08/17 23:56:01 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.47 2011/09/11 11:36:04 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_ENGINE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -61,7 +61,7 @@ CLASS IMPLEMENTATION
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number, struct Inputs& input)
|
||||
: EngineNumber(engine_number), in(input)
|
||||
: in(input), EngineNumber(engine_number)
|
||||
{
|
||||
Element* local_element;
|
||||
FGColumnVector3 location, orientation;
|
||||
|
|
|
@ -50,7 +50,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGPiston.cpp,v 1.64 2011/08/04 13:45:42 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGPiston.cpp,v 1.65 2011/09/11 12:06:54 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_PISTON;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -219,7 +219,7 @@ FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number, struct Input
|
|||
RatedAltitude[2] = el->FindElementValueAsNumberConvertTo("ratedaltitude3", "FT");
|
||||
}
|
||||
|
||||
while(table_element = el->FindNextElement("table")) {
|
||||
while((table_element = el->FindNextElement("table")) != 0) {
|
||||
name = table_element->GetAttributeValue("name");
|
||||
try {
|
||||
if (name == "COMBUSTION") {
|
||||
|
|
|
@ -45,7 +45,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.36 2011/08/03 03:21:06 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.37 2011/09/11 12:06:54 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_PROPELLER;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -99,7 +99,7 @@ FGPropeller::FGPropeller(FGFDMExec* exec, Element* prop_element, int num)
|
|||
ConstantSpeed = (int)prop_element->FindElementValueAsNumber("constspeed");
|
||||
if (prop_element->FindElement("reversepitch"))
|
||||
ReversePitch = prop_element->FindElementValueAsNumber("reversepitch");
|
||||
while(table_element = prop_element->FindNextElement("table")) {
|
||||
while((table_element = prop_element->FindNextElement("table")) != 0) {
|
||||
name = table_element->GetAttributeValue("name");
|
||||
try {
|
||||
if (name == "C_THRUST") {
|
||||
|
|
|
@ -55,7 +55,7 @@ using std::cout;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGRotor.cpp,v 1.13 2011/08/03 03:21:06 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGRotor.cpp,v 1.16 2011/09/17 16:39:19 bcoconni Exp $";
|
||||
static const char *IdHdr = ID_ROTOR;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -77,8 +77,8 @@ FGRotor::FGRotor(FGFDMExec *exec, Element* rotor_element, int num)
|
|||
: FGThruster(exec, rotor_element, num),
|
||||
rho(0.002356), // environment
|
||||
Radius(0.0), BladeNum(0), // configuration parameters
|
||||
Sense(1.0), NominalRPM(0.0), ExternalRPM(0),
|
||||
RPMdefinition(0), ExtRPMsource(NULL),
|
||||
Sense(1.0), NominalRPM(0.0), MinimalRPM(0.0), MaximalRPM(0.0),
|
||||
ExternalRPM(0), RPMdefinition(0), ExtRPMsource(NULL),
|
||||
BladeChord(0.0), LiftCurveSlope(0.0), BladeTwist(0.0), HingeOffset(0.0),
|
||||
BladeFlappingMoment(0.0), BladeMassMoment(0.0), PolarMoment(0.0),
|
||||
InflowLag(0.0), TipLossB(0.0),
|
||||
|
@ -255,6 +255,13 @@ void FGRotor::Configure(Element* rotor_element)
|
|||
// make sure that v_tip (omega*r) is below 0.7mach ~ 750ft/s
|
||||
estimate = (750.0/Radius)/(2.0*M_PI) * 60.0; // 7160/Radius
|
||||
NominalRPM = ConfigValue(rotor_element, "nominalrpm", estimate, yell);
|
||||
NominalRPM = Constrain(2.0, NominalRPM, 1e9);
|
||||
|
||||
MinimalRPM = ConfigValue(rotor_element, "minrpm", 1.0);
|
||||
MinimalRPM = Constrain(1.0, MinimalRPM, NominalRPM - 1.0);
|
||||
|
||||
MaximalRPM = ConfigValue(rotor_element, "maxrpm", 2.0*NominalRPM);
|
||||
MaximalRPM = Constrain(NominalRPM, MaximalRPM, 1e9);
|
||||
|
||||
estimate = Constrain(0.07, 2.0/Radius , 0.14); // guess solidity
|
||||
estimate = estimate * M_PI*Radius/BladeNum;
|
||||
|
@ -393,6 +400,7 @@ void FGRotor::calc_flow_and_thrust( double theta_0, double Uw, double Ww,
|
|||
double mu2;
|
||||
|
||||
mu = Uw/(Omega*Radius); // /SH79/ eqn(24)
|
||||
if (mu > 0.7) mu = 0.7;
|
||||
mu2 = sqr(mu);
|
||||
|
||||
ct_t0 = (1.0/3.0*B[3] + 1.0/2.0 * TipLossB*mu2 - 4.0/(9.0*M_PI) * mu*mu2 ) * theta_0;
|
||||
|
@ -578,9 +586,8 @@ void FGRotor::CalcStatePart1(void)
|
|||
RPM = ExtRPMsource->getDoubleValue() / GearRatio;
|
||||
}
|
||||
|
||||
if (RPM < 1.0) { // kludge, otherwise calculations go bananas
|
||||
RPM = 1.0;
|
||||
}
|
||||
// MinimalRPM is always >= 1. MaximalRPM is always >= NominalRPM
|
||||
RPM = Constrain(MinimalRPM, RPM, MaximalRPM);
|
||||
|
||||
Omega = (RPM/60.0)*2.0*M_PI;
|
||||
|
||||
|
@ -632,8 +639,8 @@ void FGRotor::CalcStatePart2(double PowerAvailable)
|
|||
double ExcessTorque = PowerAvailable / Omega;
|
||||
double deltaOmega = ExcessTorque / PolarMoment * in.TotalDeltaT;
|
||||
RPM += deltaOmega/(2.0*M_PI) * 60.0;
|
||||
if (RPM < 0.0) RPM = 0.0; // Engine won't turn backwards
|
||||
}
|
||||
RPM = Constrain(MinimalRPM, RPM, MaximalRPM); // trim again
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -846,6 +853,8 @@ void FGRotor::Debug(int from)
|
|||
cout << " Gear Ratio = " << GearRatio << endl;
|
||||
cout << " Sense = " << Sense << endl;
|
||||
cout << " Nominal RPM = " << NominalRPM << endl;
|
||||
cout << " Minimal RPM = " << MinimalRPM << endl;
|
||||
cout << " Maximal RPM = " << MaximalRPM << endl;
|
||||
|
||||
if (ExternalRPM) {
|
||||
if (RPMdefinition == -1) {
|
||||
|
|
|
@ -46,7 +46,7 @@ INCLUDES
|
|||
DEFINITIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#define ID_ROTOR "$Id: FGRotor.h,v 1.9 2011/03/10 01:35:25 dpculp Exp $"
|
||||
#define ID_ROTOR "$Id: FGRotor.h,v 1.10 2011/09/17 16:39:19 bcoconni Exp $"
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
FORWARD DECLARATIONS
|
||||
|
@ -68,6 +68,8 @@ CLASS DOCUMENTATION
|
|||
<numblades> {number} </numblades>
|
||||
<gearratio> {number} </gearratio>
|
||||
<nominalrpm> {number} </nominalrpm>
|
||||
<minrpm> {number} </minrpm>
|
||||
<maxrpm> {number} </maxrpm>
|
||||
<chord unit="{LENGTH}"> {number} </chord>
|
||||
<liftcurveslope Xunit="1/RAD"> {number} </liftcurveslope>
|
||||
<twist unit="{ANGLE}"> {number} </twist>
|
||||
|
@ -102,7 +104,9 @@ CLASS DOCUMENTATION
|
|||
\<diameter> - Rotor disk diameter (2x R).
|
||||
\<numblades> - Number of blades (b).
|
||||
\<gearratio> - Ratio of (engine rpm) / (rotor rpm), usually > 1.
|
||||
\<nominalrpm> - RPM at which the rotor usally operates.
|
||||
\<nominalrpm> - RPM at which the rotor usally operates.
|
||||
\<minrpm> - Lowest RPM used in the model, optional and defaults to 1.
|
||||
\<maxrpm> - Largest RPM used in the model, optional and defaults to 2 x nominalrpm.
|
||||
\<chord> - Blade chord, (c).
|
||||
\<liftcurveslope> - Slope of curve of section lift against section angle of attack,
|
||||
per rad (a).
|
||||
|
@ -201,7 +205,7 @@ CLASS DOCUMENTATION
|
|||
</dl>
|
||||
|
||||
@author Thomas Kreitler
|
||||
@version $Id: FGRotor.h,v 1.9 2011/03/10 01:35:25 dpculp Exp $
|
||||
@version $Id: FGRotor.h,v 1.10 2011/09/17 16:39:19 bcoconni Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -339,6 +343,8 @@ private:
|
|||
|
||||
double Sense;
|
||||
double NominalRPM;
|
||||
double MinimalRPM;
|
||||
double MaximalRPM;
|
||||
int ExternalRPM;
|
||||
int RPMdefinition;
|
||||
FGPropertyManager* ExtRPMsource;
|
||||
|
|
Loading…
Add table
Reference in a new issue