+
+ _set_Gamma_vert_rad( fdmex->GetPosition()->GetGamma() );
+ // set_Gamma_horiz_rad( Gamma_horiz_rad );
+
+ _set_Earth_position_angle( fdmex->GetAuxiliary()->GetEarthPositionAngle() );
+
+ _set_Climb_Rate( fdmex->GetPosition()->Gethdot() );
+
+
+ for ( i = 1; i <= 3; i++ ) {
+ for ( j = 1; j <= 3; j++ ) {
+ _set_T_Local_to_Body( i, j, fdmex->GetState()->GetTl2b()(i,j) );
+ }
+ }
+ return true;
+}
+
+void FGJSBsim::snap_shot(void) {
+ fgic->SetLatitudeRadIC(get_Lat_geocentric() );
+ fgic->SetLongitudeRadIC( get_Longitude() );
+ fgic->SetAltitudeFtIC( get_Altitude() );
+ fgic->SetTerrainAltitudeFtIC( get_Runway_altitude() );
+ fgic->SetVtrueFpsIC( get_V_rel_wind() );
+ fgic->SetPitchAngleRadIC( get_Theta() );
+ fgic->SetRollAngleRadIC( get_Phi() );
+ fgic->SetTrueHeadingRadIC( get_Psi() );
+ fgic->SetClimbRateFpsIC( get_Climb_Rate() );
+}
+
+
+//Positions
+void FGJSBsim::set_Latitude(double lat) {
+ double sea_level_radius_meters,lat_geoc;
+
+ FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Latitude: " << lat );
+
+ snap_shot();
+ sgGeodToGeoc( lat, get_Altitude() , &sea_level_radius_meters, &lat_geoc);
+ fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
+ fgic->SetLatitudeRadIC( lat_geoc );
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Longitude(double lon) {
+
+ FG_LOG(FG_FLIGHT,FG_INFO,"FGJSBsim::set_Longitude: " << lon );
+
+ snap_shot();
+ fgic->SetLongitudeRadIC(lon);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Altitude(double alt) {
+ double sea_level_radius_meters,lat_geoc;
+
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Altitude: " << alt );
+
+ snap_shot();
+ sgGeodToGeoc( get_Latitude(), alt , &sea_level_radius_meters, &lat_geoc);
+ fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * METER_TO_FEET );
+ fgic->SetLatitudeRadIC( lat_geoc );
+ fgic->SetAltitudeFtIC(alt);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_V_calibrated_kts(double vc) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_V_calibrated_kts: " << vc );
+
+ snap_shot();
+ fgic->SetVcalibratedKtsIC(vc);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Mach_number(double mach) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Mach_number: " << mach );
+
+ snap_shot();
+ fgic->SetMachIC(mach);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Velocities_Local( double north, double east, double down ){
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Local: "
+ << north << ", " << east << ", " << down );
+
+ snap_shot();
+ fgic->SetVnorthFpsIC(north);
+ fgic->SetVeastFpsIC(east);
+ fgic->SetVdownFpsIC(down);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Velocities_Wind_Body: "
+ << u << ", " << v << ", " << w );
+
+ snap_shot();
+ fgic->SetUBodyFpsIC(u);
+ fgic->SetVBodyFpsIC(v);
+ fgic->SetWBodyFpsIC(w);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+//Euler angles
+void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Euler_Angles: "
+ << phi << ", " << theta << ", " << psi );
+
+ snap_shot();
+ fgic->SetPitchAngleRadIC(theta);
+ fgic->SetRollAngleRadIC(phi);
+ fgic->SetTrueHeadingRadIC(psi);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+//Flight Path
+void FGJSBsim::set_Climb_Rate( double roc) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
+
+ snap_shot();
+ fgic->SetClimbRateFpsIC(roc);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Gamma_vert_rad( double gamma) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
+
+ snap_shot();
+ fgic->SetFlightPathAngleRadIC(gamma);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+//Earth
+void FGJSBsim::set_Sea_level_radius(double slr) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Sea_level_radius: " << slr );
+
+ snap_shot();
+ fgic->SetSeaLevelRadiusFtIC(slr);
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Runway_altitude(double ralt) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Runway_altitude: " << ralt );
+
+ snap_shot();
+ _set_Runway_altitude( ralt );
+ fdmex->RunIC(fgic); //loop JSBSim once
+ copy_from_JSBsim(); //update the bus
+ needTrim=true;
+}
+
+void FGJSBsim::set_Static_pressure(double p) {
+ FG_LOG(FG_FLIGHT,FG_INFO, "FGJSBsim::set_Static_pressure: " << p );
+
+ snap_shot();
+ fdmex->GetAtmosphere()->SetExPressure(p);
+ if(fdmex->GetAtmosphere()->External() == true)
+ needTrim=true;
+}