#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_interface.h>
#include <FDM/LaRCsimIC.hxx>
+#include <FDM/UIUCModel/uiuc_aircraft.h>
#include "IO360.hxx"
#include "LaRCsim.hxx"
ls_toplevel_init( 0.0, (char *)(aircraft->getStringValue().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;
+ if ( aircraft->getStringValue() == "c172" ) {
+ 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_set_model_dt( get_delta_t() );
// is slightly less
set_Tank1Fuel(28.0);
set_Tank2Fuel(28.0);
-
-
}
FGLaRCsim::~FGLaRCsim(void) {
// Initialize the LaRCsim flight model, dt is the time increment for
// each subsequent iteration through the EOM
void FGLaRCsim::init() {
+ //do init common to all FDM's
+ common_init();
- // Explicitly call the superclass's
- // init method first.
- FGInterface::init();
+ //now do any specific to LaRCsim
}
eng.set_Propeller_Lever_Pos( 100 );
eng.set_Mixture_Lever_Pos( globals->get_controls()->get_mixture( 0 )
* 100.0 );
+ eng.set_Magneto_Switch_Pos( globals->get_controls()->get_magnetos(0) );
+ eng.setStarterFlag( globals->get_controls()->get_starter(0) );
eng.set_p_amb( Static_pressure );
eng.set_T_amb( Static_temperature );
// copy engine state values onto "bus"
FGEngInterface *e = get_engine( 0 );
- e->set_Throttle( globals->get_controls()->get_throttle( 0 ) * 100.0 );
- e->set_Mixture( 80 );
+ e->set_Throttle( globals->get_controls()->get_throttle(0) * 100.0 );
+ e->set_Mixture( 80 ); // ???????
e->set_Prop_Advance( 100 );
e->set_RPM( eng.get_RPM() );
e->set_Manifold_Pressure( eng.get_Manifold_Pressure() );
e->set_CHT( eng.get_CHT() );
e->set_prop_thrust( eng.get_prop_thrust_SI() );
e->set_Fuel_Flow( eng.get_fuel_flow_gals_hr() );
+ e->set_Oil_Temp( eng.get_oil_temp() );
+ e->set_Running_Flag( eng.getRunningFlag() );
+ e->set_Cranking_Flag( eng.getCrankingFlag() );
//Assume we are using both tanks equally for now
reduce_Tank1Fuel( (eng.get_fuel_flow_gals_hr() / (2 * 3600))
// Inform LaRCsim of the local terrain altitude
// Runway_altitude = get_Runway_altitude();
- Runway_altitude = scenery.cur_elev * SG_METER_TO_FEET;
+ Runway_altitude = scenery.get_cur_elev() * SG_METER_TO_FEET;
// Weather
/* V_north_airmass = get_V_north_airmass();
_set_Geodetic_Position( Latitude, tmp_lon, Altitude );
_set_Euler_Angles( Phi, Theta, Psi );
- _set_Altitude_AGL( Altitude-Runway_altitude );
+ _set_Altitude_AGL( Altitude - Runway_altitude );
// Miscellaneous quantities
_set_T_Local_to_Body(T_local_to_body_m);
_set_Climb_Rate( -1 * V_down );
// cout << "climb rate = " << -V_down * 60 << endl;
+
+ if ( aircraft->getStringValue() == "uiuc" ) {
+ if (pilot_elev_no) {
+ globals->get_controls()->set_elevator(Long_control);
+ globals->get_controls()->set_elevator_trim(Long_trim);
+ // controls.set_elevator(Long_control);
+ // controls.set_elevator_trim(Long_trim);
+ }
+ if (pilot_ail_no) {
+ globals->get_controls()->set_aileron(Lat_control);
+ // controls.set_aileron(Lat_control);
+ }
+ if (pilot_rud_no) {
+ globals->get_controls()->set_rudder(Rudder_pedal);
+ // controls.set_rudder(Rudder_pedal);
+ }
+ if (Throttle_pct_input) {
+ globals->get_controls()->set_throttle(0,Throttle_pct);
+ // controls.set_throttle(0,Throttle_pct);
+ }
+ }
+
return true;
}