X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FLaRCsim.cxx;h=43223bf4cf9bfbde1f8fc6a0df2a7a126bf3e165;hb=ee98995d30e75cda88c9866f3cb6a761fda7d078;hp=e33b3485e25d152336145379b70451257f0b8d53;hpb=d0d3b2bd7a4fcef3c39bfdc6bb4722a8f67785dd;p=flightgear.git diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index e33b3485e..43223bf4c 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -25,8 +25,6 @@ #include #include -#include - #include
#include #include @@ -41,7 +39,7 @@ #include "LaRCsim.hxx" FGLaRCsim::FGLaRCsim( double dt ) { - set_delta_t( dt ); +// set_delta_t( dt ); speed_up = fgGetNode("/sim/speed-up", true); aero = fgGetNode("/sim/aero", true); @@ -60,10 +58,10 @@ FGLaRCsim::FGLaRCsim( double dt ) { I_xz = 0.000000E+00; } - ls_set_model_dt( get_delta_t() ); + ls_set_model_dt(dt); // Initialize our little engine that hopefully might - eng.init( get_delta_t() ); + eng.init(dt); // dcl - in passing dt to init rather than update I am assuming // that the LaRCsim dt is fixed at one value (yes it is 120hz CLO) } @@ -84,7 +82,12 @@ void FGLaRCsim::init() { // Run an iteration of the EOM (equations of motion) -void FGLaRCsim::update( int multiloop ) { +void FGLaRCsim::update( double dt ) { + + if (is_suspended()) + return; + + int multiloop = _calc_multiloop(dt); if ( !strcmp(aero->getStringValue(), "c172") ) { // set control inputs @@ -142,11 +145,11 @@ void FGLaRCsim::update( int multiloop ) { fgSetDouble("/consumables/fuel/tank[0]/level-gal_us", fgGetDouble("/consumables/fuel/tank[0]/level-gal_us") - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) - * get_delta_t()); + * dt); fgSetDouble("/consumables/fuel/tank[1]/level-gal_us", fgGetDouble("/consumables/fuel/tank[1]/level-gal_us") - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) - * get_delta_t()); + * dt); } F_X_engine = eng.get_prop_thrust_lbs(); @@ -183,8 +186,7 @@ void FGLaRCsim::update( int multiloop ) { // Inform LaRCsim of the local terrain altitude // Runway_altitude = get_Runway_altitude(); - Runway_altitude = scenery.get_cur_elev() * SG_METER_TO_FEET; - + Runway_altitude = getACModel()->get3DModel()->getFGLocation()->get_cur_elev_m() * SG_METER_TO_FEET; // Weather /* V_north_airmass = get_V_north_airmass(); V_east_airmass = get_V_east_airmass(); @@ -198,6 +200,15 @@ void FGLaRCsim::update( int multiloop ) { // printf("Altitude = %.2f\n", Altitude * 0.3048); // printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048); + // for engine functions (sounds and instruments) + // drive the rpm gauge + fgSetDouble("/engines/engine/rpm", (globals->get_controls()->get_throttle( 0 ) * 100.0 * 25 )); + // manifold air pressure, which drives the sound (see *sound.xml file) + fgSetDouble("/engines/engine/mp-osi", (globals->get_controls()->get_throttle( 0 ) * 100.0 )); + // make the engine cranking and running sounds when fgfs starts up + fgSetDouble("/engines/engine/cranking", 1); + fgSetDouble("/engines/engine/running", 1); + ls_update(multiloop); // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048); @@ -602,7 +613,6 @@ void FGLaRCsim::snap_shot(void) { void FGLaRCsim::set_Latitude(double lat) { SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::set_Latitude: " << lat ); snap_shot(); - _set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET ); lsic->SetLatitudeGDRadIC(lat); set_ls(); copy_from_LaRCsim(); //update the bus @@ -611,8 +621,6 @@ void FGLaRCsim::set_Latitude(double lat) { void FGLaRCsim::set_Longitude(double lon) { SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::set_Longitude: " << lon ); snap_shot(); - - _set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET ); lsic->SetLongitudeRadIC(lon); set_ls(); copy_from_LaRCsim(); //update the bus @@ -621,7 +629,6 @@ void FGLaRCsim::set_Longitude(double lon) { void FGLaRCsim::set_Altitude(double alt) { SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::set_Altitude: " << alt ); snap_shot(); - _set_Runway_altitude( scenery.get_cur_elev() * SG_METER_TO_FEET ); lsic->SetAltitudeFtIC(alt); set_ls(); copy_from_LaRCsim(); //update the bus @@ -700,6 +707,7 @@ void FGLaRCsim::set_AltitudeAGL(double altagl) { copy_from_LaRCsim(); } +/* getting a namespace conflict... void FGLaRCsim::set_Velocities_Local_Airmass (double wnorth, double weast, double wdown ) { @@ -710,6 +718,7 @@ void FGLaRCsim::set_Velocities_Local_Airmass (double wnorth, set_ls(); copy_from_LaRCsim(); } +*/ void FGLaRCsim::set_Static_pressure(double p) { SG_LOG( SG_FLIGHT, SG_INFO,