Converted FCS to use property tree internally, documentation updates.
This commit is contained in:
parent
41a4d0b351
commit
5fcabc9982
37 changed files with 417 additions and 786 deletions
|
@ -85,7 +85,10 @@ CLASS DOCUMENTATION
|
||||||
as ground effect and maximum lift curve tailoff are handled.
|
as ground effect and maximum lift curve tailoff are handled.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see -
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -112,17 +115,17 @@ public:
|
||||||
/** Gets the total aerodynamic force vector.
|
/** Gets the total aerodynamic force vector.
|
||||||
@return a force vector reference. */
|
@return a force vector reference. */
|
||||||
FGColumnVector3& GetForces(void) {return vForces;}
|
FGColumnVector3& GetForces(void) {return vForces;}
|
||||||
inline double GetForces(int n) const {return vForces(n);}
|
double GetForces(int n) const {return vForces(n);}
|
||||||
|
|
||||||
/** Gets the total aerodynamic moment vector.
|
/** Gets the total aerodynamic moment vector.
|
||||||
@return a moment vector reference. */
|
@return a moment vector reference. */
|
||||||
FGColumnVector3& GetMoments(void) {return vMoments;}
|
FGColumnVector3& GetMoments(void) {return vMoments;}
|
||||||
inline double GetMoments(int n) const {return vMoments(n);}
|
double GetMoments(int n) const {return vMoments(n);}
|
||||||
|
|
||||||
inline FGColumnVector3& GetvLastFs(void) { return vLastFs; }
|
FGColumnVector3& GetvLastFs(void) { return vLastFs; }
|
||||||
inline double GetvLastFs(int axis) const { return vLastFs(axis); }
|
double GetvLastFs(int axis) const { return vLastFs(axis); }
|
||||||
inline FGColumnVector3& GetvFs(void) { return vFs; }
|
FGColumnVector3& GetvFs(void) { return vFs; }
|
||||||
inline double GetvFs(int axis) const { return vFs(axis); }
|
double GetvFs(int axis) const { return vFs(axis); }
|
||||||
inline double GetLoD(void) const { return lod; }
|
inline double GetLoD(void) const { return lod; }
|
||||||
inline double GetClSquared(void) const { return clsq; }
|
inline double GetClSquared(void) const { return clsq; }
|
||||||
|
|
||||||
|
|
|
@ -102,12 +102,15 @@ CLASS IMPLEMENTATION
|
||||||
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
|
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
{
|
{
|
||||||
Name = "FGAircraft";
|
Name = "FGAircraft";
|
||||||
alphaclmin = alphaclmax = 0;
|
WingIncidence = 0.0;
|
||||||
HTailArea = VTailArea = HTailArm = VTailArm = 0.0;
|
impending_stall = 0.0;
|
||||||
lbarh = lbarv = vbarh = vbarv = 0.0;
|
alphaclmin = alphaclmax = 0.0;
|
||||||
WingIncidence=0;
|
HTailArea = VTailArea = 0.0;
|
||||||
impending_stall = 0;
|
HTailArm = VTailArm = 0.0;
|
||||||
bi2vel=ci2vel=alphaw=0;
|
lbarh = lbarv = 0.0;
|
||||||
|
vbarh = vbarv = 0.0;
|
||||||
|
bi2vel = ci2vel = 0.0;
|
||||||
|
alphaw = 0.0;
|
||||||
|
|
||||||
bind();
|
bind();
|
||||||
|
|
||||||
|
@ -147,8 +150,8 @@ bool FGAircraft::Run(void)
|
||||||
vNwcg = State->GetTb2s() * vNcg;
|
vNwcg = State->GetTb2s() * vNcg;
|
||||||
vNwcg(3) = -1*vNwcg(3) + 1;
|
vNwcg(3) = -1*vNwcg(3) + 1;
|
||||||
|
|
||||||
twovel=2*Translation->GetVt();
|
twovel = 2*Translation->GetVt();
|
||||||
if(twovel > 0) {
|
if (twovel > 0) {
|
||||||
bi2vel = WingSpan / twovel;
|
bi2vel = WingSpan / twovel;
|
||||||
ci2vel = cbar / twovel;
|
ci2vel = cbar / twovel;
|
||||||
}
|
}
|
||||||
|
@ -372,8 +375,8 @@ void FGAircraft::unbind(void)
|
||||||
PropertyManager->Untie("metrics/eyepoint-x-ft");
|
PropertyManager->Untie("metrics/eyepoint-x-ft");
|
||||||
PropertyManager->Untie("metrics/eyepoint-y-ft");
|
PropertyManager->Untie("metrics/eyepoint-y-ft");
|
||||||
PropertyManager->Untie("metrics/eyepoint-z-ft");
|
PropertyManager->Untie("metrics/eyepoint-z-ft");
|
||||||
PropertyManager->Untie("metrics/alpha-max-rad");
|
PropertyManager->Untie("metrics/alpha-max-deg");
|
||||||
PropertyManager->Untie("metrics/alpha-min-rad");
|
PropertyManager->Untie("metrics/alpha-min-deg");
|
||||||
PropertyManager->Untie("aero/bi2vel");
|
PropertyManager->Untie("aero/bi2vel");
|
||||||
PropertyManager->Untie("aero/ci2vel");
|
PropertyManager->Untie("aero/ci2vel");
|
||||||
PropertyManager->Untie("aero/alpha-wing-rad");
|
PropertyManager->Untie("aero/alpha-wing-rad");
|
||||||
|
|
|
@ -99,6 +99,10 @@ CLASS DOCUMENTATION
|
||||||
Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
|
Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
|
||||||
<li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
|
<li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
|
||||||
1982 ISBN 0-471-08936-2</li></ol>
|
1982 ISBN 0-471-08936-2</li></ol>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -167,7 +171,6 @@ public:
|
||||||
double GetCI2Vel(void) const { return ci2vel; }
|
double GetCI2Vel(void) const { return ci2vel; }
|
||||||
double GetAlphaW(void) const { return alphaw; }
|
double GetAlphaW(void) const { return alphaw; }
|
||||||
|
|
||||||
|
|
||||||
float GetNlf(void);
|
float GetNlf(void);
|
||||||
|
|
||||||
inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
|
inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
|
||||||
|
|
|
@ -72,8 +72,9 @@ CLASS IMPLEMENTATION
|
||||||
FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
|
FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
{
|
{
|
||||||
Name = "FGAtmosphere";
|
Name = "FGAtmosphere";
|
||||||
lastIndex=0;
|
lastIndex = 0;
|
||||||
h = 0;
|
h = 0.0;
|
||||||
|
psiw = 0.0;
|
||||||
htab[0]=0;
|
htab[0]=0;
|
||||||
htab[1]=36089.239;
|
htab[1]=36089.239;
|
||||||
htab[2]=65616.798;
|
htab[2]=65616.798;
|
||||||
|
|
|
@ -71,6 +71,10 @@ CLASS DOCUMENTATION
|
||||||
/** Models the standard atmosphere.
|
/** Models the standard atmosphere.
|
||||||
@author Tony Peden, Jon Berndt
|
@author Tony Peden, Jon Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -65,7 +65,10 @@ CLASS DOCUMENTATION
|
||||||
/** Encapsulates various uncategorized scheduled functions.
|
/** Encapsulates various uncategorized scheduled functions.
|
||||||
@author Tony Peden, Jon Berndt
|
@author Tony Peden, Jon Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see -
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAuxiliary.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAuxiliary.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -122,13 +122,13 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
*AC_cfg >> multparmsRow;
|
*AC_cfg >> multparmsRow;
|
||||||
prop = State->GetPropertyName( State->GetParameterIndex(multparmsRow) );
|
prop = State->GetPropertyName( multparmsRow );
|
||||||
LookupR = PropertyManager->GetNode( prop );
|
LookupR = PropertyManager->GetNode( prop );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == TABLE) {
|
if (type == TABLE) {
|
||||||
*AC_cfg >> multparmsCol;
|
*AC_cfg >> multparmsCol;
|
||||||
prop = State->GetPropertyName( State->GetParameterIndex(multparmsCol) );
|
prop = State->GetPropertyName( multparmsCol );
|
||||||
|
|
||||||
LookupC = PropertyManager->GetNode( prop );
|
LookupC = PropertyManager->GetNode( prop );
|
||||||
}
|
}
|
||||||
|
@ -147,13 +147,12 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg)
|
||||||
while (n < end && n >= 0) {
|
while (n < end && n >= 0) {
|
||||||
n -= start;
|
n -= start;
|
||||||
mult = multparms.substr(start,n);
|
mult = multparms.substr(start,n);
|
||||||
prop= State->GetPropertyName( State->GetParameterIndex(mult) );
|
prop= State->GetPropertyName( mult );
|
||||||
multipliers.push_back( PropertyManager->GetNode(prop) );
|
multipliers.push_back( PropertyManager->GetNode(prop) );
|
||||||
start += n+1;
|
start += n+1;
|
||||||
n = multparms.find("|",start);
|
n = multparms.find("|",start);
|
||||||
}
|
}
|
||||||
prop=State->GetPropertyName(
|
prop=State->GetPropertyName( multparms.substr(start,n) );
|
||||||
State->GetParameterIndex( multparms.substr(start,n) ) );
|
|
||||||
mult = multparms.substr(start,n);
|
mult = multparms.substr(start,n);
|
||||||
multipliers.push_back( PropertyManager->GetNode(prop) );
|
multipliers.push_back( PropertyManager->GetNode(prop) );
|
||||||
// End of non-dimensionalizing parameter read-in
|
// End of non-dimensionalizing parameter read-in
|
||||||
|
|
|
@ -89,7 +89,10 @@ CLASS DOCUMENTATION
|
||||||
is called and the coefficient value is calculated.
|
is called and the coefficient value is calculated.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see -
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGCoefficient.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGCoefficient.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -96,7 +96,10 @@ CLASS DOCUMENTATION
|
||||||
JSBSim config files are in XML format.
|
JSBSim config files are in XML format.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see -
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGConfigFile.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGConfigFile.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -162,7 +162,7 @@ void FGFCS::SetThrottlePos(int engineNum, double setting)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
double FGFCS::GetThrottleCmd(int engineNum)
|
double FGFCS::GetThrottleCmd(int engineNum) const
|
||||||
{
|
{
|
||||||
if (engineNum < (int)ThrottlePos.size()) {
|
if (engineNum < (int)ThrottlePos.size()) {
|
||||||
if (engineNum < 0) {
|
if (engineNum < 0) {
|
||||||
|
@ -180,7 +180,7 @@ double FGFCS::GetThrottleCmd(int engineNum)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
double FGFCS::GetThrottlePos(int engineNum)
|
double FGFCS::GetThrottlePos(int engineNum) const
|
||||||
{
|
{
|
||||||
if (engineNum < (int)ThrottlePos.size()) {
|
if (engineNum < (int)ThrottlePos.size()) {
|
||||||
if (engineNum < 0) {
|
if (engineNum < 0) {
|
||||||
|
@ -306,36 +306,40 @@ bool FGFCS::Load(FGConfigFile* AC_cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//collect information for normalizing control surfaces
|
//collect information for normalizing control surfaces
|
||||||
|
string nodeName;
|
||||||
for(i=0;i<Components.size();i++) {
|
for(i=0;i<Components.size();i++) {
|
||||||
|
|
||||||
if(Components[i]->GetType() == "AEROSURFACE_SCALE"
|
if( (Components[i]->GetType() == "AEROSURFACE_SCALE"
|
||||||
|| Components[i]->GetType() == "KINEMAT" ) {
|
|| Components[i]->GetType() == "KINEMAT")
|
||||||
if( Components[i]->GetOutputIdx() == FG_ELEVATOR_POS ) {
|
&& Components[i]->GetOutputNode() ) {
|
||||||
|
nodeName= Components[i]->GetOutputNode()->GetName();
|
||||||
|
if( nodeName == "elevator-pos-rad" ) {
|
||||||
ToNormalize[iDe]=i;
|
ToNormalize[iDe]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_LEFT_AILERON_POS
|
} else if ( nodeName == "left-aileron-pos-rad"
|
||||||
|| Components[i]->GetOutputIdx() == FG_AILERON_POS ) {
|
|| nodeName == "aileron-pos-rad" ) {
|
||||||
ToNormalize[iDaL]=i;
|
ToNormalize[iDaL]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_RIGHT_AILERON_POS ) {
|
} else if ( nodeName == "right-aileron-pos-rad" ) {
|
||||||
ToNormalize[iDaR]=i;
|
ToNormalize[iDaR]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_RUDDER_POS ) {
|
} else if ( nodeName == "rudder-pos-rad" ) {
|
||||||
ToNormalize[iDr]=i;
|
ToNormalize[iDr]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_SPDBRAKE_POS ) {
|
} else if ( nodeName == "speedbrake-pos-rad" ) {
|
||||||
ToNormalize[iDsb]=i;
|
ToNormalize[iDsb]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_SPOILERS_POS ) {
|
} else if ( nodeName == "spoiler-pos-rad" ) {
|
||||||
ToNormalize[iDsp]=i;
|
ToNormalize[iDsp]=i;
|
||||||
} else if ( Components[i]->GetOutputIdx() == FG_FLAPS_POS ) {
|
} else if ( nodeName == "flaps-pos-deg" ) {
|
||||||
ToNormalize[iDf]=i;
|
ToNormalize[iDf]=i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bindModel();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
double FGFCS::GetComponentOutput(eParam idx) {
|
double FGFCS::GetComponentOutput(int idx) {
|
||||||
return Components[idx]->GetOutput();
|
return Components[idx]->GetOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,6 +598,41 @@ void FGFCS::bind(void){
|
||||||
&FGFCS::SetGearPos,
|
&FGFCS::SetGearPos,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGFCS::bindModel(void){
|
||||||
|
unsigned i;
|
||||||
|
for(i=0;i<ThrottleCmd.size();i++) {
|
||||||
|
PropertyManager->Tie("fcs/throttle-cmd-norm",this,i,
|
||||||
|
&FGFCS::GetThrottleCmd,
|
||||||
|
&FGFCS::SetThrottleCmd,
|
||||||
|
true );
|
||||||
|
PropertyManager->Tie("fcs/throttle-pos-norm",this,i,
|
||||||
|
&FGFCS::GetThrottlePos,
|
||||||
|
&FGFCS::SetThrottlePos,
|
||||||
|
true );
|
||||||
|
if( MixtureCmd.size() > i ) {
|
||||||
|
PropertyManager->Tie("fcs/mixture-cmd-norm",this,i,
|
||||||
|
&FGFCS::GetMixtureCmd,
|
||||||
|
&FGFCS::SetMixtureCmd,
|
||||||
|
true );
|
||||||
|
PropertyManager->Tie("fcs/mixture-pos-norm",this,i,
|
||||||
|
&FGFCS::GetMixturePos,
|
||||||
|
&FGFCS::SetMixturePos,
|
||||||
|
true );
|
||||||
|
}
|
||||||
|
if( PropAdvanceCmd.size() > i ) {
|
||||||
|
PropertyManager->Tie("fcs/advance-cmd-norm",this,i,
|
||||||
|
&FGFCS::GetPropAdvanceCmd,
|
||||||
|
&FGFCS::SetPropAdvanceCmd,
|
||||||
|
true );
|
||||||
|
PropertyManager->Tie("fcs/advance-pos-norm",this,i,
|
||||||
|
&FGFCS::GetPropAdvance,
|
||||||
|
&FGFCS::SetPropAdvance,
|
||||||
|
true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,8 @@ DEFINITIONS
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf } FcIdx;
|
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx;
|
||||||
int const NNorm=7;
|
typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm;
|
||||||
typedef enum { ofRad=0, ofNorm, ofMag } OutputForm;
|
|
||||||
int const NForms=3;
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||||
|
@ -152,6 +150,10 @@ CLASS DOCUMENTATION
|
||||||
@see FGGradient
|
@see FGGradient
|
||||||
@see FGFilter
|
@see FGFilter
|
||||||
@see FGDeadBand
|
@see FGDeadBand
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -200,7 +202,7 @@ public:
|
||||||
/** Gets the throttle command.
|
/** Gets the throttle command.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@return throttle command in percent ( 0 - 100) for the given engine */
|
@return throttle command in percent ( 0 - 100) for the given engine */
|
||||||
double GetThrottleCmd(int engine);
|
double GetThrottleCmd(int engine) const;
|
||||||
|
|
||||||
/** Gets the mixture command.
|
/** Gets the mixture command.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
|
@ -272,7 +274,7 @@ public:
|
||||||
/** Gets the throttle position.
|
/** Gets the throttle position.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@return throttle position for the given engine in percent ( 0 - 100)*/
|
@return throttle position for the given engine in percent ( 0 - 100)*/
|
||||||
double GetThrottlePos(int engine);
|
double GetThrottlePos(int engine) const;
|
||||||
|
|
||||||
/** Gets the mixture position.
|
/** Gets the mixture position.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
|
@ -297,7 +299,7 @@ public:
|
||||||
/** Retrieves a components output value
|
/** Retrieves a components output value
|
||||||
@param idx the index of the component (the component ID)
|
@param idx the index of the component (the component ID)
|
||||||
@return output value from the component */
|
@return output value from the component */
|
||||||
double GetComponentOutput(eParam idx);
|
double GetComponentOutput(int idx);
|
||||||
|
|
||||||
/** Retrieves the component name
|
/** Retrieves the component name
|
||||||
@param idx the index of the component (the component ID)
|
@param idx the index of the component (the component ID)
|
||||||
|
@ -456,9 +458,11 @@ public:
|
||||||
|
|
||||||
void AddThrottle(void);
|
void AddThrottle(void);
|
||||||
|
|
||||||
void bind(void);
|
FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }
|
||||||
void unbind(void);
|
|
||||||
|
|
||||||
|
void bind(void);
|
||||||
|
void bindModel(void);
|
||||||
|
void unbind(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
|
double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
|
||||||
|
|
|
@ -85,7 +85,10 @@ CLASS DOCUMENTATION
|
||||||
/** This class encapsulates the functionality needed to manage a factor group
|
/** This class encapsulates the functionality needed to manage a factor group
|
||||||
i.e. factor*(coeff1 + coeff2 + coeff3)
|
i.e. factor*(coeff1 + coeff2 + coeff3)
|
||||||
@author Tony Peden
|
@author Tony Peden
|
||||||
@see -
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFactorGroup.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFactorGroup.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -126,6 +126,10 @@ CLASS DOCUMENTATION
|
||||||
considered equivalent to setting gamma.
|
considered equivalent to setting gamma.
|
||||||
@author Anthony K. Peden
|
@author Anthony K. Peden
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGInitialCondition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGInitialCondition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -169,6 +169,10 @@ CLASS DOCUMENTATION
|
||||||
Wiley & Sons, 1979 ISBN 0-471-03032-5
|
Wiley & Sons, 1979 ISBN 0-471-03032-5
|
||||||
@see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
|
@see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
|
||||||
AIAA-2000-4303
|
AIAA-2000-4303
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -59,7 +59,11 @@ CLASS DOCUMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/** Models a rocket nozzle.
|
/** Models a rocket nozzle.
|
||||||
*/
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGNozzle.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGNozzle.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
|
|
|
@ -70,6 +70,10 @@ DOCUMENTATION
|
||||||
@author Dave Luff (engine operational code)
|
@author Dave Luff (engine operational code)
|
||||||
@author David Megginson (porting and additional code)
|
@author David Megginson (porting and additional code)
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -64,6 +64,10 @@ DOCUMENTATION
|
||||||
/** Models the lateral and longitudinal translational EOM.
|
/** Models the lateral and longitudinal translational EOM.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -81,6 +81,10 @@ CLASS DOCUMENTATION
|
||||||
@see FGEngine
|
@see FGEngine
|
||||||
@see FGThruster
|
@see FGThruster
|
||||||
@see FGTable
|
@see FGTable
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -61,6 +61,8 @@ CLASS DOCUMENTATION
|
||||||
@author David Megginson, Tony Peden
|
@author David Megginson, Tony Peden
|
||||||
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
Header File </a>
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -113,6 +115,13 @@ class FGPropertyManager:public SGPropertyNode {
|
||||||
return (GetNode(path, false) != 0);
|
return (GetNode(path, false) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of a node
|
||||||
|
*/
|
||||||
|
inline string
|
||||||
|
GetName( void ) {
|
||||||
|
return string( getName() );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a bool value for a property.
|
* Get a bool value for a property.
|
||||||
|
|
|
@ -69,6 +69,7 @@ FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
|
||||||
numSelectedFuelTanks = numSelectedOxiTanks = 0;
|
numSelectedFuelTanks = numSelectedOxiTanks = 0;
|
||||||
numTanks = numEngines = numThrusters = 0;
|
numTanks = numEngines = numThrusters = 0;
|
||||||
numOxiTanks = numFuelTanks = 0;
|
numOxiTanks = numFuelTanks = 0;
|
||||||
|
dt = 0.0;
|
||||||
bind();
|
bind();
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,15 +90,22 @@ CLASS DOCUMENTATION
|
||||||
@see FGEngine
|
@see FGEngine
|
||||||
@see FGTank
|
@see FGTank
|
||||||
@see FGThruster
|
@see FGThruster
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGPropulsion : public FGModel {
|
class FGPropulsion : public FGModel
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Constructor
|
||||||
FGPropulsion(FGFDMExec*);
|
FGPropulsion(FGFDMExec*);
|
||||||
|
/// Destructor
|
||||||
~FGPropulsion();
|
~FGPropulsion();
|
||||||
|
|
||||||
/** Executes the propulsion model.
|
/** Executes the propulsion model.
|
||||||
|
|
|
@ -94,6 +94,10 @@ CLASS DOCUMENTATION
|
||||||
@see FGEngine
|
@see FGEngine
|
||||||
@see FGPropulsion
|
@see FGPropulsion
|
||||||
@see FGTank
|
@see FGTank
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGRocket.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGRocket.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -73,6 +73,7 @@ CLASS IMPLEMENTATION
|
||||||
FGScript::FGScript(FGFDMExec* fgex) : FDMExec(fgex)
|
FGScript::FGScript(FGFDMExec* fgex) : FDMExec(fgex)
|
||||||
{
|
{
|
||||||
State = FDMExec->GetState();
|
State = FDMExec->GetState();
|
||||||
|
PropertyManager=FDMExec->GetPropertyManager();
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ bool FGScript::LoadScript(string script)
|
||||||
string token="";
|
string token="";
|
||||||
string aircraft="";
|
string aircraft="";
|
||||||
string initialize="";
|
string initialize="";
|
||||||
|
string prop_name;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
double dt = 0.0;
|
double dt = 0.0;
|
||||||
struct condition *newCondition;
|
struct condition *newCondition;
|
||||||
|
@ -113,6 +115,11 @@ bool FGScript::LoadScript(string script)
|
||||||
if (token == "use") {
|
if (token == "use") {
|
||||||
if ((token = Script.GetValue("aircraft")) != string("")) {
|
if ((token = Script.GetValue("aircraft")) != string("")) {
|
||||||
aircraft = token;
|
aircraft = token;
|
||||||
|
result = FDMExec->LoadModel("aircraft", "engine", aircraft);
|
||||||
|
if (!result) {
|
||||||
|
cerr << "Aircraft file " << aircraft << " was not found" << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (debug_lvl > 0) cout << " Use aircraft: " << token << endl;
|
if (debug_lvl > 0) cout << " Use aircraft: " << token << endl;
|
||||||
} else if ((token = Script.GetValue("initialize")) != string("")) {
|
} else if ((token = Script.GetValue("initialize")) != string("")) {
|
||||||
initialize = token;
|
initialize = token;
|
||||||
|
@ -136,11 +143,13 @@ bool FGScript::LoadScript(string script)
|
||||||
newCondition = new struct condition();
|
newCondition = new struct condition();
|
||||||
while (token != string("/when")) {
|
while (token != string("/when")) {
|
||||||
if (token == "parameter") {
|
if (token == "parameter") {
|
||||||
newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
|
prop_name = State->GetPropertyName( Script.GetValue("name") );
|
||||||
|
newCondition->TestParam.push_back( PropertyManager->GetNode(prop_name) );
|
||||||
newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
|
newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
|
||||||
newCondition->Comparison.push_back(Script.GetValue("comparison"));
|
newCondition->Comparison.push_back(Script.GetValue("comparison"));
|
||||||
} else if (token == "set") {
|
} else if (token == "set") {
|
||||||
newCondition->SetParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
|
prop_name = State->GetPropertyName( Script.GetValue("name") );
|
||||||
|
newCondition->SetParam.push_back( PropertyManager->GetNode(prop_name) );
|
||||||
newCondition->SetValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
|
newCondition->SetValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
|
||||||
newCondition->Triggered.push_back(false);
|
newCondition->Triggered.push_back(false);
|
||||||
newCondition->OriginalValue.push_back(0.0);
|
newCondition->OriginalValue.push_back(0.0);
|
||||||
|
@ -194,11 +203,6 @@ bool FGScript::LoadScript(string script)
|
||||||
|
|
||||||
Debug(4);
|
Debug(4);
|
||||||
|
|
||||||
result = FDMExec->LoadModel("aircraft", "engine", aircraft);
|
|
||||||
if (!result) {
|
|
||||||
cerr << "Aircraft file " << aircraft << " was not found" << endl;
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
FGInitialCondition IC(FDMExec);
|
FGInitialCondition IC(FDMExec);
|
||||||
if ( ! IC.Load("aircraft", aircraft, initialize)) {
|
if ( ! IC.Load("aircraft", aircraft, initialize)) {
|
||||||
|
@ -228,17 +232,17 @@ bool FGScript::RunScript(void)
|
||||||
// to true
|
// to true
|
||||||
for (i=0; i<iC->TestValue.size(); i++) {
|
for (i=0; i<iC->TestValue.size(); i++) {
|
||||||
if (iC->Comparison[i] == "lt")
|
if (iC->Comparison[i] == "lt")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) < iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() < iC->TestValue[i];
|
||||||
else if (iC->Comparison[i] == "le")
|
else if (iC->Comparison[i] == "le")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) <= iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() <= iC->TestValue[i];
|
||||||
else if (iC->Comparison[i] == "eq")
|
else if (iC->Comparison[i] == "eq")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) == iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() == iC->TestValue[i];
|
||||||
else if (iC->Comparison[i] == "ge")
|
else if (iC->Comparison[i] == "ge")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) >= iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() >= iC->TestValue[i];
|
||||||
else if (iC->Comparison[i] == "gt")
|
else if (iC->Comparison[i] == "gt")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) > iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() > iC->TestValue[i];
|
||||||
else if (iC->Comparison[i] == "ne")
|
else if (iC->Comparison[i] == "ne")
|
||||||
truth = State->GetParameter(iC->TestParam[i]) != iC->TestValue[i];
|
truth = iC->TestParam[i]->getDoubleValue() != iC->TestValue[i];
|
||||||
else
|
else
|
||||||
cerr << "Bad comparison" << endl;
|
cerr << "Bad comparison" << endl;
|
||||||
|
|
||||||
|
@ -253,7 +257,7 @@ bool FGScript::RunScript(void)
|
||||||
if (WholeTruth) {
|
if (WholeTruth) {
|
||||||
for (i=0; i<iC->SetValue.size(); i++) {
|
for (i=0; i<iC->SetValue.size(); i++) {
|
||||||
if ( ! iC->Triggered[i]) {
|
if ( ! iC->Triggered[i]) {
|
||||||
iC->OriginalValue[i] = State->GetParameter(iC->SetParam[i]);
|
iC->OriginalValue[i] = iC->SetParam[i]->getDoubleValue();
|
||||||
switch (iC->Type[i]) {
|
switch (iC->Type[i]) {
|
||||||
case FG_VALUE:
|
case FG_VALUE:
|
||||||
iC->newValue[i] = iC->SetValue[i];
|
iC->newValue[i] = iC->SetValue[i];
|
||||||
|
@ -289,7 +293,7 @@ bool FGScript::RunScript(void)
|
||||||
cerr << "Invalid Action specified" << endl;
|
cerr << "Invalid Action specified" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
State->SetParameter(iC->SetParam[i], newSetValue);
|
iC->SetParam[i]->setDoubleValue(newSetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iC++;
|
iC++;
|
||||||
|
@ -338,15 +342,15 @@ void FGScript::Debug(int from)
|
||||||
|
|
||||||
for (i=0; i<iterConditions->TestValue.size(); i++) {
|
for (i=0; i<iterConditions->TestValue.size(); i++) {
|
||||||
if (i>0) cout << " and" << endl << " ";
|
if (i>0) cout << " and" << endl << " ";
|
||||||
cout << "(" << State->GetParameterName(iterConditions->TestParam[i])
|
cout << "(" << iterConditions->TestParam[i]->GetName()
|
||||||
<< iterConditions->Comparison[i] << " "
|
<< " " << iterConditions->Comparison[i] << " "
|
||||||
<< iterConditions->TestValue[i] << ")";
|
<< iterConditions->TestValue[i] << ")";
|
||||||
}
|
}
|
||||||
cout << ") then {";
|
cout << ") then {";
|
||||||
|
|
||||||
for (i=0; i<iterConditions->SetValue.size(); i++) {
|
for (i=0; i<iterConditions->SetValue.size(); i++) {
|
||||||
cout << endl << " set" << State->GetParameterName(iterConditions->SetParam[i])
|
cout << endl << " set " << iterConditions->SetParam[i]->GetName()
|
||||||
<< "to " << iterConditions->SetValue[i];
|
<< " to " << iterConditions->SetValue[i];
|
||||||
|
|
||||||
switch (iterConditions->Type[i]) {
|
switch (iterConditions->Type[i]) {
|
||||||
case FG_VALUE:
|
case FG_VALUE:
|
||||||
|
|
|
@ -63,6 +63,10 @@ CLASS DOCUMENTATION
|
||||||
/** Encapsulates the JSBSim scripting capability.
|
/** Encapsulates the JSBSim scripting capability.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGScript.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGScript.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
|
|
||||||
<h4>Scripting support provided via FGScript.</h4>
|
<h4>Scripting support provided via FGScript.</h4>
|
||||||
|
|
||||||
|
@ -163,8 +167,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct condition {
|
struct condition {
|
||||||
vector <eParam> TestParam;
|
vector <FGPropertyManager*> TestParam;
|
||||||
vector <eParam> SetParam;
|
vector <FGPropertyManager*> SetParam;
|
||||||
vector <double> TestValue;
|
vector <double> TestValue;
|
||||||
vector <double> SetValue;
|
vector <double> SetValue;
|
||||||
vector <string> Comparison;
|
vector <string> Comparison;
|
||||||
|
@ -191,6 +195,7 @@ private:
|
||||||
|
|
||||||
FGFDMExec* FDMExec;
|
FGFDMExec* FDMExec;
|
||||||
FGState* State;
|
FGState* State;
|
||||||
|
FGPropertyManager* PropertyManager;
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ INCLUDES
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)||defined(__BORLANDCPP__)
|
#ifdef _WIN32
|
||||||
#pragma message("\n\nRedefining snprintf\n")
|
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,7 +60,8 @@ static const char *IdHdr = ID_STATE;
|
||||||
MACROS
|
MACROS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define RegisterVariable(ID,DEF) coeffdef[#ID] = ID; paramdef[ID] = DEF
|
//#define RegisterVariable(ID,DEF) coeffdef[#ID] = ID; paramdef[ID] = DEF
|
||||||
|
#define RegisterVariable(ID,DEF) coeffdef[#ID] = ID;
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
|
@ -97,83 +97,6 @@ FGState::FGState(FGFDMExec* fdex)
|
||||||
|
|
||||||
InitPropertyMaps();
|
InitPropertyMaps();
|
||||||
|
|
||||||
RegisterVariable(FG_TIME, " time " );
|
|
||||||
RegisterVariable(FG_QBAR, " qbar " );
|
|
||||||
RegisterVariable(FG_WINGAREA, " wing_area " );
|
|
||||||
RegisterVariable(FG_WINGSPAN, " wingspan " );
|
|
||||||
RegisterVariable(FG_CBAR, " cbar " );
|
|
||||||
RegisterVariable(FG_ALPHA, " alpha " );
|
|
||||||
RegisterVariable(FG_ALPHADOT, " alphadot " );
|
|
||||||
RegisterVariable(FG_BETA, " beta " );
|
|
||||||
RegisterVariable(FG_ABETA, " |beta| " );
|
|
||||||
RegisterVariable(FG_BETADOT, " betadot " );
|
|
||||||
RegisterVariable(FG_PHI, " roll_angle " );
|
|
||||||
RegisterVariable(FG_THT, " pitch_angle " );
|
|
||||||
RegisterVariable(FG_PSI, " heading_angle " );
|
|
||||||
RegisterVariable(FG_PITCHRATE, " pitch_rate " );
|
|
||||||
RegisterVariable(FG_ROLLRATE, " roll_rate " );
|
|
||||||
RegisterVariable(FG_YAWRATE, " yaw_rate " );
|
|
||||||
RegisterVariable(FG_AEROQ, " aero_pitch_rate " );
|
|
||||||
RegisterVariable(FG_AEROP, " aero_roll_rate " );
|
|
||||||
RegisterVariable(FG_AEROR, " aero_yaw_rate " );
|
|
||||||
RegisterVariable(FG_CL_SQRD, " Clift_sqrd " );
|
|
||||||
RegisterVariable(FG_MACH, " mach " );
|
|
||||||
RegisterVariable(FG_ALTITUDE, " altitude " );
|
|
||||||
RegisterVariable(FG_BI2VEL, " BI2Vel " );
|
|
||||||
RegisterVariable(FG_CI2VEL, " CI2Vel " );
|
|
||||||
RegisterVariable(FG_ELEVATOR_POS, " elevator_pos " );
|
|
||||||
RegisterVariable(FG_AELEVATOR_POS, " |elevator_pos| " );
|
|
||||||
RegisterVariable(FG_NELEVATOR_POS, " elevator_pos_n " );
|
|
||||||
RegisterVariable(FG_AILERON_POS, " aileron_pos " );
|
|
||||||
RegisterVariable(FG_AAILERON_POS, " |aileron_pos| " );
|
|
||||||
RegisterVariable(FG_NAILERON_POS, " aileron_pos_n " );
|
|
||||||
RegisterVariable(FG_LEFT_AILERON_POS, " left_aileron_pos " );
|
|
||||||
RegisterVariable(FG_ALEFT_AILERON_POS, " |left_aileron_pos| " );
|
|
||||||
RegisterVariable(FG_NLEFT_AILERON_POS, " left_aileron_pos_n " );
|
|
||||||
RegisterVariable(FG_RIGHT_AILERON_POS, " right_aileron_pos " );
|
|
||||||
RegisterVariable(FG_ARIGHT_AILERON_POS, " |right_aileron_pos| " );
|
|
||||||
RegisterVariable(FG_NRIGHT_AILERON_POS, " right_aileron_pos_n " );
|
|
||||||
RegisterVariable(FG_RUDDER_POS, " rudder_pos " );
|
|
||||||
RegisterVariable(FG_ARUDDER_POS, " |rudder_pos| " );
|
|
||||||
RegisterVariable(FG_NRUDDER_POS, " rudder_pos_n " );
|
|
||||||
RegisterVariable(FG_SPDBRAKE_POS, " speedbrake_pos " );
|
|
||||||
RegisterVariable(FG_NSPDBRAKE_POS, " speedbrake_pos_n " );
|
|
||||||
RegisterVariable(FG_SPOILERS_POS, " spoiler_pos " );
|
|
||||||
RegisterVariable(FG_NSPOILERS_POS, " spoiler_pos_n " );
|
|
||||||
RegisterVariable(FG_FLAPS_POS, " flaps_pos " );
|
|
||||||
RegisterVariable(FG_NFLAPS_POS, " flaps_pos_n " );
|
|
||||||
RegisterVariable(FG_GEAR_POS, " gear_pos " );
|
|
||||||
RegisterVariable(FG_ELEVATOR_CMD, " elevator_cmd " );
|
|
||||||
RegisterVariable(FG_AILERON_CMD, " aileron_cmd " );
|
|
||||||
RegisterVariable(FG_RUDDER_CMD, " rudder_cmd " );
|
|
||||||
RegisterVariable(FG_SPDBRAKE_CMD, " speedbrake_cmd " );
|
|
||||||
RegisterVariable(FG_SPOILERS_CMD, " spoiler_cmd " );
|
|
||||||
RegisterVariable(FG_FLAPS_CMD, " flaps_cmd " );
|
|
||||||
RegisterVariable(FG_THROTTLE_CMD, " throttle_cmd " );
|
|
||||||
RegisterVariable(FG_GEAR_CMD, " gear_cmd " );
|
|
||||||
RegisterVariable(FG_THROTTLE_POS, " throttle_pos " );
|
|
||||||
RegisterVariable(FG_MIXTURE_CMD, " mixture_cmd " );
|
|
||||||
RegisterVariable(FG_MIXTURE_POS, " mixture_pos " );
|
|
||||||
RegisterVariable(FG_MAGNETO_CMD, " magneto_cmd " );
|
|
||||||
RegisterVariable(FG_STARTER_CMD, " starter_cmd " );
|
|
||||||
RegisterVariable(FG_ACTIVE_ENGINE, " active_engine " );
|
|
||||||
RegisterVariable(FG_HOVERB, " height/span " );
|
|
||||||
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
|
|
||||||
RegisterVariable(FG_YAW_TRIM_CMD, " yaw_trim_cmd " );
|
|
||||||
RegisterVariable(FG_ROLL_TRIM_CMD, " roll_trim_cmd " );
|
|
||||||
RegisterVariable(FG_LEFT_BRAKE_CMD, " left_brake_cmd " );
|
|
||||||
RegisterVariable(FG_RIGHT_BRAKE_CMD, " right_brake_cmd " );
|
|
||||||
RegisterVariable(FG_CENTER_BRAKE_CMD, " center_brake_cmd " );
|
|
||||||
RegisterVariable(FG_ALPHAH, " h-tail alpha " );
|
|
||||||
RegisterVariable(FG_ALPHAW, " wing alpha " );
|
|
||||||
RegisterVariable(FG_LBARH, " h-tail arm " );
|
|
||||||
RegisterVariable(FG_LBARV, " v-tail arm " );
|
|
||||||
RegisterVariable(FG_HTAILAREA, " h-tail area " );
|
|
||||||
RegisterVariable(FG_VTAILAREA, " v-tail area " );
|
|
||||||
RegisterVariable(FG_VBARH, " h-tail volume " );
|
|
||||||
RegisterVariable(FG_VBARV, " v-tail volume " );
|
|
||||||
RegisterVariable(FG_SET_LOGGING, " data_logging " );
|
|
||||||
|
|
||||||
bind();
|
bind();
|
||||||
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
|
@ -187,354 +110,6 @@ FGState::~FGState()
|
||||||
Debug(1);
|
Debug(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
double FGState::GetParameter(eParam val_idx) {
|
|
||||||
double scratch;
|
|
||||||
|
|
||||||
switch(val_idx) {
|
|
||||||
case FG_TIME:
|
|
||||||
return sim_time;
|
|
||||||
case FG_QBAR:
|
|
||||||
return Translation->Getqbar();
|
|
||||||
case FG_WINGAREA:
|
|
||||||
return Aircraft->GetWingArea();
|
|
||||||
case FG_WINGSPAN:
|
|
||||||
return Aircraft->GetWingSpan();
|
|
||||||
case FG_CBAR:
|
|
||||||
return Aircraft->Getcbar();
|
|
||||||
case FG_LBARH:
|
|
||||||
return Aircraft->Getlbarh();
|
|
||||||
case FG_LBARV:
|
|
||||||
return Aircraft->Getvbarh();
|
|
||||||
case FG_HTAILAREA:
|
|
||||||
return Aircraft->GetHTailArea();
|
|
||||||
case FG_VTAILAREA:
|
|
||||||
return Aircraft->GetVTailArea();
|
|
||||||
case FG_VBARH:
|
|
||||||
return Aircraft->Getvbarh();
|
|
||||||
case FG_VBARV:
|
|
||||||
return Aircraft->Getvbarv();
|
|
||||||
case FG_ALPHA:
|
|
||||||
return Translation->Getalpha();
|
|
||||||
case FG_ALPHAW:
|
|
||||||
return Translation->Getalpha() + Aircraft->GetWingIncidence();
|
|
||||||
case FG_ALPHADOT:
|
|
||||||
return Translation->Getadot();
|
|
||||||
case FG_BETA:
|
|
||||||
return Translation->Getbeta();
|
|
||||||
case FG_ABETA:
|
|
||||||
return fabs(Translation->Getbeta());
|
|
||||||
case FG_BETADOT:
|
|
||||||
return Translation->Getbdot();
|
|
||||||
case FG_PHI:
|
|
||||||
return Rotation->Getphi();
|
|
||||||
case FG_THT:
|
|
||||||
return Rotation->Gettht();
|
|
||||||
case FG_PSI:
|
|
||||||
return Rotation->Getpsi();
|
|
||||||
case FG_PITCHRATE:
|
|
||||||
return Rotation->GetPQR(eQ);
|
|
||||||
case FG_ROLLRATE:
|
|
||||||
return Rotation->GetPQR(eP);
|
|
||||||
case FG_YAWRATE:
|
|
||||||
return Rotation->GetPQR(eR);
|
|
||||||
case FG_AEROP:
|
|
||||||
return Rotation->GetAeroPQR(eP);
|
|
||||||
case FG_AEROQ:
|
|
||||||
return Rotation->GetAeroPQR(eQ);
|
|
||||||
case FG_AEROR:
|
|
||||||
return Rotation->GetAeroPQR(eR);
|
|
||||||
case FG_CL_SQRD:
|
|
||||||
if (Translation->Getqbar() > 0.00)
|
|
||||||
scratch = Aerodynamics->GetvLastFs(eLift)/(Aircraft->GetWingArea()*Translation->Getqbar());
|
|
||||||
else
|
|
||||||
scratch = 0.0;
|
|
||||||
return scratch*scratch;
|
|
||||||
case FG_ELEVATOR_POS:
|
|
||||||
return FCS->GetDePos();
|
|
||||||
case FG_AELEVATOR_POS:
|
|
||||||
return fabs(FCS->GetDePos());
|
|
||||||
case FG_NELEVATOR_POS:
|
|
||||||
return FCS->GetDePos(ofNorm);
|
|
||||||
case FG_AILERON_POS:
|
|
||||||
return FCS->GetDaLPos();
|
|
||||||
case FG_AAILERON_POS:
|
|
||||||
return fabs(FCS->GetDaLPos());
|
|
||||||
case FG_NAILERON_POS:
|
|
||||||
return FCS->GetDaLPos(ofNorm);
|
|
||||||
case FG_LEFT_AILERON_POS:
|
|
||||||
return FCS->GetDaLPos();
|
|
||||||
case FG_ALEFT_AILERON_POS:
|
|
||||||
return FCS->GetDaLPos(ofMag);
|
|
||||||
case FG_NLEFT_AILERON_POS:
|
|
||||||
return FCS->GetDaLPos(ofNorm);
|
|
||||||
case FG_RIGHT_AILERON_POS:
|
|
||||||
return FCS->GetDaRPos();
|
|
||||||
case FG_ARIGHT_AILERON_POS:
|
|
||||||
return FCS->GetDaRPos(ofMag);
|
|
||||||
case FG_NRIGHT_AILERON_POS:
|
|
||||||
return FCS->GetDaRPos(ofNorm);
|
|
||||||
case FG_RUDDER_POS:
|
|
||||||
return FCS->GetDrPos();
|
|
||||||
case FG_ARUDDER_POS:
|
|
||||||
return FCS->GetDrPos(ofMag);
|
|
||||||
case FG_NRUDDER_POS:
|
|
||||||
return FCS->GetDrPos(ofNorm);
|
|
||||||
case FG_SPDBRAKE_POS:
|
|
||||||
return FCS->GetDsbPos();
|
|
||||||
case FG_NSPDBRAKE_POS:
|
|
||||||
return FCS->GetDsbPos(ofNorm);
|
|
||||||
case FG_SPOILERS_POS:
|
|
||||||
return FCS->GetDspPos();
|
|
||||||
case FG_NSPOILERS_POS:
|
|
||||||
return FCS->GetDspPos(ofNorm);
|
|
||||||
case FG_FLAPS_POS:
|
|
||||||
return FCS->GetDfPos();
|
|
||||||
case FG_NFLAPS_POS:
|
|
||||||
return FCS->GetDfPos(ofNorm);
|
|
||||||
case FG_ELEVATOR_CMD:
|
|
||||||
return FCS->GetDeCmd();
|
|
||||||
case FG_AILERON_CMD:
|
|
||||||
return FCS->GetDaCmd();
|
|
||||||
case FG_RUDDER_CMD:
|
|
||||||
return FCS->GetDrCmd();
|
|
||||||
case FG_SPDBRAKE_CMD:
|
|
||||||
return FCS->GetDsbCmd();
|
|
||||||
case FG_SPOILERS_CMD:
|
|
||||||
return FCS->GetDspCmd();
|
|
||||||
case FG_FLAPS_CMD:
|
|
||||||
return FCS->GetDfCmd();
|
|
||||||
case FG_MACH:
|
|
||||||
return Translation->GetMach();
|
|
||||||
case FG_ALTITUDE:
|
|
||||||
return Position->Geth();
|
|
||||||
case FG_BI2VEL:
|
|
||||||
if(Translation->GetVt() > 0)
|
|
||||||
return Aircraft->GetWingSpan()/(2.0 * Translation->GetVt());
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
case FG_CI2VEL:
|
|
||||||
if(Translation->GetVt() > 0)
|
|
||||||
return Aircraft->Getcbar()/(2.0 * Translation->GetVt());
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
case FG_THROTTLE_CMD:
|
|
||||||
if (ActiveEngine < 0) return FCS->GetThrottleCmd(0);
|
|
||||||
else return FCS->GetThrottleCmd(ActiveEngine);
|
|
||||||
case FG_THROTTLE_POS:
|
|
||||||
if (ActiveEngine < 0) return FCS->GetThrottlePos(0);
|
|
||||||
else return FCS->GetThrottlePos(ActiveEngine);
|
|
||||||
case FG_MAGNETO_CMD:
|
|
||||||
if (ActiveEngine < 0) return Propulsion->GetEngine(0)->GetMagnetos();
|
|
||||||
else return Propulsion->GetEngine(ActiveEngine)->GetMagnetos();
|
|
||||||
case FG_STARTER_CMD:
|
|
||||||
if (ActiveEngine < 0) {
|
|
||||||
if (Propulsion->GetEngine(0)->GetStarter()) return 1.0;
|
|
||||||
else return 0.0;
|
|
||||||
} else {
|
|
||||||
if (Propulsion->GetEngine(ActiveEngine)->GetStarter()) return 1.0;
|
|
||||||
else return 0.0;
|
|
||||||
}
|
|
||||||
case FG_MIXTURE_CMD:
|
|
||||||
if (ActiveEngine < 0) return FCS->GetMixtureCmd(0);
|
|
||||||
else return FCS->GetMixtureCmd(ActiveEngine);
|
|
||||||
case FG_MIXTURE_POS:
|
|
||||||
if (ActiveEngine < 0) return FCS->GetMixturePos(0);
|
|
||||||
else return FCS->GetMixturePos(ActiveEngine);
|
|
||||||
case FG_HOVERB:
|
|
||||||
return Position->GetHOverBMAC();
|
|
||||||
case FG_PITCH_TRIM_CMD:
|
|
||||||
return FCS->GetPitchTrimCmd();
|
|
||||||
case FG_YAW_TRIM_CMD:
|
|
||||||
return FCS->GetYawTrimCmd();
|
|
||||||
case FG_ROLL_TRIM_CMD:
|
|
||||||
return FCS->GetRollTrimCmd();
|
|
||||||
case FG_GEAR_CMD:
|
|
||||||
return FCS->GetGearCmd();
|
|
||||||
case FG_GEAR_POS:
|
|
||||||
return FCS->GetGearPos();
|
|
||||||
default:
|
|
||||||
cerr << "FGState::GetParameter() - No handler for parameter " << paramdef[val_idx] << endl;
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
double FGState::GetParameter(string val_string) {
|
|
||||||
return GetParameter(coeffdef[val_string]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
eParam FGState::GetParameterIndex(string val_string)
|
|
||||||
{
|
|
||||||
return coeffdef[val_string];
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
void FGState::SetParameter(eParam val_idx, double val)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
switch(val_idx) {
|
|
||||||
case FG_ELEVATOR_POS:
|
|
||||||
FCS->SetDePos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NELEVATOR_POS:
|
|
||||||
FCS->SetDePos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_AILERON_POS:
|
|
||||||
FCS->SetDaLPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NAILERON_POS:
|
|
||||||
FCS->SetDaLPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_LEFT_AILERON_POS:
|
|
||||||
FCS->SetDaLPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NLEFT_AILERON_POS:
|
|
||||||
FCS->SetDaLPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_RIGHT_AILERON_POS:
|
|
||||||
FCS->SetDaRPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NRIGHT_AILERON_POS:
|
|
||||||
FCS->SetDaRPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_RUDDER_POS:
|
|
||||||
FCS->SetDrPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NRUDDER_POS:
|
|
||||||
FCS->SetDrPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_SPDBRAKE_POS:
|
|
||||||
FCS->SetDsbPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NSPDBRAKE_POS:
|
|
||||||
FCS->SetDsbPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_SPOILERS_POS:
|
|
||||||
FCS->SetDspPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NSPOILERS_POS:
|
|
||||||
FCS->SetDspPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_FLAPS_POS:
|
|
||||||
FCS->SetDfPos(ofRad,val);
|
|
||||||
break;
|
|
||||||
case FG_NFLAPS_POS:
|
|
||||||
FCS->SetDfPos(ofNorm,val);
|
|
||||||
break;
|
|
||||||
case FG_THROTTLE_POS:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
FCS->SetThrottlePos(i,val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
FCS->SetThrottlePos(ActiveEngine,val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FG_MIXTURE_POS:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
FCS->SetMixturePos(i,val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
FCS->SetMixturePos(ActiveEngine,val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FG_ELEVATOR_CMD:
|
|
||||||
FCS->SetDeCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_AILERON_CMD:
|
|
||||||
FCS->SetDaCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_RUDDER_CMD:
|
|
||||||
FCS->SetDrCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_SPDBRAKE_CMD:
|
|
||||||
FCS->SetDsbCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_SPOILERS_CMD:
|
|
||||||
FCS->SetDspCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_FLAPS_CMD:
|
|
||||||
FCS->SetDfCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_THROTTLE_CMD:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
FCS->SetThrottleCmd(i,val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
FCS->SetThrottleCmd(ActiveEngine,val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FG_MIXTURE_CMD:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
FCS->SetMixtureCmd(i,val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
FCS->SetMixtureCmd(ActiveEngine,val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FG_MAGNETO_CMD:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
Propulsion->GetEngine(i)->SetMagnetos((int)val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Propulsion->GetEngine(ActiveEngine)->SetMagnetos((int)val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FG_STARTER_CMD:
|
|
||||||
if (ActiveEngine == -1) {
|
|
||||||
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
|
||||||
if (val < 0.001)
|
|
||||||
Propulsion->GetEngine(i)->SetStarter(false);
|
|
||||||
else if (val >= 0.001)
|
|
||||||
Propulsion->GetEngine(i)->SetStarter(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Propulsion->GetEngine(ActiveEngine)->SetStarter(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FG_ACTIVE_ENGINE:
|
|
||||||
ActiveEngine = (int)val;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FG_LEFT_BRAKE_CMD:
|
|
||||||
FCS->SetLBrake(val);
|
|
||||||
break;
|
|
||||||
case FG_CENTER_BRAKE_CMD:
|
|
||||||
FCS->SetCBrake(val);
|
|
||||||
break;
|
|
||||||
case FG_RIGHT_BRAKE_CMD:
|
|
||||||
FCS->SetRBrake(val);
|
|
||||||
break;
|
|
||||||
case FG_GEAR_CMD:
|
|
||||||
FCS->SetGearCmd(val);
|
|
||||||
break;
|
|
||||||
case FG_GEAR_POS:
|
|
||||||
FCS->SetGearPos(val);
|
|
||||||
break;
|
|
||||||
case FG_SET_LOGGING:
|
|
||||||
if (val < -0.01) Output->Disable();
|
|
||||||
else if (val > 0.01) Output->Enable();
|
|
||||||
else Output->Toggle();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
cerr << "Parameter '" << val_idx << "' (" << paramdef[val_idx] << ") not handled" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
//
|
//
|
||||||
// Reset: Assume all angles READ FROM FILE IN DEGREES !!
|
// Reset: Assume all angles READ FROM FILE IN DEGREES !!
|
||||||
|
@ -688,29 +263,6 @@ void FGState::Initialize(FGInitialCondition *FGIC) {
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGState::StoreData(string fname) {
|
|
||||||
ofstream datafile(fname.c_str());
|
|
||||||
|
|
||||||
if (datafile) {
|
|
||||||
datafile << Translation->GetUVW(eU);
|
|
||||||
datafile << Translation->GetUVW(eV);
|
|
||||||
datafile << Translation->GetUVW(eW);
|
|
||||||
datafile << Position->GetLatitude();
|
|
||||||
datafile << Position->GetLongitude();
|
|
||||||
datafile << Rotation->GetEuler(ePhi);
|
|
||||||
datafile << Rotation->GetEuler(eTht);
|
|
||||||
datafile << Rotation->GetEuler(ePsi);
|
|
||||||
datafile << Position->Geth();
|
|
||||||
datafile.close();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
cerr << "Could not open dump file " << fname << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
void FGState::InitMatrices(double phi, double tht, double psi) {
|
void FGState::InitMatrices(double phi, double tht, double psi) {
|
||||||
double thtd2, psid2, phid2;
|
double thtd2, psid2, phid2;
|
||||||
double Sthtd2, Spsid2, Sphid2;
|
double Sthtd2, Spsid2, Sphid2;
|
||||||
|
@ -889,14 +441,14 @@ void FGState::ReportState(void)
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Speed: %4.0f KCAS Mach: %5.2f\n",
|
snprintf(out,80, " Speed: %4.0f KCAS Mach: %5.2f\n",
|
||||||
FDMExec->GetAuxiliary()->GetVcalibratedKTS(),
|
FDMExec->GetAuxiliary()->GetVcalibratedKTS(),
|
||||||
GetParameter(FG_MACH) );
|
Translation->GetMach() );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Altitude: %7.0f ft. AGL Altitude: %7.0f ft.\n",
|
snprintf(out,80, " Altitude: %7.0f ft. AGL Altitude: %7.0f ft.\n",
|
||||||
Position->Geth(),
|
Position->Geth(),
|
||||||
Position->GetDistanceAGL() );
|
Position->GetDistanceAGL() );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Angle of Attack: %6.2f deg Pitch Angle: %6.2f deg\n",
|
snprintf(out,80, " Angle of Attack: %6.2f deg Pitch Angle: %6.2f deg\n",
|
||||||
GetParameter(FG_ALPHA)*radtodeg,
|
Translation->Getalpha()*radtodeg,
|
||||||
Rotation->Gettht()*radtodeg );
|
Rotation->Gettht()*radtodeg );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Flight Path Angle: %6.2f deg Climb Rate: %5.0f ft/min\n",
|
snprintf(out,80, " Flight Path Angle: %6.2f deg Climb Rate: %5.0f ft/min\n",
|
||||||
|
@ -905,11 +457,11 @@ void FGState::ReportState(void)
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Normal Load Factor: %4.2f g's Pitch Rate: %5.2f deg/s\n",
|
snprintf(out,80, " Normal Load Factor: %4.2f g's Pitch Rate: %5.2f deg/s\n",
|
||||||
Aircraft->GetNlf(),
|
Aircraft->GetNlf(),
|
||||||
GetParameter(FG_PITCHRATE)*radtodeg );
|
Rotation->GetPQR(2)*radtodeg );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg Yaw Rate: %5.2f deg/s\n",
|
snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg Yaw Rate: %5.2f deg/s\n",
|
||||||
Rotation->Getpsi()*radtodeg,
|
Rotation->Getpsi()*radtodeg,
|
||||||
GetParameter(FG_BETA)*radtodeg,
|
Translation->Getbeta()*radtodeg,
|
||||||
Rotation->GetPQR(3)*radtodeg );
|
Rotation->GetPQR(3)*radtodeg );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Bank Angle: %5.2f deg Roll Rate: %5.2f deg/s\n",
|
snprintf(out,80, " Bank Angle: %5.2f deg Roll Rate: %5.2f deg/s\n",
|
||||||
|
@ -917,9 +469,9 @@ void FGState::ReportState(void)
|
||||||
Rotation->GetPQR(1)*radtodeg );
|
Rotation->GetPQR(1)*radtodeg );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n",
|
snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n",
|
||||||
GetParameter(FG_ELEVATOR_POS)*radtodeg,
|
FCS->GetDePos(ofRad)*radtodeg,
|
||||||
GetParameter(FG_AILERON_POS)*radtodeg,
|
FCS->GetDaLPos(ofRad)*radtodeg,
|
||||||
GetParameter(FG_RUDDER_POS)*radtodeg );
|
FCS->GetDrPos(ofRad)*radtodeg );
|
||||||
cout << out;
|
cout << out;
|
||||||
snprintf(out,80, " Throttle: %5.2f%c\n",
|
snprintf(out,80, " Throttle: %5.2f%c\n",
|
||||||
FCS->GetThrottlePos(0)*100,'%' );
|
FCS->GetThrottlePos(0)*100,'%' );
|
||||||
|
@ -940,148 +492,82 @@ void FGState::ReportState(void)
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGState::InitPropertyMaps(void) {
|
void FGState::InitPropertyMaps(void) {
|
||||||
ParamToProp[ FG_TIME ]="sim-time-sec";
|
ParamNameToProp[ "FG_TIME" ]="sim-time-sec";
|
||||||
ParamToProp[ FG_QBAR ]="aero/qbar-psf";
|
ParamNameToProp[ "FG_QBAR" ]="aero/qbar-psf";
|
||||||
ParamToProp[ FG_WINGAREA ]="metrics/Sw-sqft";
|
ParamNameToProp[ "FG_WINGAREA" ]="metrics/Sw-sqft";
|
||||||
ParamToProp[ FG_WINGSPAN ]="metrics/bw-ft";
|
ParamNameToProp[ "FG_WINGSPAN" ]="metrics/bw-ft";
|
||||||
ParamToProp[ FG_CBAR ]="metrics/cbarw-ft";
|
ParamNameToProp[ "FG_CBAR" ]="metrics/cbarw-ft";
|
||||||
ParamToProp[ FG_ALPHA ]="aero/alpha-rad";
|
ParamNameToProp[ "FG_ALPHA" ]="aero/alpha-rad";
|
||||||
ParamToProp[ FG_ALPHADOT ]="aero/alphadot-rad_sec";
|
ParamNameToProp[ "FG_ALPHADOT" ]="aero/alphadot-rad_sec";
|
||||||
ParamToProp[ FG_BETA ]="aero/beta-rad";
|
ParamNameToProp[ "FG_BETA" ]="aero/beta-rad";
|
||||||
ParamToProp[ FG_ABETA ]="aero/mag-beta-rad";
|
ParamNameToProp[ "FG_ABETA" ]="aero/mag-beta-rad";
|
||||||
ParamToProp[ FG_BETADOT ]="aero/betadot-rad_sec";
|
ParamNameToProp[ "FG_BETADOT" ]="aero/betadot-rad_sec";
|
||||||
ParamToProp[ FG_PHI ]="attitude/phi-rad";
|
ParamNameToProp[ "FG_PHI" ]="attitude/phi-rad";
|
||||||
ParamToProp[ FG_THT ]="attitude/theta-rad";
|
ParamNameToProp[ "FG_THT" ]="attitude/theta-rad";
|
||||||
ParamToProp[ FG_PSI ]="attitude/psi-true-rad";
|
ParamNameToProp[ "FG_PSI" ]="attitude/psi-true-rad";
|
||||||
ParamToProp[ FG_PITCHRATE ]="velocities/q-rad_sec";
|
ParamNameToProp[ "FG_PITCHRATE" ]="velocities/q-rad_sec";
|
||||||
ParamToProp[ FG_ROLLRATE ]="velocities/p-rad_sec";
|
ParamNameToProp[ "FG_ROLLRATE" ]="velocities/p-rad_sec";
|
||||||
ParamToProp[ FG_YAWRATE ]="velocities/r-rad_sec";
|
ParamNameToProp[ "FG_YAWRATE" ]="velocities/r-rad_sec";
|
||||||
ParamToProp[ FG_AEROP ]="velocities/p-aero-rad_sec";
|
ParamNameToProp[ "FG_AEROP" ]="velocities/p-aero-rad_sec";
|
||||||
ParamToProp[ FG_AEROQ ]="velocities/q-aero-rad_sec";
|
ParamNameToProp[ "FG_AEROQ" ]="velocities/q-aero-rad_sec";
|
||||||
ParamToProp[ FG_AEROR ]="velocities/r-aero-rad_sec";
|
ParamNameToProp[ "FG_AEROR" ]="velocities/r-aero-rad_sec";
|
||||||
ParamToProp[ FG_CL_SQRD ]="aero/cl-squared-norm";
|
ParamNameToProp[ "FG_CL_SQRD" ]="aero/cl-squared-norm";
|
||||||
ParamToProp[ FG_MACH ]="velocities/mach-norm";
|
ParamNameToProp[ "FG_MACH" ]="velocities/mach-norm";
|
||||||
ParamToProp[ FG_ALTITUDE ]="position/h-sl-ft";
|
ParamNameToProp[ "FG_ALTITUDE" ]="position/h-sl-ft";
|
||||||
ParamToProp[ FG_BI2VEL ]="aero/bi2vel";
|
ParamNameToProp[ "FG_BI2VEL" ]="aero/bi2vel";
|
||||||
ParamToProp[ FG_CI2VEL ]="aero/ci2vel";
|
ParamNameToProp[ "FG_CI2VEL" ]="aero/ci2vel";
|
||||||
ParamToProp[ FG_ELEVATOR_POS ]="fcs/elevator-pos-rad";
|
ParamNameToProp[ "FG_ELEVATOR_POS" ]="fcs/elevator-pos-rad";
|
||||||
ParamToProp[ FG_AELEVATOR_POS ]="fcs/mag-elevator-pos-rad";
|
ParamNameToProp[ "FG_AELEVATOR_POS" ]="fcs/mag-elevator-pos-rad";
|
||||||
ParamToProp[ FG_NELEVATOR_POS ]="fcs/elevator-pos-norm";
|
ParamNameToProp[ "FG_NELEVATOR_POS" ]="fcs/elevator-pos-norm";
|
||||||
ParamToProp[ FG_AILERON_POS ]="fcs/left-aileron-pos-rad";
|
ParamNameToProp[ "FG_AILERON_POS" ]="fcs/left-aileron-pos-rad";
|
||||||
ParamToProp[ FG_AAILERON_POS ]="fcs/mag-aileron-pos-rad";
|
ParamNameToProp[ "FG_AAILERON_POS" ]="fcs/mag-aileron-pos-rad";
|
||||||
ParamToProp[ FG_NAILERON_POS ]="fcs/left-aileron-pos-norm";
|
ParamNameToProp[ "FG_NAILERON_POS" ]="fcs/left-aileron-pos-norm";
|
||||||
ParamToProp[ FG_LEFT_AILERON_POS ]="fcs/left-aileron-pos-rad";
|
ParamNameToProp[ "FG_LEFT_AILERON_POS" ]="fcs/left-aileron-pos-rad";
|
||||||
ParamToProp[ FG_ALEFT_AILERON_POS ]="fcs/mag-left-aileron-pos-rad";
|
ParamNameToProp[ "FG_ALEFT_AILERON_POS" ]="fcs/mag-left-aileron-pos-rad";
|
||||||
ParamToProp[ FG_NLEFT_AILERON_POS ]="fcs/left-aileron-pos-norm";
|
ParamNameToProp[ "FG_NLEFT_AILERON_POS" ]="fcs/left-aileron-pos-norm";
|
||||||
ParamToProp[ FG_RIGHT_AILERON_POS ]="fcs/right-aileron-pos-rad";
|
ParamNameToProp[ "FG_RIGHT_AILERON_POS" ]="fcs/right-aileron-pos-rad";
|
||||||
ParamToProp[ FG_ARIGHT_AILERON_POS ]="fcs/mag-aileron-pos-rad";
|
ParamNameToProp[ "FG_ARIGHT_AILERON_POS" ]="fcs/mag-aileron-pos-rad";
|
||||||
ParamToProp[ FG_NRIGHT_AILERON_POS ]="fcs/right-aileron-pos-norm";
|
ParamNameToProp[ "FG_NRIGHT_AILERON_POS" ]="fcs/right-aileron-pos-norm";
|
||||||
ParamToProp[ FG_RUDDER_POS ]="fcs/rudder-pos-rad";
|
ParamNameToProp[ "FG_RUDDER_POS" ]="fcs/rudder-pos-rad";
|
||||||
ParamToProp[ FG_ARUDDER_POS ]="fcs/mag-rudder-pos-rad";
|
ParamNameToProp[ "FG_ARUDDER_POS" ]="fcs/mag-rudder-pos-rad";
|
||||||
ParamToProp[ FG_NRUDDER_POS ]="fcs/rudder-pos-norm";
|
ParamNameToProp[ "FG_NRUDDER_POS" ]="fcs/rudder-pos-norm";
|
||||||
ParamToProp[ FG_SPDBRAKE_POS ]="fcs/speedbrake-pos-rad";
|
ParamNameToProp[ "FG_SPDBRAKE_POS" ]="fcs/speedbrake-pos-rad";
|
||||||
ParamToProp[ FG_NSPDBRAKE_POS ]="fcs/speedbrake-pos-norm";
|
ParamNameToProp[ "FG_NSPDBRAKE_POS" ]="fcs/speedbrake-pos-norm";
|
||||||
ParamToProp[ FG_SPOILERS_POS ]="fcs/spoiler-pos-rad";
|
ParamNameToProp[ "FG_SPOILERS_POS" ]="fcs/spoiler-pos-rad";
|
||||||
ParamToProp[ FG_NSPOILERS_POS ]="fcs/spoiler-pos-norm";
|
ParamNameToProp[ "FG_NSPOILERS_POS" ]="fcs/spoiler-pos-norm";
|
||||||
ParamToProp[ FG_FLAPS_POS ]="fcs/flap-pos-deg";
|
ParamNameToProp[ "FG_FLAPS_POS" ]="fcs/flap-pos-deg";
|
||||||
ParamToProp[ FG_NFLAPS_POS ]="fcs/flap-pos-norm";
|
ParamNameToProp[ "FG_NFLAPS_POS" ]="fcs/flap-pos-norm";
|
||||||
ParamToProp[ FG_ELEVATOR_CMD ]="fcs/elevator-cmd-norm";
|
ParamNameToProp[ "FG_ELEVATOR_CMD" ]="fcs/elevator-cmd-norm";
|
||||||
ParamToProp[ FG_AILERON_CMD ]="fcs/aileron-cmd-norm";
|
ParamNameToProp[ "FG_AILERON_CMD" ]="fcs/aileron-cmd-norm";
|
||||||
ParamToProp[ FG_RUDDER_CMD ]="fcs/rudder-cmd-norm";
|
ParamNameToProp[ "FG_RUDDER_CMD" ]="fcs/rudder-cmd-norm";
|
||||||
ParamToProp[ FG_SPDBRAKE_CMD ]="fcs/speedbrake-cmd-norm";
|
ParamNameToProp[ "FG_SPDBRAKE_CMD" ]="fcs/speedbrake-cmd-norm";
|
||||||
ParamToProp[ FG_SPOILERS_CMD ]="fcs/spoiler-cmd-norm";
|
ParamNameToProp[ "FG_SPOILERS_CMD" ]="fcs/spoiler-cmd-norm";
|
||||||
ParamToProp[ FG_FLAPS_CMD ]="fcs/flap-cmd-norm";
|
ParamNameToProp[ "FG_FLAPS_CMD" ]="fcs/flap-cmd-norm";
|
||||||
ParamToProp[ FG_THROTTLE_CMD ]="zero";
|
ParamNameToProp[ "FG_THROTTLE_CMD" ]="fcs/throttle-cmd-norm";
|
||||||
ParamToProp[ FG_THROTTLE_POS ]="zero";
|
ParamNameToProp[ "FG_THROTTLE_POS" ]="fcs/throttle-pos-norm";
|
||||||
ParamToProp[ FG_MIXTURE_CMD ]="zero";
|
ParamNameToProp[ "FG_MIXTURE_CMD" ]="fcs/mixture-cmd-norm";
|
||||||
ParamToProp[ FG_MIXTURE_POS ]="zero";
|
ParamNameToProp[ "FG_MIXTURE_POS" ]="fcs/mixture-pos-norm";
|
||||||
ParamToProp[ FG_MAGNETO_CMD ]="zero";
|
ParamNameToProp[ "FG_MAGNETO_CMD" ]="zero";
|
||||||
ParamToProp[ FG_STARTER_CMD ]="zero";
|
ParamNameToProp[ "FG_STARTER_CMD" ]="zero";
|
||||||
ParamToProp[ FG_ACTIVE_ENGINE ]="zero";
|
ParamNameToProp[ "FG_ACTIVE_ENGINE" ]="zero";
|
||||||
ParamToProp[ FG_HOVERB ]="aero/h_b-mac-ft";
|
ParamNameToProp[ "FG_HOVERB" ]="aero/h_b-mac-ft";
|
||||||
ParamToProp[ FG_PITCH_TRIM_CMD ]="fcs/pitch-trim-cmd-norm";
|
ParamNameToProp[ "FG_PITCH_TRIM_CMD" ]="fcs/pitch-trim-cmd-norm";
|
||||||
ParamToProp[ FG_YAW_TRIM_CMD ]="fcs/yaw-trim-cmd-norm";
|
ParamNameToProp[ "FG_YAW_TRIM_CMD" ]="fcs/yaw-trim-cmd-norm";
|
||||||
ParamToProp[ FG_ROLL_TRIM_CMD ]="fcs/roll-trim-cmd-norm";
|
ParamNameToProp[ "FG_ROLL_TRIM_CMD" ]="fcs/roll-trim-cmd-norm";
|
||||||
ParamToProp[ FG_LEFT_BRAKE_CMD ]="zero";
|
ParamNameToProp[ "FG_LEFT_BRAKE_CMD" ]="zero";
|
||||||
ParamToProp[ FG_CENTER_BRAKE_CMD ]="zero";
|
ParamNameToProp[ "FG_CENTER_BRAKE_CMD" ]="zero";
|
||||||
ParamToProp[ FG_RIGHT_BRAKE_CMD ]="zero";
|
ParamNameToProp[ "FG_RIGHT_BRAKE_CMD" ]="zero";
|
||||||
ParamToProp[ FG_SET_LOGGING ]="zero";
|
ParamNameToProp[ "FG_SET_LOGGING" ]="zero";
|
||||||
ParamToProp[ FG_ALPHAH ]="aero/alpha-rad";
|
ParamNameToProp[ "FG_ALPHAH" ]="aero/alpha-rad";
|
||||||
ParamToProp[ FG_ALPHAW ]="aero/alpha-wing-rad";
|
ParamNameToProp[ "FG_ALPHAW" ]="aero/alpha-wing-rad";
|
||||||
ParamToProp[ FG_LBARH ]="metrics/lh-norm";
|
ParamNameToProp[ "FG_LBARH" ]="metrics/lh-norm";
|
||||||
ParamToProp[ FG_LBARV ]="metrics/lv-norm";
|
ParamNameToProp[ "FG_LBARV" ]="metrics/lv-norm";
|
||||||
ParamToProp[ FG_HTAILAREA ]="metrics/Sh-sqft";
|
ParamNameToProp[ "FG_HTAILAREA" ]="metrics/Sh-sqft";
|
||||||
ParamToProp[ FG_VTAILAREA ]="metrics/Sv-sqft";
|
ParamNameToProp[ "FG_VTAILAREA" ]="metrics/Sv-sqft";
|
||||||
ParamToProp[ FG_VBARH ]="metrics/vbarh-norm";
|
ParamNameToProp[ "FG_VBARH" ]="metrics/vbarh-norm";
|
||||||
ParamToProp[ FG_VBARV ]="metrics/vbarv-norm";
|
ParamNameToProp[ "FG_VBARV" ]="metrics/vbarv-norm";
|
||||||
ParamToProp[ FG_GEAR_CMD ]="gear/gear-cmd-norm";
|
ParamNameToProp[ "FG_GEAR_CMD" ]="gear/gear-cmd-norm";
|
||||||
ParamToProp[ FG_GEAR_POS ]="gear/gear-pos-norm";
|
ParamNameToProp[ "FG_GEAR_POS" ]="gear/gear-pos-norm";
|
||||||
|
|
||||||
PropToParam[ "sim-time-sec" ] = FG_TIME;
|
|
||||||
PropToParam[ "aero/qbar-psf" ] = FG_QBAR;
|
|
||||||
PropToParam[ "metrics/Sw-sqft" ] = FG_WINGAREA;
|
|
||||||
PropToParam[ "metrics/bw-ft" ] = FG_WINGSPAN;
|
|
||||||
PropToParam[ "metrics/cbarw-ft" ] = FG_CBAR;
|
|
||||||
PropToParam[ "aero/alpha-rad" ] = FG_ALPHA;
|
|
||||||
PropToParam[ "aero/alphadot-rad_sec" ] = FG_ALPHADOT;
|
|
||||||
PropToParam[ "aero/beta-rad" ] = FG_BETA;
|
|
||||||
PropToParam[ "aero/mag-beta-rad" ] = FG_ABETA;
|
|
||||||
PropToParam[ "aero/betadot-rad_sec" ] = FG_BETADOT;
|
|
||||||
PropToParam[ "attitude/phi-rad" ] = FG_PHI;
|
|
||||||
PropToParam[ "attitude/theta-rad" ] = FG_THT;
|
|
||||||
PropToParam[ "attitude/psi-true-rad" ] = FG_PSI;
|
|
||||||
PropToParam[ "velocities/q-rad_sec" ] = FG_PITCHRATE;
|
|
||||||
PropToParam[ "velocities/p-rad_sec" ] = FG_ROLLRATE;
|
|
||||||
PropToParam[ "velocities/r-rad_sec" ] = FG_YAWRATE;
|
|
||||||
PropToParam[ "velocities/p-aero-rad_sec" ] = FG_AEROP;
|
|
||||||
PropToParam[ "velocities/q-aero-rad_sec" ] = FG_AEROQ;
|
|
||||||
PropToParam[ "velocities/r-aero-rad_sec" ] = FG_AEROR;
|
|
||||||
PropToParam[ "aero/cl-squared-norm" ] = FG_CL_SQRD;
|
|
||||||
PropToParam[ "velocities/mach-norm" ] = FG_MACH;
|
|
||||||
PropToParam[ "position/h-sl-ft" ] = FG_ALTITUDE;
|
|
||||||
PropToParam[ "aero/bi2vel" ] = FG_BI2VEL;
|
|
||||||
PropToParam[ "aero/ci2vel" ] = FG_CI2VEL;
|
|
||||||
PropToParam[ "fcs/elevator-pos-rad" ] = FG_ELEVATOR_POS;
|
|
||||||
PropToParam[ "fcs/mag-elevator-pos-rad" ] = FG_AELEVATOR_POS;
|
|
||||||
PropToParam[ "fcs/elevator-pos-norm" ] = FG_NELEVATOR_POS;
|
|
||||||
PropToParam[ "fcs/left-aileron-pos-rad" ] = FG_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/mag-aileron-pos-rad" ] = FG_AAILERON_POS;
|
|
||||||
PropToParam[ "fcs/left-aileron-pos-norm" ] = FG_NAILERON_POS;
|
|
||||||
PropToParam[ "fcs/left-aileron-pos-rad" ] = FG_LEFT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/mag-left-aileron-pos-rad" ] = FG_ALEFT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/left-aileron-pos-norm" ] = FG_NLEFT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/right-aileron-pos-rad" ] = FG_RIGHT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/mag-aileron-pos-rad" ] = FG_ARIGHT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/right-aileron-pos-norm" ] = FG_NRIGHT_AILERON_POS;
|
|
||||||
PropToParam[ "fcs/rudder-pos-rad" ] = FG_RUDDER_POS;
|
|
||||||
PropToParam[ "fcs/mag-rudder-pos-rad" ] = FG_ARUDDER_POS;
|
|
||||||
PropToParam[ "fcs/rudder-pos-norm" ] = FG_NRUDDER_POS;
|
|
||||||
PropToParam[ "fcs/speedbrake-pos-rad" ] = FG_SPDBRAKE_POS;
|
|
||||||
PropToParam[ "fcs/speedbrake-pos-norm" ] = FG_NSPDBRAKE_POS;
|
|
||||||
PropToParam[ "fcs/spoiler-pos-rad" ] = FG_SPOILERS_POS;
|
|
||||||
PropToParam[ "fcs/spoiler-pos-norm" ] = FG_NSPOILERS_POS;
|
|
||||||
PropToParam[ "fcs/flap-pos-deg" ] = FG_FLAPS_POS;
|
|
||||||
PropToParam[ "fcs/flap-pos-norm" ] = FG_NFLAPS_POS;
|
|
||||||
PropToParam[ "fcs/elevator-cmd-norm" ] = FG_ELEVATOR_CMD;
|
|
||||||
PropToParam[ "fcs/aileron-cmd-norm" ] = FG_AILERON_CMD;
|
|
||||||
PropToParam[ "fcs/rudder-cmd-norm" ] = FG_RUDDER_CMD;
|
|
||||||
PropToParam[ "fcs/speedbrake-cmd-norm" ] = FG_SPDBRAKE_CMD;
|
|
||||||
PropToParam[ "fcs/spoiler-cmd-norm" ] = FG_SPOILERS_CMD;
|
|
||||||
PropToParam[ "fcs/flap-cmd-norm" ] = FG_FLAPS_CMD;
|
|
||||||
PropToParam[ "aero/h_b-mac-ft" ] = FG_HOVERB;
|
|
||||||
PropToParam[ "fcs/pitch-trim-cmd-norm" ] = FG_PITCH_TRIM_CMD;
|
|
||||||
PropToParam[ "fcs/yaw-trim-cmd-norm" ] = FG_YAW_TRIM_CMD;
|
|
||||||
PropToParam[ "fcs/roll-trim-cmd-norm" ] = FG_ROLL_TRIM_CMD;
|
|
||||||
PropToParam[ "aero/alpha-rad" ] = FG_ALPHAH;
|
|
||||||
PropToParam[ "aero/alpha-wing-rad" ] = FG_ALPHAW;
|
|
||||||
PropToParam[ "metrics/lh-norm" ] = FG_LBARH;
|
|
||||||
PropToParam[ "metrics/lv-norm" ] = FG_LBARV;
|
|
||||||
PropToParam[ "metrics/Sh-sqft" ] = FG_HTAILAREA;
|
|
||||||
PropToParam[ "metrics/Sv-sqft" ] = FG_VTAILAREA;
|
|
||||||
PropToParam[ "metrics/vbarh-norm" ] = FG_VBARH;
|
|
||||||
PropToParam[ "metrics/vbarv-norm" ] = FG_VBARV;
|
|
||||||
PropToParam[ "gear/gear-cmd-norm" ] = FG_GEAR_CMD;
|
|
||||||
PropToParam[ "gear/gear-pos-norm" ] = FG_GEAR_POS;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,10 @@ CLASS DOCUMENTATION
|
||||||
/** Encapsulates the calculation of aircraft state.
|
/** Encapsulates the calculation of aircraft state.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGState.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGState.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -166,12 +170,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void Initialize(FGInitialCondition *FGIC);
|
void Initialize(FGInitialCondition *FGIC);
|
||||||
|
|
||||||
/** Stores state data in the supplied file name.
|
|
||||||
@param filename the file to store the data in.
|
|
||||||
@return true if successful.
|
|
||||||
*/
|
|
||||||
bool StoreData(string filename);
|
|
||||||
|
|
||||||
/// returns the speed of sound in feet per second.
|
/// returns the speed of sound in feet per second.
|
||||||
inline double Geta(void) { return a; }
|
inline double Geta(void) { return a; }
|
||||||
|
|
||||||
|
@ -185,38 +183,11 @@ public:
|
||||||
/// Resumes the simulation by resetting delta T to the correct value.
|
/// Resumes the simulation by resetting delta T to the correct value.
|
||||||
inline void Resume(void) {dt = saved_dt;}
|
inline void Resume(void) {dt = saved_dt;}
|
||||||
|
|
||||||
/** Retrieves a parameter.
|
|
||||||
The parameters that can be retrieved are enumerated in FGJSBBase.h.
|
|
||||||
@param val_idx one of the enumerated JSBSim parameters.
|
|
||||||
@return the value of the parameter.
|
|
||||||
*/
|
|
||||||
double GetParameter(eParam val_idx);
|
|
||||||
|
|
||||||
/** Retrieves a parameter.
|
|
||||||
The parameters that can be retrieved are enumerated in FGJSBBase.h.
|
|
||||||
@param val_string a string representing one of the enumerated JSBSim parameters,
|
|
||||||
i.e. "FG_QBAR".
|
|
||||||
@return the value of the parameter.
|
|
||||||
*/
|
|
||||||
double GetParameter(string val_string);
|
|
||||||
|
|
||||||
/** Retrieves the JSBSim parameter enumerated item given the text string.
|
|
||||||
@param val_string the parameter string, i.e. "FG_QBAR".
|
|
||||||
@return the JSBSim parameter index (an enumerated type) for the supplied string.
|
|
||||||
*/
|
|
||||||
eParam GetParameterIndex(string val_string);
|
|
||||||
|
|
||||||
/** Sets the speed of sound.
|
/** Sets the speed of sound.
|
||||||
@param speed the speed of sound in feet per second.
|
@param speed the speed of sound in feet per second.
|
||||||
*/
|
*/
|
||||||
inline void Seta(double speed) { a = speed; }
|
inline void Seta(double speed) { a = speed; }
|
||||||
|
|
||||||
/** Gets the name of the parameter given the index.
|
|
||||||
@param val_idx one of the enumerated JSBSim parameters.
|
|
||||||
@return the name of the parameter pointed to by the index.
|
|
||||||
*/
|
|
||||||
string GetParameterName(eParam val_idx) {return paramdef[val_idx];}
|
|
||||||
|
|
||||||
/** Sets the current sim time.
|
/** Sets the current sim time.
|
||||||
@param cur_time the current time
|
@param cur_time the current time
|
||||||
@return the current time.
|
@return the current time.
|
||||||
|
@ -231,12 +202,6 @@ public:
|
||||||
*/
|
*/
|
||||||
inline void Setdt(double delta_t) { dt = delta_t; }
|
inline void Setdt(double delta_t) { dt = delta_t; }
|
||||||
|
|
||||||
/** Sets the JSBSim parameter to the supplied value.
|
|
||||||
@param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS.
|
|
||||||
@param val the value to give the parameter.
|
|
||||||
*/
|
|
||||||
void SetParameter(eParam prm, double val);
|
|
||||||
|
|
||||||
/** Increments the simulation time.
|
/** Increments the simulation time.
|
||||||
@return the new simulation time.
|
@return the new simulation time.
|
||||||
*/
|
*/
|
||||||
|
@ -309,8 +274,9 @@ public:
|
||||||
*/
|
*/
|
||||||
void ReportState(void);
|
void ReportState(void);
|
||||||
|
|
||||||
inline string GetPropertyName(eParam prm) { return ParamToProp[prm]; }
|
inline string GetPropertyName(string prm) { return ParamNameToProp[prm]; }
|
||||||
inline eParam GetParam(string property) { return PropToParam[property]; }
|
//inline string GetPropertyName(eParam prm) { return ParamIdxToProp[prm]; }
|
||||||
|
//inline eParam GetParam(string property) { return PropToParam[property]; }
|
||||||
|
|
||||||
void bind();
|
void bind();
|
||||||
void unbind();
|
void unbind();
|
||||||
|
@ -347,14 +313,19 @@ private:
|
||||||
FGPropulsion* Propulsion;
|
FGPropulsion* Propulsion;
|
||||||
FGPropertyManager* PropertyManager;
|
FGPropertyManager* PropertyManager;
|
||||||
|
|
||||||
typedef map<string, eParam> CoeffMap;
|
/* typedef map<string, eParam> CoeffMap;
|
||||||
CoeffMap coeffdef;
|
CoeffMap coeffdef;
|
||||||
|
|
||||||
typedef map<eParam, string> ParamMap;
|
typedef map<eParam, string> ParamMap;
|
||||||
ParamMap paramdef;
|
//ParamMap paramdef; */
|
||||||
|
|
||||||
ParamMap ParamToProp;
|
|
||||||
CoeffMap PropToParam;
|
typedef map<string,string> ParamNameMap;
|
||||||
|
ParamNameMap ParamNameToProp;
|
||||||
|
|
||||||
|
typedef map<eParam,string> ParamIdxMap;
|
||||||
|
ParamIdxMap ParamIdxToProp;
|
||||||
|
//CoeffMap PropToParam;
|
||||||
|
|
||||||
int ActiveEngine;
|
int ActiveEngine;
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,10 @@ CLASS DOCUMENTATION
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see FGCoefficient
|
@see FGCoefficient
|
||||||
@see FGPropeller
|
@see FGPropeller
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTable.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTable.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -76,7 +76,7 @@ typedef enum { tLongitudinal, tFull, tGround, tPullup,
|
||||||
tCustom, tNone, tTurn
|
tCustom, tNone, tTurn
|
||||||
} TrimMode;
|
} TrimMode;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -140,6 +140,10 @@ CLASS DOCUMENTATION
|
||||||
fgt->ReportState();
|
fgt->ReportState();
|
||||||
@author Tony Peden
|
@author Tony Peden
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTrim.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTrim.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -51,12 +51,11 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
|
||||||
Type = "";
|
Type = "";
|
||||||
ID = 0;
|
ID = 0;
|
||||||
Input = 0.0;
|
Input = 0.0;
|
||||||
InputIdx = FG_UNDEF;
|
InputNode = 0;
|
||||||
Output = 0.0;
|
Output = 0.0;
|
||||||
sOutputIdx = "";
|
OutputNode = 0;
|
||||||
OutputIdx = FG_UNDEF;
|
|
||||||
IsOutput = false;
|
IsOutput = false;
|
||||||
|
PropertyManager=fcs->GetPropertyManager();
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ FGFCSComponent::~FGFCSComponent()
|
||||||
|
|
||||||
void FGFCSComponent::SetOutput(void)
|
void FGFCSComponent::SetOutput(void)
|
||||||
{
|
{
|
||||||
fcs->GetState()->SetParameter(OutputIdx, Output);
|
OutputNode->setDoubleValue(Output);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -80,14 +79,15 @@ bool FGFCSComponent::Run(void)
|
||||||
{
|
{
|
||||||
switch(InputType) {
|
switch(InputType) {
|
||||||
case itPilotAC:
|
case itPilotAC:
|
||||||
Input = fcs->GetState()->GetParameter(InputIdx);
|
Input = InputNode->getDoubleValue();
|
||||||
break;
|
break;
|
||||||
case itFCS:
|
case itFCS:
|
||||||
Input = fcs->GetComponentOutput(InputIdx);
|
Input = fcs->GetComponentOutput(InputIdx);
|
||||||
break;
|
|
||||||
case itAP:
|
case itAP:
|
||||||
// implement autopilot input mechanism
|
// implement autopilot input mechanism
|
||||||
break;
|
break;
|
||||||
|
case itBias:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -43,6 +43,8 @@ INCLUDES
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../FGJSBBase.h"
|
#include "../FGJSBBase.h"
|
||||||
|
#include "../FGPropertyManager.h"
|
||||||
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
|
@ -100,7 +102,7 @@ public:
|
||||||
virtual bool Run(void);
|
virtual bool Run(void);
|
||||||
virtual void SetOutput(void);
|
virtual void SetOutput(void);
|
||||||
inline double GetOutput (void) {return Output;}
|
inline double GetOutput (void) {return Output;}
|
||||||
inline int GetOutputIdx(void) { return OutputIdx; }
|
inline FGPropertyManager* GetOutputNode(void) { return OutputNode; }
|
||||||
inline string GetName(void) {return Name;}
|
inline string GetName(void) {return Name;}
|
||||||
inline string GetType(void) { return Type; }
|
inline string GetType(void) { return Type; }
|
||||||
virtual double GetOutputPct(void) { return 0; }
|
virtual double GetOutputPct(void) { return 0; }
|
||||||
|
@ -109,13 +111,14 @@ protected:
|
||||||
/// Pilot/Aircraft, FCS, Autopilot inputs
|
/// Pilot/Aircraft, FCS, Autopilot inputs
|
||||||
enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
|
enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
|
||||||
FGFCS* fcs;
|
FGFCS* fcs;
|
||||||
|
FGPropertyManager* PropertyManager;
|
||||||
string Type;
|
string Type;
|
||||||
string Name;
|
string Name;
|
||||||
int ID;
|
int ID;
|
||||||
eParam InputIdx;
|
FGPropertyManager* InputNode;
|
||||||
|
int InputIdx;
|
||||||
double Input;
|
double Input;
|
||||||
string sOutputIdx;
|
FGPropertyManager* OutputNode;
|
||||||
eParam OutputIdx;
|
|
||||||
double Output;
|
double Output;
|
||||||
bool IsOutput;
|
bool IsOutput;
|
||||||
virtual void Debug(int from);
|
virtual void Debug(int from);
|
||||||
|
|
|
@ -51,6 +51,7 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
double denom;
|
double denom;
|
||||||
|
string sOutputIdx;
|
||||||
|
|
||||||
Type = AC_cfg->GetValue("TYPE");
|
Type = AC_cfg->GetValue("TYPE");
|
||||||
Name = AC_cfg->GetValue("NAME");
|
Name = AC_cfg->GetValue("NAME");
|
||||||
|
@ -80,7 +81,8 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
token = AC_cfg->GetValue("INPUT");
|
token = AC_cfg->GetValue("INPUT");
|
||||||
if (token.find("FG_") != token.npos) {
|
if (token.find("FG_") != token.npos) {
|
||||||
*AC_cfg >> token;
|
*AC_cfg >> token;
|
||||||
InputIdx = fcs->GetState()->GetParameterIndex(token);
|
InputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(token) );
|
||||||
InputType = itPilotAC;
|
InputType = itPilotAC;
|
||||||
} else {
|
} else {
|
||||||
*AC_cfg >> InputIdx;
|
*AC_cfg >> InputIdx;
|
||||||
|
@ -91,7 +93,8 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
{
|
{
|
||||||
IsOutput = true;
|
IsOutput = true;
|
||||||
*AC_cfg >> sOutputIdx;
|
*AC_cfg >> sOutputIdx;
|
||||||
OutputIdx = fcs->GetState()->GetParameterIndex(sOutputIdx);
|
OutputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(sOutputIdx) );
|
||||||
}
|
}
|
||||||
else cerr << "Unknown filter type: " << token << endl;
|
else cerr << "Unknown filter type: " << token << endl;
|
||||||
}
|
}
|
||||||
|
@ -215,12 +218,15 @@ void FGFilter::Debug(int from)
|
||||||
cout << " ID: " << ID << endl;
|
cout << " ID: " << ID << endl;
|
||||||
switch(InputType) {
|
switch(InputType) {
|
||||||
case itPilotAC:
|
case itPilotAC:
|
||||||
cout << " INPUT: " << fcs->GetState()->GetParameterName(InputIdx) << endl;
|
cout << " INPUT: " << InputNode->getName() << endl;
|
||||||
break;
|
break;
|
||||||
case itFCS:
|
case itFCS:
|
||||||
cout << " INPUT: FCS Component " << InputIdx << " (" <<
|
cout << " INPUT: FCS Component " << InputIdx << " (" <<
|
||||||
fcs->GetComponentName(InputIdx) << ")" << endl;
|
fcs->GetComponentName(InputIdx) << ")" << endl;
|
||||||
break;
|
break;
|
||||||
|
case itAP:
|
||||||
|
case itBias:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cout << " C1: " << C1 << endl;
|
cout << " C1: " << C1 << endl;
|
||||||
cout << " C2: " << C2 << endl;
|
cout << " C2: " << C2 << endl;
|
||||||
|
@ -228,7 +234,7 @@ void FGFilter::Debug(int from)
|
||||||
cout << " C4: " << C4 << endl;
|
cout << " C4: " << C4 << endl;
|
||||||
cout << " C5: " << C5 << endl;
|
cout << " C5: " << C5 << endl;
|
||||||
cout << " C6: " << C6 << endl;
|
cout << " C6: " << C6 << endl;
|
||||||
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
|
if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -77,6 +77,10 @@ CLASS DOCUMENTATION
|
||||||
</pre>
|
</pre>
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFilter.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFilter.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -52,6 +52,7 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
string strScheduledBy;
|
string strScheduledBy;
|
||||||
|
string sOutputIdx;
|
||||||
|
|
||||||
State = fcs->GetState();
|
State = fcs->GetState();
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
Min = Max = 0.0;
|
Min = Max = 0.0;
|
||||||
OutputPct=0;
|
OutputPct=0;
|
||||||
invert=false;
|
invert=false;
|
||||||
ScheduledBy = FG_UNDEF;
|
ScheduledBy = 0;
|
||||||
|
|
||||||
Type = AC_cfg->GetValue("TYPE");
|
Type = AC_cfg->GetValue("TYPE");
|
||||||
Name = AC_cfg->GetValue("NAME");
|
Name = AC_cfg->GetValue("NAME");
|
||||||
|
@ -74,7 +75,8 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
token = AC_cfg->GetValue("INPUT");
|
token = AC_cfg->GetValue("INPUT");
|
||||||
if (token.find("FG_") != token.npos) {
|
if (token.find("FG_") != token.npos) {
|
||||||
*AC_cfg >> token;
|
*AC_cfg >> token;
|
||||||
InputIdx = State->GetParameterIndex(token);
|
InputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(token) );
|
||||||
InputType = itPilotAC;
|
InputType = itPilotAC;
|
||||||
} else {
|
} else {
|
||||||
*AC_cfg >> InputIdx;
|
*AC_cfg >> InputIdx;
|
||||||
|
@ -95,14 +97,15 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
token = AC_cfg->GetValue("SCHEDULED_BY");
|
token = AC_cfg->GetValue("SCHEDULED_BY");
|
||||||
if (token.find("FG_") != token.npos) {
|
if (token.find("FG_") != token.npos) {
|
||||||
*AC_cfg >> strScheduledBy;
|
*AC_cfg >> strScheduledBy;
|
||||||
ScheduledBy = State->GetParameterIndex(strScheduledBy);
|
ScheduledBy = PropertyManager->GetNode(
|
||||||
} else {
|
fcs->GetState()->GetPropertyName(strScheduledBy) );
|
||||||
*AC_cfg >> ScheduledBy;
|
|
||||||
}
|
}
|
||||||
} else if (token == "OUTPUT") {
|
} else if (token == "OUTPUT") {
|
||||||
IsOutput = true;
|
IsOutput = true;
|
||||||
*AC_cfg >> sOutputIdx;
|
*AC_cfg >> sOutputIdx;
|
||||||
OutputIdx = State->GetParameterIndex(sOutputIdx);
|
OutputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(sOutputIdx) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
AC_cfg->ResetLineIndexToZero();
|
AC_cfg->ResetLineIndexToZero();
|
||||||
*Table << *AC_cfg;
|
*Table << *AC_cfg;
|
||||||
|
@ -130,7 +133,7 @@ bool FGGain::Run(void )
|
||||||
if (Type == "PURE_GAIN") {
|
if (Type == "PURE_GAIN") {
|
||||||
Output = Gain * Input;
|
Output = Gain * Input;
|
||||||
} else if (Type == "SCHEDULED_GAIN") {
|
} else if (Type == "SCHEDULED_GAIN") {
|
||||||
LookupVal = State->GetParameter(ScheduledBy);
|
LookupVal = ScheduledBy->getDoubleValue();
|
||||||
SchedGain = Table->GetValue(LookupVal);
|
SchedGain = Table->GetValue(LookupVal);
|
||||||
Output = Gain * SchedGain * Input;
|
Output = Gain * SchedGain * Input;
|
||||||
} else if (Type == "AEROSURFACE_SCALE") {
|
} else if (Type == "AEROSURFACE_SCALE") {
|
||||||
|
@ -179,20 +182,23 @@ void FGGain::Debug(int from)
|
||||||
cout << " ID: " << ID << endl;
|
cout << " ID: " << ID << endl;
|
||||||
switch(InputType) {
|
switch(InputType) {
|
||||||
case itPilotAC:
|
case itPilotAC:
|
||||||
cout << " INPUT: " << State->GetParameterName(InputIdx) << endl;
|
cout << " INPUT: " << InputNode->getName() << endl;
|
||||||
break;
|
break;
|
||||||
case itFCS:
|
case itFCS:
|
||||||
cout << " INPUT: FCS Component " << InputIdx << " (" <<
|
cout << " INPUT: FCS Component " << InputIdx << " (" <<
|
||||||
fcs->GetComponentName(InputIdx) << ")" << endl;
|
fcs->GetComponentName(InputIdx) << ")" << endl;
|
||||||
break;
|
break;
|
||||||
|
case itAP:
|
||||||
|
case itBias:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cout << " GAIN: " << Gain << endl;
|
cout << " GAIN: " << Gain << endl;
|
||||||
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
|
if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
|
||||||
cout << " MIN: " << Min << endl;
|
cout << " MIN: " << Min << endl;
|
||||||
cout << " MAX: " << Max << endl;
|
cout << " MAX: " << Max << endl;
|
||||||
if(invert) cout << " Invert mapping" << endl;
|
if(invert) cout << " Invert mapping" << endl;
|
||||||
if (ScheduledBy != FG_UNDEF) {
|
if (ScheduledBy != 0) {
|
||||||
cout << " Scheduled by parameter: " << ScheduledBy << endl;
|
cout << " Scheduled by parameter: " << ScheduledBy->getName() << endl;
|
||||||
Table->Print();
|
Table->Print();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ INCLUDES
|
||||||
#include "../FGConfigFile.h"
|
#include "../FGConfigFile.h"
|
||||||
#include "../FGTable.h"
|
#include "../FGTable.h"
|
||||||
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINES
|
DEFINES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
@ -84,7 +85,7 @@ private:
|
||||||
double OutputPct;
|
double OutputPct;
|
||||||
bool invert;
|
bool invert;
|
||||||
int Rows;
|
int Rows;
|
||||||
eParam ScheduledBy;
|
FGPropertyManager* ScheduledBy;
|
||||||
|
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,7 @@ CLASS IMPLEMENTATION
|
||||||
FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
AC_cfg(AC_cfg)
|
AC_cfg(AC_cfg)
|
||||||
{
|
{
|
||||||
string token;
|
string token,sOutputIdx;
|
||||||
double tmpDetent;
|
double tmpDetent;
|
||||||
double tmpTime;
|
double tmpTime;
|
||||||
|
|
||||||
|
@ -70,8 +70,12 @@ FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
token = AC_cfg->GetValue("INPUT");
|
token = AC_cfg->GetValue("INPUT");
|
||||||
if (token.find("FG_") != token.npos) {
|
if (token.find("FG_") != token.npos) {
|
||||||
*AC_cfg >> token;
|
*AC_cfg >> token;
|
||||||
InputIdx = fcs->GetState()->GetParameterIndex(token);
|
InputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(token) );
|
||||||
InputType = itPilotAC;
|
InputType = itPilotAC;
|
||||||
|
} else {
|
||||||
|
*AC_cfg >> InputIdx;
|
||||||
|
InputType = itFCS;
|
||||||
}
|
}
|
||||||
} else if ( token == "DETENTS" ) {
|
} else if ( token == "DETENTS" ) {
|
||||||
*AC_cfg >> NumDetents;
|
*AC_cfg >> NumDetents;
|
||||||
|
@ -85,7 +89,8 @@ FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
|
|
||||||
IsOutput = true;
|
IsOutput = true;
|
||||||
*AC_cfg >> sOutputIdx;
|
*AC_cfg >> sOutputIdx;
|
||||||
OutputIdx = fcs->GetState()->GetParameterIndex(sOutputIdx);
|
OutputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(sOutputIdx) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +112,7 @@ bool FGKinemat::Run(void ) {
|
||||||
|
|
||||||
FGFCSComponent::Run(); // call the base class for initialization of Input
|
FGFCSComponent::Run(); // call the base class for initialization of Input
|
||||||
InputCmd = Input*Detents[NumDetents-1];
|
InputCmd = Input*Detents[NumDetents-1];
|
||||||
OutputPos = fcs->GetState()->GetParameter(OutputIdx);
|
OutputPos = OutputNode->getDoubleValue();
|
||||||
|
|
||||||
if(InputCmd < Detents[0]) {
|
if(InputCmd < Detents[0]) {
|
||||||
fi=0;
|
fi=0;
|
||||||
|
@ -127,11 +132,10 @@ bool FGKinemat::Run(void ) {
|
||||||
OutputPos=InputCmd;
|
OutputPos=InputCmd;
|
||||||
else {
|
else {
|
||||||
if(InputCmd != lastInputCmd) {
|
if(InputCmd != lastInputCmd) {
|
||||||
|
|
||||||
InTransit=1;
|
InTransit=1;
|
||||||
}
|
}
|
||||||
|
//cout << "FGKinemat::Run, InTransit: " << InTransit << endl;
|
||||||
if(InTransit) {
|
if(InTransit) {
|
||||||
|
|
||||||
//fprintf(stderr,"InputCmd: %g, OutputPos: %g\n",InputCmd,OutputPos);
|
//fprintf(stderr,"InputCmd: %g, OutputPos: %g\n",InputCmd,OutputPos);
|
||||||
fi=0;
|
fi=0;
|
||||||
while(Detents[fi] < InputCmd) {
|
while(Detents[fi] < InputCmd) {
|
||||||
|
@ -142,15 +146,18 @@ bool FGKinemat::Run(void ) {
|
||||||
output_transit_rate=(Detents[fi] - Detents[fi-1])/TransitionTimes[fi];
|
output_transit_rate=(Detents[fi] - Detents[fi-1])/TransitionTimes[fi];
|
||||||
else
|
else
|
||||||
output_transit_rate=(Detents[fi] - Detents[fi-1])/5;
|
output_transit_rate=(Detents[fi] - Detents[fi-1])/5;
|
||||||
|
//cout << "FGKinemat::Run, output_transit_rate: " << output_transit_rate << endl;
|
||||||
} else {
|
} else {
|
||||||
if(TransitionTimes[fi+1] > 0)
|
if(TransitionTimes[fi+1] > 0)
|
||||||
output_transit_rate=(Detents[fi] - Detents[fi+1])/TransitionTimes[fi+1];
|
output_transit_rate=(Detents[fi] - Detents[fi+1])/TransitionTimes[fi+1];
|
||||||
else
|
else
|
||||||
output_transit_rate=(Detents[fi] - Detents[fi+1])/5;
|
output_transit_rate=(Detents[fi] - Detents[fi+1])/5;
|
||||||
}
|
}
|
||||||
if(fabs(OutputPos - InputCmd) > fabs(dt*output_transit_rate) )
|
if(fabs(OutputPos - InputCmd) > fabs(dt*output_transit_rate) ) {
|
||||||
OutputPos+=output_transit_rate*dt;
|
OutputPos+=output_transit_rate*dt;
|
||||||
else {
|
//cout << "FGKinemat::Run, OutputPos: " << OutputPos
|
||||||
|
// << " dt: " << dt << endl;
|
||||||
|
} else {
|
||||||
InTransit=0;
|
InTransit=0;
|
||||||
OutputPos=InputCmd;
|
OutputPos=InputCmd;
|
||||||
}
|
}
|
||||||
|
@ -195,12 +202,12 @@ void FGKinemat::Debug(int from)
|
||||||
if (debug_lvl & 1) { // Standard console startup message output
|
if (debug_lvl & 1) { // Standard console startup message output
|
||||||
if (from == 0) { // Constructor
|
if (from == 0) { // Constructor
|
||||||
cout << " ID: " << ID << endl;
|
cout << " ID: " << ID << endl;
|
||||||
cout << " INPUT: " << InputIdx << endl;
|
cout << " INPUT: " << InputNode->getName() << endl;
|
||||||
cout << " DETENTS: " << NumDetents << endl;
|
cout << " DETENTS: " << NumDetents << endl;
|
||||||
for(int i=0;i<NumDetents;i++) {
|
for(int i=0;i<NumDetents;i++) {
|
||||||
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
|
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
|
||||||
}
|
}
|
||||||
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
|
if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -50,14 +50,14 @@ CLASS IMPLEMENTATION
|
||||||
FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
AC_cfg(AC_cfg)
|
AC_cfg(AC_cfg)
|
||||||
{
|
{
|
||||||
string token;
|
string token,sOutputIdx;
|
||||||
eParam tmpInputIndex;
|
eParam tmpInputIndex;
|
||||||
|
InputRec *input;
|
||||||
|
|
||||||
clip = false;
|
clip = false;
|
||||||
clipmin = clipmax = 0.0;
|
clipmin = clipmax = 0.0;
|
||||||
Bias = 0.0;
|
Bias = 0.0;
|
||||||
InputIndices.clear();
|
Inputs.clear();
|
||||||
InputTypes.clear();
|
|
||||||
|
|
||||||
Type = AC_cfg->GetValue("TYPE");
|
Type = AC_cfg->GetValue("TYPE");
|
||||||
Name = AC_cfg->GetValue("NAME");
|
Name = AC_cfg->GetValue("NAME");
|
||||||
|
@ -69,21 +69,26 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
if (token == "ID") {
|
if (token == "ID") {
|
||||||
*AC_cfg >> ID;
|
*AC_cfg >> ID;
|
||||||
} else if (token == "INPUT") {
|
} else if (token == "INPUT") {
|
||||||
|
input = new InputRec;
|
||||||
token = AC_cfg->GetValue("INPUT");
|
token = AC_cfg->GetValue("INPUT");
|
||||||
if (token.find("FG_") != token.npos) {
|
if (token.find("FG_") != token.npos) {
|
||||||
*AC_cfg >> token;
|
*AC_cfg >> token;
|
||||||
tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
|
input->Node = PropertyManager->GetNode(
|
||||||
InputIndices.push_back(tmpInputIndex);
|
fcs->GetState()->GetPropertyName(token) );
|
||||||
InputTypes.push_back(itPilotAC);
|
input->Idx=-1;
|
||||||
|
input->Type = itPilotAC;
|
||||||
} else if (token.find(".") != token.npos) { // bias
|
} else if (token.find(".") != token.npos) { // bias
|
||||||
*AC_cfg >> Bias;
|
*AC_cfg >> Bias;
|
||||||
InputIndices.push_back((eParam)0);
|
input->Node=0;
|
||||||
InputTypes.push_back(itBias);
|
input->Idx=0;
|
||||||
|
input->Type=itBias;
|
||||||
} else {
|
} else {
|
||||||
*AC_cfg >> tmpInputIndex;
|
*AC_cfg >> tmpInputIndex;
|
||||||
InputIndices.push_back(tmpInputIndex);
|
input->Idx=tmpInputIndex;
|
||||||
InputTypes.push_back(itFCS);
|
input->Node=0;
|
||||||
|
input->Type=itFCS;
|
||||||
}
|
}
|
||||||
|
Inputs.push_back(input);
|
||||||
} else if (token == "CLIPTO") {
|
} else if (token == "CLIPTO") {
|
||||||
*AC_cfg >> clipmin >> clipmax;
|
*AC_cfg >> clipmin >> clipmax;
|
||||||
if (clipmax > clipmin) {
|
if (clipmax > clipmin) {
|
||||||
|
@ -92,7 +97,8 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
} else if (token == "OUTPUT") {
|
} else if (token == "OUTPUT") {
|
||||||
IsOutput = true;
|
IsOutput = true;
|
||||||
*AC_cfg >> sOutputIdx;
|
*AC_cfg >> sOutputIdx;
|
||||||
OutputIdx = fcs->GetState()->GetParameterIndex(sOutputIdx);
|
OutputNode = PropertyManager->GetNode(
|
||||||
|
fcs->GetState()->GetPropertyName(sOutputIdx) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +109,10 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||||
|
|
||||||
FGSummer::~FGSummer()
|
FGSummer::~FGSummer()
|
||||||
{
|
{
|
||||||
|
unsigned i;
|
||||||
|
for(i=0;i<Inputs.size();i++) {
|
||||||
|
delete Inputs[i];
|
||||||
|
}
|
||||||
Debug(1);
|
Debug(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,13 +127,13 @@ bool FGSummer::Run(void )
|
||||||
|
|
||||||
Output = 0.0;
|
Output = 0.0;
|
||||||
|
|
||||||
for (idx=0; idx<InputIndices.size(); idx++) {
|
for (idx=0; idx<Inputs.size(); idx++) {
|
||||||
switch (InputTypes[idx]) {
|
switch (Inputs[idx]->Type) {
|
||||||
case itPilotAC:
|
case itPilotAC:
|
||||||
Output += fcs->GetState()->GetParameter(InputIndices[idx]);
|
Output += Inputs[idx]->Node->getDoubleValue();
|
||||||
break;
|
break;
|
||||||
case itFCS:
|
case itFCS:
|
||||||
Output += fcs->GetComponentOutput(InputIndices[idx]);
|
Output += fcs->GetComponentOutput(Inputs[idx]->Idx);
|
||||||
break;
|
break;
|
||||||
case itBias:
|
case itBias:
|
||||||
Output += Bias;
|
Output += Bias;
|
||||||
|
@ -168,14 +178,14 @@ void FGSummer::Debug(int from)
|
||||||
if (from == 0) { // Constructor
|
if (from == 0) { // Constructor
|
||||||
cout << " ID: " << ID << endl;
|
cout << " ID: " << ID << endl;
|
||||||
cout << " INPUTS: " << endl;
|
cout << " INPUTS: " << endl;
|
||||||
for (unsigned i=0;i<InputIndices.size();i++) {
|
for (unsigned i=0;i<Inputs.size();i++) {
|
||||||
switch (InputTypes[i]) {
|
switch (Inputs[i]->Type) {
|
||||||
case itPilotAC:
|
case itPilotAC:
|
||||||
cout << " " << fcs->GetState()->GetParameterName(InputIndices[i]) << endl;
|
cout << " " << Inputs[i]->Node->getName() << endl;
|
||||||
break;
|
break;
|
||||||
case itFCS:
|
case itFCS:
|
||||||
cout << " FCS Component " << InputIndices[i] << " (" <<
|
cout << " FCS Component " << Inputs[i]->Idx << " (" <<
|
||||||
fcs->GetComponentName(InputIndices[i]) << ")" << endl;
|
fcs->GetComponentName(Inputs[i]->Idx) << ")" << endl;
|
||||||
break;
|
break;
|
||||||
case itBias:
|
case itBias:
|
||||||
cout << " " << "Bias of " << Bias << endl;
|
cout << " " << "Bias of " << Bias << endl;
|
||||||
|
@ -184,7 +194,7 @@ void FGSummer::Debug(int from)
|
||||||
}
|
}
|
||||||
if (clip) cout << " CLIPTO: " << clipmin
|
if (clip) cout << " CLIPTO: " << clipmin
|
||||||
<< ", " << clipmax << endl;
|
<< ", " << clipmax << endl;
|
||||||
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
|
if (IsOutput) cout << " OUTPUT: " <<OutputNode->getName() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -75,7 +75,10 @@ CLASS DOCUMENTATION
|
||||||
state variables, or even floating point numbers (e.g. for a bias).
|
state variables, or even floating point numbers (e.g. for a bias).
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGSummer.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Header File </a>
|
||||||
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGSummer.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
||||||
|
Source File </a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -97,8 +100,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FGConfigFile* AC_cfg;
|
FGConfigFile* AC_cfg;
|
||||||
vector <eParam> InputIndices;
|
typedef struct {
|
||||||
vector <int> InputTypes;
|
FGPropertyManager* Node;
|
||||||
|
int Idx;
|
||||||
|
int Type;
|
||||||
|
} InputRec;
|
||||||
|
vector <InputRec*> Inputs;
|
||||||
bool clip;
|
bool clip;
|
||||||
double clipmin,clipmax;
|
double clipmin,clipmax;
|
||||||
double Bias;
|
double Bias;
|
||||||
|
|
Loading…
Add table
Reference in a new issue