A first stab at an ACMS (Aircraft Condition Monitoring System) Special Purpose support FDM. Move the ADA FDM into the Special Purpose directory and make the SP FDM's a configure option.
This commit is contained in:
parent
1254fdea2a
commit
8b53b86aa0
12 changed files with 196 additions and 9 deletions
14
configure.ac
14
configure.ac
|
@ -68,6 +68,10 @@ else
|
|||
fi
|
||||
AM_CONDITIONAL(ENABLE_MPLAYER_AS, test "x$with_multiplayer" != "xno")
|
||||
|
||||
AC_ARG_ENABLE(sp_fdms, [ --enable-sp-fdms Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
|
||||
AC_DEFINE([ENABLE_SP_FMDS], test "x$enable_sp_fdms" = "xyes", [Define to include special purpose FDMs])
|
||||
AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
|
||||
|
||||
|
||||
dnl Thread related checks
|
||||
# defaults to yes
|
||||
|
@ -219,7 +223,7 @@ AC_SEARCH_LIBS(dlclose, dl)
|
|||
base_LIBS="$LIBS"
|
||||
|
||||
dnl Check for SDL if enabled.
|
||||
AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], enable_sdl="yes", enable_sdl="")
|
||||
AC_ARG_ENABLE(sdl, [ --enable-sdl Configure to use SDL instead of GLUT], [enable_sdl="$enableval"])
|
||||
AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
|
||||
if test "x$enable_sdl" = "xyes"; then
|
||||
AC_DEFINE([PU_USE_SDL], 1, [Define to use SDL])
|
||||
|
@ -545,6 +549,7 @@ AC_CONFIG_FILES([ \
|
|||
src/FDM/JSBSim/Makefile \
|
||||
src/FDM/JSBSim/filtersjb/Makefile \
|
||||
src/FDM/LaRCsim/Makefile \
|
||||
src/FDM/SP/Makefile \
|
||||
src/FDM/UIUCModel/Makefile \
|
||||
src/FDM/YASim/Makefile \
|
||||
src/FDM/Makefile \
|
||||
|
@ -601,3 +606,10 @@ if test "x$with_threads" = "xyes"; then
|
|||
else
|
||||
echo "threads: no"
|
||||
fi
|
||||
|
||||
if test "x$enable_sp_fdms" != "xno"; then
|
||||
echo "Include special purpose flight models: yes"
|
||||
else
|
||||
echo "Include special purpose flight models: no"
|
||||
fi
|
||||
|
||||
|
|
|
@ -43,7 +43,9 @@
|
|||
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Include/general.hxx>
|
||||
#include <FDM/ADA.hxx>
|
||||
#ifdef ENABLE_SP_FMDS
|
||||
#include <FDM/SP/ADA.hxx>
|
||||
#endif
|
||||
#include <Main/globals.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/viewmgr.hxx>
|
||||
|
@ -337,6 +339,7 @@ float get_anzg ( void )
|
|||
return anzg;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SP_FMDS
|
||||
int get_iaux1 (void)
|
||||
{
|
||||
FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
|
||||
|
@ -516,7 +519,7 @@ float get_aux18 (void)
|
|||
FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
|
||||
return fdm->get_faux(10);
|
||||
}
|
||||
// #endif
|
||||
#endif
|
||||
// $$$ end - added, VS Renganathan 13 Oct 2K
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
SUBDIRS = Balloon ExternalNet ExternalPipe JSBSim LaRCsim UIUCModel YASim
|
||||
if ENABLE_SP_FDM
|
||||
SP_DIR = SP
|
||||
else
|
||||
SP_DIR =
|
||||
endif
|
||||
|
||||
SUBDIRS = Balloon JSBSim LaRCsim UIUCModel YASim \
|
||||
$(SP_DIR) ExternalNet ExternalPipe
|
||||
|
||||
noinst_LIBRARIES = libFlight.a
|
||||
|
||||
libFlight_a_SOURCES = \
|
||||
ADA.cxx ADA.hxx \
|
||||
Balloon.cxx Balloon.h \
|
||||
flight.cxx flight.hxx \
|
||||
MagicCarpet.cxx MagicCarpet.hxx \
|
||||
|
|
95
src/FDM/SP/ACMS.cxx
Normal file
95
src/FDM/SP/ACMS.cxx
Normal file
|
@ -0,0 +1,95 @@
|
|||
// ACMS.cxx -- interface to the ACMS FDM
|
||||
//
|
||||
// Written by Erik Hofman, started October 2004
|
||||
//
|
||||
// Copyright (C) 2004 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
#include "ACMS.hxx"
|
||||
|
||||
FGACMS::FGACMS( double dt )
|
||||
{
|
||||
// set_delta_t( dt );
|
||||
}
|
||||
|
||||
|
||||
FGACMS::~FGACMS() {
|
||||
}
|
||||
|
||||
|
||||
// Initialize the ACMSFDM flight model, dt is the time increment
|
||||
// for each subsequent iteration through the EOM
|
||||
void FGACMS::init() {
|
||||
common_init();
|
||||
}
|
||||
|
||||
|
||||
// Run an iteration of the EOM (equations of motion)
|
||||
void FGACMS::update( double dt ) {
|
||||
|
||||
double pitch = get_Theta();
|
||||
double roll = get_Phi();
|
||||
double heading = get_Psi() * SG_DEGREES_TO_RADIANS;
|
||||
double alt = get_Altitude();
|
||||
|
||||
double sl_radius, lat_geoc;
|
||||
sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
|
||||
|
||||
double lon_acc = get_V_north();
|
||||
double lat_acc = get_V_east();
|
||||
double vert_acc = get_V_down();
|
||||
|
||||
double accel_heading = atan( lon_acc/lat_acc );
|
||||
double accel_pitch = atan( vert_acc/accel_heading );
|
||||
|
||||
double accel = sqrt(sqrt(lon_acc*lon_acc + lat_acc*lat_acc)
|
||||
+ vert_acc*vert_acc);
|
||||
|
||||
double velocity = get_V_true_kts() * accel / (SG_METER_TO_NM * 3600.0);
|
||||
double speed = cos (pitch) * velocity; // meters/sec
|
||||
double dist = speed * dt;
|
||||
double kts = velocity * 6076.11549 * 3600.0;
|
||||
|
||||
double climb_rate = fgGetDouble("/velocities/climb-rate", 0);
|
||||
double climb = climb_rate * dt;
|
||||
|
||||
_set_Alpha( pitch - accel_pitch);
|
||||
_set_Beta( heading - accel_heading);
|
||||
_set_Climb_Rate( climb_rate );
|
||||
_set_V_equiv_kts( kts );
|
||||
_set_V_calibrated_kts( kts );
|
||||
_set_V_ground_speed( kts );
|
||||
_set_Altitude( get_Altitude() + climb );
|
||||
|
||||
// update (lon/lat) position
|
||||
double lat2, lon2, az2;
|
||||
geo_direct_wgs_84 ( get_Altitude(),
|
||||
get_Latitude() * SGD_RADIANS_TO_DEGREES,
|
||||
get_Longitude() * SGD_RADIANS_TO_DEGREES,
|
||||
get_Psi() * SGD_RADIANS_TO_DEGREES,
|
||||
dist, &lat2, &lon2, &az2 );
|
||||
_set_Geocentric_Position( lat_geoc, get_Longitude(),
|
||||
sl_radius + get_Altitude() + climb );
|
||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
|
||||
|
||||
_set_Longitude( lon2 * SGD_DEGREES_TO_RADIANS );
|
||||
_set_Latitude( lat2 * SGD_DEGREES_TO_RADIANS );
|
||||
|
||||
}
|
46
src/FDM/SP/ACMS.hxx
Normal file
46
src/FDM/SP/ACMS.hxx
Normal file
|
@ -0,0 +1,46 @@
|
|||
// ACMS.hxx -- interface to the AIAircraft FDM
|
||||
//
|
||||
// Written by Erik Hofman, started October 2004
|
||||
//
|
||||
// Copyright (C) 2004 Erik Hofman <erik@ehofman.com>
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
|
||||
#ifndef _ACMS_HXX
|
||||
#define _ACMS_HXX
|
||||
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
|
||||
class FGACMS: public FGInterface
|
||||
{
|
||||
public:
|
||||
FGACMS( double dt );
|
||||
~FGACMS();
|
||||
|
||||
// reset flight params to a specific position
|
||||
void init();
|
||||
|
||||
// update position based on properties
|
||||
void update( double dt );
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // _ACMS_HXX
|
8
src/FDM/SP/Makefile.am
Normal file
8
src/FDM/SP/Makefile.am
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
noinst_LIBRARIES = libSPFDM.a
|
||||
|
||||
libSPFDM_a_SOURCES = \
|
||||
ADA.cxx ADA.hxx \
|
||||
ACMS.cxx ACMS.hxx
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
5
src/FDM/SP/README
Normal file
5
src/FDM/SP/README
Normal file
|
@ -0,0 +1,5 @@
|
|||
This directory contains special purpose FDM's that should not be of
|
||||
interest to the common user. At this time there is a special FDM to
|
||||
support ACMS files which are generated from flight recorder data
|
||||
(http://www.sasflightops.com/dlk/acms.htm).
|
||||
|
|
@ -7,6 +7,12 @@ else
|
|||
MPLAYER_LIBS =
|
||||
endif
|
||||
|
||||
if ENABLE_SP_FDM
|
||||
SP_FDM_LIBS = $(top_builddir)/src/FDM/SP/libSPFDM.a
|
||||
else
|
||||
SP_FDM_LIBS =
|
||||
endif
|
||||
|
||||
if WITH_THREADS
|
||||
THREAD_LIBS = -lsgthreads $(thread_LIBS)
|
||||
else
|
||||
|
@ -69,6 +75,7 @@ fgfs_LDADD = \
|
|||
$(top_builddir)/src/FDM/JSBSim/filtersjb/libfiltersjb.a \
|
||||
$(top_builddir)/src/FDM/LaRCsim/libLaRCsim.a \
|
||||
$(top_builddir)/src/FDM/UIUCModel/libUIUCModel.a \
|
||||
$(SP_FDM_LIBS) \
|
||||
$(top_builddir)/src/GUI/libGUI.a \
|
||||
$(top_builddir)/src/Autopilot/libAutopilot.a \
|
||||
$(top_builddir)/src/Input/libInput.a \
|
||||
|
|
|
@ -82,7 +82,10 @@
|
|||
#include <Cockpit/radiostack.hxx>
|
||||
#include <Cockpit/panel.hxx>
|
||||
#include <Cockpit/panel_io.hxx>
|
||||
#include <FDM/ADA.hxx>
|
||||
#ifdef ENABLE_SP_FMDS
|
||||
#include <FDM/SP/ADA.hxx>
|
||||
#include <FDM/SP/ACMS.hxx>
|
||||
#endif
|
||||
#include <FDM/Balloon.h>
|
||||
#include <FDM/ExternalNet/ExternalNet.hxx>
|
||||
#include <FDM/ExternalPipe/ExternalPipe.hxx>
|
||||
|
@ -1252,8 +1255,12 @@ void fgInitFDM() {
|
|||
cur_fdm_state = new FGLaRCsim( dt );
|
||||
} else if ( model == "jsb" ) {
|
||||
cur_fdm_state = new FGJSBsim( dt );
|
||||
#ifdef ENABLE_SP_FMDS
|
||||
} else if ( model == "ada" ) {
|
||||
cur_fdm_state = new FGADA( dt );
|
||||
} else if ( model == "acms" ) {
|
||||
cur_fdm_state = new FGACMS( dt );
|
||||
#endif
|
||||
} else if ( model == "balloon" ) {
|
||||
cur_fdm_state = new FGBalloonSim( dt );
|
||||
} else if ( model == "magic" ) {
|
||||
|
@ -1708,7 +1715,6 @@ bool fgInitSubsystems() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the radio stack subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
current_radiostack = new FGRadioStack;
|
||||
current_radiostack->init();
|
||||
current_radiostack->bind();
|
||||
|
@ -1717,7 +1723,6 @@ bool fgInitSubsystems() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the cockpit subsystem
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
if( fgCockpitInit( ¤t_aircraft )) {
|
||||
// Cockpit initialized ok.
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
#include <Scenery/tilemgr.hxx>
|
||||
#include <FDM/flight.hxx>
|
||||
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
|
||||
#include <FDM/ADA.hxx>
|
||||
// #include <FDM/ADA.hxx>
|
||||
#include <ATC/ATCdisplay.hxx>
|
||||
#include <ATC/ATCmgr.hxx>
|
||||
#include <ATC/AIMgr.hxx>
|
||||
|
|
Loading…
Reference in a new issue