FGLaRCsim::FGLaRCsim( double dt ) {
set_delta_t( dt );
- ls_toplevel_init( 0.0,
- (char *)fgGetString("/sim/aircraft").c_str() );
+ speed_up = fgGetNode("/sim/speed-up", true);
+ aircraft = fgGetNode("/sim/aircraft", true);
+
+ 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;
- //current_aircraft.fdm_state->set_Tank1Fuel(15.0);
- //current_aircraft.fdm_state->set_Tank2Fuel(15.0);
- //Tank1Fuel = 15.0;
- //Tank2Fuel = 15.0;
-}
-
-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
-void FGLaRCsim::init() {
-
- // Explicitly call the superclass's
- // init method first.
- FGInterface::init();
-
- speed_up = fgGetValue("/sim/speed-up", true);
ls_set_model_dt( get_delta_t() );
- // Initialize our little engine that hopefully might
+
+ // Initialize our little engine that hopefully might
eng.init( get_delta_t() );
// 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)
set_Tank1Fuel(28.0);
set_Tank2Fuel(28.0);
- // SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::init()" );
- double save_alt = 0.0;
+}
- if ( get_Altitude() < -9000.0 ) {
- save_alt = get_Altitude();
- set_Altitude( 0.0 );
+FGLaRCsim::~FGLaRCsim(void) {
+ if(lsic != NULL) {
+ delete lsic;
}
+}
- // translate FG to LaRCsim structure
- copy_to_LaRCsim();
-
- // actual LaRCsim top level init
- // ls_toplevel_init( dt, (char *)fgGetString("/sim/aircraft").c_str() );
-
- SG_LOG( SG_FLIGHT, SG_INFO, "FG pos = " <<
- get_Latitude() );
-
- // translate LaRCsim back to FG structure
- copy_from_LaRCsim();
+// Initialize the LaRCsim flight model, dt is the time increment for
+// each subsequent iteration through the EOM
+void FGLaRCsim::init() {
- // but lets restore our original bogus altitude when we are done
- if ( save_alt < -9000.0 ) {
- set_Altitude( save_alt );
- }
+ // Explicitly call the superclass's
+ // init method first.
+ FGInterface::init();
}
// Run an iteration of the EOM (equations of motion)
bool FGLaRCsim::update( int multiloop ) {
- if ( fgGetString("/sim/aircraft") == "c172" ) {
+ if ( aircraft->getStringValue() == "c172" ) {
// set control inputs
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
eng.set_IAS( V_calibrated_kts );
speed_up->getIntValue();
Flap_handle = 30.0 * controls.get_flaps();
- if ( fgGetString("/sim/aircraft") == "c172" ) {
+ if ( aircraft->getStringValue() == "c172" ) {
Use_External_Engine = 1;
} else {
Use_External_Engine = 0;