Change FGSteam into a proper subsystem rather than a collection of
static methods, and remove outdated dependency in panel_io.cxx.
This commit is contained in:
parent
bf58dbd3c9
commit
5aee96c481
8 changed files with 240 additions and 120 deletions
|
@ -481,7 +481,8 @@ FGAutopilot::update (double dt)
|
||||||
// heading hold
|
// heading hold
|
||||||
if ( heading_hold == true ) {
|
if ( heading_hold == true ) {
|
||||||
if ( heading_mode == FG_DG_HEADING_LOCK ) {
|
if ( heading_mode == FG_DG_HEADING_LOCK ) {
|
||||||
TargetHeading = DGTargetHeading + FGSteam::get_DG_err();
|
TargetHeading = DGTargetHeading +
|
||||||
|
globals->get_steam()->get_DG_err();
|
||||||
while ( TargetHeading < 0.0 ) { TargetHeading += 360.0; }
|
while ( TargetHeading < 0.0 ) { TargetHeading += 360.0; }
|
||||||
while ( TargetHeading > 360.0 ) { TargetHeading -= 360.0; }
|
while ( TargetHeading > 360.0 ) { TargetHeading -= 360.0; }
|
||||||
MakeTargetHeadingStr( TargetHeading );
|
MakeTargetHeadingStr( TargetHeading );
|
||||||
|
@ -603,7 +604,7 @@ FGAutopilot::update (double dt)
|
||||||
|
|
||||||
if ( heading_mode == FG_TC_HEADING_LOCK ) {
|
if ( heading_mode == FG_TC_HEADING_LOCK ) {
|
||||||
// drive the turn coordinator to zero
|
// drive the turn coordinator to zero
|
||||||
double turn = FGSteam::get_TC_std();
|
double turn = globals->get_steam()->get_TC_std();
|
||||||
double AileronSet = -turn / 2.0;
|
double AileronSet = -turn / 2.0;
|
||||||
SG_CLAMP_RANGE( AileronSet, -1.0, 1.0 );
|
SG_CLAMP_RANGE( AileronSet, -1.0, 1.0 );
|
||||||
globals->get_controls()->set_aileron( AileronSet );
|
globals->get_controls()->set_aileron( AileronSet );
|
||||||
|
@ -689,7 +690,8 @@ FGAutopilot::update (double dt)
|
||||||
|
|
||||||
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
|
if ( altitude_mode == FG_ALTITUDE_LOCK ) {
|
||||||
climb_rate =
|
climb_rate =
|
||||||
( TargetAltitude - FGSteam::get_ALT_ft() * SG_FEET_TO_METER ) * 8.0;
|
( TargetAltitude -
|
||||||
|
globals->get_steam()->get_ALT_ft() * SG_FEET_TO_METER ) * 8.0;
|
||||||
} else if ( altitude_mode == FG_ALTITUDE_GS1 ) {
|
} else if ( altitude_mode == FG_ALTITUDE_GS1 ) {
|
||||||
double x = current_radiostack->get_nav1_gs_dist();
|
double x = current_radiostack->get_nav1_gs_dist();
|
||||||
double y = (altitude_node->getDoubleValue()
|
double y = (altitude_node->getDoubleValue()
|
||||||
|
|
|
@ -33,7 +33,7 @@ FGMagRibbon::FGMagRibbon (int w, int h)
|
||||||
void
|
void
|
||||||
FGMagRibbon::draw ()
|
FGMagRibbon::draw ()
|
||||||
{
|
{
|
||||||
double heading = FGSteam::get_MH_deg();
|
double heading = globals->get_steam()->get_MH_deg();
|
||||||
double xoffset, yoffset;
|
double xoffset, yoffset;
|
||||||
|
|
||||||
while (heading >= 360.0) {
|
while (heading >= 360.0) {
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include <GUI/gui.h>
|
#include <GUI/gui.h>
|
||||||
|
|
||||||
#include "panel.hxx"
|
#include "panel.hxx"
|
||||||
#include "steam.hxx"
|
|
||||||
#include "panel_io.hxx"
|
#include "panel_io.hxx"
|
||||||
|
|
||||||
//built-in layers
|
//built-in layers
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
#include <simgear/math/sg_types.hxx>
|
#include <simgear/math/sg_types.hxx>
|
||||||
#include <simgear/misc/props.hxx>
|
#include <simgear/misc/props.hxx>
|
||||||
|
|
||||||
|
#include <Main/fg_props.hxx>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
#ifdef FG_WEATHERCM
|
#ifdef FG_WEATHERCM
|
||||||
# include <WeatherCM/FGLocalWeatherDatabase.h>
|
# include <WeatherCM/FGLocalWeatherDatabase.h>
|
||||||
|
@ -46,51 +48,173 @@ SG_USING_NAMESPACE(std);
|
||||||
static bool isTied = false;
|
static bool isTied = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Constructor and destructor.
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
FGSteam::FGSteam ()
|
||||||
|
: the_STATIC_inhg(29.92),
|
||||||
|
the_ALT_ft(0.0),
|
||||||
|
the_ALT_datum_mb(1013.0),
|
||||||
|
the_VSI_case(29.92),
|
||||||
|
the_VSI_fps(0.0),
|
||||||
|
the_VACUUM_inhg(0.0),
|
||||||
|
the_MH_err(0.0),
|
||||||
|
the_MH_deg(0.0),
|
||||||
|
the_MH_degps(0.0),
|
||||||
|
the_DG_err(0.0),
|
||||||
|
the_DG_deg(0.0),
|
||||||
|
the_DG_degps(0.0),
|
||||||
|
the_DG_inhg(0.0),
|
||||||
|
the_TC_rad(0.0),
|
||||||
|
the_TC_std(0.0),
|
||||||
|
_UpdateTimePending(1000000)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FGSteam::~FGSteam ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGSteam::init ()
|
||||||
|
{
|
||||||
|
_heading_deg_node = fgGetNode("/orientation/heading-deg", true);
|
||||||
|
_mag_var_deg_node = fgGetNode("/environment/magnetic-variation-deg", true);
|
||||||
|
_mag_dip_deg_node = fgGetNode("/environment/magnetic-dip-deg", true);
|
||||||
|
_engine_0_rpm_node = fgGetNode("/engines/engine[0]/rpm", true);
|
||||||
|
_pressure_inhg_node = fgGetNode("environment/pressure-inhg", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGSteam::update (double dt_sec)
|
||||||
|
{
|
||||||
|
_UpdateTimePending += dt_sec;
|
||||||
|
_CatchUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGSteam::bind ()
|
||||||
|
{
|
||||||
|
fgTie("/steam/airspeed-kt", this, &FGSteam::get_ASI_kias);
|
||||||
|
fgSetArchivable("/steam/airspeed-kt");
|
||||||
|
fgTie("/steam/altitude-ft", this, &FGSteam::get_ALT_ft);
|
||||||
|
fgSetArchivable("/steam/altitude-ft");
|
||||||
|
fgTie("/steam/altimeter-datum-mb", this,
|
||||||
|
&FGSteam::get_ALT_datum_mb, &FGSteam::set_ALT_datum_mb,
|
||||||
|
false); /* don't modify the value */
|
||||||
|
fgSetArchivable("/steam/altimeter-datum-mb");
|
||||||
|
fgTie("/steam/turn-rate", this, &FGSteam::get_TC_std);
|
||||||
|
fgSetArchivable("/steam/turn-rate");
|
||||||
|
fgTie("/steam/slip-skid",this, &FGSteam::get_TC_rad);
|
||||||
|
fgSetArchivable("/steam/slip-skid");
|
||||||
|
fgTie("/steam/vertical-speed-fps", this, &FGSteam::get_VSI_fps);
|
||||||
|
fgSetArchivable("/steam/vertical-speed-fps");
|
||||||
|
fgTie("/steam/gyro-compass-deg", this, &FGSteam::get_DG_deg);
|
||||||
|
fgSetArchivable("/steam/gyro-compass-deg");
|
||||||
|
// fgTie("/steam/adf-deg", FGSteam::get_HackADF_deg);
|
||||||
|
// fgSetArchivable("/steam/adf-deg");
|
||||||
|
fgTie("/steam/gyro-compass-error-deg", this,
|
||||||
|
&FGSteam::get_DG_err, &FGSteam::set_DG_err,
|
||||||
|
false); /* don't modify the value */
|
||||||
|
fgSetArchivable("/steam/gyro-compass-error-deg");
|
||||||
|
fgTie("/steam/mag-compass-deg", this, &FGSteam::get_MH_deg);
|
||||||
|
fgSetArchivable("/steam/mag-compass-deg");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGSteam::unbind ()
|
||||||
|
{
|
||||||
|
fgUntie("/steam/airspeed-kt");
|
||||||
|
fgUntie("/steam/altitude-ft");
|
||||||
|
fgUntie("/steam/altimeter-datum-mb");
|
||||||
|
fgUntie("/steam/turn-rate");
|
||||||
|
fgUntie("/steam/slip-skid");
|
||||||
|
fgUntie("/steam/vertical-speed-fps");
|
||||||
|
fgUntie("/steam/gyro-compass-deg");
|
||||||
|
fgUntie("/steam/gyro-compass-error-deg");
|
||||||
|
fgUntie("/steam/mag-compass-deg");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Declare the functions that read the variables
|
// Declare the functions that read the variables
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
double FGSteam::the_STATIC_inhg = 29.92;
|
double
|
||||||
double FGSteam::the_ALT_ft = 0.0; // Indicated altitude
|
FGSteam::get_ALT_ft () const
|
||||||
double FGSteam::get_ALT_ft() { _CatchUp(); return the_ALT_ft; }
|
{
|
||||||
|
return the_ALT_ft;
|
||||||
|
}
|
||||||
|
|
||||||
double FGSteam::the_ALT_datum_mb = 1013.0;
|
double
|
||||||
double FGSteam::get_ALT_datum_mb() { return the_ALT_datum_mb; }
|
FGSteam::get_ALT_datum_mb () const
|
||||||
|
{
|
||||||
|
return the_ALT_datum_mb;
|
||||||
|
}
|
||||||
|
|
||||||
void FGSteam::set_ALT_datum_mb ( double datum_mb ) {
|
void
|
||||||
|
FGSteam::set_ALT_datum_mb (double datum_mb)
|
||||||
|
{
|
||||||
the_ALT_datum_mb = datum_mb;
|
the_ALT_datum_mb = datum_mb;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FGSteam::get_ASI_kias() { return fgGetDouble("/velocities/airspeed-kt"); }
|
double
|
||||||
|
FGSteam::get_ASI_kias () const
|
||||||
double FGSteam::the_VSI_case = 29.92;
|
{
|
||||||
double FGSteam::the_VSI_fps = 0.0;
|
return fgGetDouble("/velocities/airspeed-kt");
|
||||||
double FGSteam::get_VSI_fps() { _CatchUp(); return the_VSI_fps; }
|
}
|
||||||
|
|
||||||
double FGSteam::the_VACUUM_inhg = 0.0;
|
double
|
||||||
double FGSteam::get_VACUUM_inhg() { _CatchUp(); return the_VACUUM_inhg; }
|
FGSteam::get_VSI_fps () const
|
||||||
|
{
|
||||||
double FGSteam::the_MH_err = 0.0;
|
return the_VSI_fps;
|
||||||
double FGSteam::the_MH_deg = 0.0;
|
}
|
||||||
double FGSteam::the_MH_degps = 0.0;
|
|
||||||
double FGSteam::get_MH_deg () { _CatchUp(); return the_MH_deg; }
|
double
|
||||||
|
FGSteam::get_VACUUM_inhg () const
|
||||||
double FGSteam::the_DG_err = 0.0;
|
{
|
||||||
double FGSteam::the_DG_deg = 0.0;
|
return the_VACUUM_inhg;
|
||||||
double FGSteam::the_DG_degps = 0.0;
|
}
|
||||||
double FGSteam::the_DG_inhg = 0.0;
|
|
||||||
double FGSteam::get_DG_deg () { _CatchUp(); return the_DG_deg; }
|
double
|
||||||
double FGSteam::get_DG_err () { _CatchUp(); return the_DG_err; }
|
FGSteam::get_MH_deg () const
|
||||||
|
{
|
||||||
void FGSteam::set_DG_err ( double approx_magvar ) {
|
return the_MH_deg;
|
||||||
the_DG_err = approx_magvar;
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
FGSteam::get_DG_deg () const
|
||||||
|
{
|
||||||
|
return the_DG_deg;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
FGSteam::get_DG_err () const
|
||||||
|
{
|
||||||
|
return the_DG_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGSteam::set_DG_err (double approx_magvar)
|
||||||
|
{
|
||||||
|
the_DG_err = approx_magvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
FGSteam::get_TC_rad () const
|
||||||
|
{
|
||||||
|
return the_TC_rad;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
FGSteam::get_TC_std () const
|
||||||
|
{
|
||||||
|
return the_TC_std;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FGSteam::the_TC_rad = 0.0;
|
|
||||||
double FGSteam::the_TC_std = 0.0;
|
|
||||||
double FGSteam::get_TC_rad () { _CatchUp(); return the_TC_rad; }
|
|
||||||
double FGSteam::get_TC_std () { _CatchUp(); return the_TC_std; }
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -98,45 +222,6 @@ double FGSteam::get_TC_std () { _CatchUp(); return the_TC_std; }
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
double FGSteam::_UpdateTimePending = 1000000; /* Forces filters to reset */
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME: no need to use static
|
|
||||||
// functions any longer.
|
|
||||||
|
|
||||||
void FGSteam::update (double dt)
|
|
||||||
{
|
|
||||||
if (!isTied) {
|
|
||||||
isTied = true;
|
|
||||||
fgTie("/steam/airspeed-kt", FGSteam::get_ASI_kias);
|
|
||||||
fgSetArchivable("/steam/airspeed-kt");
|
|
||||||
fgTie("/steam/altitude-ft", FGSteam::get_ALT_ft);
|
|
||||||
fgSetArchivable("/steam/altitude-ft");
|
|
||||||
fgTie("/steam/altimeter-datum-mb",
|
|
||||||
FGSteam::get_ALT_datum_mb, FGSteam::set_ALT_datum_mb,
|
|
||||||
false); /* don't modify the value */
|
|
||||||
fgSetArchivable("/steam/altimeter-datum-mb");
|
|
||||||
fgTie("/steam/turn-rate", FGSteam::get_TC_std);
|
|
||||||
fgSetArchivable("/steam/turn-rate");
|
|
||||||
fgTie("/steam/slip-skid", FGSteam::get_TC_rad);
|
|
||||||
fgSetArchivable("/steam/slip-skid");
|
|
||||||
fgTie("/steam/vertical-speed-fps", FGSteam::get_VSI_fps);
|
|
||||||
fgSetArchivable("/steam/vertical-speed-fps");
|
|
||||||
fgTie("/steam/gyro-compass-deg", FGSteam::get_DG_deg);
|
|
||||||
fgSetArchivable("/steam/gyro-compass-deg");
|
|
||||||
// fgTie("/steam/adf-deg", FGSteam::get_HackADF_deg);
|
|
||||||
// fgSetArchivable("/steam/adf-deg");
|
|
||||||
fgTie("/steam/gyro-compass-error-deg",
|
|
||||||
FGSteam::get_DG_err, FGSteam::set_DG_err,
|
|
||||||
false); /* don't modify the value */
|
|
||||||
fgSetArchivable("/steam/gyro-compass-error-deg");
|
|
||||||
fgTie("/steam/mag-compass-deg", FGSteam::get_MH_deg);
|
|
||||||
fgSetArchivable("/steam/mag-compass-deg");
|
|
||||||
}
|
|
||||||
_UpdateTimePending += dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* tc should be (elapsed_time_between_updates / desired_smoothing_time) */
|
/* tc should be (elapsed_time_between_updates / desired_smoothing_time) */
|
||||||
void FGSteam::set_lowpass ( double *outthe, double inthe, double tc )
|
void FGSteam::set_lowpass ( double *outthe, double inthe, double tc )
|
||||||
{
|
{
|
||||||
|
@ -206,11 +291,6 @@ double altFtToPressInHg(double alt_ft)
|
||||||
|
|
||||||
void FGSteam::_CatchUp()
|
void FGSteam::_CatchUp()
|
||||||
{
|
{
|
||||||
static const SGPropertyNode *heading_deg_node = fgGetNode("/orientation/heading-deg", true);
|
|
||||||
static const SGPropertyNode *mag_var_deg_node = fgGetNode("/environment/magnetic-variation-deg", true);
|
|
||||||
static const SGPropertyNode *mag_dip_deg_node = fgGetNode("/environment/magnetic-dip-deg", true);
|
|
||||||
static const SGPropertyNode *enginge_0_rpm_node = fgGetNode("/engines/engine[0]/rpm", true);
|
|
||||||
|
|
||||||
if ( _UpdateTimePending != 0 )
|
if ( _UpdateTimePending != 0 )
|
||||||
{
|
{
|
||||||
double dt = _UpdateTimePending;
|
double dt = _UpdateTimePending;
|
||||||
|
@ -267,16 +347,16 @@ void FGSteam::_CatchUp()
|
||||||
if ( fabs(the_TC_rad) > 0.2 /* 2.0 */ )
|
if ( fabs(the_TC_rad) > 0.2 /* 2.0 */ )
|
||||||
{ /* Massive sideslip jams it; it stops turning */
|
{ /* Massive sideslip jams it; it stops turning */
|
||||||
the_MH_degps = 0.0;
|
the_MH_degps = 0.0;
|
||||||
the_MH_err = heading_deg_node->getDoubleValue() - the_MH_deg;
|
the_MH_err = _heading_deg_node->getDoubleValue() - the_MH_deg;
|
||||||
} else
|
} else
|
||||||
{ double MagDip, MagVar, CosDip;
|
{ double MagDip, MagVar, CosDip;
|
||||||
double FrcN, FrcE, FrcU, AccTot;
|
double FrcN, FrcE, FrcU, AccTot;
|
||||||
double EdgN, EdgE, EdgU;
|
double EdgN, EdgE, EdgU;
|
||||||
double TrqN, TrqE, TrqU, Torque;
|
double TrqN, TrqE, TrqU, Torque;
|
||||||
/* Find a force vector towards exact magnetic north */
|
/* Find a force vector towards exact magnetic north */
|
||||||
MagVar = mag_var_deg_node->getDoubleValue()
|
MagVar = _mag_var_deg_node->getDoubleValue()
|
||||||
/ SGD_RADIANS_TO_DEGREES;
|
/ SGD_RADIANS_TO_DEGREES;
|
||||||
MagDip = mag_var_deg_node->getDoubleValue()
|
MagDip = _mag_var_deg_node->getDoubleValue()
|
||||||
/ SGD_RADIANS_TO_DEGREES;
|
/ SGD_RADIANS_TO_DEGREES;
|
||||||
CosDip = cos ( MagDip );
|
CosDip = cos ( MagDip );
|
||||||
FrcN = CosDip * cos ( MagVar );
|
FrcN = CosDip * cos ( MagVar );
|
||||||
|
@ -307,7 +387,7 @@ void FGSteam::_CatchUp()
|
||||||
}
|
}
|
||||||
if ( the_MH_err > 180.0 ) the_MH_err -= 360.0; else
|
if ( the_MH_err > 180.0 ) the_MH_err -= 360.0; else
|
||||||
if ( the_MH_err < -180.0 ) the_MH_err += 360.0;
|
if ( the_MH_err < -180.0 ) the_MH_err += 360.0;
|
||||||
the_MH_deg = heading_deg_node->getDoubleValue() - the_MH_err;
|
the_MH_deg = _heading_deg_node->getDoubleValue() - the_MH_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
|
@ -315,7 +395,7 @@ void FGSteam::_CatchUp()
|
||||||
scaling capability for the vacuum pump later on.
|
scaling capability for the vacuum pump later on.
|
||||||
When we have a real engine model, we can ask it.
|
When we have a real engine model, we can ask it.
|
||||||
*/
|
*/
|
||||||
the_ENGINE_rpm = enginge_0_rpm_node->getDoubleValue();
|
the_ENGINE_rpm = _engine_0_rpm_node->getDoubleValue();
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
First, we need to know what the static line is reporting,
|
First, we need to know what the static line is reporting,
|
||||||
|
@ -330,7 +410,7 @@ void FGSteam::_CatchUp()
|
||||||
double static_inhg = WeatherDatabase->get(plane_pos).AirPressure *
|
double static_inhg = WeatherDatabase->get(plane_pos).AirPressure *
|
||||||
(0.01 / INHG_TO_MB);
|
(0.01 / INHG_TO_MB);
|
||||||
#else
|
#else
|
||||||
double static_inhg = fgGetDouble("/environment/pressure-inhg");
|
double static_inhg = _pressure_inhg_node->getDoubleValue();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
set_lowpass ( & the_STATIC_inhg, static_inhg, dt );
|
set_lowpass ( & the_STATIC_inhg, static_inhg, dt );
|
||||||
|
@ -395,7 +475,7 @@ void FGSteam::_CatchUp()
|
||||||
the_DG_err = fgGetDouble("/environment/magnetic-variation-deg");
|
the_DG_err = fgGetDouble("/environment/magnetic-variation-deg");
|
||||||
the_DG_degps = 0.01; /* HACK! */
|
the_DG_degps = 0.01; /* HACK! */
|
||||||
if (dt<1.0) the_DG_err += dt * the_DG_degps;
|
if (dt<1.0) the_DG_err += dt * the_DG_degps;
|
||||||
the_DG_deg = heading_deg_node->getDoubleValue() - the_DG_err;
|
the_DG_deg = _heading_deg_node->getDoubleValue() - the_DG_err;
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
Finished updates, now clear the timer
|
Finished updates, now clear the timer
|
||||||
|
@ -411,11 +491,13 @@ void FGSteam::_CatchUp()
|
||||||
// Everything below is a transient hack; expect it to disappear
|
// Everything below is a transient hack; expect it to disappear
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
double FGSteam::get_HackOBS1_deg () {
|
double FGSteam::get_HackOBS1_deg () const
|
||||||
return current_radiostack->get_nav1_radial();
|
{
|
||||||
|
return current_radiostack->get_nav1_radial();
|
||||||
}
|
}
|
||||||
|
|
||||||
double FGSteam::get_HackOBS2_deg () {
|
double FGSteam::get_HackOBS2_deg () const
|
||||||
|
{
|
||||||
return current_radiostack->get_nav2_radial();
|
return current_radiostack->get_nav2_radial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
|
#include <Main/fgfs.hxx>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include STL_STRING
|
#include STL_STRING
|
||||||
|
|
||||||
|
@ -49,54 +51,70 @@ SG_USING_NAMESPACE(std);
|
||||||
* and autopilot features where these are slaved thus.
|
* and autopilot features where these are slaved thus.
|
||||||
* They should not be used for other simulation purposes.
|
* They should not be used for other simulation purposes.
|
||||||
*/
|
*/
|
||||||
class FGSteam
|
class FGSteam : public FGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void update ( double dt );
|
FGSteam ();
|
||||||
|
virtual ~FGSteam ();
|
||||||
|
|
||||||
|
virtual void init ();
|
||||||
|
|
||||||
|
virtual void update (double dt_sec);
|
||||||
|
|
||||||
|
virtual void bind ();
|
||||||
|
|
||||||
|
virtual void unbind ();
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
static double get_ALT_ft ();
|
virtual double get_ALT_ft () const;
|
||||||
static double get_TC_rad ();
|
virtual double get_TC_rad () const;
|
||||||
static double get_MH_deg ();
|
virtual double get_MH_deg () const;
|
||||||
static double get_DG_deg ();
|
virtual double get_DG_deg () const;
|
||||||
static double get_DG_err ();
|
virtual double get_DG_err () const;
|
||||||
static void set_DG_err(double approx_magvar);
|
virtual void set_DG_err(double approx_magvar);
|
||||||
|
|
||||||
// Velocities
|
// Velocities
|
||||||
static double get_ASI_kias ();
|
virtual double get_ASI_kias () const;
|
||||||
static double get_TC_std ();
|
virtual double get_TC_std () const;
|
||||||
static double get_VSI_fps ();
|
virtual double get_VSI_fps () const;
|
||||||
|
|
||||||
// Engine Gauges
|
// Engine Gauges
|
||||||
static double get_VACUUM_inhg ();
|
virtual double get_VACUUM_inhg () const;
|
||||||
|
|
||||||
// Atmosphere
|
// Atmosphere
|
||||||
static double get_ALT_datum_mb ();
|
virtual double get_ALT_datum_mb () const;
|
||||||
static void set_ALT_datum_mb(double datum_mb);
|
virtual void set_ALT_datum_mb(double datum_mb);
|
||||||
|
|
||||||
// Hacks ... temporary stuff
|
// Hacks ... temporary stuff
|
||||||
// static double get_HackVOR1_deg ();
|
// static double get_HackVOR1_deg ();
|
||||||
static double get_HackOBS1_deg ();
|
virtual double get_HackOBS1_deg () const;
|
||||||
// static double get_HackGS_deg ();
|
// static double get_HackGS_deg ();
|
||||||
// static double get_HackVOR2_deg ();
|
// static double get_HackVOR2_deg ();
|
||||||
static double get_HackOBS2_deg ();
|
virtual double get_HackOBS2_deg () const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static double the_ALT_ft;
|
|
||||||
static double the_ALT_datum_mb;
|
|
||||||
static double the_TC_rad, the_TC_std;
|
|
||||||
static double the_STATIC_inhg, the_VACUUM_inhg;
|
|
||||||
static double the_VSI_fps, the_VSI_case;
|
|
||||||
static double the_MH_deg, the_MH_degps, the_MH_err;
|
|
||||||
static double the_DG_deg, the_DG_degps, the_DG_inhg, the_DG_err;
|
|
||||||
|
|
||||||
static double _UpdateTimePending;
|
void _CatchUp ();
|
||||||
static void _CatchUp ();
|
void set_lowpass ( double *outthe, double inthe, double tc );
|
||||||
|
|
||||||
|
double the_ALT_ft;
|
||||||
|
double the_ALT_datum_mb;
|
||||||
|
double the_TC_rad, the_TC_std;
|
||||||
|
double the_STATIC_inhg, the_VACUUM_inhg;
|
||||||
|
double the_VSI_fps, the_VSI_case;
|
||||||
|
double the_MH_deg, the_MH_degps, the_MH_err;
|
||||||
|
double the_DG_deg, the_DG_degps, the_DG_inhg, the_DG_err;
|
||||||
|
|
||||||
|
double _UpdateTimePending;
|
||||||
|
|
||||||
|
SGPropertyNode_ptr _heading_deg_node;
|
||||||
|
SGPropertyNode_ptr _mag_var_deg_node;
|
||||||
|
SGPropertyNode_ptr _mag_dip_deg_node;
|
||||||
|
SGPropertyNode_ptr _engine_0_rpm_node;
|
||||||
|
SGPropertyNode_ptr _pressure_inhg_node;
|
||||||
|
|
||||||
static void set_lowpass ( double *outthe,
|
|
||||||
double inthe, double tc );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
#include <Autopilot/newauto.hxx>
|
#include <Autopilot/newauto.hxx>
|
||||||
#include <Cockpit/cockpit.hxx>
|
#include <Cockpit/cockpit.hxx>
|
||||||
#include <Cockpit/radiostack.hxx>
|
#include <Cockpit/radiostack.hxx>
|
||||||
|
#include <Cockpit/steam.hxx>
|
||||||
#include <Cockpit/panel.hxx>
|
#include <Cockpit/panel.hxx>
|
||||||
#include <Cockpit/panel_io.hxx>
|
#include <Cockpit/panel_io.hxx>
|
||||||
#include <FDM/ADA.hxx>
|
#include <FDM/ADA.hxx>
|
||||||
|
@ -1061,6 +1062,14 @@ bool fgInitSubsystems( void ) {
|
||||||
globals->get_controls()->bind();
|
globals->get_controls()->bind();
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Initialize the steam subsystem.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
globals->get_steam()->init();
|
||||||
|
globals->get_steam()->bind();
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the input subsystem.
|
// Initialize the input subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -56,6 +56,7 @@ class FGLogger;
|
||||||
class FGEnvironmentMgr;
|
class FGEnvironmentMgr;
|
||||||
class FGEnvironment;
|
class FGEnvironment;
|
||||||
class FGControls;
|
class FGControls;
|
||||||
|
class FGSteam;
|
||||||
class FGSoundMgr;
|
class FGSoundMgr;
|
||||||
class FGAutopilot;
|
class FGAutopilot;
|
||||||
class FGFX;
|
class FGFX;
|
||||||
|
@ -143,6 +144,9 @@ private:
|
||||||
// control input state
|
// control input state
|
||||||
FGControls *controls;
|
FGControls *controls;
|
||||||
|
|
||||||
|
// Steam instruments
|
||||||
|
FGSteam *steam;
|
||||||
|
|
||||||
// viewer manager
|
// viewer manager
|
||||||
FGViewMgr *viewmgr;
|
FGViewMgr *viewmgr;
|
||||||
|
|
||||||
|
@ -240,6 +244,9 @@ public:
|
||||||
inline FGControls *get_controls() const { return controls; }
|
inline FGControls *get_controls() const { return controls; }
|
||||||
inline void set_controls( FGControls *c ) { controls = c; }
|
inline void set_controls( FGControls *c ) { controls = c; }
|
||||||
|
|
||||||
|
inline FGSteam *get_steam() const { return steam; }
|
||||||
|
inline void set_steam( FGSteam *s ) { steam = s; }
|
||||||
|
|
||||||
inline FGViewMgr *get_viewmgr() const { return viewmgr; }
|
inline FGViewMgr *get_viewmgr() const { return viewmgr; }
|
||||||
inline void set_viewmgr( FGViewMgr *vm ) { viewmgr = vm; }
|
inline void set_viewmgr( FGViewMgr *vm ) { viewmgr = vm; }
|
||||||
FGViewer *get_current_view() const;
|
FGViewer *get_current_view() const;
|
||||||
|
|
|
@ -798,7 +798,7 @@ void fgUpdateTimeDepCalcs() {
|
||||||
|
|
||||||
globals->get_autopilot()->update(delta_time_sec);
|
globals->get_autopilot()->update(delta_time_sec);
|
||||||
cur_fdm_state->update(delta_time_sec);
|
cur_fdm_state->update(delta_time_sec);
|
||||||
FGSteam::update(delta_time_sec);
|
globals->get_steam()->update(delta_time_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !strcmp(fgGetString("/sim/view-mode"), "pilot") ) {
|
if ( !strcmp(fgGetString("/sim/view-mode"), "pilot") ) {
|
||||||
|
@ -1411,6 +1411,9 @@ int mainLoop( int argc, char **argv ) {
|
||||||
FGControls *controls = new FGControls;
|
FGControls *controls = new FGControls;
|
||||||
globals->set_controls( controls );
|
globals->set_controls( controls );
|
||||||
|
|
||||||
|
FGSteam *steam = new FGSteam;
|
||||||
|
globals->set_steam( steam );
|
||||||
|
|
||||||
string_list *col = new string_list;
|
string_list *col = new string_list;
|
||||||
globals->set_channel_options_list( col );
|
globals->set_channel_options_list( col );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue