void FGLaRCsim::init() {
//do init common to all FDM's
common_init();
-
- //now do any specific to LaRCsim
}
// update engine model
eng.update();
+ // Fake control-surface positions
+ fgSetDouble("/surface-positions/flap-pos-norm",
+ fgGetDouble("/controls/flaps"));
+ // FIXME: ignoring trim
+ fgSetDouble("/surface-positions/elevator-pos-norm",
+ fgGetDouble("/controls/elevator"));
+ // FIXME: ignoring trim
+ fgSetDouble("/surface-positions/left-aileron-pos-norm",
+ fgGetDouble("/controls/aileron"));
+ // FIXME: ignoring trim
+ fgSetDouble("/surface-positions/right-aileron-pos-norm",
+ -1 * fgGetDouble("/controls/aileron"));
+ // FIXME: ignoring trim
+ fgSetDouble("/surface-positions/rudder-pos-norm",
+ fgGetDouble("/controls/rudder"));
+
// copy engine state values onto "bus"
fgSetDouble("/engines/engine/rpm", eng.get_RPM());
fgSetDouble("/engines/engine/mp-osi", eng.get_Manifold_Pressure());
fgSetDouble("/engines/engine/running", eng.getRunningFlag());
fgSetDouble("/engines/engine/cranking", eng.getCrankingFlag());
- //Assume we are using both tanks equally for now
- fgSetDouble("/consumables/fuel/tank[0]",
- fgGetDouble("/consumables/fuel/tank[0]")
- - (eng.get_fuel_flow_gals_hr() / (2 * 3600))
- * get_delta_t());
- fgSetDouble("/consumables/fuel/tank[1]",
- fgGetDouble("/consumables/fuel/tank[1]")
- - (eng.get_fuel_flow_gals_hr() / (2 * 3600))
- * get_delta_t());
+ static const SGPropertyNode *fuel_freeze
+ = fgGetNode("/sim/freeze/fuel");
+
+ if ( ! fuel_freeze->getBoolValue() ) {
+ //Assume we are using both tanks equally for now
+ 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());
+ 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());
+ }
F_X_engine = eng.get_prop_thrust_lbs();
// cout << "F_X_engine = " << F_X_engine << '\n';
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();
+ V_north_airmass = lsic->GetVnorthAirmassFpsIC() * -1;
+ V_east_airmass = lsic->GetVeastAirmassFpsIC() * -1;
+ V_down_airmass = lsic->GetVdownAirmassFpsIC() * -1;
ls_loop(0.0,-1);
copy_from_LaRCsim();
- SG_LOG( SG_FLIGHT, SG_INFO, " FGLaRCsim::set_ls(): " );
- SG_LOG( SG_FLIGHT, SG_INFO, " Phi: " << Phi );
- SG_LOG( SG_FLIGHT, SG_INFO, " Theta: " << Theta );
- SG_LOG( SG_FLIGHT, SG_INFO, " Psi: " << Psi );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_north: " << V_north );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_east: " << V_east );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_down: " << V_down );
- SG_LOG( SG_FLIGHT, SG_INFO, " Altitude: " << Altitude );
- SG_LOG( SG_FLIGHT, SG_INFO, " Latitude: " << Latitude );
- SG_LOG( SG_FLIGHT, SG_INFO, " Longitude: " << Longitude );
- SG_LOG( SG_FLIGHT, SG_INFO, " Runway_altitude: " << Runway_altitude );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_north_airmass: " << V_north_airmass );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_east_airmass: " << V_east_airmass );
- SG_LOG( SG_FLIGHT, SG_INFO, " V_down_airmass: " << V_down_airmass );
}
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
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
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
copy_from_LaRCsim(); //update the bus
}
-void FGLaRCsim::set_Runway_altitude(double ralt) {
- SG_LOG( SG_FLIGHT, SG_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) {
SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::set_AltitudeAGL: " << altagl );
snap_shot();