[JSBSim] An improvement and 2 bug fixes
- Electric engines RPM is now exported in UDP sockets. - The sign of the XZ inertia has been fixed in the property inertia/ixz-slug_ft2 (was just an output error, the correct XZ inertia was used internally). Thanks to Nikolai Verner Christensen for reporting the bug. - The parameter <ignitionn2> was wrongly affected to N1. Bug reported by Nikolai Verner Christensen and fixed by Jonathan Redpath. Thanks to them.
This commit is contained in:
parent
b4bb24f10e
commit
88ca381e83
3 changed files with 24 additions and 14 deletions
|
@ -47,6 +47,7 @@ INCLUDES
|
|||
#include "models/FGPropulsion.h"
|
||||
#include "models/FGFCS.h"
|
||||
#include "models/propulsion/FGPiston.h"
|
||||
#include "models/propulsion/FGElectric.h"
|
||||
#include "models/propulsion/FGTank.h"
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
|
@ -216,32 +217,37 @@ void FGOutputFG::SocketDataFill(FGNetFDM* net)
|
|||
net->num_engines = min(FGNetFDM::FG_MAX_ENGINES,Propulsion->GetNumEngines()); // Number of valid engines
|
||||
|
||||
for (i=0; i<net->num_engines; i++) {
|
||||
if (Propulsion->GetEngine(i)->GetRunning())
|
||||
FGEngine* engine = Propulsion->GetEngine(i);
|
||||
if (engine->GetRunning())
|
||||
net->eng_state[i] = 2; // Engine state running
|
||||
else if (Propulsion->GetEngine(i)->GetCranking())
|
||||
else if (engine->GetCranking())
|
||||
net->eng_state[i] = 1; // Engine state cranking
|
||||
else
|
||||
net->eng_state[i] = 0; // Engine state off
|
||||
|
||||
switch (Propulsion->GetEngine(i)->GetType()) {
|
||||
switch (engine->GetType()) {
|
||||
case (FGEngine::etRocket):
|
||||
break;
|
||||
case (FGEngine::etPiston):
|
||||
net->rpm[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getRPM());
|
||||
net->fuel_flow[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getFuelFlow_gph());
|
||||
{
|
||||
FGPiston* piston_engine = static_cast<FGPiston*>(engine);
|
||||
net->rpm[i] = (float)(piston_engine->getRPM());
|
||||
net->fuel_flow[i] = (float)(piston_engine->getFuelFlow_gph());
|
||||
net->fuel_px[i] = 0; // Fuel pressure, psi (N/A in current model)
|
||||
net->egt[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->GetEGT());
|
||||
net->cht[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getCylinderHeadTemp_degF());
|
||||
net->mp_osi[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getManifoldPressure_inHg());
|
||||
net->oil_temp[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilTemp_degF());
|
||||
net->oil_px[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilPressure_psi());
|
||||
net->egt[i] = (float)(piston_engine->GetEGT());
|
||||
net->cht[i] = (float)(piston_engine->getCylinderHeadTemp_degF());
|
||||
net->mp_osi[i] = (float)(piston_engine->getManifoldPressure_inHg());
|
||||
net->oil_temp[i] = (float)(piston_engine->getOilTemp_degF());
|
||||
net->oil_px[i] = (float)(piston_engine->getOilPressure_psi());
|
||||
net->tit[i] = 0; // Turbine Inlet Temperature (N/A for piston)
|
||||
}
|
||||
break;
|
||||
case (FGEngine::etTurbine):
|
||||
break;
|
||||
case (FGEngine::etTurboprop):
|
||||
break;
|
||||
case (FGEngine::etElectric):
|
||||
net->rpm[i] = static_cast<float>(static_cast<FGElectric*>(engine)->getRPM());
|
||||
break;
|
||||
case (FGEngine::etUnknown):
|
||||
break;
|
||||
|
|
|
@ -126,6 +126,8 @@ public:
|
|||
double GetMass(void) const {return Mass;}
|
||||
double GetWeight(void) const {return Weight;}
|
||||
double GetEmptyWeight(void) const {return EmptyWeight;}
|
||||
/** Returns the coordinates of the center of gravity expressed in the
|
||||
structural frame. */
|
||||
const FGColumnVector3& GetXYZcg(void) const {return vXYZcg;}
|
||||
double GetXYZcg(int axis) const {return vXYZcg(axis);}
|
||||
const FGColumnVector3& GetDeltaXYZcg(void) const {return vDeltaXYZcg;}
|
||||
|
@ -172,7 +174,9 @@ public:
|
|||
double GetTotalPointMassWeight(void) const;
|
||||
|
||||
const FGColumnVector3& GetPointMassMoment(void);
|
||||
/// Returns the inertia matrix expressed in the body frame.
|
||||
const FGMatrix33& GetJ(void) const {return mJ;}
|
||||
/// Returns the inverse of the inertia matrix expressed in the body frame.
|
||||
const FGMatrix33& GetJinv(void) const {return mJinv;}
|
||||
void SetAircraftBaseInertias(const FGMatrix33& BaseJ) {baseJ = BaseJ;}
|
||||
void GetMassPropertiesReport(int i);
|
||||
|
@ -209,7 +213,7 @@ private:
|
|||
double GetIyy(void) const { return mJ(2,2); }
|
||||
double GetIzz(void) const { return mJ(3,3); }
|
||||
double GetIxy(void) const { return -mJ(1,2); }
|
||||
double GetIxz(void) const { return -mJ(1,3); }
|
||||
double GetIxz(void) const { return mJ(1,3); }
|
||||
double GetIyz(void) const { return -mJ(2,3); }
|
||||
|
||||
/** The PointMass structure encapsulates a point mass object, moments of inertia
|
||||
|
|
|
@ -459,7 +459,7 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
|
|||
if (el->FindElement("ignitionn1"))
|
||||
IgnitionN1 = el->FindElementValueAsNumber("ignitionn1");
|
||||
if (el->FindElement("ignitionn2"))
|
||||
IgnitionN1 = el->FindElementValueAsNumber("ignitionn2");
|
||||
IgnitionN2 = el->FindElementValueAsNumber("ignitionn2");
|
||||
if (el->FindElement("idlen1"))
|
||||
IdleN1 = el->FindElementValueAsNumber("idlen1");
|
||||
if (el->FindElement("idlen2"))
|
||||
|
|
Loading…
Reference in a new issue