Sync. with JSBSim
This commit is contained in:
parent
94caa0b891
commit
a7976b835d
6 changed files with 42 additions and 26 deletions
|
@ -58,7 +58,8 @@ FGState::FGState(FGFDMExec* fdex)
|
|||
FDMExec = fdex;
|
||||
|
||||
sim_time = 0.0;
|
||||
//dt = 1.0/120.0;
|
||||
dt = 1.0/120.0; // a default timestep size. This is needed for when JSBSim is
|
||||
// run in standalone mode with no initialization file.
|
||||
|
||||
Aircraft = FDMExec->GetAircraft();
|
||||
Propagate = FDMExec->GetPropagate();
|
||||
|
|
|
@ -35,14 +35,9 @@ SENTRY
|
|||
INCLUDES
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include "simgear/props/props.hxx"
|
||||
|
||||
#include "FGJSBBase.h"
|
||||
|
||||
|
|
|
@ -310,6 +310,19 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
RollingForce = ((1.0 - TirePressureNorm) * 30 + vLocalForce(eZ) * BrakeFCoeff) * sign;
|
||||
SideForce = vLocalForce(eZ) * FCoeff;
|
||||
|
||||
// Lag and attenuate the XY-plane forces dependent on velocity. This code
|
||||
// uses a lag filter, C/(s + C) where "C" is the filter coefficient. When
|
||||
// "C" is chosen at the frame rate (in Hz), the jittering is significantly
|
||||
// reduced. This is because the jitter is present *at* the execution rate.
|
||||
// If a coefficient is set to something equal to or less than zero, the
|
||||
// filter is bypassed.
|
||||
|
||||
if (LongForceLagFilterCoeff > 0) RollingForce = LongForceFilter.execute(RollingForce);
|
||||
if (LatForceLagFilterCoeff > 0) SideForce = LatForceFilter.execute(SideForce);
|
||||
|
||||
if ((fabs(RollingWhlVel) <= RFRV) && RFRV > 0) RollingForce *= fabs(RollingWhlVel)/RFRV;
|
||||
if ((fabs(SideWhlVel) <= SFRV) && SFRV > 0) SideForce *= fabs(SideWhlVel)/SFRV;
|
||||
|
||||
// Transform these forces back to the local reference frame.
|
||||
|
||||
vLocalForce(eX) = RollingForce*CosWheel - SideForce*SinWheel;
|
||||
|
@ -319,19 +332,6 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
|
||||
vForce = Propagate->GetTl2b() * vLocalForce;
|
||||
|
||||
// Lag and attenuate the XY-plane forces dependent on velocity. This code
|
||||
// uses a lag filter, C/(s + C) where "C" is the filter coefficient. When
|
||||
// "C" is chosen at the frame rate (in Hz), the jittering is significantly
|
||||
// reduced. This is because the jitter is present *at* the execution rate.
|
||||
// If a coefficient is set to something equal to or less than zero, the
|
||||
// filter is bypassed.
|
||||
|
||||
if (LongForceLagFilterCoeff > 0) vForce(eX) = LongForceFilter.execute(vForce(eX));
|
||||
if (LatForceLagFilterCoeff > 0) vForce(eY) = LatForceFilter.execute(vForce(eY));
|
||||
|
||||
if ((fabs(RollingWhlVel) <= RFRV) && RFRV > 0) vForce(eX) *= fabs(RollingWhlVel)/RFRV;
|
||||
if ((fabs(SideWhlVel) <= SFRV) && SFRV > 0) vForce(eY) *= fabs(SideWhlVel)/SFRV;
|
||||
|
||||
// End section for attentuating gear jitter
|
||||
|
||||
vMoment = vWhlBodyVec * vForce;
|
||||
|
@ -340,9 +340,14 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
|
||||
WOW = false;
|
||||
compressLength = 0.0;
|
||||
compressSpeed = 0.0;
|
||||
|
||||
// No wheel conditons
|
||||
RollingWhlVel = SideWhlVel = WheelSlip = 0.0;
|
||||
// No wheel conditions
|
||||
SideWhlVel = WheelSlip = 0.0;
|
||||
|
||||
// Let wheel spin down slowly
|
||||
RollingWhlVel -= 13.0*dT;
|
||||
if (RollingWhlVel < 0.0) RollingWhlVel = 0.0;
|
||||
|
||||
// Return to neutral position between 1.0 and 0.8 gear pos.
|
||||
SteerAngle *= max(GetGearUnitPos()-0.8, 0.0)/0.2;
|
||||
|
@ -371,6 +376,7 @@ void FGLGear::ComputeRetractionState(void)
|
|||
GearUp = true;
|
||||
WOW = false;
|
||||
GearDown = false;
|
||||
RollingWhlVel = 0.0;
|
||||
} else if (gearPos > 0.99) {
|
||||
GearDown = true;
|
||||
GearUp = false;
|
||||
|
|
|
@ -94,14 +94,24 @@ double FGElectric::Calculate(void)
|
|||
|
||||
string FGElectric::GetEngineLabels(string delimeter)
|
||||
{
|
||||
return ""; // currently no labels are returned for this engine
|
||||
std::ostringstream buf;
|
||||
|
||||
buf << Name << " HP (engine " << EngineNumber << ")" << delimeter
|
||||
<< Thruster->GetThrusterLabels(EngineNumber, delimeter);
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
string FGElectric::GetEngineValues(string delimeter)
|
||||
{
|
||||
return ""; // currently no values are returned for this engine
|
||||
std::ostringstream buf;
|
||||
|
||||
buf << HP << delimeter
|
||||
<< Thruster->GetThrusterValues(EngineNumber, delimeter);
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -199,6 +199,8 @@ double FGPropeller::Calculate(double PowerAvailable)
|
|||
vH(eY) = 0.0;
|
||||
vH(eZ) = 0.0;
|
||||
|
||||
vH = Transform()*vH; // Transform rotational momentum to rotated frame (if any)
|
||||
|
||||
if (omega > 0.0) ExcessTorque = GearRatio * PowerAvailable / omega;
|
||||
else ExcessTorque = GearRatio * PowerAvailable / 1.0;
|
||||
|
||||
|
@ -206,7 +208,9 @@ double FGPropeller::Calculate(double PowerAvailable)
|
|||
|
||||
if (RPM < 1.0) RPM = 0; // Engine friction stops rotation arbitrarily at 1 RPM.
|
||||
|
||||
vMn = fdmex->GetPropagate()->GetPQR()*vH + vTorque;
|
||||
// Transform Torque and momentum prior to this equation, as PQR is used in this
|
||||
// equation and cannot be transformed itself.
|
||||
vMn = fdmex->GetPropagate()->GetPQR()*vH + Transform()*vTorque;
|
||||
|
||||
return Thrust; // return thrust in pounds
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
|
|||
if (el->FindElement("idlen1"))
|
||||
IdleN1 = el->FindElementValueAsNumber("idlen1");
|
||||
if (el->FindElement("idlen2"))
|
||||
IdleN2 = el->FindElementValueAsNumber("idlen1");
|
||||
IdleN2 = el->FindElementValueAsNumber("idlen2");
|
||||
if (el->FindElement("maxn1"))
|
||||
MaxN1 = el->FindElementValueAsNumber("maxn1");
|
||||
if (el->FindElement("maxn2"))
|
||||
|
|
Loading…
Reference in a new issue