X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FLaRCsim.cxx;h=47c6bfa93079a73b4cb050749a872e9635185469;hb=7a235abecdb3b17580ed81bd69d20a55b1c8b4e6;hp=f1e7422364d25fc33bc015370d194f0672010f08;hpb=47c3f4182886fa790d074b76b3225f59f5918200;p=flightgear.git diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index f1e742236..47c6bfa93 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -24,33 +24,54 @@ #include #include +#include + #include #include #include #include #include #include +#include #include "IO360.hxx" #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; +} + +FGLaRCsim::~FGLaRCsim(void) { + if(lsic != NULL) { + delete lsic; + } +} // Initialize the LaRCsim flight model, dt is the time increment for // each subsequent iteration through the EOM bool FGLaRCsim::init( double dt ) { + + ls_set_model_dt(dt); + // Initialize our little engine that hopefully might + 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) - if ( current_options.get_aircraft() == "c172" ) { - // Initialize our little engine that hopefully might - 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) - - // update the engines interface - FGEngInterface e; - add_engine( e ); - } + // update the engines interface + FGEngInterface e; + add_engine( e ); + - // cout << "FGLaRCsim::init()" << endl; + // FG_LOG( FG_FLIGHT, FG_INFO, "FGLaRCsim::init()" ); double save_alt = 0.0; @@ -63,7 +84,7 @@ bool FGLaRCsim::init( double dt ) { copy_to_LaRCsim(); // actual LaRCsim top level init - ls_toplevel_init( dt, (char *)current_options.get_aircraft().c_str() ); + // ls_toplevel_init( dt, (char *)globals->get_options()->get_aircraft().c_str() ); FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << get_Latitude() ); @@ -85,17 +106,16 @@ bool FGLaRCsim::init( double dt ) { // Run an iteration of the EOM (equations of motion) bool FGLaRCsim::update( int multiloop ) { - // cout << "FGLaRCsim::update()" << endl; - if ( current_options.get_aircraft() == "c172" ) { + if ( globals->get_options()->get_aircraft() == "c172" ) { // set control inputs eng.set_IAS( V_calibrated_kts ); 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 @@ -111,26 +131,27 @@ bool FGLaRCsim::update( int multiloop ) { e->set_MaxHP( eng.get_MaxHP() ); e->set_Percentage_Power( eng.get_Percentage_Power() ); e->set_EGT( eng.get_EGT() ); + e->set_CHT( eng.get_CHT() ); e->set_prop_thrust( eng.get_prop_thrust_SI() ); #if 0 - cout << "Throttle = " << controls.get_throttle( 0 ) * 100.0; - cout << " Mixture = " << controls.get_mixture( 0 ) * 100.0; - cout << " RPM = " << eng.get_RPM(); - cout << " MP = " << eng.get_Manifold_Pressure(); - cout << " HP = " << ( eng.get_MaxHP() * eng.get_Percentage_Power() - / 100.0 ); - cout << " EGT = " << eng.get_EGT(); - cout << " Thrust (N) " << eng.get_prop_thrust_SI(); // Thrust in Newtons - cout << '\n'; + 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, " 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, '\n'); #endif - + // Hmm .. Newtons to lbs is 0.2248 ... F_X_engine = eng.get_prop_thrust_SI() * 0.07; } double save_alt = 0.0; - double time_step = (1.0 / current_options.get_model_hz()) * multiloop; - double start_elev = get_Altitude(); // lets try to avoid really screwing up the LaRCsim model if ( get_Altitude() < -9000.0 ) { @@ -139,29 +160,34 @@ bool FGLaRCsim::update( int multiloop ) { } // copy control positions into the LaRCsim structure - Lat_control = controls.get_aileron() / current_options.get_speed_up(); + Lat_control = controls.get_aileron() / + globals->get_options()->get_speed_up(); Long_control = controls.get_elevator(); Long_trim = controls.get_elevator_trim(); - Rudder_pedal = controls.get_rudder() / current_options.get_speed_up(); + Rudder_pedal = controls.get_rudder() / + globals->get_options()->get_speed_up(); Flap_handle = 30.0 * controls.get_flaps(); - if ( current_options.get_aircraft() == "c172" ) { + if ( globals->get_options()->get_aircraft() == "c172" ) { Use_External_Engine = 1; } else { Use_External_Engine = 0; } Throttle_pct = controls.get_throttle( 0 ) * 1.0; + Brake_pct[0] = controls.get_brake( 1 ); Brake_pct[1] = controls.get_brake( 0 ); // Inform LaRCsim of the local terrain altitude - Runway_altitude = get_Runway_altitude(); + // Runway_altitude = get_Runway_altitude(); + Runway_altitude = scenery.cur_elev * METER_TO_FEET; // Weather - V_north_airmass = get_V_north_airmass(); - V_east_airmass = get_V_east_airmass(); - V_down_airmass = get_V_down_airmass(); + /* V_north_airmass = get_V_north_airmass(); + V_east_airmass = get_V_east_airmass(); + V_down_airmass = get_V_down_airmass(); */ + // old -- FGInterface_2_LaRCsim() not needed except for Init() // translate FG to LaRCsim structure @@ -174,7 +200,7 @@ bool FGLaRCsim::update( int multiloop ) { // 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 @@ -185,12 +211,6 @@ bool FGLaRCsim::update( int multiloop ) { set_Altitude( save_alt ); } - double end_elev = get_Altitude(); - if ( time_step > 0.0 ) { - // feet per second - set_Climb_Rate( (end_elev - start_elev) / time_step ); - } - return true; } @@ -259,9 +279,9 @@ bool FGLaRCsim::copy_to_LaRCsim () { // P_dot_body = get_P_dot_body(); // Q_dot_body = get_Q_dot_body(); // R_dot_body = get_R_dot_body(); - V_north = get_V_north(); - V_east = get_V_east(); - V_down = get_V_down(); + // V_north = get_V_north(); + // V_east = get_V_east(); + // V_down = get_V_down(); // V_north_rel_ground = get_V_north_rel_ground(); // V_east_rel_ground = get_V_east_rel_ground(); // V_down_rel_ground = get_V_down_rel_ground(); @@ -286,9 +306,9 @@ bool FGLaRCsim::copy_to_LaRCsim () { // V_equiv_kts = get_V_equiv_kts(); // V_calibrated = get_V_calibrated(); // V_calibrated_kts = get_V_calibrated_kts(); - P_body = get_P_body(); - Q_body = get_Q_body(); - R_body = get_R_body(); + // P_body = get_P_body(); + // Q_body = get_Q_body(); + // R_body = get_R_body(); // P_local = get_P_local(); // Q_local = get_Q_local(); // R_local = get_R_local(); @@ -301,15 +321,15 @@ bool FGLaRCsim::copy_to_LaRCsim () { // Latitude_dot = get_Latitude_dot(); // Longitude_dot = get_Longitude_dot(); // Radius_dot = get_Radius_dot(); - Lat_geocentric = get_Lat_geocentric(); - Lon_geocentric = get_Lon_geocentric(); - Radius_to_vehicle = get_Radius_to_vehicle(); - Latitude = get_Latitude(); - Longitude = get_Longitude(); - Altitude = get_Altitude(); - Phi = get_Phi(); - Theta = get_Theta(); - Psi = get_Psi(); + // Lat_geocentric = get_Lat_geocentric(); + // Lon_geocentric = get_Lon_geocentric(); + // Radius_to_vehicle = get_Radius_to_vehicle(); + // Latitude = get_Latitude(); + // Longitude = get_Longitude(); + // Altitude = get_Altitude(); + // Phi = get_Phi(); + // Theta = get_Theta(); + // Psi = get_Psi(); // T_local_to_body_11 = get_T_local_to_body_11(); // T_local_to_body_12 = get_T_local_to_body_12(); // T_local_to_body_13 = get_T_local_to_body_13(); @@ -347,9 +367,9 @@ bool FGLaRCsim::copy_to_LaRCsim () { // Dynamic_pressure = get_Dynamic_pressure(); // Static_temperature = get_Static_temperature(); // Total_temperature = get_Total_temperature(); - Sea_level_radius = get_Sea_level_radius(); - Earth_position_angle = get_Earth_position_angle(); - Runway_altitude = get_Runway_altitude(); + // Sea_level_radius = get_Sea_level_radius(); + // Earth_position_angle = get_Earth_position_angle(); + // Runway_altitude = get_Runway_altitude(); // Runway_latitude = get_Runway_latitude(); // Runway_longitude = get_Runway_longitude(); // Runway_heading = get_Runway_heading(); @@ -375,9 +395,9 @@ bool FGLaRCsim::copy_to_LaRCsim () { bool FGLaRCsim::copy_from_LaRCsim() { // Mass properties and geometry values - set_Inertias( Mass, I_xx, I_yy, I_zz, I_xz ); + _set_Inertias( Mass, I_xx, I_yy, I_zz, I_xz ); // set_Pilot_Location( Dx_pilot, Dy_pilot, Dz_pilot ); - set_CG_Position( Dx_cg, Dy_cg, Dz_cg ); + _set_CG_Position( Dx_cg, Dy_cg, Dz_cg ); // Forces // set_Forces_Body_Total( F_X, F_Y, F_Z ); @@ -394,43 +414,43 @@ bool FGLaRCsim::copy_from_LaRCsim() { // set_Moments_Gear( M_l_gear, M_m_gear, M_n_gear ); // Accelerations - set_Accels_Local( V_dot_north, V_dot_east, V_dot_down ); - set_Accels_Body( U_dot_body, V_dot_body, W_dot_body ); - set_Accels_CG_Body( A_X_cg, A_Y_cg, A_Z_cg ); - set_Accels_Pilot_Body( A_X_pilot, A_Y_pilot, A_Z_pilot ); + _set_Accels_Local( V_dot_north, V_dot_east, V_dot_down ); + _set_Accels_Body( U_dot_body, V_dot_body, W_dot_body ); + _set_Accels_CG_Body( A_X_cg, A_Y_cg, A_Z_cg ); + _set_Accels_Pilot_Body( A_X_pilot, A_Y_pilot, A_Z_pilot ); // set_Accels_CG_Body_N( N_X_cg, N_Y_cg, N_Z_cg ); // set_Accels_Pilot_Body_N( N_X_pilot, N_Y_pilot, N_Z_pilot ); // set_Accels_Omega( P_dot_body, Q_dot_body, R_dot_body ); // Velocities - set_Velocities_Local( V_north, V_east, V_down ); + _set_Velocities_Local( V_north, V_east, V_down ); // set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground, // V_down_rel_ground ); - // set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass, - // V_down_airmass ); + _set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass, + V_down_airmass ); // set_Velocities_Local_Rel_Airmass( V_north_rel_airmass, // V_east_rel_airmass, V_down_rel_airmass ); // set_Velocities_Gust( U_gust, V_gust, W_gust ); - set_Velocities_Wind_Body( U_body, V_body, W_body ); + _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 ); - set_V_ground_speed( V_ground_speed ); + _set_V_ground_speed( V_ground_speed ); // set_V_equiv( V_equiv ); - set_V_equiv_kts( V_equiv_kts ); + _set_V_equiv_kts( V_equiv_kts ); // set_V_calibrated( V_calibrated ); - set_V_calibrated_kts( V_calibrated_kts ); + _set_V_calibrated_kts( V_calibrated_kts ); - set_Omega_Body( P_body, Q_body, R_body ); + _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 ); - set_Mach_number( Mach_number ); + _set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot ); + _set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot ); + + _set_Mach_number( Mach_number ); FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << Longitude << " lat_geoc = " << Lat_geocentric << " lat_geod = " << Latitude @@ -446,18 +466,20 @@ bool FGLaRCsim::copy_from_LaRCsim() { while ( tmp_lon > FG_PI ) { tmp_lon -= FG_2PI; } // Positions - set_Geocentric_Position( Lat_geocentric, tmp_lon_geoc, - Radius_to_vehicle ); - set_Geodetic_Position( Latitude, tmp_lon, Altitude ); - set_Euler_Angles( Phi, Theta, Psi ); + _set_Geocentric_Position( Lat_geocentric, tmp_lon_geoc, + Radius_to_vehicle ); + _set_Geodetic_Position( Latitude, tmp_lon, Altitude ); + _set_Euler_Angles( Phi, Theta, Psi ); + + _set_Altitude_AGL( Altitude-Runway_altitude ); // Miscellaneous quantities - set_T_Local_to_Body(T_local_to_body_m); + _set_T_Local_to_Body(T_local_to_body_m); // set_Gravity( Gravity ); // set_Centrifugal_relief( Centrifugal_relief ); - set_Alpha( Alpha ); - set_Beta( Beta ); + _set_Alpha( Alpha ); + _set_Beta( Beta ); // set_Alpha_dot( Alpha_dot ); // set_Beta_dot( Beta_dot ); @@ -466,33 +488,33 @@ bool FGLaRCsim::copy_from_LaRCsim() { // set_Cos_beta( Cos_beta ); // set_Sin_beta( Sin_beta ); - set_Cos_phi( Cos_phi ); + _set_Cos_phi( Cos_phi ); // set_Sin_phi( Sin_phi ); - set_Cos_theta( Cos_theta ); + _set_Cos_theta( Cos_theta ); // set_Sin_theta( Sin_theta ); // set_Cos_psi( Cos_psi ); // set_Sin_psi( Sin_psi ); - set_Gamma_vert_rad( Gamma_vert_rad ); + _set_Gamma_vert_rad( Gamma_vert_rad ); // set_Gamma_horiz_rad( Gamma_horiz_rad ); // set_Sigma( Sigma ); - set_Density( Density ); + _set_Density( Density ); // set_V_sound( V_sound ); // set_Mach_number( Mach_number ); - set_Static_pressure( Static_pressure ); + _set_Static_pressure( Static_pressure ); // set_Total_pressure( Total_pressure ); // set_Impact_pressure( Impact_pressure ); // set_Dynamic_pressure( Dynamic_pressure ); - set_Static_temperature( Static_temperature ); + _set_Static_temperature( Static_temperature ); // set_Total_temperature( Total_temperature ); - set_Sea_level_radius( Sea_level_radius ); - set_Earth_position_angle( Earth_position_angle ); + _set_Sea_level_radius( Sea_level_radius ); + _set_Earth_position_angle( Earth_position_angle ); - set_Runway_altitude( Runway_altitude ); + _set_Runway_altitude( Runway_altitude ); // set_Runway_latitude( Runway_latitude ); // set_Runway_longitude( Runway_longitude ); // set_Runway_heading( Runway_heading ); @@ -504,10 +526,10 @@ bool FGLaRCsim::copy_from_LaRCsim() { // D_pilot_above_rwy ); // set_Pilot_Rwy_Rwy( X_pilot_rwy, Y_pilot_rwy, H_pilot_rwy ); - set_sin_lat_geocentric(Lat_geocentric); - set_cos_lat_geocentric(Lat_geocentric); - set_sin_cos_longitude(Longitude); - set_sin_cos_latitude(Latitude); + _set_sin_lat_geocentric(Lat_geocentric); + _set_cos_lat_geocentric(Lat_geocentric); + _set_sin_cos_longitude(Longitude); + _set_sin_cos_latitude(Latitude); // printf("sin_lat_geo %f cos_lat_geo %f\n", sin_Lat_geoc, cos_Lat_geoc); // printf("sin_lat %f cos_lat %f\n", @@ -515,5 +537,195 @@ bool FGLaRCsim::copy_from_LaRCsim() { // printf("sin_lon %f cos_lon %f\n", // get_sin_longitude(), get_cos_longitude()); + _set_Climb_Rate( -1 * V_down ); + return true; } + + +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 ); +} + +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 ); + 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 ); + 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 ); + 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 ); + 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 ); + 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 ); + 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 ); + 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 ); + + 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 ); + 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 ); + 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 ); + 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 ); + 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 ); + 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" ); +} + +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" ); + +} + +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" ); + +} +