diff --git a/FlightGear.dsp b/FlightGear.dsp index e58087aae..5f6d95384 100644 --- a/FlightGear.dsp +++ b/FlightGear.dsp @@ -2280,6 +2280,51 @@ SOURCE=.\src\Main\viewer.cxx !ENDIF +# End Source File +# Begin Source File + +SOURCE=.\src\Main\viewer_lookat.cxx + +!IF "$(CFG)" == "FlightGear - Win32 Release" + +# PROP Intermediate_Dir "Release\main" + +!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug" + +# PROP Intermediate_Dir "Debug\main" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\src\Main\viewer_rph.cxx + +!IF "$(CFG)" == "FlightGear - Win32 Release" + +# PROP Intermediate_Dir "Release\main" + +!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug" + +# PROP Intermediate_Dir "Debug\main" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\src\Main\viewmgr.cxx + +!IF "$(CFG)" == "FlightGear - Win32 Release" + +# PROP Intermediate_Dir "Release\main" + +!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug" + +# PROP Intermediate_Dir "Debug\main" + +!ENDIF + # End Source File # End Group # Begin Group "Lib_Navaids" diff --git a/src/FDM/Balloon.cxx b/src/FDM/Balloon.cxx index 7ea20dd59..216a7d42c 100644 --- a/src/FDM/Balloon.cxx +++ b/src/FDM/Balloon.cxx @@ -176,37 +176,14 @@ bool FGBalloonSim::copy_from_BalloonSim() { // Positions current_balloon.getPosition( temp ); - double lat_geoc = temp[0]; - double lon = temp[1]; - double alt = temp[2] * METER_TO_FEET; - - double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc; - sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER, - &lat_geod, &tmp_alt, &sl_radius1 ); - sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc ); - - FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod - << " lat_geoc = " << lat_geoc - << " alt = " << alt << " tmp_alt = " << tmp_alt * METER_TO_FEET - << " sl_radius1 = " << sl_radius1 * METER_TO_FEET - << " sl_radius2 = " << sl_radius2 * METER_TO_FEET - << " Equator = " << EQUATORIAL_RADIUS_FT ); - - _set_Geocentric_Position( lat_geoc, lon, - sl_radius2 * METER_TO_FEET + alt ); - _set_Geodetic_Position( lat_geod, lon, alt ); + //temp[0]: geocentric latitude + //temp[1]: longitude + //temp[2]: altitude (meters) + _updatePosition( temp[0], temp[1], temp[2] * METER_TO_FEET ); + current_balloon.getHPR( temp ); - /* **FIXME*** */ _set_Sea_level_radius( sl_radius2 * METER_TO_FEET ); - /* **FIXME*** */ _set_Earth_position_angle( 0.0 ); - - /* ***FIXME*** */ _set_Runway_altitude( 0.0 ); - - _set_sin_lat_geocentric( lat_geoc ); - _set_cos_lat_geocentric( lat_geoc ); - - _set_sin_cos_longitude( lon ); - _set_sin_cos_latitude( lat_geod ); + set_Euler_Angles( temp[0], temp[1], temp[2] ); return true; } diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 9285fb35f..44058b127 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -343,7 +343,9 @@ bool FGJSBsim::copy_from_JSBsim() { _set_Velocities_Wind_Body( fdmex->GetTranslation()->GetUVW()(1), fdmex->GetTranslation()->GetUVW()(2), fdmex->GetTranslation()->GetUVW()(3) ); - + + _set_V_rel_wind( fdmex->GetTranslation()->GetVt() ); + _set_V_equiv_kts( fdmex->GetAuxiliary()->GetVequivalentKTS() ); // _set_V_calibrated( fdmex->GetAuxiliary()->GetVcalibratedFPS() ); @@ -367,27 +369,10 @@ bool FGJSBsim::copy_from_JSBsim() { _set_Mach_number( fdmex->GetTranslation()->GetMach() ); // Positions - - double lat_geoc = fdmex->GetPosition()->GetLatitude(); - double lon = fdmex->GetPosition()->GetLongitude(); - double alt = fdmex->GetPosition()->Geth(); - double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc; - - sgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER, - &lat_geod, &tmp_alt, &sl_radius1 ); - sgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc ); - - FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod - << " lat_geoc = " << lat_geoc - << " alt = " << alt << " tmp_alt = " << tmp_alt * METER_TO_FEET - << " sl_radius1 = " << sl_radius1 * METER_TO_FEET - << " sl_radius2 = " << sl_radius2 * METER_TO_FEET - << " Equator = " << EQUATORIAL_RADIUS_FT ); - - _set_Geocentric_Position( lat_geoc, lon, sl_radius2 * METER_TO_FEET + alt ); - - _set_Geodetic_Position( lat_geod, lon, alt ); - + _updatePosition( fdmex->GetPosition()->GetLatitude(), + fdmex->GetPosition()->GetLongitude(), + fdmex->GetPosition()->Geth() ); + _set_Euler_Angles( fdmex->GetRotation()->Getphi(), fdmex->GetRotation()->Gettht(), fdmex->GetRotation()->Getpsi() ); @@ -398,41 +383,51 @@ bool FGJSBsim::copy_from_JSBsim() { _set_Gamma_vert_rad( fdmex->GetPosition()->GetGamma() ); // set_Gamma_horiz_rad( Gamma_horiz_rad ); - /* **FIXME*** */ _set_Sea_level_radius( sl_radius2 * METER_TO_FEET ); - /* **FIXME*** */ _set_Earth_position_angle( fdmex->GetAuxiliary()-> - GetEarthPositionAngle() ); + _set_Earth_position_angle( fdmex->GetAuxiliary()->GetEarthPositionAngle() ); - /* ***FIXME*** */ _set_Runway_altitude( scenery.cur_radius * METERS_TO_FEET - - get_Sea_level_radius() ); - - _set_sin_lat_geocentric( lat_geoc ); - _set_cos_lat_geocentric( lat_geoc ); - - _set_sin_cos_longitude( lon ); - - _set_sin_cos_latitude( lat_geod ); - _set_Climb_Rate( fdmex->GetPosition()->Gethdot() ); - for ( i = 0; i < 3; i++ ) { - for ( j = 0; j < 3; j++ ) { + for ( i = 1; i <= 3; i++ ) { + for ( j = 1; j <= 3; j++ ) { _set_T_Local_to_Body( i, j, fdmex->GetState()->GetTl2b()(i,j) ); } } - return true; } + +void FGJSBsim::snap_shot(void) { + fgic->SetLatitudeRadIC(get_Lat_geocentric() ); + fgic->SetLongitudeRadIC( get_Longitude() ); + fgic->SetAltitudeFtIC( get_Altitude() ); + fgic->SetTerrainAltitudeFtIC( get_Runway_altitude() ); + fgic->SetVtrueFpsIC( get_V_rel_wind() ); + fgic->SetPitchAngleRadIC( get_Theta() ); + fgic->SetRollAngleRadIC( get_Phi() ); + fgic->SetTrueHeadingRadIC( get_Psi() ); + fgic->SetClimbRateFpsIC( get_Climb_Rate() ); +} + + //Positions void FGJSBsim::set_Latitude(double lat) { - FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Latitude: " << lat); - fgic->SetLatitudeRadIC(lat); + double sea_level_radius_meters,lat_geoc; + + FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Latitude: " << lat ); + + snap_shot(); + sgGeodToGeoc( lat, get_Altitude() , &sea_level_radius_meters, &lat_geoc); + fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET ); + fgic->SetLatitudeRadIC( lat_geoc ); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus needTrim=true; } void FGJSBsim::set_Longitude(double lon) { - FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Longitude: " << lon); + + FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Longitude: " << lon ); + + snap_shot(); fgic->SetLongitudeRadIC(lon); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -440,7 +435,14 @@ void FGJSBsim::set_Longitude(double lon) { } void FGJSBsim::set_Altitude(double alt) { - FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Altitude: " << alt ); + double sea_level_radius_meters,lat_geoc; + + FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Altitude: " << alt ); + + snap_shot(); + sgGeodToGeoc( get_Latitude(), alt , &sea_level_radius_meters, &lat_geoc); + fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET ); + fgic->SetLatitudeRadIC( lat_geoc ); fgic->SetAltitudeFtIC(alt); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -449,6 +451,8 @@ void FGJSBsim::set_Altitude(double alt) { void FGJSBsim::set_V_calibrated_kts(double vc) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_V_calibrated_kts: " << vc ); + + snap_shot(); fgic->SetVcalibratedKtsIC(vc); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -457,6 +461,8 @@ void FGJSBsim::set_V_calibrated_kts(double vc) { void FGJSBsim::set_Mach_number(double mach) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Mach_number: " << mach ); + + snap_shot(); fgic->SetMachIC(mach); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -466,22 +472,21 @@ void FGJSBsim::set_Mach_number(double mach) { void FGJSBsim::set_Velocities_Local( double north, double east, double down ){ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Local: " << north << ", " << east << ", " << down ); + + snap_shot(); fgic->SetVnorthFpsIC(north); fgic->SetVeastFpsIC(east); fgic->SetVdownFpsIC(down); fdmex->RunIC(fgic); //loop JSBSim once - cout << "fdmex->GetTranslation()->GetVt(): " << fdmex->GetTranslation()->GetVt() << endl; - cout << "fdmex->GetPosition()->GetVn(): " << fdmex->GetPosition()->GetVn() << endl; - copy_from_JSBsim(); //update the bus - busdump(); needTrim=true; } void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Wind_Body: " << u << ", " << v << ", " << w ); - + + snap_shot(); fgic->SetUBodyFpsIC(u); fgic->SetVBodyFpsIC(v); fgic->SetWBodyFpsIC(w); @@ -494,6 +499,8 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Euler_Angles: " << phi << ", " << theta << ", " << psi ); + + snap_shot(); fgic->SetPitchAngleRadIC(theta); fgic->SetRollAngleRadIC(phi); fgic->SetTrueHeadingRadIC(psi); @@ -505,6 +512,8 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) { //Flight Path void FGJSBsim::set_Climb_Rate( double roc) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Climb_Rate: " << roc ); + + snap_shot(); fgic->SetClimbRateFpsIC(roc); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -513,6 +522,8 @@ void FGJSBsim::set_Climb_Rate( double roc) { void FGJSBsim::set_Gamma_vert_rad( double gamma) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma ); + + snap_shot(); fgic->SetFlightPathAngleRadIC(gamma); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -522,6 +533,8 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma) { //Earth void FGJSBsim::set_Sea_level_radius(double slr) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Sea_level_radius: " << slr ); + + snap_shot(); fgic->SetSeaLevelRadiusFtIC(slr); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -530,6 +543,8 @@ void FGJSBsim::set_Sea_level_radius(double slr) { void FGJSBsim::set_Runway_altitude(double ralt) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Runway_altitude: " << ralt ); + + snap_shot(); _set_Runway_altitude( ralt ); fdmex->RunIC(fgic); //loop JSBSim once copy_from_JSBsim(); //update the bus @@ -538,6 +553,8 @@ void FGJSBsim::set_Runway_altitude(double ralt) { void FGJSBsim::set_Static_pressure(double p) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Static_pressure: " << p ); + + snap_shot(); fdmex->GetAtmosphere()->SetExPressure(p); if(fdmex->GetAtmosphere()->External() == true) needTrim=true; @@ -545,6 +562,8 @@ void FGJSBsim::set_Static_pressure(double p) { void FGJSBsim::set_Static_temperature(double T) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Static_temperature: " << T ); + + snap_shot(); fdmex->GetAtmosphere()->SetExTemperature(T); if(fdmex->GetAtmosphere()->External() == true) needTrim=true; @@ -553,6 +572,8 @@ void FGJSBsim::set_Static_temperature(double T) { void FGJSBsim::set_Density(double rho) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Density: " << rho ); + + snap_shot(); fdmex->GetAtmosphere()->SetExDensity(rho); if(fdmex->GetAtmosphere()->External() == true) needTrim=true; @@ -564,6 +585,8 @@ void FGJSBsim::set_Velocities_Local_Airmass (double wnorth, double wdown ) { FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Local_Airmass: " << wnorth << ", " << weast << ", " << wdown ); + + snap_shot(); fdmex->GetAtmosphere()->SetWindNED(wnorth, weast, wdown ); if(fdmex->GetAtmosphere()->External() == true) needTrim=true; diff --git a/src/FDM/JSBSim.hxx b/src/FDM/JSBSim.hxx index 9d5f542c0..4b9cf8e2f 100644 --- a/src/FDM/JSBSim.hxx +++ b/src/FDM/JSBSim.hxx @@ -21,6 +21,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Further information about the GNU General Public License can also be found on + the world wide web at http://www.gnu.org. + HISTORY -------------------------------------------------------------------------------- 02/01/1999 CLO Created @@ -77,15 +80,6 @@ CLASS DECLARATION class FGJSBsim: public FGInterface { - // The aircraft for this instance - FGFDMExec *fdmex; - FGInitialCondition *fgic; - bool needTrim; - - bool trimmed; - float trim_elev; - float trim_throttle; - public: /// Constructor FGJSBsim::FGJSBsim(void); @@ -100,40 +94,120 @@ public: /// Reset flight params to a specific position bool init( double dt ); - - // Positions - void set_Latitude(double lat); // geocentric - void set_Longitude(double lon); - void set_Altitude(double alt); // triggers re-calc of AGL altitude - //void set_AltitudeAGL(double altagl); // and vice-versa - - // Speeds -- setting any of these will trigger a re-calc of the rest - void set_V_calibrated_kts(double vc); - void set_Mach_number(double mach); - void set_Velocities_Local( double north, double east, double down ); - void set_Velocities_Wind_Body( double u, double v, double w); - - // Euler angles - void set_Euler_Angles( double phi, double theta, double psi ); - - // Flight Path - void set_Climb_Rate( double roc); - void set_Gamma_vert_rad( double gamma); - - // Earth - void set_Sea_level_radius(double slr); - void set_Runway_altitude(double ralt); - - // Atmosphere - void set_Static_pressure(double p); - void set_Static_temperature(double T); - void set_Density(double rho); - void set_Velocities_Local_Airmass (double wnorth, - double weast, - double wdown ); - // update position based on inputs, positions, velocities, etc. + /// Position Parameters + //@{ + /** Set geocentric latitude + @param lat latitude in radians measured from the 0 meridian where + the westerly direction is positive and east is negative */ + void set_Latitude(double lat); // geocentric + + /** Set longitude + @param lon longitude in radians measured from the equator where + the northerly direction is positive and south is negative */ + void set_Longitude(double lon); + + /** Set altitude + Note: this triggers a recalculation of AGL altitude + @param alt altitude in feet */ + void set_Altitude(double alt); // triggers re-calc of AGL altitude + //@} + + //void set_AltitudeAGL(double altagl); // and vice-versa + + /// Velocity Parameters + //@{ + /** Sets calibrated airspeed + Setting this will trigger a recalc of the other velocity terms. + @param vc Calibrated airspeed in ft/sec */ + void set_V_calibrated_kts(double vc); + + /** Sets Mach number. + Setting this will trigger a recalc of the other velocity terms. + @param mach Mach number */ + void set_Mach_number(double mach); + + /** Sets velocity in N-E-D coordinates. + Setting this will trigger a recalc of the other velocity terms. + @param north velocity northward in ft/sec + @param east velocity eastward in ft/sec + @param down velocity downward in ft/sec */ + void set_Velocities_Local( double north, double east, double down ); + + /** Sets aircraft velocity in stability frame. + Setting this will trigger a recalc of the other velocity terms. + @param u X velocity in ft/sec + @param v Y velocity in ft/sec + @param w Z velocity in ft/sec */ + void set_Velocities_Wind_Body( double u, double v, double w); + //@} + + /** Euler angle parameters + @param phi roll angle in radians + @param theta pitch angle in radians + @param psi heading angle in radians */ + void set_Euler_Angles( double phi, double theta, double psi ); + + /// Flight Path Parameters + //@{ + /** Sets rate of climb + @param roc Rate of climb in ft/sec */ + void set_Climb_Rate( double roc); + + /** Sets the flight path angle in radians + @param gamma flight path angle in radians. */ + void set_Gamma_vert_rad( double gamma); + //@} + + /// Earth Parameters + //@{ + /** Sets the sea level radius in feet. + @param slr Sea Level Radius in feet */ + void set_Sea_level_radius(double slr); + + /** Sets the runway altitude in feet above sea level. + @param ralt Runway altitude in feet above sea level. */ + void set_Runway_altitude(double ralt); + //@} + + /// Atmospheric Parameters + //@{ + /** Sets the atmospheric static pressure + @param p pressure in psf */ + void set_Static_pressure(double p); + + /** Sets the atmospheric temperature + @param T temperature in degrees rankine */ + void set_Static_temperature(double T); + + /** Sets the atmospheric density. + @param rho air density slugs/cubic foot */ + void set_Density(double rho); + + /** Sets the velocity of the local airmass for wind modeling. + @param wnorth velocity north in fps + @param weast velocity east in fps + @param wdown velocity down in fps*/ + void set_Velocities_Local_Airmass (double wnorth, + double weast, + double wdown ); + //@} + + /** Update the position based on inputs, positions, velocities, etc. + @param multiloop number of times to loop through the FDM + @return true if successful */ bool update( int multiloop ); + +private: + FGFDMExec *fdmex; + FGInitialCondition *fgic; + bool needTrim; + + bool trimmed; + float trim_elev; + float trim_throttle; + + void snap_shot(void); }; diff --git a/src/FDM/JSBSim/FGInitialCondition.cpp b/src/FDM/JSBSim/FGInitialCondition.cpp index 284cddb23..14ea2ae0c 100644 --- a/src/FDM/JSBSim/FGInitialCondition.cpp +++ b/src/FDM/JSBSim/FGInitialCondition.cpp @@ -110,8 +110,8 @@ void FGInitialCondition::SetVequivalentKtsIC(float tt) { vc=calcVcas(mach); } -void FGInitialCondition::SetVtrueKtsIC(float tt) { - vt=tt*jsbKTSTOFPS; +void FGInitialCondition::SetVtrueFpsIC(float tt) { + vt=tt; lastSpeedSet=setvt; mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed(); vc=calcVcas(mach); diff --git a/src/FDM/JSBSim/FGInitialCondition.h b/src/FDM/JSBSim/FGInitialCondition.h index 7303bbad1..ccb5e9a96 100644 --- a/src/FDM/JSBSim/FGInitialCondition.h +++ b/src/FDM/JSBSim/FGInitialCondition.h @@ -118,7 +118,8 @@ public: void SetVcalibratedKtsIC(float tt); void SetVequivalentKtsIC(float tt); - void SetVtrueKtsIC(float tt); + inline void SetVtrueKtsIC(float tt) { SetVtrueFpsIC(tt*jsbKTSTOFPS); } + void SetVtrueFpsIC(float tt); void SetMachIC(float tt); void SetUBodyFpsIC(float tt); @@ -206,6 +207,9 @@ public: inline float GetThetaRadIC(void) { return theta; } inline float GetPhiRadIC(void) { return phi; } inline float GetPsiRadIC(void) { return psi; } + + inline float GetSeaLevelRadiusFtIC(void) { return sea_level_radius; } + inline float GetTerrainAltitudeFtIC(void) { return terrain_altitude; } diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index f383f72b3..4fe8aab56 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -360,6 +360,10 @@ void FGState::Initialize(FGInitialCondition *FGIC) { psi = FGIC->GetPsiRadIC(); Initialize(U, V, W, phi, tht, psi, latitude, longitude, h); + + FDMExec->GetPosition()->SetSeaLevelRadius( FGIC->GetSeaLevelRadiusFtIC() ); + FDMExec->GetPosition()->SetRunwayRadius( FGIC->GetSeaLevelRadiusFtIC() + + FGIC->GetTerrainAltitudeFtIC() ); } /******************************************************************************/ diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 8423e5283..856c104ff 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -38,24 +38,22 @@ #include "LaRCsim.hxx" FGLaRCsim::FGLaRCsim(void) { - ls_toplevel_init( 0.0, (char *)globals->get_options()->get_aircraft().c_str() ); - lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is - copy_to_LaRCsim(); // initialize all of LaRCsim's vars - //this should go away someday -- formerly done in fg_init.cxx - Mass = 8.547270E+01; - I_xx = 1.048000E+03; - I_yy = 3.000000E+03; - I_zz = 3.530000E+03; - I_xz = 0.000000E+00; - - - + ls_toplevel_init( 0.0, + (char *)globals->get_options()->get_aircraft().c_str() ); + lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is + copy_to_LaRCsim(); // initialize all of LaRCsim's vars + //this should go away someday -- formerly done in fg_init.cxx + Mass = 8.547270E+01; + I_xx = 1.048000E+03; + I_yy = 3.000000E+03; + I_zz = 3.530000E+03; + I_xz = 0.000000E+00; } FGLaRCsim::~FGLaRCsim(void) { - if(lsic != NULL) { - delete lsic; - } + if(lsic != NULL) { + delete lsic; + } } // Initialize the LaRCsim flight model, dt is the time increment for @@ -71,7 +69,7 @@ bool FGLaRCsim::init( double dt ) { // update the engines interface FGEngInterface e; add_engine( e ); - + // FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::init()" ); @@ -87,7 +85,6 @@ bool FGLaRCsim::init( double dt ) { // actual LaRCsim top level init // ls_toplevel_init( dt, (char *)globals->get_options()->get_aircraft().c_str() ); - FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << get_Latitude() ); @@ -116,9 +113,9 @@ bool FGLaRCsim::update( int multiloop ) { eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 ); eng.set_Propeller_Lever_Pos( 100 ); if ( controls.get_mixture( 0 ) > 0.60 ) { - eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 ); + eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 ); } else { - eng.set_Mixture_Lever_Pos( 60.0 ); + eng.set_Mixture_Lever_Pos( 60.0 ); } // update engine model @@ -138,13 +135,16 @@ bool FGLaRCsim::update( int multiloop ) { e->set_prop_thrust( eng.get_prop_thrust_SI() ); #if 0 - FG_LOG( FG_FLIGHT, FG_INFO, "Throttle = " << controls.get_throttle( 0 ) * 100.0); + FG_LOG( FG_FLIGHT, FG_INFO, "Throttle = " + << controls.get_throttle( 0 ) * 100.0); FG_LOG( FG_FLIGHT, FG_INFO, " Mixture = " << 80); FG_LOG( FG_FLIGHT, FG_INFO, " RPM = " << eng.get_RPM()); FG_LOG( FG_FLIGHT, FG_INFO, " MP = " << eng.get_Manifold_Pressure()); - FG_LOG( FG_FLIGHT, FG_INFO, " HP = " << ( eng.get_MaxHP() * eng.get_Percentage_Power()/ 100.0) ); + FG_LOG( FG_FLIGHT, FG_INFO, " HP = " + << ( eng.get_MaxHP() * eng.get_Percentage_Power()/ 100.0) ); FG_LOG( FG_FLIGHT, FG_INFO, " EGT = " << eng.get_EGT()); - FG_LOG( FG_FLIGHT, FG_INFO, " Thrust (N) " << eng.get_prop_thrust_SI()); // Thrust in Newtons + FG_LOG( FG_FLIGHT, FG_INFO, " Thrust (N) " + << eng.get_prop_thrust_SI()); // Thrust in Newtons FG_LOG( FG_FLIGHT, FG_INFO, '\n'); #endif // Hmm .. Newtons to lbs is 0.2248 ... @@ -185,8 +185,8 @@ bool FGLaRCsim::update( int multiloop ) { // Weather /* V_north_airmass = get_V_north_airmass(); - V_east_airmass = get_V_east_airmass(); - V_down_airmass = get_V_down_airmass(); */ + V_east_airmass = get_V_east_airmass(); + V_down_airmass = get_V_down_airmass(); */ // old -- FGInterface_2_LaRCsim() not needed except for Init() @@ -198,14 +198,9 @@ bool FGLaRCsim::update( int multiloop ) { ls_update(multiloop); - if(isnan(Phi)) { - busdump(); - exit(1); - } - // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048); // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048); - + // translate LaRCsim back to FG structure so that the // autopilot (and the rest of the sim can use the updated // values @@ -438,7 +433,7 @@ bool FGLaRCsim::copy_from_LaRCsim() { // set_Velocities_Gust( U_gust, V_gust, W_gust ); _set_Velocities_Wind_Body( U_body, V_body, W_body ); - // set_V_rel_wind( V_rel_wind ); + _set_V_rel_wind( V_rel_wind ); // set_V_true_kts( V_true_kts ); // set_V_rel_ground( V_rel_ground ); // set_V_inertial( V_inertial ); @@ -451,7 +446,7 @@ bool FGLaRCsim::copy_from_LaRCsim() { _set_Omega_Body( P_body, Q_body, R_body ); // set_Omega_Local( P_local, Q_local, R_local ); // set_Omega_Total( P_total, Q_total, R_total ); - + _set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot ); _set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot ); @@ -472,7 +467,7 @@ bool FGLaRCsim::copy_from_LaRCsim() { // Positions _set_Geocentric_Position( Lat_geocentric, tmp_lon_geoc, - Radius_to_vehicle ); + Radius_to_vehicle ); _set_Geodetic_Position( Latitude, tmp_lon, Altitude ); _set_Euler_Angles( Phi, Theta, Psi ); @@ -549,159 +544,188 @@ bool FGLaRCsim::copy_from_LaRCsim() { void FGLaRCsim::set_ls(void) { - Phi=lsic->GetRollAngleRadIC(); - Theta=lsic->GetPitchAngleRadIC(); - Psi=lsic->GetHeadingRadIC(); - V_north=lsic->GetVnorthFpsIC(); - V_east=lsic->GetVeastFpsIC(); - V_down=lsic->GetVdownFpsIC(); - Altitude=lsic->GetAltitudeFtIC(); - Latitude=lsic->GetLatitudeGDRadIC(); - Longitude=lsic->GetLongitudeRadIC(); - Runway_altitude=lsic->GetRunwayAltitudeFtIC(); - V_north_airmass = lsic->GetVnorthAirmassFpsIC(); - V_east_airmass = lsic->GetVeastAirmassFpsIC(); - V_down_airmass = lsic->GetVdownAirmassFpsIC(); - ls_loop(0.0,-1); - copy_from_LaRCsim(); - FG_LOG( FG_FLIGHT, FG_INFO, " FGLaRCsim::set_ls(): " ); - FG_LOG( FG_FLIGHT, FG_INFO, " Phi: " << Phi ); - FG_LOG( FG_FLIGHT, FG_INFO, " Theta: " << Theta ); - FG_LOG( FG_FLIGHT, FG_INFO, " Psi: " << Psi ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_north: " << V_north ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_east: " << V_east ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_down: " << V_down ); - FG_LOG( FG_FLIGHT, FG_INFO, " Altitude: " << Altitude ); - FG_LOG( FG_FLIGHT, FG_INFO, " Latitude: " << Latitude ); - FG_LOG( FG_FLIGHT, FG_INFO, " Longitude: " << Longitude ); - FG_LOG( FG_FLIGHT, FG_INFO, " Runway_altitude: " << Runway_altitude ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_north_airmass: " << V_north_airmass ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_east_airmass: " << V_east_airmass ); - FG_LOG( FG_FLIGHT, FG_INFO, " V_down_airmass: " << V_down_airmass ); + Phi=lsic->GetRollAngleRadIC(); + Theta=lsic->GetPitchAngleRadIC(); + Psi=lsic->GetHeadingRadIC(); + V_north=lsic->GetVnorthFpsIC(); + V_east=lsic->GetVeastFpsIC(); + V_down=lsic->GetVdownFpsIC(); + Altitude=lsic->GetAltitudeFtIC(); + Latitude=lsic->GetLatitudeGDRadIC(); + Longitude=lsic->GetLongitudeRadIC(); + Runway_altitude=lsic->GetRunwayAltitudeFtIC(); + V_north_airmass = lsic->GetVnorthAirmassFpsIC(); + V_east_airmass = lsic->GetVeastAirmassFpsIC(); + V_down_airmass = lsic->GetVdownAirmassFpsIC(); + ls_loop(0.0,-1); + copy_from_LaRCsim(); + FG_LOG( FG_FLIGHT, FG_INFO, " FGLaRCsim::set_ls(): " ); + FG_LOG( FG_FLIGHT, FG_INFO, " Phi: " << Phi ); + FG_LOG( FG_FLIGHT, FG_INFO, " Theta: " << Theta ); + FG_LOG( FG_FLIGHT, FG_INFO, " Psi: " << Psi ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_north: " << V_north ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_east: " << V_east ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_down: " << V_down ); + FG_LOG( FG_FLIGHT, FG_INFO, " Altitude: " << Altitude ); + FG_LOG( FG_FLIGHT, FG_INFO, " Latitude: " << Latitude ); + FG_LOG( FG_FLIGHT, FG_INFO, " Longitude: " << Longitude ); + FG_LOG( FG_FLIGHT, FG_INFO, " Runway_altitude: " << Runway_altitude ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_north_airmass: " << V_north_airmass ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_east_airmass: " << V_east_airmass ); + FG_LOG( FG_FLIGHT, FG_INFO, " V_down_airmass: " << V_down_airmass ); } - //Positions +void FGLaRCsim::snap_shot(void) { + lsic->SetLatitudeGDRadIC( get_Latitude() ); + lsic->SetLongitudeRadIC( get_Longitude() ); + lsic->SetAltitudeFtIC( get_Altitude() ); + lsic->SetRunwayAltitudeFtIC( get_Runway_altitude() ); + lsic->SetVtrueFpsIC( get_V_rel_wind() ); + lsic->SetPitchAngleRadIC( get_Theta() ); + lsic->SetRollAngleRadIC( get_Phi() ); + lsic->SetHeadingRadIC( get_Psi() ); + lsic->SetClimbRateFpsIC( get_Climb_Rate() ); + lsic->SetVNEDAirmassFpsIC( get_V_north_airmass(), + get_V_east_airmass(), + get_V_down_airmass() ); +} + +//Positions void FGLaRCsim::set_Latitude(double lat) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Latitude: " << lat ); - lsic->SetLatitudeGDRadIC(lat); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Latitude: " << lat ); + snap_shot(); + lsic->SetLatitudeGDRadIC(lat); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Longitude(double lon) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Longitude: " << lon ); - lsic->SetLongitudeRadIC(lon); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Longitude: " << lon ); + snap_shot(); + lsic->SetLongitudeRadIC(lon); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Altitude(double alt) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Altitude: " << alt ); - lsic->SetAltitudeFtIC(alt); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Altitude: " << alt ); + snap_shot(); + lsic->SetAltitudeFtIC(alt); + set_ls(); + copy_from_LaRCsim(); //update the bus } - + void FGLaRCsim::set_V_calibrated_kts(double vc) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_V_calibrated_kts: " << vc ); - lsic->SetVcalibratedKtsIC(vc); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, + "FGLaRCsim::set_V_calibrated_kts: " << vc ); + snap_shot(); + lsic->SetVcalibratedKtsIC(vc); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Mach_number(double mach) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Mach_number: " << mach ); - lsic->SetMachIC(mach); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Mach_number: " << mach ); + snap_shot(); + lsic->SetMachIC(mach); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Velocities_Local( double north, double east, double down ){ - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_local: " - << north << " " << east << " " << down ); - lsic->SetVnorthFpsIC(north); - lsic->SetVeastFpsIC(east); - lsic->SetVdownFpsIC(down); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_local: " + << north << " " << east << " " << down ); + snap_shot(); + lsic->SetVNEDFpsIC(north, east, down); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Velocities_Wind_Body( double u, double v, double w){ - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Wind_Body: " - << u << " " << v << " " << w ); - - lsic->SetUBodyFpsIC(u); - lsic->SetVBodyFpsIC(v); - lsic->SetWBodyFpsIC(w); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Wind_Body: " + << u << " " << v << " " << w ); + snap_shot(); + lsic->SetUVWFpsIC(u,v,w); + set_ls(); + copy_from_LaRCsim(); //update the bus } //Euler angles void FGLaRCsim::set_Euler_Angles( double phi, double theta, double psi ) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Euler_angles: " - << phi << " " << theta << " " << psi ); + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Euler_angles: " + << phi << " " << theta << " " << psi ); - lsic->SetPitchAngleRadIC(theta); - lsic->SetRollAngleRadIC(phi); - lsic->SetHeadingRadIC(psi); - set_ls(); - copy_from_LaRCsim(); //update the bus + snap_shot(); + lsic->SetPitchAngleRadIC(theta); + lsic->SetRollAngleRadIC(phi); + lsic->SetHeadingRadIC(psi); + set_ls(); + copy_from_LaRCsim(); //update the bus } //Flight Path void FGLaRCsim::set_Climb_Rate( double roc) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Climb_rate: " << roc ); - lsic->SetClimbRateFpsIC(roc); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Climb_rate: " << roc ); + snap_shot(); + lsic->SetClimbRateFpsIC(roc); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Gamma_vert_rad( double gamma) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Gamma_vert_rad: " << gamma ); - lsic->SetFlightPathAngleRadIC(gamma); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Gamma_vert_rad: " << gamma ); + snap_shot(); + lsic->SetFlightPathAngleRadIC(gamma); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_Runway_altitude(double ralt) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Runway_altitude: " << ralt ); - lsic->SetRunwayAltitudeFtIC(ralt); - set_ls(); - copy_from_LaRCsim(); //update the bus + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Runway_altitude: " << ralt ); + snap_shot(); + lsic->SetRunwayAltitudeFtIC(ralt); + set_ls(); + copy_from_LaRCsim(); //update the bus } void FGLaRCsim::set_AltitudeAGL(double altagl) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_AltitudeAGL: " << altagl ); - lsic->SetAltitudeAGLFtIC(altagl); - set_ls(); - copy_from_LaRCsim(); + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_AltitudeAGL: " << altagl ); + snap_shot(); + lsic->SetAltitudeAGLFtIC(altagl); + set_ls(); + copy_from_LaRCsim(); } void FGLaRCsim::set_Velocities_Local_Airmass (double wnorth, - double weast, - double wdown ) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Local_Airmass: " - << wnorth << " " << weast << " " << wdown ); - _set_Velocities_Local_Airmass( wnorth, weast, wdown ); - set_ls(); - copy_from_LaRCsim(); + double weast, + double wdown ) { + FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Velocities_Local_Airmass: " + << wnorth << " " << weast << " " << wdown ); + snap_shot(); + lsic->SetVNEDAirmassFpsIC( wnorth, weast, wdown ); + set_ls(); + copy_from_LaRCsim(); } void FGLaRCsim::set_Static_pressure(double p) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Static_pressure: " << p ); - FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" ); + FG_LOG( FG_FLIGHT, FG_INFO, + "FGLaRCsim::set_Static_pressure: " << p ); + FG_LOG( FG_FLIGHT, FG_INFO, + "LaRCsim does not support externally supplied atmospheric data" ); } void FGLaRCsim::set_Static_temperature(double T) { - FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Static_temperature: " << T ); - FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" ); + FG_LOG( FG_FLIGHT, FG_INFO, + "FGLaRCsim::set_Static_temperature: " << T ); + FG_LOG( FG_FLIGHT, FG_INFO, + "LaRCsim does not support externally supplied atmospheric data" ); } - + void FGLaRCsim::set_Density(double rho) { FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::set_Density: " << rho ); - FG_LOG( FG_FLIGHT, FG_INFO, "LaRCsim does not support externally supplied atmospheric data" ); + FG_LOG( FG_FLIGHT, FG_INFO, + "LaRCsim does not support externally supplied atmospheric data" ); } diff --git a/src/FDM/LaRCsim.hxx b/src/FDM/LaRCsim.hxx index 837eaba00..2ac2f5dd4 100644 --- a/src/FDM/LaRCsim.hxx +++ b/src/FDM/LaRCsim.hxx @@ -36,6 +36,7 @@ class FGLaRCsim: public FGInterface { FGNewEngine eng; LaRCsimIC* lsic; void set_ls(void); + void snap_shot(void); double time_step; public: diff --git a/src/FDM/LaRCsim/ls_model.c b/src/FDM/LaRCsim/ls_model.c index 0a5da7d1d..c717508c2 100644 --- a/src/FDM/LaRCsim/ls_model.c +++ b/src/FDM/LaRCsim/ls_model.c @@ -37,6 +37,9 @@ CURRENT RCS HEADER INFO: $Header$ $Log$ +Revision 1.3 2000/10/28 14:30:33 curt +Updates by Tony working on the FDM interface bus. + Revision 1.2 2000/04/10 18:09:41 curt David Megginson made a few (mostly minor) mods to the LaRCsim files, and it's now possible to choose the LaRCsim model at runtime, as in @@ -119,6 +122,7 @@ void ls_model( SCALAR dt, int Initialize ) { navion_gear( dt, Initialize ); break; case C172: + if(Initialize < 0) c172_init(); inertias( dt, Initialize ); subsystems( dt, Initialize ); c172_aero( dt, Initialize ); diff --git a/src/FDM/LaRCsimIC.cxx b/src/FDM/LaRCsimIC.cxx index 9b00c3b58..8e629e2b6 100644 --- a/src/FDM/LaRCsimIC.cxx +++ b/src/FDM/LaRCsimIC.cxx @@ -119,40 +119,18 @@ void LaRCsimIC::SetPitchAngleRadIC(SCALAR tt) { getAlpha(); } -void LaRCsimIC::SetUBodyFpsIC( SCALAR tt) { - u=tt; +void LaRCsimIC::SetUVWFpsIC(SCALAR vu, SCALAR vv, SCALAR vw) { + u=vu; v=vv; w=vw; vt=sqrt(u*u+v*v+w*w); lastSpeedSet=lssetuvw; } -void LaRCsimIC::SetVBodyFpsIC( SCALAR tt) { - v=tt; - vt=sqrt(u*u+v*v+w*w); - lastSpeedSet=lssetuvw; -} - -void LaRCsimIC::SetWBodyFpsIC( SCALAR tt) { - w=tt; - vt=sqrt(u*u+v*v+w*w); - lastSpeedSet=lssetuvw; -} - -void LaRCsimIC::SetVNorthAirmassFpsIC(SCALAR tt) { - vnorthwind=tt; - vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind); -} - -void LaRCsimIC::SetVEastAirmassFpsIC(SCALAR tt) { - veastwind=tt; - vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind); -} - -void LaRCsimIC::SetVDownAirmassFpsIC(SCALAR tt){ - vdownwind=tt; +void LaRCsimIC::SetVNEDAirmassFpsIC(SCALAR north, SCALAR east, SCALAR down ) { + vnorthwind=north; veastwind=east; vdownwind=down; vw=sqrt(vnorthwind*vnorthwind + veastwind*veastwind + vdownwind*vdownwind); vtg=vt+vw; - hdot=-vtg*sin(gamma); + SetClimbRateFpsIC(-1*(vdown+vdownwind)); } void LaRCsimIC::SetAltitudeFtIC( SCALAR tt) { @@ -243,25 +221,15 @@ void LaRCsimIC::calcNEDfromVt(void) { vdownwind; } -void LaRCsimIC::SetVnorthFpsIC( SCALAR tt) { - vnorth=tt; +void LaRCsimIC::SetVNEDFpsIC( SCALAR north, SCALAR east, SCALAR down) { + vnorth=north; + veast=east; + vdown=down; + SetClimbRateFpsIC(-1*vdown); lastSpeedSet=lssetned; calcVtfromNED(); } -void LaRCsimIC::SetVeastFpsIC( SCALAR tt) { - veast=tt; - lastSpeedSet=lssetned; - calcVtfromNED(); -} - -void LaRCsimIC::SetVdownFpsIC( SCALAR tt) { - vdown=tt; - calcVtfromNED(); - SetClimbRateFpsIC(-1*vdown); - lastSpeedSet=lssetned; -} - void LaRCsimIC::SetLatitudeGDRadIC(SCALAR tt) { latitude_gd=tt; ls_geod_to_geoc(latitude_gd,altitude,&sea_level_radius, &latitude_gc); diff --git a/src/FDM/LaRCsimIC.hxx b/src/FDM/LaRCsimIC.hxx index 366f6bb07..001019422 100644 --- a/src/FDM/LaRCsimIC.hxx +++ b/src/FDM/LaRCsimIC.hxx @@ -59,17 +59,11 @@ public: void SetVequivalentKtsIC(SCALAR tt); - void SetUBodyFpsIC(SCALAR tt); - void SetVBodyFpsIC(SCALAR tt); - void SetWBodyFpsIC(SCALAR tt); + void SetUVWFpsIC(SCALAR vu, SCALAR vv, SCALAR vw); + + void SetVNEDFpsIC(SCALAR north, SCALAR east, SCALAR down); - void SetVnorthFpsIC(SCALAR tt); - void SetVeastFpsIC(SCALAR tt); - void SetVdownFpsIC(SCALAR tt); - - void SetVNorthAirmassFpsIC(SCALAR tt); - void SetVEastAirmassFpsIC(SCALAR tt); - void SetVDownAirmassFpsIC(SCALAR tt); + void SetVNEDAirmassFpsIC(SCALAR north, SCALAR east, SCALAR down ); void SetAltitudeFtIC(SCALAR tt); void SetAltitudeAGLFtIC(SCALAR tt); diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index cbdd1f7bd..b16798b29 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include
#include