#include <float.h>
#include <queue>
#include <string>
+#include <sstream>
#include <cmath>
using std::fabs;
double dVal;
};
+ /// First order, (low pass / lag) filter
+ class Filter {
+ double prev_in;
+ double prev_out;
+ double ca;
+ double cb;
+ public: Filter(void) {}
+ public: Filter(double coeff, double dt) {
+ prev_in = prev_out = 0.0;
+ double denom = 2.0 + coeff*dt;
+ ca = coeff*dt/denom;
+ cb = (2.0 - coeff*dt)/denom;
+ }
+ public: double execute(double in) {
+ double out = (in + prev_in)*ca + prev_out*cb;
+ prev_in = in;
+ prev_out = out;
+ return out;
+ }
+ };
+
///@name JSBSim console output highlighting terms.
//@{
/// highlights text
static const string needed_cfg_version;
static const string JSBSim_version;
+ static string CreateIndexedPropertyName(string Property, int index)
+ {
+ std::stringstream str;
+ str << index;
+ string tmp;
+ str >> tmp;
+ return Property + "[" + tmp + "]";
+ }
+
public:
/// Moments L, M, N
enum {eL = 1, eM, eN };
FDMExec = fdex;
sim_time = 0.0;
- dt = 1.0/120.0;
+ //dt = 1.0/120.0;
Aircraft = FDMExec->GetAircraft();
Propagate = FDMExec->GetPropagate();
if (node->getChild("level-gal_us", 0, false) != 0) {
Propulsion->GetTank(i)->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
} else {
- node->setDoubleValue("level-lb", Propulsion->GetTank(i)->GetContents());
+ node->setDoubleValue("level-lbs", Propulsion->GetTank(i)->GetContents());
node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
}
node->setDoubleValue("capacity-gal_us",
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
FGTank * tank = Propulsion->GetTank(i);
tank->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
-// tank->SetContents(node->getDoubleValue("level-lb"));
+// tank->SetContents(node->getDoubleValue("level-lbs"));
}
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
double contents = tank->GetContents();
double temp = tank->GetTemperature_degC();
node->setDoubleValue("level-gal_us", contents/6.6);
- node->setDoubleValue("level-lb", contents);
+ node->setDoubleValue("level-lbs", contents);
if (temp != -9999.0) node->setDoubleValue("temperature_degC", temp);
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <cstdlib>
+#include <iomanip>
#include "FGTrim.h"
#include <models/FGAtmosphere.h>
#include "FGInitialCondition.h"
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGTrim::TrimStats() {
- char out[80];
int run_sum=0;
cout << endl << " Trim Statistics: " << endl;
cout << " Total Iterations: " << total_its << endl;
- if(total_its > 0) {
+ if( total_its > 0) {
cout << " Sub-iterations:" << endl;
- for(current_axis=0; current_axis<TrimAxes.size(); current_axis++) {
- run_sum+=TrimAxes[current_axis]->GetRunCount();
- snprintf(out,80," %5s: %3.0f average: %5.2f successful: %3.0f stability: %5.2f\n",
- TrimAxes[current_axis]->GetStateName().c_str(),
- sub_iterations[current_axis],
- sub_iterations[current_axis]/double(total_its),
- successful[current_axis],
- TrimAxes[current_axis]->GetAvgStability() );
- cout << out;
+ for (current_axis=0; current_axis<TrimAxes.size(); current_axis++) {
+ run_sum += TrimAxes[current_axis]->GetRunCount();
+ cout << " " << setw(5) << TrimAxes[current_axis]->GetStateName().c_str()
+ << ": " << setprecision(3) << sub_iterations[current_axis]
+ << " average: " << setprecision(5) << sub_iterations[current_axis]/double(total_its)
+ << " successful: " << setprecision(3) << successful[current_axis]
+ << " stability: " << setprecision(5) << TrimAxes[current_axis]->GetAvgStability()
+ << endl;
}
cout << " Run Count: " << run_sum << endl;
}
#define ID_TRIM "$Id$"
-#if defined(_WIN32) && !defined(__CYGWIN__)
- #define snprintf _snprintf
-#endif
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <FGFDMExec.h>
#include <input_output/FGPropertyManager.h>
#include <fstream>
+#include <sstream>
+#include <iomanip>
#include <models/flight_control/FGFilter.h>
#include <models/flight_control/FGDeadBand.h>
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FCS;
-#if defined(WIN32) && !defined(__CYGWIN__)
-#define snprintf _snprintf
-#endif
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
string FGFCS::GetComponentValues(string delimeter)
{
+ std::ostringstream buf;
+
unsigned int comp;
- string CompValues = "";
- char buffer[100];
bool firstime = true;
int total_count=0;
for (unsigned int i=0; i<Systems.size(); i++) {
if (firstime) firstime = false;
- else CompValues += delimeter;
+ else buf << delimeter;
- snprintf(buffer, 100, "%9.6f", Systems[i]->GetOutput());
- CompValues += string(buffer);
+ buf << setprecision(9) << Systems[i]->GetOutput();
total_count++;
}
for (comp = 0; comp < APComponents.size(); comp++) {
if (firstime) firstime = false;
- else CompValues += delimeter;
+ else buf << delimeter;
- sprintf(buffer, "%9.6f", APComponents[comp]->GetOutput());
- CompValues += string(buffer);
+ buf << setprecision(9) << APComponents[comp]->GetOutput();
total_count++;
}
for (comp = 0; comp < FCSComponents.size(); comp++) {
if (firstime) firstime = false;
- else CompValues += delimeter;
+ else buf << delimeter;
- sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
- CompValues += string(buffer);
+ buf << setprecision(9) << FCSComponents[comp]->GetOutput();
total_count++;
}
- CompValues += "\0";
- return CompValues;
+ return buf.str();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Technically, this function should probably bind propulsion type specific controls
// rather than mixture and prop-advance.
-//
void FGFCS::bindThrottle(unsigned int num)
{
- char tmp[80];
+ string tmp;
- snprintf(tmp, 80, "fcs/throttle-cmd-norm[%u]",num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetThrottleCmd,
+ tmp = CreateIndexedPropertyName("fcs/throttle-cmd-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetThrottleCmd,
&FGFCS::SetThrottleCmd);
- snprintf(tmp, 80, "fcs/throttle-pos-norm[%u]",num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetThrottlePos,
+ tmp = CreateIndexedPropertyName("fcs/throttle-pos-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetThrottlePos,
&FGFCS::SetThrottlePos);
- snprintf(tmp, 80, "fcs/mixture-cmd-norm[%u]",num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetMixtureCmd,
+ tmp = CreateIndexedPropertyName("fcs/mixture-cmd-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetMixtureCmd,
&FGFCS::SetMixtureCmd);
- snprintf(tmp, 80, "fcs/mixture-pos-norm[%u]",num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetMixturePos,
+ tmp = CreateIndexedPropertyName("fcs/mixture-pos-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetMixturePos,
&FGFCS::SetMixturePos);
- snprintf(tmp, 80, "fcs/advance-cmd-norm[%u]",num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetPropAdvanceCmd,
+ tmp = CreateIndexedPropertyName("fcs/advance-cmd-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetPropAdvanceCmd,
&FGFCS::SetPropAdvanceCmd);
- snprintf(tmp, 80, "fcs/advance-pos-norm[%u]", num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetPropAdvance,
+ tmp = CreateIndexedPropertyName("fcs/advance-pos-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetPropAdvance,
&FGFCS::SetPropAdvance);
- snprintf(tmp, 80, "fcs/feather-cmd-norm[%u]", num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetFeatherCmd,
+ tmp = CreateIndexedPropertyName("fcs/feather-cmd-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetFeatherCmd,
&FGFCS::SetFeatherCmd);
- snprintf(tmp, 80, "fcs/feather-pos-norm[%u]", num);
- PropertyManager->Tie( tmp, this, num, &FGFCS::GetPropFeather,
+ tmp = CreateIndexedPropertyName("fcs/feather-pos-norm", num);
+ PropertyManager->Tie( tmp.c_str(), this, num, &FGFCS::GetPropFeather,
&FGFCS::SetPropFeather);
}
void FGFCS::bindModel(void)
{
unsigned int i;
- char tmp[80];
+ string tmp;
for (i=0; i<SteerPosDeg.size(); i++) {
if (GroundReactions->GetGearUnit(i)->GetSteerable()) {
- snprintf(tmp,80,"fcs/steer-pos-deg[%u]",i);
- PropertyManager->Tie( tmp, this, i, &FGFCS::GetSteerPosDeg, &FGFCS::SetSteerPosDeg);
+ tmp = CreateIndexedPropertyName("fcs/steer-pos-deg", i);
+ PropertyManager->Tie( tmp.c_str(), this, i, &FGFCS::GetSteerPosDeg, &FGFCS::SetSteerPosDeg);
}
}
}
//@{
/** Gets the aileron command.
@return aileron command in range from -1.0 - 1.0 */
- inline double GetDaCmd(void) const { return DaCmd; }
+ double GetDaCmd(void) const { return DaCmd; }
/** Gets the elevator command.
@return elevator command in range from -1.0 - 1.0 */
- inline double GetDeCmd(void) const { return DeCmd; }
+ double GetDeCmd(void) const { return DeCmd; }
/** Gets the rudder command.
@return rudder command in range from -1.0 - 1.0 */
- inline double GetDrCmd(void) const { return DrCmd; }
+ double GetDrCmd(void) const { return DrCmd; }
/** Gets the steering command.
@return steering command in range from -1.0 - 1.0 */
- inline double GetDsCmd(void) const { return DsCmd; }
+ double GetDsCmd(void) const { return DsCmd; }
/** Gets the flaps command.
@return flaps command in range from 0 to 1.0 */
- inline double GetDfCmd(void) const { return DfCmd; }
+ double GetDfCmd(void) const { return DfCmd; }
/** Gets the speedbrake command.
@return speedbrake command in range from 0 to 1.0 */
- inline double GetDsbCmd(void) const { return DsbCmd; }
+ double GetDsbCmd(void) const { return DsbCmd; }
/** Gets the spoiler command.
@return spoiler command in range from 0 to 1.0 */
- inline double GetDspCmd(void) const { return DspCmd; }
+ double GetDspCmd(void) const { return DspCmd; }
/** Gets the throttle command.
@param engine engine ID number
/** Gets the mixture command.
@param engine engine ID number
@return mixture command in range from 0 - 1.0 for the given engine */
- inline double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
+ double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
/** Gets the prop pitch command.
@param engine engine ID number
@return pitch command in range from 0.0 - 1.0 for the given engine */
- inline double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
+ double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
/** Gets the prop feather command.
@param engine engine ID number
@return feather command for the given engine (on / off)*/
- inline bool GetFeatherCmd(int engine) const { return PropFeatherCmd[engine]; }
+ bool GetFeatherCmd(int engine) const { return PropFeatherCmd[engine]; }
/** Gets the pitch trim command.
@return pitch trim command in range from -1.0 to 1.0 */
- inline double GetPitchTrimCmd(void) const { return PTrimCmd; }
+ double GetPitchTrimCmd(void) const { return PTrimCmd; }
/** Gets the rudder trim command.
@return rudder trim command in range from -1.0 - 1.0 */
- inline double GetYawTrimCmd(void) const { return YTrimCmd; }
+ double GetYawTrimCmd(void) const { return YTrimCmd; }
/** Gets the aileron trim command.
@return aileron trim command in range from -1.0 - 1.0 */
- inline double GetRollTrimCmd(void) const { return RTrimCmd; }
+ double GetRollTrimCmd(void) const { return RTrimCmd; }
/** Get the gear extend/retract command. 0 commands gear up, 1 down.
defaults to down.
@return the current value of the gear extend/retract command*/
- inline double GetGearCmd(void) const { return GearCmd; }
+ double GetGearCmd(void) const { return GearCmd; }
//@}
/// @name Aerosurface position retrieval
//@{
/** Gets the left aileron position.
@return aileron position in radians */
- inline double GetDaLPos( int form = ofRad )
+ double GetDaLPos( int form = ofRad )
const { return DaLPos[form]; }
/// @name Aerosurface position retrieval
//@{
/** Gets the right aileron position.
@return aileron position in radians */
- inline double GetDaRPos( int form = ofRad )
+ double GetDaRPos( int form = ofRad )
const { return DaRPos[form]; }
/** Gets the elevator position.
@return elevator position in radians */
- inline double GetDePos( int form = ofRad )
+ double GetDePos( int form = ofRad )
const { return DePos[form]; }
/** Gets the rudder position.
@return rudder position in radians */
- inline double GetDrPos( int form = ofRad )
+ double GetDrPos( int form = ofRad )
const { return DrPos[form]; }
/** Gets the speedbrake position.
@return speedbrake position in radians */
- inline double GetDsbPos( int form = ofRad )
+ double GetDsbPos( int form = ofRad )
const { return DsbPos[form]; }
/** Gets the spoiler position.
@return spoiler position in radians */
- inline double GetDspPos( int form = ofRad )
+ double GetDspPos( int form = ofRad )
const { return DspPos[form]; }
/** Gets the flaps position.
@return flaps position in radians */
- inline double GetDfPos( int form = ofRad )
+ double GetDfPos( int form = ofRad )
const { return DfPos[form]; }
/** Gets the throttle position.
/** Gets the mixture position.
@param engine engine ID number
@return mixture position for the given engine in range from 0 - 1.0 */
- inline double GetMixturePos(int engine) const { return MixturePos[engine]; }
+ double GetMixturePos(int engine) const { return MixturePos[engine]; }
/** Gets the steering position.
@return steering position in degrees */
/** Gets the gear position (0 up, 1 down), defaults to down
@return gear position (0 up, 1 down) */
- inline double GetGearPos(void) const { return GearPos; }
+ double GetGearPos(void) const { return GearPos; }
/** Gets the tailhook position (0 up, 1 down)
@return tailhook position (0 up, 1 down) */
- inline double GetTailhookPos(void) const { return TailhookPos; }
+ double GetTailhookPos(void) const { return TailhookPos; }
/** Gets the wing fold position (0 unfolded, 1 folded)
@return wing fold position (0 unfolded, 1 folded) */
- inline double GetWingFoldPos(void) const { return WingFoldPos; }
+ double GetWingFoldPos(void) const { return WingFoldPos; }
/** Gets the prop pitch position.
@param engine engine ID number
@return prop pitch position for the given engine in range from 0 - 1.0 */
- inline double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
+ double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
/** Gets the prop feather position.
@param engine engine ID number
@return prop fether for the given engine (on / off)*/
- inline bool GetPropFeather(int engine) const { return PropFeather[engine]; }
+ bool GetPropFeather(int engine) const { return PropFeather[engine]; }
//@}
/** Retrieves the State object pointer.
This is used by the FGFCS-owned components.
@return pointer to the State object */
- inline FGState* GetState(void) { return State; }
+ FGState* GetState(void) { return State; }
/** Retrieves all component names for inclusion in output stream
@param delimeter either a tab or comma string depending on output type
//@{
/** Sets the aileron command
@param cmd aileron command */
- inline void SetDaCmd( double cmd ) { DaCmd = cmd; }
+ void SetDaCmd( double cmd ) { DaCmd = cmd; }
/** Sets the elevator command
@param cmd elevator command in percent*/
- inline void SetDeCmd(double cmd ) { DeCmd = cmd; }
+ void SetDeCmd(double cmd ) { DeCmd = cmd; }
/** Sets the rudder command
@param cmd rudder command in percent*/
- inline void SetDrCmd(double cmd) { DrCmd = cmd; }
+ void SetDrCmd(double cmd) { DrCmd = cmd; }
/** Sets the steering command
@param cmd steering command in percent*/
- inline void SetDsCmd(double cmd) { DsCmd = cmd; }
+ void SetDsCmd(double cmd) { DsCmd = cmd; }
/** Sets the flaps command
@param cmd flaps command in percent*/
- inline void SetDfCmd(double cmd) { DfCmd = cmd; }
+ void SetDfCmd(double cmd) { DfCmd = cmd; }
/** Sets the speedbrake command
@param cmd speedbrake command in percent*/
- inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
+ void SetDsbCmd(double cmd) { DsbCmd = cmd; }
/** Sets the spoilers command
@param cmd spoilers command in percent*/
- inline void SetDspCmd(double cmd) { DspCmd = cmd; }
+ void SetDspCmd(double cmd) { DspCmd = cmd; }
/** Sets the pitch trim command
@param cmd pitch trim command in percent*/
- inline void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
+ void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
/** Sets the rudder trim command
@param cmd rudder trim command in percent*/
- inline void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
+ void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
/** Sets the aileron trim command
@param cmd aileron trim command in percent*/
- inline void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
+ void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
/** Sets the throttle command for the specified engine
@param engine engine ID number
//@{
/** Sets the left aileron position
@param cmd left aileron position in radians*/
- inline void SetDaLPos( int form , double pos );
+ void SetDaLPos( int form , double pos );
/** Sets the right aileron position
@param cmd right aileron position in radians*/
- inline void SetDaRPos( int form , double pos );
+ void SetDaRPos( int form , double pos );
/** Sets the elevator position
@param cmd elevator position in radians*/
- inline void SetDePos( int form , double pos );
+ void SetDePos( int form , double pos );
/** Sets the rudder position
@param cmd rudder position in radians*/
- inline void SetDrPos( int form , double pos );
+ void SetDrPos( int form , double pos );
/** Sets the flaps position
@param cmd flaps position in radians*/
- inline void SetDfPos( int form , double pos );
+ void SetDfPos( int form , double pos );
/** Sets the speedbrake position
@param cmd speedbrake position in radians*/
- inline void SetDsbPos( int form , double pos );
+ void SetDsbPos( int form , double pos );
/** Sets the spoiler position
@param cmd spoiler position in radians*/
- inline void SetDspPos( int form , double pos );
+ void SetDspPos( int form , double pos );
/** Sets the actual throttle setting for the specified engine
@param engine engine ID number
Mass = Contents * M_gas();
// Bind relevant properties
- char property_name[80];
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/max_volume-ft3",
- CellNum);
- PropertyManager->Tie( property_name, &MaxVolume );
+ string property_name, base_property_name;
+
+ base_property_name = CreateIndexedPropertyName("buoyant_forces/gas-cell", CellNum);
+
+ property_name = base_property_name + "/max_volume-ft3";
+ PropertyManager->Tie( property_name.c_str(), &MaxVolume );
PropertyManager->SetWritable( property_name, false );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/temp-R",
- CellNum);
- PropertyManager->Tie( property_name, &Temperature );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/pressure-psf",
- CellNum);
- PropertyManager->Tie( property_name, &Pressure );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/volume-ft3",
- CellNum);
- PropertyManager->Tie( property_name, &Volume );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/buoyancy-lbs",
- CellNum);
- PropertyManager->Tie( property_name, &Buoyancy );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/contents-mol",
- CellNum);
- PropertyManager->Tie( property_name, &Contents );
- snprintf(property_name, 80, "buoyant_forces/gas-cell[%d]/valve_open",
- CellNum);
- PropertyManager->Tie( property_name, &ValveOpen );
+ property_name = base_property_name + "/temp-R";
+ PropertyManager->Tie( property_name.c_str(), &Temperature );
+ property_name = base_property_name + "/pressure-psf";
+ PropertyManager->Tie( property_name.c_str(), &Pressure );
+ property_name = base_property_name + "/volume-ft3";
+ PropertyManager->Tie( property_name.c_str(), &Volume );
+ property_name = base_property_name + "/buoyancy-lbs";
+ PropertyManager->Tie( property_name.c_str(), &Buoyancy );
+ property_name = base_property_name + "/contents-mol";
+ PropertyManager->Tie( property_name.c_str(), &Contents );
+ property_name = base_property_name + "/valve_open";
+ PropertyManager->Tie( property_name.c_str(), &ValveOpen );
Debug(0);
Volume = Contents * R * Temperature / Pressure;
// Bind relevant properties
- char property_name[80];
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/max_volume-ft3",
- Parent->GetIndex(),
- CellNum);
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("buoyant_forces/gas-cell", Parent->GetIndex());
+ base_property_name = CreateIndexedPropertyName(base_property_name + "/ballonet", CellNum);
+
+ property_name = base_property_name + "/max_volume-ft3";
PropertyManager->Tie( property_name, &MaxVolume );
PropertyManager->SetWritable( property_name, false );
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/temp-R",
- Parent->GetIndex(),
- CellNum);
+
+ property_name = base_property_name + "/temp-R";
PropertyManager->Tie( property_name, &Temperature );
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/pressure-psf",
- Parent->GetIndex(),
- CellNum);
+
+ property_name = base_property_name + "/pressure-psf";
PropertyManager->Tie( property_name, &Pressure );
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/volume-ft3",
- Parent->GetIndex(),
- CellNum);
+
+ property_name = base_property_name + "/volume-ft3";
PropertyManager->Tie( property_name, &Volume );
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/contents-mol",
- Parent->GetIndex(),
- CellNum);
+
+ property_name = base_property_name + "/contents-mol";
PropertyManager->Tie( property_name, &Contents );
- snprintf(property_name, 80,
- "buoyant_forces/gas-cell[%d]/ballonet[%d]/valve_open",
- Parent->GetIndex(),
- CellNum);
+
+ property_name = base_property_name + "/valve_open";
PropertyManager->Tie( property_name, &ValveOpen );
Debug(0);
}
}
+ LongForceFilter = Filter(LongForceLagFilterCoeff, State->Getdt());
+ LatForceFilter = Filter(LatForceLagFilterCoeff, State->Getdt());
+
WheelSlipLagFilterCoeff = 1/State->Getdt();
Element *wheel_slip_angle_lag_elem = el->FindElement("wheel_slip_filter");
WheelSlipLagFilterCoeff = wheel_slip_angle_lag_elem->GetDataAsNumber();
}
+ WheelSlipFilter = Filter(WheelSlipLagFilterCoeff, State->Getdt());
+
GearUp = false;
GearDown = true;
GearPos = 1.0;
SinWheel = 0.0;
CosWheel = 0.0;
- prevSlipIn = 0.0;
- prevSlipOut = 0.0;
-
Debug(0);
}
ForceY_Table = lgear.ForceY_Table;
CosWheel = lgear.CosWheel;
SinWheel = lgear.SinWheel;
- prevOut = lgear.prevOut;
- prevIn = lgear.prevIn;
- prevSlipIn = lgear.prevSlipIn;
- prevSlipOut = lgear.prevSlipOut;
RFRV = lgear.RFRV;
SFRV = lgear.SFRV;
LongForceLagFilterCoeff = lgear.LongForceLagFilterCoeff;
LatForceLagFilterCoeff = lgear.LatForceLagFilterCoeff;
WheelSlipLagFilterCoeff = lgear.WheelSlipLagFilterCoeff;
+ WheelSlipFilter = lgear.WheelSlipFilter;
+ LongForceFilter = lgear.LongForceFilter;
+ LatForceFilter = lgear.LatForceFilter;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vForce = Propagate->GetTl2b() * vLocalForce;
- // Lag and attenuate the XY-plane forces dependent on velocity
-
- double ca, cb, denom;
- FGColumnVector3 Output;
+ // Lag and attenuate the XY-plane forces dependent on velocity. This code
+ // uses a lag filter, C/(s + C) where "C" is the filter coefficient. When
+ // "C" is chosen at the frame rate (in Hz), the jittering is significantly
+ // reduced. This is because the jitter is present *at* the execution rate.
+ // If a coefficient is set to something equal to or less than zero, the
+ // filter is bypassed.
- // This code implements a lag filter, C/(s + C) where
- // "C" is the filter coefficient. When "C" is chosen at the
- // frame rate (in Hz), the jittering is significantly reduced. This is because
- // the jitter is present *at* the execution rate.
- // If a coefficient is set to something equal to or less than zero, the filter
- // is bypassed.
-
- if (LongForceLagFilterCoeff > 0) {
- denom = 2.00 + dT*LongForceLagFilterCoeff;
- ca = dT*LongForceLagFilterCoeff / denom;
- cb = (2.00 - dT*LongForceLagFilterCoeff) / denom;
- Output(eX) = vForce(eX) * ca + prevIn(eX) * ca + prevOut(eX) * cb;
- vForce(eX) = Output(eX);
- }
- if (LatForceLagFilterCoeff > 0) {
- denom = 2.00 + dT*LatForceLagFilterCoeff;
- ca = dT*LatForceLagFilterCoeff / denom;
- cb = (2.00 - dT*LatForceLagFilterCoeff) / denom;
- Output(eY) = vForce(eY) * ca + prevIn(eY) * ca + prevOut(eY) * cb;
- vForce(eY) = Output(eY);
- }
-
- prevIn = vForce;
- prevOut = Output;
+ if (LongForceLagFilterCoeff > 0) vForce(eX) = LongForceFilter.execute(vForce(eX));
+ if (LatForceLagFilterCoeff > 0) vForce(eY) = LatForceFilter.execute(vForce(eY));
if ((fabs(RollingWhlVel) <= RFRV) && RFRV > 0) vForce(eX) *= fabs(RollingWhlVel)/RFRV;
if ((fabs(SideWhlVel) <= SFRV) && SFRV > 0) vForce(eY) *= fabs(SideWhlVel)/SFRV;
- // End section for attentuating gear jitter
+ // End section for attentuating gear jitter
vMoment = vWhlBodyVec * vForce;
SideWhlVel = vWhlVelVec(eY)*CosWheel - vWhlVelVec(eX)*SinWheel;
// Calculate tire slip angle.
- WheelSlip = atan2(SideWhlVel, fabs(RollingWhlVel))*radtodeg;
+ WheelSlip = atan2(SideWhlVel, fabs(RollingWhlVel))*radtodeg;
// Filter the wheel slip angle
-
- double SlipOutput, ca, cb, denom;
-
- if (WheelSlipLagFilterCoeff > 0) {
- denom = 2.00 + dT*WheelSlipLagFilterCoeff;
- ca = dT*WheelSlipLagFilterCoeff / denom;
- cb = (2.00 - dT*WheelSlipLagFilterCoeff) / denom;
-
- SlipOutput = ca * (WheelSlip + prevSlipIn) + cb * prevSlipOut;
-
- prevSlipIn = WheelSlip;
- WheelSlip = prevSlipOut = SlipOutput;
- }
+ if (WheelSlipLagFilterCoeff > 0) WheelSlip = WheelSlipFilter.execute(WheelSlip);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGLGear::bind(void)
{
- char property_name[80];
+ string property_name;
+ string base_property_name;
+ base_property_name = CreateIndexedPropertyName("gear/unit", GearNumber);
if (eContactType == ctBOGEY) {
- snprintf(property_name, 80, "gear/unit[%d]/slip-angle-deg", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, &WheelSlip );
- snprintf(property_name, 80, "gear/unit[%d]/WOW", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, &WOW );
- snprintf(property_name, 80, "gear/unit[%d]/wheel-speed-fps", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, &RollingWhlVel );
- snprintf(property_name, 80, "gear/unit[%d]/z-position", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, (FGLGear*)this,
+ property_name = base_property_name + "/slip-angle-deg";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), &WheelSlip );
+ property_name = base_property_name + "/WOW";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), &WOW );
+ property_name = base_property_name + "/wheel-speed-fps";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), &RollingWhlVel );
+ property_name = base_property_name + "/z-position";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), (FGLGear*)this,
&FGLGear::GetZPosition, &FGLGear::SetZPosition);
- snprintf(property_name, 80, "gear/unit[%d]/compression-ft", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, &compressLength );
+ property_name = base_property_name + "/compression-ft";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), &compressLength );
}
if( isRetractable ) {
- snprintf(property_name, 80, "gear/unit[%d]/pos-norm", GearNumber);
- Exec->GetPropertyManager()->Tie( property_name, &GearPos );
+ property_name = base_property_name + "/pos-norm";
+ Exec->GetPropertyManager()->Tie( property_name.c_str(), &GearPos );
}
}
/// Destructor
~FGLGear();
-
/// The Force vector for this gear
FGColumnVector3& Force(void);
/// The Moment vector for this gear
FGColumnVector3 vLocalForce;
FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local)
FGColumnVector3 normal, cvel;
- FGColumnVector3 prevOut, prevIn;
FGLocation contact, gearLoc;
FGTable *ForceY_Table;
double dT;
double SideWhlVel, RollingWhlVel;
double RollingForce, SideForce, FCoeff;
double WheelSlip;
- double prevSlipIn;
- double prevSlipOut;
double TirePressureNorm;
double SinWheel, CosWheel;
double GearPos;
double LatForceLagFilterCoeff; // Lateral Force Lag Filter Coefficient
double WheelSlipLagFilterCoeff; // Wheel slip angle lag filter coefficient
+ Filter LongForceFilter;
+ Filter LatForceFilter;
+ Filter WheelSlipFilter;
+
FGFDMExec* Exec;
FGState* State;
FGAircraft* Aircraft;
#define ID_MASSBALANCE "$Id$"
-#if defined(WIN32) && !defined(__CYGWIN__)
-#define snprintf _snprintf
-#endif
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONSS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGMatrix33& CalculatePMInertias(void);
struct PointMass {
- char tmp[80];
PointMass(double w, FGColumnVector3& vXYZ) {
Weight = w;
Location = vXYZ;
double GetPointMassWeight(void) const {return Weight;}
void bind(FGPropertyManager* PropertyManager, int num) {
- snprintf(tmp, 80, "inertia/pointmass-weight-lbs[%u]", num);
- PropertyManager->Tie( tmp, this, &PointMass::GetPointMassWeight,
+ string tmp = CreateIndexedPropertyName("inertia/pointmass-weight-lbs", num);
+ PropertyManager->Tie( tmp.c_str(), this, &PointMass::GetPointMassWeight,
&PointMass::SetPointMassWeight);
- snprintf(tmp, 80, "inertia/pointmass-location-X-inches[%u]", num);
- PropertyManager->Tie( tmp, this, eX, &PointMass::GetPointMassLocation,
+ tmp = CreateIndexedPropertyName("inertia/pointmass-location-X-inches", num);
+ PropertyManager->Tie( tmp.c_str(), this, eX, &PointMass::GetPointMassLocation,
&PointMass::SetPointMassLocation);
- snprintf(tmp, 80, "inertia/pointmass-location-Y-inches[%u]", num);
- PropertyManager->Tie( tmp, this, eY, &PointMass::GetPointMassLocation,
+ tmp = CreateIndexedPropertyName("inertia/pointmass-location-Y-inches", num);
+ PropertyManager->Tie( tmp.c_str(), this, eY, &PointMass::GetPointMassLocation,
&PointMass::SetPointMassLocation);
- snprintf(tmp, 80, "inertia/pointmass-location-Z-inches[%u]", num);
- PropertyManager->Tie( tmp, this, eZ, &PointMass::GetPointMassLocation,
+ tmp = CreateIndexedPropertyName("inertia/pointmass-location-Z-inches", num);
+ PropertyManager->Tie( tmp.c_str(), this, eZ, &PointMass::GetPointMassLocation,
&PointMass::SetPointMassLocation);
}
};
cerr << "No feed tank specified in engine definition." << endl;
}
- char property_name[80];
- snprintf(property_name, 80, "propulsion/engine[%d]/set-running", EngineNumber);
- PropertyManager->Tie( property_name, this, &FGEngine::GetRunning, &FGEngine::SetRunning );
- snprintf(property_name, 80, "propulsion/engine[%u]/thrust-lbs", EngineNumber);
- PropertyManager->Tie( property_name, Thruster, &FGThruster::GetThrust);
- snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow-rate-pps", EngineNumber);
- PropertyManager->Tie( property_name, this, &FGEngine::GetFuelFlowRate);
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
+
+ property_name = base_property_name + "/set-running";
+ PropertyManager->Tie( property_name.c_str(), this, &FGEngine::GetRunning, &FGEngine::SetRunning );
+ property_name = base_property_name + "/thrust-lbs";
+ PropertyManager->Tie( property_name.c_str(), Thruster, &FGThruster::GetThrust);
+ property_name = base_property_name + "/fuel-flow-rate-pps";
+ PropertyManager->Tie( property_name.c_str(), this, &FGEngine::GetFuelFlowRate);
Debug(0);
}
MaxManifoldPressure_Percent = MaxManifoldPressure_inHg / 29.92;
}
- char property_name[80];
- snprintf(property_name, 80, "propulsion/engine[%d]/power-hp", EngineNumber);
- PropertyManager->Tie(property_name, &HP);
- snprintf(property_name, 80, "propulsion/engine[%d]/bsfc-lbs_hphr", EngineNumber);
- PropertyManager->Tie(property_name, &BSFC);
- snprintf(property_name, 80, "propulsion/engine[%d]/volumetric-efficiency", EngineNumber);
- PropertyManager->Tie(property_name, &volumetric_efficiency);
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
+ property_name = base_property_name + "/power-hp";
+ PropertyManager->Tie(property_name.c_str(), &HP);
+ property_name = base_property_name + "/bsfc-lbs_hphr";
+ PropertyManager->Tie(property_name.c_str(), &BSFC);
+ property_name = base_property_name + "/volumetric-efficiency";
+ PropertyManager->Tie(property_name.c_str(), &volumetric_efficiency);
minMAP = MinManifoldPressure_inHg * inhgtopa; // inHg to Pa
maxMAP = MaxManifoldPressure_inHg * inhgtopa;
StarterHP = sqrt(MaxHP) * 0.4;
D4 = Diameter*Diameter*Diameter*Diameter;
D5 = D4*Diameter;
- char property_name[80];
- snprintf(property_name, 80, "propulsion/engine[%d]/advance-ratio", EngineNum);
- PropertyManager->Tie( property_name, &J );
- snprintf(property_name, 80, "propulsion/engine[%d]/blade-angle", EngineNum);
- PropertyManager->Tie( property_name, &Pitch );
- snprintf(property_name, 80, "propulsion/engine[%d]/thrust-coefficient", EngineNum);
- PropertyManager->Tie( property_name, this, &FGPropeller::GetThrustCoefficient );
- snprintf(property_name, 80, "propulsion/engine[%d]/propeller-rpm", EngineNum);
- PropertyManager->Tie( property_name, this, &FGPropeller::GetRPM );
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNum);
+ property_name = base_property_name + "/advance-ratio";
+ PropertyManager->Tie( property_name.c_str(), &J );
+ property_name = base_property_name + "/blade-angle";
+ PropertyManager->Tie( property_name.c_str(), &Pitch );
+ property_name = base_property_name + "/thrust-coefficient";
+ PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetThrustCoefficient );
+ property_name = base_property_name + "/propeller-rpm";
+ PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetRPM );
Debug(0);
}
double dRPM = rpmReq - RPM;
// The pitch of a variable propeller cannot be changed when the RPMs are
// too low - the oil pump does not work.
- if (RPM > 200) Pitch -= dRPM / 10;
-
+ if (RPM > 200) Pitch -= dRPM * deltaT;
if (Pitch < MinPitch) Pitch = MinPitch;
else if (Pitch > MaxPitch) Pitch = MaxPitch;
//
void FGRocket::bindmodel()
{
- char property_name[80];
-
- snprintf(property_name, 80, "propulsion/engine[%u]/total-impulse", EngineNumber);
- PropertyManager->Tie( property_name, this, &FGRocket::GetTotalImpulse);
- snprintf(property_name, 80, "propulsion/engine[%u]/oxi-flow-rate-pps", EngineNumber);
- PropertyManager->Tie( property_name, this, &FGRocket::GetOxiFlowRate);
- snprintf(property_name, 80, "propulsion/engine[%u]/vacuum-thrust_lbs", EngineNumber);
- PropertyManager->Tie( property_name, this, &FGRocket::GetVacThrust);
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
+
+ property_name = base_property_name + "/total-impulse";
+ PropertyManager->Tie( property_name.c_str(), this, &FGRocket::GetTotalImpulse);
+ property_name = base_property_name + "/oxi-flow-rate-pps";
+ PropertyManager->Tie( property_name.c_str(), this, &FGRocket::GetOxiFlowRate);
+ property_name = base_property_name + "/vacuum-thrust_lbs";
+ PropertyManager->Tie( property_name.c_str(), this, &FGRocket::GetVacThrust);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
exit(-1);
}
Density = (Contents*lbtoslug)/Volume; // slugs/in^3
-
+ CalculateInertias();
}
- char property_name[80];
- snprintf(property_name, 80, "propulsion/tank[%d]/contents-lbs", TankNumber);
- PropertyManager->Tie( property_name, (FGTank*)this, &FGTank::GetContents,
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/tank", TankNumber);
+ property_name = base_property_name + "/contents-lbs";
+ PropertyManager->Tie( property_name.c_str(), (FGTank*)this, &FGTank::GetContents,
&FGTank::SetContents );
if (Temperature != -9999.0) InitialTemperature = Temperature = FahrenheitToCelsius(Temperature);
Area = 40.0 * pow(Capacity/1975, 0.666666667);
- CalculateInertias();
-
Debug(0);
}
double Mass = Contents*lbtoslug;
double RadSumSqr;
double Rad2 = Radius*Radius;
- Volume = (Contents*lbtoslug)/Density; // in^3
+
+ if (Density > 0.0) {
+ Volume = (Contents*lbtoslug)/Density; // in^3
+ } else {
+ cerr << endl << " Solid propellant grain density is zero!" << endl << endl;
+ exit(-1);
+ }
switch (grainType) {
case gtCYLINDRICAL:
SetLocation(location);
SetAnglesToBody(orientation);
- char property_name[80];
- snprintf(property_name, 80, "propulsion/engine[%d]/pitch-angle-rad", EngineNum);
- PropertyManager->Tie( property_name, (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch);
- snprintf(property_name, 80, "propulsion/engine[%d]/yaw-angle-rad", EngineNum);
- PropertyManager->Tie( property_name, (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw);
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNum);
+ property_name = base_property_name + "/pitch-angle-rad";
+ PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch);
+ property_name = base_property_name + "/yaw-angle-rad";
+ PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw);
if (el->GetName() == "direct") // this is a direct thruster. At this time
// only a direct thruster can be reversed.
{
- snprintf(property_name, 80, "propulsion/engine[%d]/reverser-angle-rad", EngineNum);
- PropertyManager->Tie( property_name, (FGThruster *)this, &FGThruster::GetReverserAngle,
+ property_name = base_property_name + "/reverser-angle-rad";
+ PropertyManager->Tie( property_name.c_str(), (FGThruster *)this, &FGThruster::GetReverserAngle,
&FGThruster::SetReverserAngle);
}
bool FGTurbine::Load(FGFDMExec* exec, Element *el)
{
- char property_prefix[80];
- snprintf(property_prefix, 80, "propulsion/engine[%u]/", EngineNumber);
+ string property_name, property_prefix;
+ property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
if (el->FindElement("milthrust"))
MilThrust = el->FindElementValueAsNumberConvertTo("milthrust","LBS");
void FGTurbine::bindmodel()
{
- char property_name[80];
-
- snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
- PropertyManager->Tie( property_name, &N1);
- snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
- PropertyManager->Tie( property_name, &N2);
- snprintf(property_name, 80, "propulsion/engine[%u]/injection_cmd", EngineNumber);
- PropertyManager->Tie( property_name, (FGTurbine*)this,
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
+ property_name = base_property_name + "/n1";
+ PropertyManager->Tie( property_name.c_str(), &N1);
+ property_name = base_property_name + "/n2";
+ PropertyManager->Tie( property_name.c_str(), &N2);
+ property_name = base_property_name + "/injection_cmd";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this,
&FGTurbine::GetInjection, &FGTurbine::SetInjection);
}
bool FGTurboProp::Load(FGFDMExec* exec, Element *el)
{
- char property_prefix[80];
- snprintf(property_prefix, 80, "propulsion/engine[%u]/", EngineNumber);
-
IdleFF=-1;
MaxStartingTime = 999999; //very big timeout -> infinite
Ielu_max_torque=-1;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-int FGTurboProp::InitRunning(void) {
+
+int FGTurboProp::InitRunning(void)
+{
State->SuspendIntegration();
Cutoff=false;
Running=true;
return phase==tpRun;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGTurboProp::bindmodel()
{
- char property_name[80];
-
-// ToDo: Do a proper Tie here, this should be read only.
-
- snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
- PropertyManager->Tie( property_name, &N1);
- snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
- PropertyManager->Tie( property_name, &N2);
- snprintf(property_name, 80, "propulsion/engine[%u]/reverser", EngineNumber);
- PropertyManager->Tie( property_name, &Reversed);
-
+ string property_name, base_property_name;
+ base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
+ property_name = base_property_name + "/n1";
+ PropertyManager->Tie( property_name.c_str(), &N1);
+ property_name = base_property_name + "/n2";
+ PropertyManager->Tie( property_name.c_str(), &N2);
+ property_name = base_property_name + "/reverser";
+ PropertyManager->Tie( property_name.c_str(), &Reversed);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%