diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index 39159f439..720be75fe 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -84,9 +84,9 @@ FGRadioStack::FGRadioStack() { nav2_radial = 0.0; nav2_dme_dist = 0.0; need_update = true; - longitudeVal = fgGetValue("/position/longitude"); - latitudeVal = fgGetValue("/position/latitude"); - altitudeVal = fgGetValue("/position/altitude"); + lon_node = fgGetNode("/position/longitude"); + lat_node = fgGetNode("/position/latitude"); + alt_node = fgGetNode("/position/altitude"); } @@ -308,9 +308,9 @@ double FGRadioStack::adjustILSRange( double stationElev, double aircraftElev, void FGRadioStack::update() { - double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double elev = altitudeVal->getDoubleValue() * SG_FEET_TO_METER; + double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER; need_update = false; @@ -603,9 +603,9 @@ void FGRadioStack::search() { static FGMkrBeacon::fgMkrBeacType last_beacon = FGMkrBeacon::NOBEACON; - double lon = longitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double lat = latitudeVal->getDoubleValue() * SGD_DEGREES_TO_RADIANS; - double elev = altitudeVal->getDoubleValue() * SG_FEET_TO_METER; + double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; + double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER; // nav1 FGILS ils; diff --git a/src/Cockpit/radiostack.hxx b/src/Cockpit/radiostack.hxx index 9a8f0f3db..cf8873523 100644 --- a/src/Cockpit/radiostack.hxx +++ b/src/Cockpit/radiostack.hxx @@ -48,9 +48,9 @@ class FGRadioStack : public FGSubsystem SGInterpTable *low_tbl; SGInterpTable *high_tbl; - SGValue * latitudeVal; - SGValue * longitudeVal; - SGValue * altitudeVal; + SGPropertyNode *lat_node; + SGPropertyNode *lon_node; + SGPropertyNode *alt_node; bool need_update; diff --git a/src/Controls/controls.cxx b/src/Controls/controls.cxx index ed7fc2fa8..203aaea4b 100644 --- a/src/Controls/controls.cxx +++ b/src/Controls/controls.cxx @@ -70,7 +70,7 @@ FGControls::init () brake[wheel] = 0.0; } - auto_coordination = fgGetValue("/sim/auto-coordination", true); + auto_coordination = fgGetNode("/sim/auto-coordination", true); } diff --git a/src/Controls/controls.hxx b/src/Controls/controls.hxx index 7f0019dec..ba2a92d5b 100644 --- a/src/Controls/controls.hxx +++ b/src/Controls/controls.hxx @@ -66,7 +66,7 @@ private: double brake[MAX_WHEELS]; bool throttle_idle; - SGValue * auto_coordination; + SGPropertyNode * auto_coordination; inline void CLAMP(double *x, double min, double max ) { if ( *x < min ) { *x = min; } diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 05fa4ec5d..301f60553 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -105,9 +105,15 @@ FGJSBsim::FGJSBsim( double dt ) fgSetDouble("/fdm/trim/aileron", FCS->GetDaCmd()); fgSetDouble("/fdm/trim/rudder", FCS->GetDrCmd()); - trimmed = fgGetValue("/fdm/trim/trimmed",true); + startup_trim = fgGetNode("/sim/startup/trim", true); + + trimmed = fgGetNode("/fdm/trim/trimmed", true); trimmed->setBoolValue(false); + pitch_trim = fgGetNode("/fdm/trim/pitch-trim", true ); + throttle_trim = fgGetNode("/fdm/trim/throttle", true ); + aileron_trim = fgGetNode("/fdm/trim/aileron", true ); + rudder_trim = fgGetNode("/fdm/trim/rudder", true ); } /******************************************************************************/ @@ -192,44 +198,44 @@ bool FGJSBsim::update( int multiloop ) { trimmed->setBoolValue(false); - if (needTrim && fgGetBool("/sim/startup/trim")) { + if ( needTrim && startup_trim->getBoolValue() ) { - //fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() ); - //fgic->SetTerrainAltitudeFtIC( scenery.cur_elev * SG_METER_TO_FEET ); + //fgic->SetSeaLevelRadiusFtIC( get_Sea_level_radius() ); + //fgic->SetTerrainAltitudeFtIC( scenery.cur_elev * SG_METER_TO_FEET ); - FGTrim *fgtrim; - if(fgic->GetVcalibratedKtsIC() < 10 ) { - fgic->SetVcalibratedKtsIC(0.0); - fgtrim=new FGTrim(fdmex,fgic,tGround); - } else { - fgtrim=new FGTrim(fdmex,fgic,tLongitudinal); - } - if(!fgtrim->DoTrim()) { - fgtrim->Report(); - fgtrim->TrimStats(); - } else { - trimmed->setBoolValue(true); - } - fgtrim->ReportState(); - delete fgtrim; + FGTrim *fgtrim; + if(fgic->GetVcalibratedKtsIC() < 10 ) { + fgic->SetVcalibratedKtsIC(0.0); + fgtrim=new FGTrim(fdmex,fgic,tGround); + } else { + fgtrim=new FGTrim(fdmex,fgic,tLongitudinal); + } + if(!fgtrim->DoTrim()) { + fgtrim->Report(); + fgtrim->TrimStats(); + } else { + trimmed->setBoolValue(true); + } + fgtrim->ReportState(); + delete fgtrim; - needTrim=false; + needTrim=false; - fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd()); - fgSetDouble("/fdm/trim/throttle", FCS->GetThrottleCmd(0)); - fgSetDouble("/fdm/trim/aileron", FCS->GetDaCmd()); - fgSetDouble("/fdm/trim/rudder", FCS->GetDrCmd()); + pitch_trim->setDoubleValue( FCS->GetPitchTrimCmd() ); + throttle_trim->setDoubleValue( FCS->GetThrottleCmd(0) ); + aileron_trim->setDoubleValue( FCS->GetDaCmd() ); + rudder_trim->setDoubleValue( FCS->GetDrCmd() ); - controls.set_elevator_trim(FCS->GetPitchTrimCmd()); - controls.set_elevator(FCS->GetDeCmd()); - controls.set_throttle(FGControls::ALL_ENGINES, - FCS->GetThrottleCmd(0)); + controls.set_elevator_trim(FCS->GetPitchTrimCmd()); + controls.set_elevator(FCS->GetDeCmd()); + controls.set_throttle(FGControls::ALL_ENGINES, + FCS->GetThrottleCmd(0)); - controls.set_aileron(FCS->GetDaCmd()); - controls.set_rudder( FCS->GetDrCmd()); + controls.set_aileron(FCS->GetDaCmd()); + controls.set_rudder( FCS->GetDrCmd()); - SG_LOG( SG_FLIGHT, SG_INFO, " Trim complete" ); - } + SG_LOG( SG_FLIGHT, SG_INFO, " Trim complete" ); + } for( i=0; iset_RPM( Propulsion->GetThruster(i)->GetRPM() ); diff --git a/src/FDM/JSBSim.hxx b/src/FDM/JSBSim.hxx index 06364c18e..bb6cdccbb 100644 --- a/src/FDM/JSBSim.hxx +++ b/src/FDM/JSBSim.hxx @@ -50,6 +50,8 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include + #include class FGState; @@ -233,7 +235,12 @@ private: float trim_elev; float trim_throttle; - SGValue *trimmed; + SGPropertyNode *startup_trim; + SGPropertyNode *trimmed; + SGPropertyNode *pitch_trim; + SGPropertyNode *throttle_trim; + SGPropertyNode *aileron_trim; + SGPropertyNode *rudder_trim; void snap_shot(void); }; diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index e2cdc0b45..39e012382 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -41,8 +41,11 @@ 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 @@ -71,8 +74,6 @@ void FGLaRCsim::init() { // 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 eng.init( get_delta_t() ); @@ -121,7 +122,7 @@ void FGLaRCsim::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 ); @@ -188,7 +189,7 @@ bool FGLaRCsim::update( int multiloop ) { 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; diff --git a/src/FDM/LaRCsim.hxx b/src/FDM/LaRCsim.hxx index ee884af87..bc37e85a5 100644 --- a/src/FDM/LaRCsim.hxx +++ b/src/FDM/LaRCsim.hxx @@ -33,14 +33,18 @@ class FGLaRCsim: public FGInterface { +private: + FGNewEngine eng; LaRCsimIC* lsic; void set_ls(void); void snap_shot(void); double time_step; - SGValue * speed_up; + SGPropertyNode *speed_up; + SGPropertyNode *aircraft; public: + FGLaRCsim( double dt ); ~FGLaRCsim(void);