Updates. Includes property tree additions and fixes. Also Jon's first cut at
multi-fdm capability. Thanks also to Erik for pointing out a couple of typos.
This commit is contained in:
parent
464c060171
commit
d2156b5649
21 changed files with 455 additions and 255 deletions
|
@ -164,11 +164,9 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
|
|||
if( token == "COEFFICIENT" ) {
|
||||
ca.push_back( new FGCoefficient(FDMExec) );
|
||||
ca.back()->Load(AC_cfg);
|
||||
cm[ca.back()->Getname()]=ca.back();
|
||||
} else if ( token == "GROUP" ) {
|
||||
ca.push_back( new FGFactorGroup(FDMExec) );
|
||||
ca.back()->Load(AC_cfg);
|
||||
cm[ca.back()->Getname()]=ca.back();
|
||||
}
|
||||
}
|
||||
Coeff[AxisIdx[axis]] = ca;
|
||||
|
@ -257,15 +255,14 @@ void FGAerodynamics::bindModel(void) {
|
|||
|
||||
unsigned i,j;
|
||||
FGPropertyManager* node;
|
||||
string prop_name;
|
||||
|
||||
string axis_node_name;
|
||||
node = PropertyManager->GetNode("aero/buildup",true);
|
||||
for(i=0;i<NAxes;i++) {
|
||||
node=node->GetNode( string(AxisNames[i]),true );
|
||||
for (j=0; j < Coeff[i].size(); j++) {
|
||||
prop_name = "aero/buildup/" + string(AxisNames[i])
|
||||
+ "/" + Coeff[i][j]->Getname();
|
||||
node= PropertyManager->GetNode(prop_name,true);
|
||||
Coeff[i][j]->bind(node);
|
||||
}
|
||||
}
|
||||
node=(FGPropertyManager*)node->getParent();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,8 +135,6 @@ public:
|
|||
coefficients */
|
||||
string GetCoefficientValues(void);
|
||||
|
||||
inline FGCoefficient* GetCoefficient(string name) { return cm[name]; }
|
||||
|
||||
void bind(void);
|
||||
void bindModel(void);
|
||||
void unbind(void);
|
||||
|
@ -146,8 +144,6 @@ private:
|
|||
AxisIndex AxisIdx;
|
||||
typedef vector<FGCoefficient*> CoeffArray;
|
||||
CoeffArray* Coeff;
|
||||
typedef map<string,FGCoefficient*> CoeffMap;
|
||||
CoeffMap cm;
|
||||
FGColumnVector3 vFs;
|
||||
FGColumnVector3 vForces;
|
||||
FGColumnVector3 vMoments;
|
||||
|
|
|
@ -101,7 +101,6 @@ CLASS IMPLEMENTATION
|
|||
|
||||
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||
{
|
||||
|
||||
Name = "FGAircraft";
|
||||
alphaclmin = alphaclmax = 0;
|
||||
HTailArea = VTailArea = HTailArm = VTailArm = 0.0;
|
||||
|
@ -276,51 +275,9 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
|
|||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
// out the normally expected messages, essentially echoing
|
||||
// the config files as they are read. If the environment
|
||||
// variable is not set, debug_lvl is set to 1 internally
|
||||
// 0: This requests JSBSim not to output any messages
|
||||
// whatsoever.
|
||||
// 1: This value explicity requests the normal JSBSim
|
||||
// startup messages
|
||||
// 2: This value asks for a message to be printed out when
|
||||
// a class is instantiated
|
||||
// 4: When this value is set, a message is displayed when a
|
||||
// FGModel object executes its Run() method
|
||||
// 8: When this value is set, various runtime state variables
|
||||
// are printed out periodically
|
||||
// 16: When set various parameters are sanity checked and
|
||||
// a message is printed out when they go out of bounds
|
||||
|
||||
void FGAircraft::Debug(int from)
|
||||
void FGAircraft::bind(void)
|
||||
{
|
||||
if (debug_lvl <= 0) return;
|
||||
|
||||
if (debug_lvl & 1) { // Standard console startup message output
|
||||
if (from == 0) { // Constructor
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
if (from == 0) cout << "Instantiated: FGAircraft" << endl;
|
||||
if (from == 1) cout << "Destroyed: FGAircraft" << endl;
|
||||
}
|
||||
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
||||
}
|
||||
if (debug_lvl & 8 ) { // Runtime state variables
|
||||
}
|
||||
if (debug_lvl & 16) { // Sanity checking
|
||||
}
|
||||
if (debug_lvl & 64) {
|
||||
if (from == 0) { // Constructor
|
||||
cout << IdSrc << endl;
|
||||
cout << IdHdr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FGAircraft::bind(void){
|
||||
PropertyManager->Tie("metrics/Sw-sqft", this,
|
||||
&FGAircraft::GetWingArea);
|
||||
PropertyManager->Tie("metrics/bw-ft", this,
|
||||
|
@ -387,7 +344,10 @@ void FGAircraft::bind(void){
|
|||
&FGAircraft::GetStallWarn);
|
||||
}
|
||||
|
||||
void FGAircraft::unbind(void){
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::unbind(void)
|
||||
{
|
||||
PropertyManager->Untie("metrics/Sw-sqft");
|
||||
PropertyManager->Untie("metrics/bw-ft");
|
||||
PropertyManager->Untie("metrics/cbarw-ft");
|
||||
|
@ -412,10 +372,56 @@ void FGAircraft::unbind(void){
|
|||
PropertyManager->Untie("metrics/eyepoint-x-ft");
|
||||
PropertyManager->Untie("metrics/eyepoint-y-ft");
|
||||
PropertyManager->Untie("metrics/eyepoint-z-ft");
|
||||
PropertyManager->Untie("metrics/alpha-max-deg");
|
||||
PropertyManager->Untie("metrics/alpha-min-deg");
|
||||
PropertyManager->Untie("metrics/alpha-max-rad");
|
||||
PropertyManager->Untie("metrics/alpha-min-rad");
|
||||
PropertyManager->Untie("aero/bi2vel");
|
||||
PropertyManager->Untie("aero/ci2vel");
|
||||
PropertyManager->Untie("aero/alpha-wing-rad");
|
||||
PropertyManager->Untie("systems/stall-warn-norm");
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
// out the normally expected messages, essentially echoing
|
||||
// the config files as they are read. If the environment
|
||||
// variable is not set, debug_lvl is set to 1 internally
|
||||
// 0: This requests JSBSim not to output any messages
|
||||
// whatsoever.
|
||||
// 1: This value explicity requests the normal JSBSim
|
||||
// startup messages
|
||||
// 2: This value asks for a message to be printed out when
|
||||
// a class is instantiated
|
||||
// 4: When this value is set, a message is displayed when a
|
||||
// FGModel object executes its Run() method
|
||||
// 8: When this value is set, various runtime state variables
|
||||
// are printed out periodically
|
||||
// 16: When set various parameters are sanity checked and
|
||||
// a message is printed out when they go out of bounds
|
||||
|
||||
void FGAircraft::Debug(int from)
|
||||
{
|
||||
if (debug_lvl <= 0) return;
|
||||
|
||||
if (debug_lvl & 1) { // Standard console startup message output
|
||||
if (from == 0) { // Constructor
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
if (from == 0) cout << "Instantiated: FGAircraft" << endl;
|
||||
if (from == 1) cout << "Destroyed: FGAircraft" << endl;
|
||||
}
|
||||
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
||||
}
|
||||
if (debug_lvl & 8 ) { // Runtime state variables
|
||||
}
|
||||
if (debug_lvl & 16) { // Sanity checking
|
||||
}
|
||||
if (debug_lvl & 64) {
|
||||
if (from == 0) { // Constructor
|
||||
cout << IdSrc << endl;
|
||||
cout << IdHdr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -293,6 +293,66 @@ void FGAtmosphere::Turbulence(void)
|
|||
}
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAtmosphere::bind(void)
|
||||
{
|
||||
PropertyManager->Tie("atmosphere/T-R", this,
|
||||
&FGAtmosphere::GetTemperature);
|
||||
PropertyManager->Tie("atmosphere/rho-slugs_ft3", this,
|
||||
&FGAtmosphere::GetDensity);
|
||||
PropertyManager->Tie("atmosphere/P-psf", this,
|
||||
&FGAtmosphere::GetPressure);
|
||||
PropertyManager->Tie("atmosphere/a-fps", this,
|
||||
&FGAtmosphere::GetSoundSpeed);
|
||||
PropertyManager->Tie("atmosphere/T-sl-R", this,
|
||||
&FGAtmosphere::GetTemperatureSL);
|
||||
PropertyManager->Tie("atmosphere/rho-sl-slugs_ft3", this,
|
||||
&FGAtmosphere::GetDensitySL);
|
||||
PropertyManager->Tie("atmosphere/P-sl-psf", this,
|
||||
&FGAtmosphere::GetPressureSL);
|
||||
PropertyManager->Tie("atmosphere/a-sl-fps", this,
|
||||
&FGAtmosphere::GetSoundSpeedSL);
|
||||
PropertyManager->Tie("atmosphere/theta-norm", this,
|
||||
&FGAtmosphere::GetTemperatureRatio);
|
||||
PropertyManager->Tie("atmosphere/sigma-norm", this,
|
||||
&FGAtmosphere::GetDensityRatio);
|
||||
PropertyManager->Tie("atmosphere/delta-norm", this,
|
||||
&FGAtmosphere::GetPressureRatio);
|
||||
PropertyManager->Tie("atmosphere/a-norm", this,
|
||||
&FGAtmosphere::GetSoundSpeedRatio);
|
||||
PropertyManager->Tie("atmosphere/psiw-rad", this,
|
||||
&FGAtmosphere::GetWindPsi);
|
||||
PropertyManager->Tie("atmosphere/p-turb-rad_sec", this,1,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
PropertyManager->Tie("atmosphere/q-turb-rad_sec", this,2,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
PropertyManager->Tie("atmosphere/r-turb-rad_sec", this,3,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAtmosphere::unbind(void)
|
||||
{
|
||||
PropertyManager->Untie("atmosphere/T-R");
|
||||
PropertyManager->Untie("atmosphere/rho-slugs_ft3");
|
||||
PropertyManager->Untie("atmosphere/P-psf");
|
||||
PropertyManager->Untie("atmosphere/a-fps");
|
||||
PropertyManager->Untie("atmosphere/T-sl-R");
|
||||
PropertyManager->Untie("atmosphere/rho-sl-slugs_ft3");
|
||||
PropertyManager->Untie("atmosphere/P-sl-psf");
|
||||
PropertyManager->Untie("atmosphere/a-sl-fps");
|
||||
PropertyManager->Untie("atmosphere/theta-norm");
|
||||
PropertyManager->Untie("atmosphere/sigma-norm");
|
||||
PropertyManager->Untie("atmosphere/delta-norm");
|
||||
PropertyManager->Untie("atmosphere/a-norm");
|
||||
PropertyManager->Untie("atmosphere/psiw-rad");
|
||||
PropertyManager->Untie("atmosphere/p-turb-rad_sec");
|
||||
PropertyManager->Untie("atmosphere/q-turb-rad_sec");
|
||||
PropertyManager->Untie("atmosphere/r-turb-rad_sec");
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
|
@ -349,56 +409,3 @@ void FGAtmosphere::Debug(int from)
|
|||
}
|
||||
}
|
||||
|
||||
void FGAtmosphere::bind(void){
|
||||
PropertyManager->Tie("atmosphere/T-R", this,
|
||||
&FGAtmosphere::GetTemperature);
|
||||
PropertyManager->Tie("atmosphere/rho-slugs_ft3", this,
|
||||
&FGAtmosphere::GetDensity);
|
||||
PropertyManager->Tie("atmosphere/P-psf", this,
|
||||
&FGAtmosphere::GetPressure);
|
||||
PropertyManager->Tie("atmosphere/a-fps", this,
|
||||
&FGAtmosphere::GetSoundSpeed);
|
||||
PropertyManager->Tie("atmosphere/T-sl-R", this,
|
||||
&FGAtmosphere::GetTemperatureSL);
|
||||
PropertyManager->Tie("atmosphere/rho-sl-slugs_ft3", this,
|
||||
&FGAtmosphere::GetDensitySL);
|
||||
PropertyManager->Tie("atmosphere/P-sl-psf", this,
|
||||
&FGAtmosphere::GetPressureSL);
|
||||
PropertyManager->Tie("atmosphere/a-sl-fps", this,
|
||||
&FGAtmosphere::GetSoundSpeedSL);
|
||||
PropertyManager->Tie("atmosphere/theta-norm", this,
|
||||
&FGAtmosphere::GetTemperatureRatio);
|
||||
PropertyManager->Tie("atmosphere/sigma-norm", this,
|
||||
&FGAtmosphere::GetDensityRatio);
|
||||
PropertyManager->Tie("atmosphere/delta-norm", this,
|
||||
&FGAtmosphere::GetPressureRatio);
|
||||
PropertyManager->Tie("atmosphere/a-norm", this,
|
||||
&FGAtmosphere::GetSoundSpeedRatio);
|
||||
PropertyManager->Tie("atmosphere/psiw-rad", this,
|
||||
&FGAtmosphere::GetWindPsi);
|
||||
PropertyManager->Tie("atmosphere/p-turb-rad_sec", this,1,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
PropertyManager->Tie("atmosphere/q-turb-rad_sec", this,2,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
PropertyManager->Tie("atmosphere/r-turb-rad_sec", this,3,
|
||||
&FGAtmosphere::GetTurbPQR);
|
||||
}
|
||||
|
||||
void FGAtmosphere::unbind(void){
|
||||
PropertyManager->Untie("atmosphere/T-R");
|
||||
PropertyManager->Untie("atmosphere/rho-slugs_ft3");
|
||||
PropertyManager->Untie("atmosphere/P-psf");
|
||||
PropertyManager->Untie("atmosphere/a-fps");
|
||||
PropertyManager->Untie("atmosphere/T-sl-R");
|
||||
PropertyManager->Untie("atmosphere/rho-sl-slugs_ft3");
|
||||
PropertyManager->Untie("atmosphere/P-sl-psf");
|
||||
PropertyManager->Untie("atmosphere/a-sl-fps");
|
||||
PropertyManager->Untie("atmosphere/theta-norm");
|
||||
PropertyManager->Untie("atmosphere/sigma-norm");
|
||||
PropertyManager->Untie("atmosphere/delta-norm");
|
||||
PropertyManager->Untie("atmosphere/a-norm");
|
||||
PropertyManager->Untie("atmosphere/psiw-rad");
|
||||
PropertyManager->Untie("atmosphere/p-turb-rad_sec");
|
||||
PropertyManager->Untie("atmosphere/q-turb-rad_sec");
|
||||
PropertyManager->Untie("atmosphere/r-turb-rad_sec");
|
||||
}
|
||||
|
|
|
@ -285,20 +285,23 @@ string FGCoefficient::GetCoefficientValues(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGCoefficient::bind(FGPropertyManager *node) {
|
||||
void FGCoefficient::bind(FGPropertyManager *parent) {
|
||||
string mult;
|
||||
unsigned i;
|
||||
|
||||
FGCoefficient::node=node;
|
||||
node=parent->GetNode(name,true);
|
||||
|
||||
node->SetString("description",description);
|
||||
if(LookupR) node->SetString("row-parm",LookupR->getName() );
|
||||
if(LookupC) node->SetString("column-parm",LookupC->getName() );
|
||||
|
||||
mult="";
|
||||
if(multipliers.size() == 0)
|
||||
mult="none";
|
||||
|
||||
for (i=0; i<multipliers.size(); i++) {
|
||||
mult += multipliers[i]->getName();
|
||||
if( i < multipliers.size()-1 ) mult += "|";
|
||||
if( i < multipliers.size()-1 ) mult += " ";
|
||||
}
|
||||
node->SetString("multipliers",mult);
|
||||
|
||||
|
|
|
@ -125,8 +125,8 @@ public:
|
|||
inline double getBias(void) const { return bias; }
|
||||
inline double getGain(void) const { return gain; }
|
||||
|
||||
void bind(FGPropertyManager *node);
|
||||
void unbind(void);
|
||||
virtual void bind(FGPropertyManager *parent);
|
||||
virtual void unbind(void);
|
||||
|
||||
private:
|
||||
enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
|
||||
|
|
|
@ -65,6 +65,11 @@ DEFINITIONS
|
|||
FORWARD DECLARATIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf } FcIdx;
|
||||
int const NNorm=7;
|
||||
typedef enum { ofRad=0, ofNorm, ofMag } OutputForm;
|
||||
int const NForms=3;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
@ -153,11 +158,6 @@ CLASS DOCUMENTATION
|
|||
CLASS DECLARATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf } FcIdx;
|
||||
int const NNorm=7;
|
||||
typedef enum { ofRad=0, ofNorm, ofMag } OutputForm;
|
||||
int const NForms=3;
|
||||
|
||||
class FGFCS : public FGModel {
|
||||
|
||||
public:
|
||||
|
@ -267,9 +267,8 @@ public:
|
|||
/** Gets the flaps position.
|
||||
@return flaps position in radians */
|
||||
inline double GetDfPos( int form = ofRad )
|
||||
const { return DspPos[form]; }
|
||||
const { return DfPos[form]; }
|
||||
|
||||
|
||||
/** Gets the throttle position.
|
||||
@param engine engine ID number
|
||||
@return throttle position for the given engine in percent ( 0 - 100)*/
|
||||
|
|
|
@ -81,6 +81,7 @@ GLOBAL DECLARATIONS
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
unsigned int FGFDMExec::FDMctr = 0;
|
||||
FGPropertyManager* FGFDMExec::master=0;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
CLASS IMPLEMENTATION
|
||||
|
@ -112,6 +113,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root)
|
|||
terminate = false;
|
||||
frozen = false;
|
||||
modelLoaded = false;
|
||||
IsSlave = false;
|
||||
|
||||
IdFDM = FDMctr;
|
||||
FDMctr++;
|
||||
|
@ -124,11 +126,9 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root)
|
|||
debug_lvl = 1;
|
||||
}
|
||||
|
||||
if (root == 0) master= new FGPropertyManager;
|
||||
else master = root;
|
||||
|
||||
if(root == 0)
|
||||
master= new FGPropertyManager;
|
||||
else
|
||||
master = root;
|
||||
instance = master->GetNode("/fdm/jsbsim",IdFDM,true);
|
||||
instance->SetDouble("zero",0);
|
||||
|
||||
|
@ -154,6 +154,9 @@ FGFDMExec::~FGFDMExec()
|
|||
cout << "Caught error: " << msg << endl;
|
||||
}
|
||||
|
||||
for (int i=1; i<SlaveFDMList.size(); i++) delete SlaveFDMList[i]->exec;
|
||||
SlaveFDMList.clear();
|
||||
|
||||
Debug(1);
|
||||
}
|
||||
|
||||
|
@ -329,6 +332,11 @@ bool FGFDMExec::Run(void)
|
|||
|
||||
Debug(2);
|
||||
|
||||
for (int i=0; i<SlaveFDMList.size(); i++) {
|
||||
// TransferState(i);
|
||||
// Run(i)
|
||||
}
|
||||
|
||||
while (!model_iterator->Run()) {
|
||||
model_iterator = model_iterator->NextModel;
|
||||
if (model_iterator == 0L) break;
|
||||
|
@ -353,6 +361,31 @@ bool FGFDMExec::RunIC(FGInitialCondition *fgic)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGFDMExec::TransferState(int idxFDM)
|
||||
{
|
||||
SlaveFDMList[idxFDM]->exec->GetRotation()->SetEuler(Rotation->GetEuler());
|
||||
SlaveFDMList[idxFDM]->exec->GetRotation()->SetAeroPQR(Rotation->GetAeroPQR());
|
||||
SlaveFDMList[idxFDM]->exec->GetTranslation()->SetAeroUVW(Translation->GetAeroUVW());
|
||||
SlaveFDMList[idxFDM]->exec->GetRotation()->SetEuler(Rotation->GetEuler());
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
vector <string> FGFDMExec::EnumerateFDMs(void)
|
||||
{
|
||||
vector <string> FDMList;
|
||||
|
||||
FDMList.push_back(Aircraft->GetAircraftName());
|
||||
|
||||
for (int i=1; i<SlaveFDMList.size(); i++) {
|
||||
FDMList.push_back(SlaveFDMList[i]->exec->GetAircraft()->GetAircraftName());
|
||||
}
|
||||
|
||||
return FDMList;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGFDMExec::LoadModel(string APath, string EPath, string model)
|
||||
{
|
||||
bool result = true;
|
||||
|
@ -383,6 +416,10 @@ bool FGFDMExec::LoadModel(string APath, string EPath, string model)
|
|||
if (token == "METRICS") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
|
||||
if (!ReadMetrics(&AC_cfg)) result = false;
|
||||
} else if (token == "SLAVE") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Slave flight vehicle: " << fgdef
|
||||
<< AC_cfg.GetValue("NAME") << endl;
|
||||
if (!ReadSlave(&AC_cfg)) result = false;
|
||||
} else if (token == "AERODYNAMICS") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
|
||||
if (!ReadAerodynamics(&AC_cfg)) result = false;
|
||||
|
@ -420,7 +457,7 @@ bool FGFDMExec::ReadPrologue(FGConfigFile* AC_cfg)
|
|||
string token = AC_cfg->GetValue();
|
||||
string scratch;
|
||||
string AircraftName;
|
||||
|
||||
|
||||
AircraftName = AC_cfg->GetValue("NAME");
|
||||
Aircraft->SetAircraftName(AircraftName);
|
||||
|
||||
|
@ -432,7 +469,7 @@ bool FGFDMExec::ReadPrologue(FGConfigFile* AC_cfg)
|
|||
|
||||
if (debug_lvl > 0)
|
||||
cout << " Version: " << highint << CFGVersion
|
||||
<< normint << endl;
|
||||
<< normint << endl;
|
||||
if (CFGVersion != needed_cfg_version) {
|
||||
cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
|
||||
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
|
||||
|
@ -440,6 +477,34 @@ bool FGFDMExec::ReadPrologue(FGConfigFile* AC_cfg)
|
|||
cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGFDMExec::ReadSlave(FGConfigFile* AC_cfg)
|
||||
{
|
||||
// Add a new slaveData object to the slave FDM list
|
||||
// Populate that slaveData element with a new FDMExec object
|
||||
// Set the IsSlave flag for that FDMExec object
|
||||
// Get the aircraft name
|
||||
// set debug level to print out no additional data for slave objects
|
||||
// Load the model given the aircraft name
|
||||
// reset debug level to prior setting
|
||||
|
||||
int saved_debug_lvl = debug_lvl;
|
||||
|
||||
SlaveFDMList.push_back(new slaveData);
|
||||
SlaveFDMList.back()->exec = new FGFDMExec();
|
||||
SlaveFDMList.back()->exec->SetSlave();
|
||||
|
||||
string AircraftName = AC_cfg->GetValue("FILE");
|
||||
|
||||
debug_lvl = 0;
|
||||
SlaveFDMList.back()->exec->LoadModel("aircraft", "engine", AircraftName);
|
||||
debug_lvl = saved_debug_lvl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ class FGFDMExec : public FGJSBBase
|
|||
{
|
||||
public:
|
||||
|
||||
|
||||
/// Default constructor
|
||||
FGFDMExec(FGPropertyManager* root = 0);
|
||||
|
||||
|
@ -202,6 +201,8 @@ public:
|
|||
inline string GetAircraftPath(void) {return AircraftPath;}
|
||||
|
||||
FGPropertyManager* GetPropertyManager(void);
|
||||
vector <string> EnumerateFDMs(void);
|
||||
void SetSlave(void) {IsSlave = true;}
|
||||
|
||||
private:
|
||||
FGModel* FirstModel;
|
||||
|
@ -213,10 +214,29 @@ private:
|
|||
unsigned int IdFDM;
|
||||
static unsigned int FDMctr;
|
||||
bool modelLoaded;
|
||||
|
||||
FGPropertyManager *master;
|
||||
bool IsSlave;
|
||||
static FGPropertyManager *master;
|
||||
FGPropertyManager *instance;
|
||||
|
||||
struct slaveData {
|
||||
FGFDMExec* exec;
|
||||
string info;
|
||||
double x, y, z;
|
||||
double roll, pitch, yaw;
|
||||
bool mated;
|
||||
|
||||
slaveData(void) {
|
||||
info = "";
|
||||
x = y = z = 0.0;
|
||||
roll = pitch = yaw = 0.0;
|
||||
mated = true;
|
||||
}
|
||||
|
||||
~slaveData(void) {
|
||||
delete exec;
|
||||
}
|
||||
};
|
||||
|
||||
string AircraftPath;
|
||||
string EnginePath;
|
||||
string CFGVersion;
|
||||
|
@ -236,7 +256,10 @@ private:
|
|||
FGAuxiliary* Auxiliary;
|
||||
FGOutput* Output;
|
||||
|
||||
vector <slaveData*> SlaveFDMList;
|
||||
|
||||
bool ReadMetrics(FGConfigFile*);
|
||||
bool ReadSlave(FGConfigFile*);
|
||||
bool ReadPropulsion(FGConfigFile*);
|
||||
bool ReadFlightControls(FGConfigFile*);
|
||||
bool ReadAerodynamics(FGConfigFile*);
|
||||
|
@ -244,6 +267,7 @@ private:
|
|||
bool ReadPrologue(FGConfigFile*);
|
||||
bool ReadOutput(FGConfigFile*);
|
||||
|
||||
void TransferState(int idx);
|
||||
bool Allocate(void);
|
||||
bool DeAllocate(void);
|
||||
void Debug(int from);
|
||||
|
|
|
@ -128,6 +128,35 @@ double FGFactorGroup::TotalValue(void)
|
|||
return totalValue;
|
||||
}
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
void FGFactorGroup::bind(FGPropertyManager* parent) {
|
||||
|
||||
cout << "In FGFactorGroup::bind" << endl;
|
||||
cout << parent->getName() << endl;
|
||||
unsigned i;
|
||||
node=parent->GetNode(name,true);
|
||||
cout << node->getName() << endl;
|
||||
node->SetString("description",description);
|
||||
FGCoefficient::bind(node);
|
||||
for (i=0; i < sum.size(); i++) {
|
||||
sum[i]->bind(node);
|
||||
}
|
||||
node=(FGPropertyManager*)node->getParent();
|
||||
|
||||
}
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
void FGFactorGroup::unbind(void) {
|
||||
unsigned i;
|
||||
|
||||
FGCoefficient::unbind();
|
||||
for (i=0; i < sum.size(); i++) {
|
||||
sum[i]->unbind();
|
||||
}
|
||||
}
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
|
|
|
@ -105,6 +105,8 @@ class FGFactorGroup: public FGCoefficient {
|
|||
inline double GetSD(void) { return SDtotal; }
|
||||
inline double GetFactorSD(void) { return FGCoefficient::GetSD(); }
|
||||
|
||||
void bind(FGPropertyManager* parent);
|
||||
void unbind(void);
|
||||
private:
|
||||
FGFDMExec *FDMExec;
|
||||
string name;
|
||||
|
@ -113,6 +115,7 @@ class FGFactorGroup: public FGCoefficient {
|
|||
CoeffArray sum;
|
||||
double SDtotal;
|
||||
double totalValue;
|
||||
FGPropertyManager* node;
|
||||
void Debug(int from);
|
||||
};
|
||||
|
||||
|
|
|
@ -775,48 +775,7 @@ bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
|
|||
return true;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
// out the normally expected messages, essentially echoing
|
||||
// the config files as they are read. If the environment
|
||||
// variable is not set, debug_lvl is set to 1 internally
|
||||
// 0: This requests JSBSim not to output any messages
|
||||
// whatsoever.
|
||||
// 1: This value explicity requests the normal JSBSim
|
||||
// startup messages
|
||||
// 2: This value asks for a message to be printed out when
|
||||
// a class is instantiated
|
||||
// 4: When this value is set, a message is displayed when a
|
||||
// FGModel object executes its Run() method
|
||||
// 8: When this value is set, various runtime state variables
|
||||
// are printed out periodically
|
||||
// 16: When set various parameters are sanity checked and
|
||||
// a message is printed out when they go out of bounds
|
||||
|
||||
void FGInitialCondition::Debug(int from)
|
||||
{
|
||||
if (debug_lvl <= 0) return;
|
||||
|
||||
if (debug_lvl & 1) { // Standard console startup message output
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
|
||||
if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
|
||||
}
|
||||
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
||||
}
|
||||
if (debug_lvl & 8 ) { // Runtime state variables
|
||||
}
|
||||
if (debug_lvl & 16) { // Sanity checking
|
||||
}
|
||||
if (debug_lvl & 64) {
|
||||
if (from == 0) { // Constructor
|
||||
cout << IdSrc << endl;
|
||||
cout << IdHdr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::bind(void){
|
||||
PropertyManager->Tie("ic/vc-kts", this,
|
||||
|
@ -965,6 +924,8 @@ void FGInitialCondition::bind(void){
|
|||
true);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::unbind(void){
|
||||
PropertyManager->Untie("ic/vc-kts");
|
||||
PropertyManager->Untie("ic/ve-kts");
|
||||
|
@ -1010,3 +971,47 @@ void FGInitialCondition::unbind(void){
|
|||
PropertyManager->Untie("ic/lat-gc-rad");
|
||||
PropertyManager->Untie("ic/long-gc-rad");
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
// out the normally expected messages, essentially echoing
|
||||
// the config files as they are read. If the environment
|
||||
// variable is not set, debug_lvl is set to 1 internally
|
||||
// 0: This requests JSBSim not to output any messages
|
||||
// whatsoever.
|
||||
// 1: This value explicity requests the normal JSBSim
|
||||
// startup messages
|
||||
// 2: This value asks for a message to be printed out when
|
||||
// a class is instantiated
|
||||
// 4: When this value is set, a message is displayed when a
|
||||
// FGModel object executes its Run() method
|
||||
// 8: When this value is set, various runtime state variables
|
||||
// are printed out periodically
|
||||
// 16: When set various parameters are sanity checked and
|
||||
// a message is printed out when they go out of bounds
|
||||
|
||||
void FGInitialCondition::Debug(int from)
|
||||
{
|
||||
if (debug_lvl <= 0) return;
|
||||
|
||||
if (debug_lvl & 1) { // Standard console startup message output
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
|
||||
if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
|
||||
}
|
||||
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
||||
}
|
||||
if (debug_lvl & 8 ) { // Runtime state variables
|
||||
}
|
||||
if (debug_lvl & 16) { // Sanity checking
|
||||
}
|
||||
if (debug_lvl & 64) {
|
||||
if (from == 0) { // Constructor
|
||||
cout << IdSrc << endl;
|
||||
cout << IdHdr << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << Translation->Getqbar() << ", ";
|
||||
outstream << Translation->GetVt() << ", ";
|
||||
outstream << Translation->GetUVW() << ", ";
|
||||
outstream << Translation->GetvAeroUVW() << ", ";
|
||||
outstream << Translation->GetAeroUVW() << ", ";
|
||||
outstream << Position->GetVel();
|
||||
}
|
||||
if (SubSystems & ssForces) {
|
||||
|
@ -367,9 +367,9 @@ void FGOutput::SocketOutput(void)
|
|||
socket->Append(Translation->GetUVW(eU));
|
||||
socket->Append(Translation->GetUVW(eV));
|
||||
socket->Append(Translation->GetUVW(eW));
|
||||
socket->Append(Translation->GetvAeroUVW(eU));
|
||||
socket->Append(Translation->GetvAeroUVW(eV));
|
||||
socket->Append(Translation->GetvAeroUVW(eW));
|
||||
socket->Append(Translation->GetAeroUVW(eU));
|
||||
socket->Append(Translation->GetAeroUVW(eV));
|
||||
socket->Append(Translation->GetAeroUVW(eW));
|
||||
socket->Append(Position->GetVn());
|
||||
socket->Append(Position->GetVe());
|
||||
socket->Append(Position->GetVd());
|
||||
|
|
|
@ -289,18 +289,18 @@ void FGPosition::bind(void){
|
|||
&FGPosition::Geth,
|
||||
&FGPosition::Seth,
|
||||
true);
|
||||
PropertyManager->Tie("postition/h-dot-fps", this,
|
||||
PropertyManager->Tie("velocities/h-dot-fps", this,
|
||||
&FGPosition::Gethdot);
|
||||
PropertyManager->Tie("postition/lat-gc-rad", this,
|
||||
PropertyManager->Tie("position/lat-gc-rad", this,
|
||||
&FGPosition::GetLatitude,
|
||||
&FGPosition::SetLatitude);
|
||||
PropertyManager->Tie("postition/lat-dot-gc-rad", this,
|
||||
PropertyManager->Tie("position/lat-dot-gc-rad", this,
|
||||
&FGPosition::GetLatitudeDot);
|
||||
PropertyManager->Tie("postition/long-gc-rad", this,
|
||||
PropertyManager->Tie("position/long-gc-rad", this,
|
||||
&FGPosition::GetLongitude,
|
||||
&FGPosition::SetLongitude,
|
||||
true);
|
||||
PropertyManager->Tie("postition/long-dot-gc-rad", this,
|
||||
PropertyManager->Tie("position/long-dot-gc-rad", this,
|
||||
&FGPosition::GetLongitudeDot);
|
||||
PropertyManager->Tie("metrics/runway-radius", this,
|
||||
&FGPosition::GetRunwayRadius,
|
||||
|
@ -313,9 +313,9 @@ void FGPosition::bind(void){
|
|||
PropertyManager->Tie("flight-path/gamma-rad", this,
|
||||
&FGPosition::GetGamma,
|
||||
&FGPosition::SetGamma);
|
||||
PropertyManager->Tie("position/h_b-cg-ft", this,
|
||||
PropertyManager->Tie("aero/h_b-cg-ft", this,
|
||||
&FGPosition::GetHOverBCG);
|
||||
PropertyManager->Tie("position/h_b-mac-ft", this,
|
||||
PropertyManager->Tie("aero/h_b-mac-ft", this,
|
||||
&FGPosition::GetHOverBMAC);
|
||||
}
|
||||
|
||||
|
@ -326,15 +326,15 @@ void FGPosition::unbind(void){
|
|||
PropertyManager->Untie("velocities/vg-fps");
|
||||
PropertyManager->Untie("flight-path/psi-gt-rad");
|
||||
PropertyManager->Untie("position/h-sl-ft");
|
||||
PropertyManager->Untie("postition/h-dot-fps");
|
||||
PropertyManager->Untie("postition/lat-gc-rad");
|
||||
PropertyManager->Untie("postition/lat-dot-gc-rad");
|
||||
PropertyManager->Untie("postition/long-gc-rad");
|
||||
PropertyManager->Untie("postition/long-dot-gc-rad");
|
||||
PropertyManager->Untie("velocities/h-dot-fps");
|
||||
PropertyManager->Untie("position/lat-gc-rad");
|
||||
PropertyManager->Untie("position/lat-dot-gc-rad");
|
||||
PropertyManager->Untie("position/long-gc-rad");
|
||||
PropertyManager->Untie("position/long-dot-gc-rad");
|
||||
PropertyManager->Untie("metrics/runway-radius");
|
||||
PropertyManager->Untie("position/h-agl-ft");
|
||||
PropertyManager->Untie("position/radius-to-vehicle-ft");
|
||||
PropertyManager->Untie("flight-path/gamma-rad");
|
||||
PropertyManager->Untie("position/h_b-cg-ft");
|
||||
PropertyManager->Untie("position/h_b-mac-ft");
|
||||
PropertyManager->Untie("aero/h_b-cg-ft");
|
||||
PropertyManager->Untie("aero/h_b-mac-ft");
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ FGPropeller::~FGPropeller()
|
|||
double FGPropeller::Calculate(double PowerAvailable)
|
||||
{
|
||||
double J, C_Thrust, omega;
|
||||
double Vel = fdmex->GetTranslation()->GetvAeroUVW(eU);
|
||||
double Vel = fdmex->GetTranslation()->GetAeroUVW(eU);
|
||||
double rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
double RPS = RPM/60.0;
|
||||
double alpha, beta;
|
||||
|
@ -190,7 +190,7 @@ double FGPropeller::GetPowerRequired(void)
|
|||
|
||||
double cPReq, RPS = RPM / 60.0;
|
||||
|
||||
double J = fdmex->GetTranslation()->GetvAeroUVW(eU) / (Diameter * RPS);
|
||||
double J = fdmex->GetTranslation()->GetAeroUVW(eU) / (Diameter * RPS);
|
||||
double rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
|
||||
if (MaxPitch == MinPitch) { // Fixed pitch prop
|
||||
|
|
|
@ -1,23 +1,79 @@
|
|||
// FGPropertyManager.h
|
||||
// Class wrapper for property handling.
|
||||
// based on FlightGear source src/Main/fg_props.hxx
|
||||
// Originally written by David Megginson, started 2000.
|
||||
//
|
||||
// This file is in the Public Domain, and comes with no warranty.
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
Header: FGPropertyManager.h
|
||||
Author: Tony Peden
|
||||
Based on work originally by David Megginson
|
||||
Date: 2/2002
|
||||
|
||||
------------- Copyright (C) 2002 -------------
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Further information about the GNU General Public License can also be found on
|
||||
the world wide web at http://www.gnu.org.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
SENTRY
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#ifndef FGPROPERTYMANAGER_H
|
||||
#define FGPROPERTYMANAGER_H
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
INCLUDES
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
DEFINITIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#define ID_PROPERTYMANAGER "$Id$"
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
FORWARD DECLARATIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
CLASS DOCUMENTATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
/** Class wrapper for property handling.
|
||||
@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">
|
||||
Header File </a>
|
||||
*/
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
CLASS DECLARATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
class FGPropertyManager:public SGPropertyNode {
|
||||
public:
|
||||
/// Constructor
|
||||
FGPropertyManager(void) {
|
||||
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
~FGPropertyManager(void) {
|
||||
|
||||
}
|
||||
|
@ -505,19 +561,19 @@ class FGPropertyManager:public SGPropertyNode {
|
|||
}
|
||||
|
||||
/* template <class V> void
|
||||
FGPropertyManager::Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
|
||||
Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
|
||||
bool useDefault = true);
|
||||
|
||||
template <class V> void
|
||||
FGPropertyManager::Tie (const string &name, int index, V (*getter)(int),
|
||||
Tie (const string &name, int index, V (*getter)(int),
|
||||
void (*setter)(int, V) = 0, bool useDefault = true);
|
||||
|
||||
template <class T, class V> void
|
||||
FGPropertyManager::Tie (const string &name, T * obj, V (T::*getter)() const,
|
||||
Tie (const string &name, T * obj, V (T::*getter)() const,
|
||||
void (T::*setter)(V) = 0, bool useDefault = true);
|
||||
|
||||
template <class T, class V> void
|
||||
FGPropertyManager::Tie (const string &name, T * obj, int index,
|
||||
Tie (const string &name, T * obj, int index,
|
||||
V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,
|
||||
bool useDefault = true); */
|
||||
|
||||
|
@ -539,7 +595,7 @@ class FGPropertyManager:public SGPropertyNode {
|
|||
*/
|
||||
template <class V>
|
||||
inline void
|
||||
FGPropertyManager::Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
|
||||
Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
|
||||
bool useDefault = true)
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter),
|
||||
|
@ -569,7 +625,7 @@ class FGPropertyManager:public SGPropertyNode {
|
|||
*/
|
||||
template <class V>
|
||||
inline void
|
||||
FGPropertyManager::Tie (const string &name, int index, V (*getter)(int),
|
||||
Tie (const string &name, int index, V (*getter)(int),
|
||||
void (*setter)(int, V) = 0, bool useDefault = true)
|
||||
{
|
||||
if (!tie(name.c_str(),
|
||||
|
@ -603,7 +659,7 @@ class FGPropertyManager:public SGPropertyNode {
|
|||
*/
|
||||
template <class T, class V>
|
||||
inline void
|
||||
FGPropertyManager::Tie (const string &name, T * obj, V (T::*getter)() const,
|
||||
Tie (const string &name, T * obj, V (T::*getter)() const,
|
||||
void (T::*setter)(V) = 0, bool useDefault = true)
|
||||
{
|
||||
if (!tie(name.c_str(),
|
||||
|
@ -635,7 +691,7 @@ class FGPropertyManager:public SGPropertyNode {
|
|||
*/
|
||||
template <class T, class V>
|
||||
inline void
|
||||
FGPropertyManager::Tie (const string &name, T * obj, int index,
|
||||
Tie (const string &name, T * obj, int index,
|
||||
V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,
|
||||
bool useDefault = true)
|
||||
{
|
||||
|
|
|
@ -545,6 +545,49 @@ double FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg)
|
|||
return I;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGPropulsion::bind(void){
|
||||
/* PropertyManager->Tie("propulsion/num-engines", this,
|
||||
&FGPropulsion::GetNumEngines);
|
||||
PropertyManager->Tie("propulsion/num-tanks", this,
|
||||
&FGPropulsion::GetNumTanks); */
|
||||
PropertyManager->Tie("propulsion/num-sel-fuel-tanks", this,
|
||||
&FGPropulsion::GetnumSelectedFuelTanks);
|
||||
PropertyManager->Tie("propulsion/num-sel-ox-tanks", this,
|
||||
&FGPropulsion::GetnumSelectedOxiTanks);
|
||||
PropertyManager->Tie("forces/fbx-prop-lbs", this,1,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("forces/fby-prop-lbs", this,2,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("forces/fbz-prop-lbs", this,3,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("moments/l-prop-lbsft", this,1,
|
||||
&FGPropulsion::GetMoments);
|
||||
PropertyManager->Tie("moments/m-prop-lbsft", this,2,
|
||||
&FGPropulsion::GetMoments);
|
||||
PropertyManager->Tie("moments/n-prop-lbsft", this,3,
|
||||
&FGPropulsion::GetMoments);
|
||||
//PropertyManager->Tie("propulsion/tanks-weight-lbs", this,
|
||||
// &FGPropulsion::GetTanksWeight);
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGPropulsion::unbind(void){
|
||||
/* PropertyManager->Untie("propulsion/num-engines");
|
||||
PropertyManager->Untie("propulsion/num-tanks"); */
|
||||
PropertyManager->Untie("propulsion/num-sel-fuel-tanks");
|
||||
PropertyManager->Untie("propulsion/num-sel-ox-tanks");
|
||||
PropertyManager->Untie("forces/fbx-prop-lbs");
|
||||
PropertyManager->Untie("forces/fby-prop-lbs");
|
||||
PropertyManager->Untie("forces/fbz-prop-lbs");
|
||||
PropertyManager->Untie("moments/l-prop-lbsft");
|
||||
PropertyManager->Untie("moments/m-prop-lbsft");
|
||||
PropertyManager->Untie("moments/n-prop-lbsft");
|
||||
//PropertyManager->Untie("propulsion/tanks-weight-lbs");
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// The bitmasked value choices are as follows:
|
||||
// unset: In this case (the default) JSBSim would only print
|
||||
|
@ -591,41 +634,3 @@ void FGPropulsion::Debug(int from)
|
|||
}
|
||||
}
|
||||
|
||||
void FGPropulsion::bind(void){
|
||||
/* PropertyManager->Tie("propulsion/num-engines", this,
|
||||
&FGPropulsion::GetNumEngines);
|
||||
PropertyManager->Tie("propulsion/num-tanks", this,
|
||||
&FGPropulsion::GetNumTanks); */
|
||||
PropertyManager->Tie("propulsion/num-sel-fuel-tanks", this,
|
||||
&FGPropulsion::GetnumSelectedFuelTanks);
|
||||
PropertyManager->Tie("propulsion/num-sel-ox-tanks", this,
|
||||
&FGPropulsion::GetnumSelectedOxiTanks);
|
||||
PropertyManager->Tie("propulsion/fbx-prop-lbs", this,1,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("propulsion/fby-prop-lbs", this,2,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("propulsion/fbz-prop-lbs", this,3,
|
||||
&FGPropulsion::GetForces);
|
||||
PropertyManager->Tie("propulsion/l-prop-lbsft", this,1,
|
||||
&FGPropulsion::GetMoments);
|
||||
PropertyManager->Tie("propulsion/m-prop-lbsft", this,2,
|
||||
&FGPropulsion::GetMoments);
|
||||
PropertyManager->Tie("propulsion/n-prop-lbsft", this,3,
|
||||
&FGPropulsion::GetMoments);
|
||||
//PropertyManager->Tie("propulsion/tanks-weight-lbs", this,
|
||||
// &FGPropulsion::GetTanksWeight);
|
||||
}
|
||||
|
||||
void FGPropulsion::unbind(void){
|
||||
/* PropertyManager->Untie("propulsion/num-engines");
|
||||
PropertyManager->Untie("propulsion/num-tanks"); */
|
||||
PropertyManager->Untie("propulsion/num-sel-fuel-tanks");
|
||||
PropertyManager->Untie("propulsion/num-sel-ox-tanks");
|
||||
PropertyManager->Untie("propulsion/fbx-prop-lbs");
|
||||
PropertyManager->Untie("propulsion/fby-prop-lbs");
|
||||
PropertyManager->Untie("propulsion/fbz-prop-lbs");
|
||||
PropertyManager->Untie("propulsion/l-prop-lbsft");
|
||||
PropertyManager->Untie("propulsion/m-prop-lbsft");
|
||||
PropertyManager->Untie("propulsion/n-prop-lbsft");
|
||||
//PropertyManager->Untie("propulsion/tanks-weight-lbs");
|
||||
}
|
||||
|
|
|
@ -100,6 +100,10 @@ public:
|
|||
inline void SetPQR(double p, double q, double r) {vPQR(eP)=p;
|
||||
vPQR(eQ)=q;
|
||||
vPQR(eR)=r;}
|
||||
inline void SetAeroPQR(FGColumnVector3 tt) {vAeroPQR = tt;}
|
||||
inline void SetAeroPQR(double p, double q, double r) {vAeroPQR(eP)=p;
|
||||
vAeroPQR(eQ)=q;
|
||||
vAeroPQR(eR)=r;}
|
||||
inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;}
|
||||
|
||||
inline double Getphi(void) const {return vEuler(1);}
|
||||
|
|
|
@ -998,7 +998,7 @@ void FGState::InitPropertyMaps(void) {
|
|||
ParamToProp[ FG_MAGNETO_CMD ]="zero";
|
||||
ParamToProp[ FG_STARTER_CMD ]="zero";
|
||||
ParamToProp[ FG_ACTIVE_ENGINE ]="zero";
|
||||
ParamToProp[ FG_HOVERB ]="position/h_b-mac-ft";
|
||||
ParamToProp[ FG_HOVERB ]="aero/h_b-mac-ft";
|
||||
ParamToProp[ FG_PITCH_TRIM_CMD ]="fcs/pitch-trim-cmd-norm";
|
||||
ParamToProp[ FG_YAW_TRIM_CMD ]="fcs/yaw-trim-cmd-norm";
|
||||
ParamToProp[ FG_ROLL_TRIM_CMD ]="fcs/roll-trim-cmd-norm";
|
||||
|
@ -1068,7 +1068,7 @@ void FGState::InitPropertyMaps(void) {
|
|||
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[ "position/h_b-mac-ft" ] = FG_HOVERB;
|
||||
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;
|
||||
|
|
|
@ -245,11 +245,11 @@ void FGTranslation::bind(void){
|
|||
PropertyManager->Tie("accelerations/wdot-fps", this,3,
|
||||
&FGTranslation::GetUVWdot);
|
||||
PropertyManager->Tie("velocities/u-aero-fps", this,1,
|
||||
&FGTranslation::GetvAeroUVW);
|
||||
&FGTranslation::GetAeroUVW);
|
||||
PropertyManager->Tie("velocities/v-aero-fps", this,2,
|
||||
&FGTranslation::GetvAeroUVW);
|
||||
&FGTranslation::GetAeroUVW);
|
||||
PropertyManager->Tie("velocities/w-aero-fps", this,3,
|
||||
&FGTranslation::GetvAeroUVW);
|
||||
&FGTranslation::GetAeroUVW);
|
||||
PropertyManager->Tie("aero/alpha-rad", this,
|
||||
&FGTranslation::Getalpha,
|
||||
&FGTranslation::Setalpha,
|
||||
|
|
|
@ -91,8 +91,8 @@ public:
|
|||
inline FGColumnVector3& GetUVW (void) { return vUVW; }
|
||||
inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; }
|
||||
inline double GetUVWdot(int idx) const { return vUVWdot(idx); }
|
||||
inline FGColumnVector3& GetvAeroUVW (void) { return vAeroUVW; }
|
||||
inline double GetvAeroUVW (int idx) const { return vAeroUVW(idx); }
|
||||
inline FGColumnVector3& GetAeroUVW (void) { return vAeroUVW; }
|
||||
inline double GetAeroUVW (int idx) const { return vAeroUVW(idx); }
|
||||
|
||||
double Getalpha(void) const { return alpha; }
|
||||
double Getbeta (void) const { return beta; }
|
||||
|
@ -104,6 +104,7 @@ public:
|
|||
double Getbdot (void) const { return bdot; }
|
||||
|
||||
void SetUVW(FGColumnVector3 tt) { vUVW = tt; }
|
||||
void SetAeroUVW(FGColumnVector3 tt) { vAeroUVW = tt; }
|
||||
|
||||
inline void Setalpha(double tt) { alpha = tt; }
|
||||
inline void Setbeta (double tt) { beta = tt; }
|
||||
|
|
Loading…
Add table
Reference in a new issue